当前位置: 首页>>代码示例>>C#>>正文


C# BaseService.GetAllUseEntity方法代码示例

本文整理汇总了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
                     })
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:Canteen_GetDataController.cs


注:本文中的BaseService.GetAllUseEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。