本文整理汇总了C#中BaseService.GetAllUseEntity方法的典型用法代码示例。如果您正苦于以下问题:C# BaseService.GetAllUseEntity方法的具体用法?C# BaseService.GetAllUseEntity怎么用?C# BaseService.GetAllUseEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseService
的用法示例。
在下文中一共展示了BaseService.GetAllUseEntity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetComputeBackPayList
public ActionResult GetComputeBackPayList([DataSourceRequest] DataSourceRequest request, Can_ComputeBackPaySearchModel model)
{
string status = string.Empty;
string note = "Tổng Hợp Trả Lại Tiền Ăn ";
var baseService = new BaseService();
var dataComputes = GetListData<Can_ComputeBackPayModel, Can_ComputeBackPayModel, Can_ComputeBackPaySearchModel>(request, model, ConstantSql.hrm_can_sp_get_ComputeBackPay, ref status);
var computeBackPayModels = new List<Can_ComputeBackPayModel>();
if (dataComputes.Any() && model != null && model.MonthYear.HasValue)
{
var month = model.MonthYear.Value.Month;
var year = model.MonthYear.Value.Year;
var backPays = baseService.GetAllUseEntity<Can_BackPayEntity>(ref status).Where(p => p.MonthYear.HasValue && p.MonthYear.Value.Year == year && p.MonthYear.Value.Month == month).ToList();
foreach (var canComputeBackPayModel in dataComputes)
{
var backPay = backPays.Where(p => p.ProfileID == canComputeBackPayModel.ProfileID && p.MealAllowanceTypeSettingID == canComputeBackPayModel.MealAllowanceTypeSettingID).FirstOrDefault();
#region Thêm mới vào Can_BackPay
if (backPay == null)
{
var backPayEntity = new Can_BackPayEntity
{
ProfileID = canComputeBackPayModel.ProfileID,
MonthYear = model.MonthYear,
MealAllowanceTypeSettingID = canComputeBackPayModel.MealAllowanceTypeSettingID
};
if (canComputeBackPayModel.IsFullPay.HasValue && canComputeBackPayModel.IsFullPay.Value)
{
//neu isFullPay => cap nhat count , amount
backPayEntity.Count = (int?)canComputeBackPayModel.Total;
backPayEntity.Amount = (canComputeBackPayModel.Amount * canComputeBackPayModel.Total);
}
else
{
//neu ko la isFullPay => cap nhat CountByFomular,AmountByFomular
backPayEntity.CountByFomular = (int?)ComputeAmountBackPay(canComputeBackPayModel.Total);
backPayEntity.AmountByFomular = canComputeBackPayModel.Amount * ComputeAmountBackPay(canComputeBackPayModel.Total);
}
//add
backPayEntity.Note = note + canComputeBackPayModel.MonthYear;
baseService.Add<Can_BackPayEntity>(backPayEntity);
backPays.Add(backPayEntity);
}
#endregion
#region Chỉnh sửa Can_BackPay
else
{
//edit
//neu isFullPay => cap nhat count , amount
//neu ko la isFullPay => cap nhat CountByFomular,AmountByFomular
if (canComputeBackPayModel.IsFullPay.HasValue && canComputeBackPayModel.IsFullPay.Value)
{
//neu isFullPay => cap nhat count , amount
backPay.Count = (int?)canComputeBackPayModel.Total;
backPay.Amount = canComputeBackPayModel.Amount * canComputeBackPayModel.Total;
}
else
{
//neu ko la isFullPay => cap nhat CountByFomular,AmountByFomular
backPay.CountByFomular = (int?)ComputeAmountBackPay(canComputeBackPayModel.Total);
backPay.AmountByFomular = canComputeBackPayModel.Amount * ComputeAmountBackPay(canComputeBackPayModel.Total);
}
if (!string.IsNullOrEmpty(backPay.Note))
{
canComputeBackPayModel.Note = backPay.Note;
}
backPay.Note = note + canComputeBackPayModel.MonthYear;
baseService.Edit<Can_BackPayEntity>(backPay);
}
#endregion
}
#region List hiển thị
var profileIds = dataComputes.Select(p => p.ProfileID).ToList();
var modelSearch = new Can_BackPaySearchModel();
modelSearch.ProfileName = null;
modelSearch.DateFrom = null;
modelSearch.DateTo = null;
var datas = GetListData<Can_BackPayModel, Can_BackPayEntity, Can_BackPaySearchModel>(request, modelSearch, ConstantSql.hrm_can_sp_get_BackPay, ref status);
computeBackPayModels = datas.Where(p => p.MonthYear.HasValue && p.MonthYear.Value.Year == year && p.MonthYear.Value.Month == month)
.Select(p => new Can_ComputeBackPayModel
{
ProfileName = p.ProfileName,
MonthYear = p.MonthYear.HasValue ? p.MonthYear.Value.ToString("MM-yyyy") : string.Empty,
Note = p.Note,
Amount = p.Amount ?? 0,
MealAllowanceTypeSettingID = p.MealAllowanceTypeSettingID,
Type = p.MealAllowanceTypeName,
CountByFomular = ComputeAmountBackPay(p.CountByFomular ?? 0),
AmountByFomular = p.AmountByFomular,
Summary = ComputeAmountBackPay(p.CountByFomular ?? 0) + (p.Count ?? 0),
Total = p.Count ?? 0
})
//.........这里部分代码省略.........