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


C# CustomBaseRepository类代码示例

本文整理汇总了C#中CustomBaseRepository的典型用法代码示例。如果您正苦于以下问题:C# CustomBaseRepository类的具体用法?C# CustomBaseRepository怎么用?C# CustomBaseRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CustomBaseRepository类属于命名空间,在下文中一共展示了CustomBaseRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getAllGrade2

        public static List<Att_Grade> getAllGrade2(List<Guid> listProfileId, DateTime monthYear)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoAtt_Grade = new CustomBaseRepository<Att_Grade>(unitOfWork);

                List<Att_Grade> lst = new List<Att_Grade>();
                string[] strInclude = new string[] { "Cat_GradeAttendance" };

                lst = repoAtt_Grade.FindBy(gd => listProfileId.Contains(gd.ProfileID.Value)
                    && gd.MonthStart <= monthYear).OrderByDescending(prop => prop.MonthStart).ToList();

                List<Att_Grade> lstGrade = new List<Att_Grade>();
                foreach (Att_Grade grade in lst)
                {
                    Att_Grade grade1 = lstGrade.FirstOrDefault(prop => prop.ProfileID == grade.ProfileID);
                    if (grade1 == null)
                    {
                        lstGrade.Add(grade);
                    }
                }
                return lstGrade;
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:25,代码来源:Att_GradeServices.cs

示例2: SaveEvalutionData

 public string SaveEvalutionData(int year, Guid? TimesGetDataID, string orgStructureID, DateTime? _dateStart, DateTime? _dateEnd,string userLogin)
 {
     using (var context = new VnrHrmDataContext())
     {
         var evaServices = new Eva_ReportServices();
         List<Eva_EvalutionDataEntity> lstEvalutionDataEntity = new List<Eva_EvalutionDataEntity>();
         lstEvalutionDataEntity = evaServices.SummaryEvalutionData(year, TimesGetDataID, orgStructureID, _dateStart, _dateEnd,userLogin);
         var unitOfWork = (IUnitOfWork)new UnitOfWork(context);
         var repoEva_EvalutionData = new CustomBaseRepository<Eva_EvalutionData>(unitOfWork);
         List<Eva_EvalutionData> lstEvalutionData = new List<Eva_EvalutionData>();
         lstEvalutionData = lstEvalutionDataEntity.Translate<Eva_EvalutionData>();
         if (lstEvalutionData != null)
         {
             int _total = lstEvalutionData.Count;
             int _totalPage = _total / 200 + 1;
             int _pageSize = 200;
             for (int _page = 1; _page <= _totalPage; _page++)
             {
                 int _skip = _pageSize * (_page - 1);
                 var _listCurrenPage = lstEvalutionData.Skip(_skip).Take(_pageSize).ToList();
                 foreach (var item in _listCurrenPage)
                 {
                     repoEva_EvalutionData.Add(item);
                 }
                 unitOfWork.SaveChanges();
             }
         }
         return "SaveSuccess";
         //    #endregion
     }
 }  
开发者ID:dtafe,项目名称:vnr,代码行数:31,代码来源:Eva_EvalutionDataServices.cs

示例3: GetClaimApprovedList

        public List<FIN_ClaimEntity> GetClaimApprovedList(Guid UserLogin)
        {
            List<FIN_ClaimEntity> lstReturn = new List<FIN_ClaimEntity>();

            string appType = ApproveType.E_FIN_ClaimRequest.ToString();
            string status = string.Empty;
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoFIN_Claim = new CustomBaseRepository<FIN_Claim>(unitOfWork);
                List<Sys_ConditionApproved> lstCondition = new List<Sys_ConditionApproved>();
                List<Hre_ProfileEntity> lstProfile = new List<Hre_ProfileEntity>();
                GetProfileWithPermissionLogin(UserLogin, appType, out lstCondition, out lstProfile);

                var lstExpensesCondition = lstCondition.Select(s => s.ExpensesType).Distinct().ToList();
                var dataClaim = repoFIN_Claim
                    .FindBy(s => s.IsDelete == null && lstExpensesCondition.Contains(s.ExpensesType))
                    .ToList().Translate<FIN_ClaimEntity>();

                foreach (var condition in lstCondition)
                {
                    List<Guid> lstGuidOrg = GetOrgInCondition(condition);
                    var profileInOrg = lstProfile.Where(s => lstGuidOrg.Contains(s.OrgStructureID.Value)).Select(a => a.ID).ToList();
                    
                    var resultCondition = dataClaim.Where(s => profileInOrg.Contains(s.ProfileID.Value)).ToList();
                    lstReturn.AddRange(resultCondition);
                }
            }
            return lstReturn;
        }
开发者ID:dtafe,项目名称:vnr,代码行数:30,代码来源:FIN_ClaimService.cs

示例4: SaveList

 public string SaveList(List<Att_RosterEntity> lstModel)
 {
     using (var context = new VnrHrmDataContext())
     {
         List<Att_Roster> lstSave = new List<Att_Roster>();
         lstSave = lstModel.Translate<Att_Roster>();
         var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         var repo = new CustomBaseRepository<Att_Roster>(unitOfWork);
         //int count = 0;
         foreach (var item in lstSave)
         {
             //count += 1;
             item.ID = Guid.NewGuid();
             repo.Add(item);
         }
         try
         {
             repo.SaveChanges();
             return "Success";
         }
         catch (Exception)
         {
             return "Error";
         }
     }
 }
开发者ID:dtafe,项目名称:vnr,代码行数:26,代码来源:Att_RosterServices.cs

示例5: ComputeAnnualLeaveAllowance

        public Guid ComputeAnnualLeaveAllowance(Sal_UnusualAllowanceEntity model)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)new UnitOfWork(context);
                var repoSys_AsynTask = new CustomBaseRepository<Sys_AsynTask>(unitOfWork);
                var repoCat_Element = new CustomBaseRepository<Cat_Element>(unitOfWork);


                //tạo asynTask
                Sys_AsynTask asynTask = new Sys_AsynTask()
                {
                    ID = Guid.NewGuid(),
                    Summary = "Tính phép năm : " + model.MonthStart.Value.ToString("dd/MM/yyyy"),
                    Type = AsynTask.Payroll_Compute_AnnualLeaveAllowance.ToString(),
                    Status = AsynTaskStatus.Doing.ToString(),
                    TimeStart = DateTime.Now,
                    PercentComplete = 0.01,
                };
                repoSys_AsynTask.Add(asynTask);
                unitOfWork.SaveChanges();

                Thread threadCompute = new Thread(() => ComputeBonusUnusualAllowance_Progress(asynTask.ID, model, true));
                threadCompute.Start();

                return asynTask.ID;
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:28,代码来源:Sal_UnusualAllowanceServices.cs

示例6: GetGrade

        public static Att_Grade GetGrade(Hre_Profile profile, DateTime effectMonth)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoAtt_Grade = new CustomBaseRepository<Att_Grade>(unitOfWork);
                //NOTE: can modify lai cau truy van de gioi han data lay len
                List<Att_Grade> lst = repoAtt_Grade
                    .FindBy(alw => alw.IsDelete == null
                        && alw.ProfileID == profile.ID
                        && alw.MonthStart <= effectMonth)
                    .OrderByDescending(alw => alw.MonthStart).ToList();

                if (lst != null && lst.Count > 0)
                {
                    // Lấy grade có ngày đến hạn, nếu không có ngày đến hạn xem như Ok không hết hạn, nếu có ngày đến hạn
                    DateTime temp = new DateTime(effectMonth.Year, effectMonth.Month, 1);
                    if (!lst[0].MonthEnd.HasValue || (lst[0].MonthEnd.HasValue && lst[0].MonthEnd.Value >= temp))
                    {
                        return lst[0];
                    }
                }
                return null;
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:25,代码来源:Att_GradeServices.cs

示例7: AddList

        public bool AddList(List<Att_AnnualLeaveDetailEntity> models)
        {
            bool isSuccess = false;
            var leaveType = string.Empty;
            var status = string.Empty;
            var year = 2013;
            if (models != null && models.FirstOrDefault() != null && models.FirstOrDefault().Year != null) 
            {
                year = Convert.ToInt32(models.FirstOrDefault().Year);
                leaveType = models.FirstOrDefault().Type;
            }

            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new CustomBaseRepository<Att_AnnualLeaveDetail>(unitOfWork);
                try
                {
                    var annualLeaveDetails = GetAllUseEntity<Att_AnnualLeaveDetail>(ref status).Where(p => p.Type == leaveType && p.Year == year).ToList().AsQueryable();
                    foreach (var attAnnualLeaveDetail in models)
                    {
                        var addSuccess = false;
                        var existAnnualDetail = annualLeaveDetails.Where(p => p.ProfileID == attAnnualLeaveDetail.ProfileID ).FirstOrDefault();
                        if (existAnnualDetail != null)
                        {
                            existAnnualDetail.Month1 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month2 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month3 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month4 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month5 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month6 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month7 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month8 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month9 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month10 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month11 = attAnnualLeaveDetail.Month1;
                            existAnnualDetail.Month12 = attAnnualLeaveDetail.Month1;

                            repo.Edit(existAnnualDetail);
                        }
                        else
                        {
                            Att_AnnualLeaveDetail temp = new Att_AnnualLeaveDetail();
                            temp = attAnnualLeaveDetail.CopyData<Att_AnnualLeaveDetail>();
                            repo.Add(temp);
                        }
                    }
                    repo.SaveChanges();
                    return true;
                }
                catch
                {
                    return false;
                }

            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:57,代码来源:Att_AnnualLeaveDetailServices.cs

示例8: ProcessSendRequest

        /// <summary>
        /// [Hieu.Van]
        /// Xử lý Gửi yêu cầu phê duyệt
        /// </summary>
        /// <param name="LoginID"></param>
        /// <param name="userApprovedID"></param>
        /// <param name="recordID"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public string ProcessSendRequest(string host, Guid LoginID, Guid userApprovedID, Guid recordID, string type)
        {
            DataErrorCode status = DataErrorCode.Success;
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoFIN_PurchaseRequest = new CustomBaseRepository<FIN_PurchaseRequest>(unitOfWork);
                var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);

                var record = repoFIN_PurchaseRequest.FindBy(s => s.ID == recordID).FirstOrDefault();
                if (record.UserCreateID != LoginID)
                {
                    return DataErrorCode.NoPermission.ToString();
                }
                if (record.Status == EnumDropDown.Status.E_REJECTED.ToString())
                {
                    return DataErrorCode.Error_Reject.ToString();
                }
                if (record.Status != null)
                {
                    return DataErrorCode.Error_SendRequest.ToString();
                }
                var userApproved = repoSys_UserApprove.FindBy(s => s.ID == userApprovedID).FirstOrDefault();
                // Lấy status hiện tại của bản ghi
                string currentStatus = record.Status;

                // truyền từ Dropdownlist chọn người duyệt, lấy ra giá trị Status tiếp theo
                string nextStatus = userApproved.CurrentStatus;

                record.Status = nextStatus;
                record.UserApproveID = userApprovedID;
                repoFIN_PurchaseRequest.Edit(record);
                status = repoFIN_PurchaseRequest.SaveChanges();

                
                if (status == DataErrorCode.Success)
                {
                    if (nextStatus != "Approved")
                    {
                        status = SendMail_ToNextApproved(host, recordID, userApprovedID, nextStatus, type);
                    }

                    var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
                    var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == record.Status).FirstOrDefault();
                    if (configProcess == null)
                    {
                        return DataErrorCode.Success.ToString();
                    }
                    else
                    {
                        return DataErrorCode.Success_Forward.ToString();
                    }
                }

                return status.ToString();
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:66,代码来源:FIN_PurchaseRequestService.cs

示例9: GetWorkDaysByDate

 public List<Att_WorkdayEntity> GetWorkDaysByDate(DateTime DateFrom, DateTime DateTo)
 {
     using (var context = new VnrHrmDataContext())
     {
         var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         var repo = new Att_WorkDayRepository(unitOfWork);
         var repoAtt_Workday = new CustomBaseRepository<Att_Workday>(unitOfWork);
         return repoAtt_Workday.FindBy(m => m.IsDelete == null && m.WorkDate >= DateFrom && m.WorkDate <= DateTo).Select(s => new Att_WorkdayEntity { ID = s.ID, ProfileID = s.ProfileID, InTimeRoot = s.InTimeRoot, OutTimeRoot = s.OutTimeRoot, LateEarlyDuration = s.LateEarlyDuration, ShiftID = s.ShiftID, MissInOutReason = s.MissInOutReason }).ToList<Att_WorkdayEntity>();
     }
 }
开发者ID:dtafe,项目名称:vnr,代码行数:10,代码来源:Att_WorkDayServices.cs

示例10: ActionApproved

        public void ActionApproved(List<Guid> lstId, string status, Guid userId)
        {
            var statusMes = string.Empty;
            var objTravelRequest = new List<object>();
            string UserLogin = string.Empty;
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoTravelRequestItem = new CustomBaseRepository<FIN_ClaimItem>(unitOfWork);
                var lstTravelRequestItem = repoTravelRequestItem.GetAll().Where(s => s.IsDelete == null).ToList();

                if(status == "E_APPROVED")
                {
                    var objApprovedClaim = new List<object>();
                    objApprovedClaim.AddRange(new object[6]);
                    objApprovedClaim[4] = 1;
                    objApprovedClaim[5] = int.MaxValue - 1;
                    var lstApprovedClaim = GetData<FIN_ApproverECLAIMEntity>(objApprovedClaim, ConstantSql.hrm_fin_sp_get_ApproverECLAIM, UserLogin, ref statusMes).ToList();

                    var approvedType1 = FinApproverType.FIN_Claim_Profile.ToString();
                    var approvedType2 = FinApproverType.FIN_Claim_Manufacture.ToString();

                    var approvedEntity = lstApprovedClaim.Where(s => s.ApprovedID != null && s.ApprovedID.Value == userId && (s.ApprovedType == approvedType1 || s.ApprovedType == approvedType2)).FirstOrDefault();
                    if (lstId.Count > 0)
                    {
                        if (approvedEntity != null)
                        {
                            lstTravelRequestItem = lstTravelRequestItem.Where(s => lstId.Contains(s.ID)).ToList();
                            foreach (var item in lstTravelRequestItem)
                            {
                                item.Description2 = status;
                            }
                            repoTravelRequestItem.SaveChanges();
                        }
                        
                    }
                }

                if(status == "E_REJECTED")
                {
                    if (lstId.Count > 0)
                    {
                        lstTravelRequestItem = lstTravelRequestItem.Where(s => lstId.Contains(s.ID)).ToList();
                        foreach (var item in lstTravelRequestItem)
                        {
                            item.Description2 = status;
                        }
                        repoTravelRequestItem.SaveChanges();
                    }
                
                }
               

            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:55,代码来源:FIN_ClaimItemService.cs

示例11: CreateFormulaTemplate

        public void CreateFormulaTemplate(List<Cat_FormulaTemplateEntity> listFormulaTemplate,Guid GradeID)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)new UnitOfWork(context);
                var repoCat_FormulaTemplate = new CustomBaseRepository<Cat_FormulaTemplate>(unitOfWork);
                var repoCat_Element = new CustomBaseRepository<Cat_Element>(unitOfWork);

                #region Xử lý bảng template
                //lấy các phần tử template trong grade
                List<Cat_FormulaTemplate> listFormulaTemplateByGrade = repoCat_FormulaTemplate.FindBy(m => m.IsDelete != true && m.GradeID != null && m.GradeID == GradeID).ToList();
                //xóa các phần tử đó
                repoCat_FormulaTemplate.Delete(listFormulaTemplateByGrade);

                //insert lại các phần tử mới
                List<Cat_FormulaTemplate> listFormulaTemplateModel = listFormulaTemplate.Translate<Cat_FormulaTemplate>();
                listFormulaTemplateModel.ForEach(m => m.GradeID = GradeID);
                repoCat_FormulaTemplate.Add(listFormulaTemplateModel); 
                #endregion

                #region Xử lý bảng cat_element
                //lấy các phần tử có cùng mã code với template
                List<Cat_Element> listElement = repoCat_Element.FindBy(m => m.IsDelete != true && m.GradePayrollID == GradeID).ToList();
                listElement = listElement.Where(m => listFormulaTemplate.Any(t => t.ElementCode.ReplaceSpace() == m.ElementCode.ReplaceSpace())).ToList();
                //xóa các phần tử đó đi
                repoCat_Element.Delete(listElement);

                //tạo ra các element
                List<Cat_Element> listElementModel = new List<Cat_Element>();
                Cat_Element item = new Cat_Element();
                foreach (var template in listFormulaTemplate)
                {
                    item = new Cat_Element();
                    item.GradePayrollID = GradeID;
                    item.ElementCode = template.ElementCode.ReplaceSpace();
                    item.ElementName = template.ElementName;
                    item.Formula = template.Formula;
                    item.IsBold = template.IsBold;
                    item.Invisible = template.Invisible;
                    item.Description = template.Description;
                    item.TabType = CatElementType.Payroll.ToString();
                    item.MethodPayroll = MethodPayroll.E_NORMAL.ToString();
                    item.ElementType = CatElementType.Payroll.ToString();    
                    item.Type = EnumDropDown.ElementDataType.Double.ToString();
                    listElementModel.Add(item);
                }
                repoCat_Element.Add(listElementModel);

                unitOfWork.SaveChanges();
                #endregion

            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:53,代码来源:Cat_FormulaTemplateServices.cs

示例12: SaveUnusualAllowance

        public void SaveUnusualAllowance(List<Sal_UnusualAllowanceEntity> model)
        {
            using (var context = new VnrHrmDataContext())
            {
                string status = string.Empty;
                var unitOfWork = (IUnitOfWork)new UnitOfWork(context);
                var repoUnusualAllowance = new CustomBaseRepository<Sal_UnusualAllowance>(unitOfWork);

                repoUnusualAllowance.Add(model.Translate<Sal_UnusualAllowance>());
                unitOfWork.SaveChanges();
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:12,代码来源:Sal_UnusualAllowanceServices.cs

示例13: AddDataForBasicSalary

        public void AddDataForBasicSalary(string ProfileIDs, string BasicSalary, DateTime DateHire, Guid SalaryRankID,string UserLogin)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                string status = string.Empty;
                var repoBasicSalary = new CustomBaseRepository<Sal_BasicSalary>(unitOfWork);
                List<Guid> lstProfileIDs = ProfileIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
                List<Sal_BasicSalary> lstBasicSalary = new List<Sal_BasicSalary>();
                //chua co cach giai quyet nen hard code lay mac dinh la VND
                var repoCurrency = new CustomBaseRepository<Cat_Currency>(unitOfWork);
                var currency = repoCurrency.FindBy(s => s.IsDelete == null && s.CurrencyName == "VND").FirstOrDefault();
                //var repoSalaryRank = new CustomBaseRepository<Cat_SalaryRank>(unitOfWork);
                //var repoSalaryClass = new CustomBaseRepository<Cat_SalaryClass>(unitOfWork);
                //var salaryRank = repoSalaryRank.FindBy(s => s.IsDelete == null && s.ID == SalaryRankID).FirstOrDefault();
                //var salaryClass = repoSalaryClass.FindBy(s => s.IsDelete == null && s.ID == salaryRank.SalaryClassID).FirstOrDefault();
                var salaryRankServices = new Cat_SalaryRankServices();
                var lstObjRank = new List<object>();
                lstObjRank.Add(null);
                lstObjRank.Add(null);
                lstObjRank.Add(1);
                lstObjRank.Add(int.MaxValue -1);
                var lstRank = salaryRankServices.GetData<Cat_SalaryRankEntity>(lstObjRank, ConstantSql.hrm_cat_sp_get_SalaryRank, UserLogin, ref status).ToList().Translate<Cat_SalaryRank>();
                var rankEntity = lstRank.Where(s => s.ID == SalaryRankID).FirstOrDefault();

                var salaryClassServices = new Cat_SalaryClassServices();
                var lstObjClass = new List<object>();
                lstObjClass.Add(null);
                lstObjClass.Add(1);
                lstObjClass.Add(int.MaxValue -1);
                var salaryClass = salaryClassServices.GetData<Cat_SalaryClassEntity>(lstObjClass, ConstantSql.hrm_cat_sp_get_SalaryClass, UserLogin, ref status).ToList().Translate<Cat_SalaryClass>();
                
                var salaryClassEntity = salaryClass.Where(s => rankEntity.SalaryClassID == s.ID).FirstOrDefault();
               
                foreach (var item in lstProfileIDs)
                {
                    Sal_BasicSalary objBasicSalary = new Sal_BasicSalary();
                    objBasicSalary.ProfileID = item;
                    objBasicSalary.GrossAmount = BasicSalary;
                    objBasicSalary.Amount = BasicSalary.Encrypt(); 
                    objBasicSalary.DateOfEffect = DateHire;
                    objBasicSalary.RankRateID = SalaryRankID;
                    objBasicSalary.CurrencyID = currency.ID;
                    objBasicSalary.ClassRateID = salaryClassEntity == null ? Guid.Empty : salaryClassEntity.ID;
                    lstBasicSalary.Add(objBasicSalary);
                }

                repoBasicSalary.Add(lstBasicSalary);
                repoBasicSalary.SaveChanges();


            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:53,代码来源:Sal_BasicSalaryServices.cs

示例14: GetProfileIDByTravelRequests

 public Guid GetProfileIDByTravelRequests(Guid TravelRequestID)
 {
     Guid rs = Guid.Empty;
     using (var context = new VnrHrmDataContext())
     {
         var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         var repoTravelRequest = new CustomBaseRepository<FIN_TravelRequest>(unitOfWork);
         var TravelRequest = repoTravelRequest.GetById(TravelRequestID);
         rs = TravelRequest.ProfileID.Value;
     }
     return rs;
 }
开发者ID:dtafe,项目名称:vnr,代码行数:12,代码来源:FIN_TravelRequestService.cs

示例15: SetCompensationLeaveBeginYear

        public void SetCompensationLeaveBeginYear(List<Guid> lstProfileIDs, double? limitMaximum, int Year, int? MonthResetANL, Guid? AllowanceTypeID, Guid? CuttOffDurationID)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoAtt_CompensationConfig = new CustomBaseRepository<Att_CompensationConfig>(unitOfWork);
                DateTime EndLastYear = new DateTime(Year - 1, 12, 1);

                List<Att_CompensationDetail> lstCompensationDetail = unitOfWork.CreateQueryable<Att_CompensationDetail>(m => m.MonthYear == EndLastYear
                                                                        && m.ProfileID != null
                                                                        && lstProfileIDs.Contains(m.ProfileID.Value)).ToList();
                var lstCompensationLeaveInDB = unitOfWork.CreateQueryable<Att_CompensationConfig>(m => m.Year == Year && m.ProfileID != null && lstProfileIDs.Contains(m.ProfileID.Value)).ToList();

                List<Att_CompensationConfig> lstNewData = new List<Att_CompensationConfig>();
                List<Att_CompensationConfig> lstEditData = new List<Att_CompensationConfig>();
                foreach (var ProfileID in lstProfileIDs)
                {
                    Att_CompensationConfig CompensationLeaveConfigByProfile = lstCompensationLeaveInDB.Where(m => m.ProfileID == ProfileID).FirstOrDefault();
                    bool IsNew = false;
                    if (CompensationLeaveConfigByProfile == null)
                    {
                        IsNew = true;
                        CompensationLeaveConfigByProfile = new Att_CompensationConfig();
                        CompensationLeaveConfigByProfile.ID = Guid.NewGuid();
                        CompensationLeaveConfigByProfile.ProfileID = ProfileID;
                        CompensationLeaveConfigByProfile.Year = Year;
                    }
                    CompensationLeaveConfigByProfile.MonthResetInitAvailable = MonthResetANL;
                    double RemainLastYear = lstCompensationDetail.Where(m => m.ProfileID == ProfileID).Select(m => m.Remain ?? 0).FirstOrDefault();
                    if (limitMaximum != null)
                    {
                        CompensationLeaveConfigByProfile.InitAvailable = RemainLastYear > limitMaximum.Value ? limitMaximum.Value : RemainLastYear;
                    }
                    else
                    {
                        CompensationLeaveConfigByProfile.InitAvailable = RemainLastYear;
                    }
                    if (IsNew)
                    {
                        lstNewData.Add(CompensationLeaveConfigByProfile);
                    }
                    else
                    {
                        lstEditData.Add(CompensationLeaveConfigByProfile);
                    }
                    //Sửa lại theo phần tử mới mà Sơn build
                }
                repoAtt_CompensationConfig.Add(lstNewData);
                repoAtt_CompensationConfig.Edit(lstEditData);
                unitOfWork.SaveChanges();
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:52,代码来源:Att_CompensationServices.cs


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