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


C# CustomBaseRepository.GetAll方法代码示例

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


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

示例1: 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

示例2: GetPerformanceExtendByPerID

        public Eva_PerformanceExtendEntity GetPerformanceExtendByPerID(string ID,string userLogin)
        {
            Guid perID = Guid.Empty;
            Guid.TryParse( ID, out perID);
            BaseService service = new BaseService();
            string status = string.Empty;

            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoEva_Performance = new CustomBaseRepository<Eva_Performance>(unitOfWork);
                var repoEva_PerformanceExtend = new CustomBaseRepository<Eva_PerformanceExtend>(unitOfWork);

                var performance = repoEva_Performance.GetAll().Where(s => s.ID == perID).FirstOrDefault();
                var extend = repoEva_PerformanceExtend.GetAll().Where(s => s.ID == performance.PerformanceExtendID).FirstOrDefault();

                var result = extend.Copy<Eva_PerformanceExtendEntity>();
                string proID = Common.DotNetToOracle(performance.ProfileID.Value.ToString());
                var profile = service.GetData<Hre_ProfileEntity>(proID, ConstantSql.hrm_hr_sp_get_ProfileById,userLogin, ref status).FirstOrDefault();

                if (profile != null && result == null)
                {
                    result = new Eva_PerformanceExtendEntity();
                }
                
                result.ProfileName = profile.ProfileName ?? string.Empty;
                result.CodeEmp = profile.CodeEmp ?? string.Empty;
                result.PositionName = profile.PositionName ?? string.Empty;
                result.JobTitleName = profile.JobTitleName ?? string.Empty;
                result.DateOfBirth = profile.DateOfBirth;
                result.DateHire = profile.DateHire;
                result.PayrollGroupName = profile.PayrollGroupName ?? string.Empty;
                result.SupervisorName = profile.SupervisorName ?? string.Empty;
                result.HighSupervisorName = profile.HighSupervisorName ?? string.Empty;
                result.WorkPlaceName = profile.WorkPlaceName ?? string.Empty;
                result.TCountryName = profile.TCountryName ?? string.Empty;
                result.TProvinceName = profile.TProvinceName ?? string.Empty;
                result.Channel = profile.Channel ?? string.Empty;
                result.Region = profile.Region ?? string.Empty;
                result.Area = profile.Area ?? string.Empty;
                result.DateOfEffect = profile.DateOfEffect;

                return result;

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

示例3: ComputeDepartment

        public void ComputeDepartment(Guid departmentID)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (UnitOfWork)(new UnitOfWork(context));
                var repoSal_SalaryDepartment = new CustomBaseRepository<Sal_SalaryDepartment>(unitOfWork);
                var repoSal_SalaryDepartmentItem = new CustomBaseRepository<Sal_SalaryDepartmentItem>(unitOfWork);
                var repoAtt_CutOffDuration = new CustomBaseRepository<Att_CutOffDurationEntity>(unitOfWork);

                Sal_SalaryDepartment item = new Sal_SalaryDepartment();
                item = repoSal_SalaryDepartment.GetById(departmentID);

                //xóa các item nếu đã tính trước đó
                List<Sal_SalaryDepartmentItem> listDepartmentItem = new List<Sal_SalaryDepartmentItem>();
                listDepartmentItem = repoSal_SalaryDepartmentItem.GetAll().Where(m => m.SalaryDepartmentID == departmentID).ToList();
                repoSal_SalaryDepartmentItem.Delete(listDepartmentItem);
                unitOfWork.SaveChanges();

                //nếu chọn theo cutoff thì lấy datefrom dateto của cutoff
                if (item.CutOffDurationID != null)
                {
                    var cutoff= repoAtt_CutOffDuration.GetById((Guid)item.CutOffDurationID);
                    item.MonthYear = cutoff.MonthYear;
                    item.DateFrom = cutoff.DateStart;
                    item.DateTo = cutoff.DateEnd;
                }

                Hashtable hasTable = new Hashtable();
                List<Sal_SalaryDepartment> listSalaryDepartment = new List<Sal_SalaryDepartment>(); 
                listSalaryDepartment.Add(item);

                ComputeSalaryDepartment(item.MonthYear, (DateTime)item.DateFrom, (DateTime)item.DateTo, listSalaryDepartment, ref hasTable);

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

示例4: FillAllowOTValidate

        private void FillAllowOTValidate(List<Att_OvertimeEntity> lstOvertime, OvertimePermitEntity OtPermit)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoAtt_Overtime = new CustomBaseRepository<Att_Overtime>(unitOfWork);
                var repoCat_Shift = new CustomBaseRepository<Cat_Shift>(unitOfWork);
                var repoCat_DayOff = new CustomBaseRepository<Cat_DayOff>(unitOfWork);

                if (lstOvertime.Count == 0)
                {
                    return;
                }
                if (OtPermit == null || (OtPermit.limitHour_ByDay == null
                                        && OtPermit.limitHour_ByDay_Lev1 == null
                                        && OtPermit.limitHour_ByDay_Lev2 == null
                                        && OtPermit.limitHour_ByWeek == null
                                        && OtPermit.limitHour_ByWeek_Lev1 == null
                                        && OtPermit.limitHour_ByWeek_Lev2 == null
                                        && OtPermit.limitHour_ByMonth == null
                                        && OtPermit.limitHour_ByMonth_Lev1 == null
                                        && OtPermit.limitHour_ByMonth_Lev2 == null
                                        && OtPermit.limitHour_ByYear == null
                                        && OtPermit.limitHour_ByYear_Lev1 == null
                                        && OtPermit.limitHour_ByYear_Lev2 == null)
                    )
                {
                    return;
                }
                #region getData
                DateTime DateMinInlstOvertime = lstOvertime.Min(m => m.WorkDate);
                DateTime DateMaxInlstOvertime = lstOvertime.Max(m => m.WorkDate);
                List<Guid> lstProfileID = lstOvertime.Select(m => m.ProfileID).Distinct().ToList();

                //Lấy ngày Đầu Năm, Đầu Tuần ->> Ngày nào nhỏ nhất thì lấy theo Ngày đó làm mốc
                DateTime DateMin = DateTime.MinValue;
                DateTime DateBeginYear = new DateTime(DateMinInlstOvertime.Year, 1, 1);
                DateTime DateBeginMonth = new DateTime(DateMinInlstOvertime.Year, DateMinInlstOvertime.Month, 1);
                DateTime DateBeginWeek = DateTime.MinValue;
                DateTime DateEndWeek = DateTime.MinValue;
                Common.GetStartEndWeek(DateMinInlstOvertime.Date, out DateBeginWeek, out DateEndWeek);
                DateMin = DateBeginYear < DateBeginWeek ? DateBeginYear : DateBeginWeek;
                DateTime DateMax = DateMaxInlstOvertime.AddYears(1);

                //string E_SUBMIT = OverTimeStatus.E_SUBMIT.ToString();
                //string E_SUBMIT_TEMP = OverTimeStatus.E_SUBMIT_TEMP.ToString();
                //string E_FIRST_APPROVED = OverTimeStatus.E_FIRST_APPROVED.ToString();
                //string E_WAIT_APPROVED = OverTimeStatus.E_WAIT_APPROVED.ToString();
                string E_APPROVED = OverTimeStatus.E_APPROVED.ToString();
                //string E_CONFIRM = OverTimeStatus.E_CONFIRM.ToString();
                string E_CASHOUT = MethodOption.E_CASHOUT.ToString();

                List<Guid> lstOvertimeAlreadyID = lstOvertime.Where(m => m.udAlreadyOvertimeID != null).Select(m => m.udAlreadyOvertimeID ?? Guid.Empty).Distinct().ToList();


                //var lstOvertimeInDb = repoAtt_Overtime.FindBy(m => m.IsDelete == null && m.WorkDate >= DateMin && m.WorkDate < DateMax && lstProfileID.Contains(m.ProfileID)
                //    && (m.MethodPayment == null || (m.MethodPayment != null && m.MethodPayment == E_CASHOUT))
                //&& m.Status == E_APPROVED)
                //    .Select(m => new { m.Status, m.ProfileID, m.WorkDate, m.RegisterHours, m.ApproveHours, m.ConfirmHours });
                var lstOvertimeInDb = new List<Att_Overtime>().Select(m => new { m.Status, m.ProfileID, m.WorkDate, m.RegisterHours, m.ApproveHours, m.ConfirmHours });
                if (lstProfileID.Count < 2000)
                {
                    lstOvertimeInDb = repoAtt_Overtime.FindBy(m => m.IsDelete == null && m.WorkDate >= DateMin && m.WorkDate < DateMax && lstProfileID.Contains(m.ProfileID)
                           && (m.MethodPayment == null || (m.MethodPayment != null && m.MethodPayment == E_CASHOUT))
                       && m.Status == E_APPROVED)
                       .Select(m => new { m.Status, m.ProfileID, m.WorkDate, m.RegisterHours, m.ApproveHours, m.ConfirmHours }).ToList();
                }
                else
                {
                    lstOvertimeInDb = repoAtt_Overtime.FindBy(m => m.IsDelete == null && m.WorkDate >= DateMin && m.WorkDate < DateMax
                           && (m.MethodPayment == null || (m.MethodPayment != null && m.MethodPayment == E_CASHOUT))
                       && m.Status == E_APPROVED)
                       .Select(m => new { m.Status, m.ProfileID, m.WorkDate, m.RegisterHours, m.ApproveHours, m.ConfirmHours }).ToList();
                }

                var lstShift = repoCat_Shift.GetAll().Select(m => new { m.ID, m.InTime, m.CoBreakOut, m.CoBreakIn, m.CoOut });

                string E_HOLIDAY_HLD = HolidayType.E_HOLIDAY_HLD.ToString();
                List<DateTime> lstHoliday = repoCat_DayOff.FindBy(m => m.Type == E_HOLIDAY_HLD).Select(m => m.DateOff).ToList<DateTime>();
                #endregion

                #region processing

                lstOvertime = lstOvertime.OrderBy(m => m.WorkDateRoot).ThenBy(m => m.WorkDate).ToList();
                foreach (var ProfileID in lstProfileID)
                {
                    Double RegisterPlus_Year_Validate = 0;
                    Double RegisterPlus_Month_Validate = 0;
                    Double RegisterPlus_Week_Validate = 0;

                    DateTime BeginYear = DateTime.MinValue;
                    DateTime EndYear = DateTime.MinValue;
                    DateTime BeginMonth = DateTime.MinValue;
                    DateTime EndMonth = DateTime.MinValue;
                    DateTime BeginWeek = DateTime.MinValue;
                    DateTime EndWeek = DateTime.MinValue;
                    DateTime BeginDate = DateTime.MinValue;
                    DateTime EndDate = DateTime.MinValue;

                    bool isResetYear = false;
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:Att_OvertimeServices.cs

示例5: GetListTraineeScore

        public List<Tra_TraineeScoreEntity> GetListTraineeScore(List<Tra_TraineeScoreImport> lstTraineeScore, out List<Tra_TraineeScoreImport> DataReviewOutput)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoTra_Class = new CustomBaseRepository<Tra_Class>(unitOfWork);
                var repoTra_Trainee = new CustomBaseRepository<Tra_Trainee>(unitOfWork);
                var repoTra_TraineeTopic = new CustomBaseRepository<Tra_TraineeTopic>(unitOfWork);
                var repoTra_TraineeScore = new CustomBaseRepository<Tra_TraineeScore>(unitOfWork);
                var repoTra_ScoreType = new CustomBaseRepository<Tra_ScoreType>(unitOfWork);
                List<Tra_TraineeScoreEntity> entity = new List<Tra_TraineeScoreEntity>();
                List<Tra_TraineeScore> result = new List<Tra_TraineeScore>();
                DataReviewOutput = new List<Tra_TraineeScoreImport>();
                List<string> ClassCode = lstTraineeScore.Select(m => m.ClassCode).Distinct().ToList();
                //Lấy DS ClassID
                List<Guid> ClassID = repoTra_Class.GetAll().Where(m => m.IsDelete == null && ClassCode.Contains(m.Code)).Select(m => m.ID).ToList<Guid>();
                //Lấy DS TraineeID
                List<Guid> TraineeID = repoTra_Trainee.GetAll().Where(m => m.IsDelete == null && ClassID.Contains(m.ClassID)).Select(m => m.ID).ToList<Guid>();
                //Lấy DS TraineetopicID
                List<Guid> lstTraineeTopicID = repoTra_TraineeTopic.GetAll().Where(m => m.IsDelete == null && TraineeID.Contains(m.TraineeID ?? Guid.Empty)).Select(m => m.ID).ToList<Guid>();
                //Lấy DS TraineeTopic
                var TraineeTopicAll = repoTra_TraineeTopic.GetAll().Where(m => m.IsDelete == null && lstTraineeTopicID.Contains(m.ID))
                    .Select(m => new { m.ID, TopicCode = m.Cat_Topic.Code, CodeEmp = m.Tra_Trainee.Hre_Profile.CodeEmp, ClassCode = m.Tra_Trainee.Tra_Class.Code }).ToList();
                //Lấy DS TraineeScore
                List<Tra_TraineeScore> LstTraineeScoreAll = repoTra_TraineeScore.GetAll().Where(m => m.IsDelete == null && lstTraineeTopicID.Contains(m.TraineeTopicID ?? Guid.Empty)).ToList<Tra_TraineeScore>();
                List<string> ScoreTypeCode = lstTraineeScore.Select(m => m.TypeScore).Distinct().ToList<string>();
                List<Tra_ScoreType> lstTypeScoreAll = repoTra_ScoreType.GetAll().Where(m => m.IsDelete == null && ScoreTypeCode.Contains(m.Code)).ToList<Tra_ScoreType>();
                var stt = 1;
                foreach (var TraineeScore in lstTraineeScore)
                {
                    var TraineeTopic = TraineeTopicAll.Where(m =>  m.CodeEmp == TraineeScore.CodeEmp && m.TopicCode == TraineeScore.TopicCode).FirstOrDefault();
                    Tra_ScoreType ScoreType = lstTypeScoreAll.Where(m => m.Code == TraineeScore.TypeScore).FirstOrDefault();
                    if (TraineeTopic == null) //Loi import
                    {
                        TraineeScore.Stt = stt++;
                        TraineeScore.TypeError = "Không Có Môn Học Của Học Viên";
                        DataReviewOutput.Add(TraineeScore);
                    }
                    else if (ScoreType == null)
                    {
                        TraineeScore.Stt = stt++;
                        TraineeScore.TypeError = "Không Có Loại Điểm Của Môn Học";
                        DataReviewOutput.Add(TraineeScore);
                    }
                    else
                    {
                        TraineeScore.Stt = stt++;
                        DataReviewOutput.Add(TraineeScore);
                        //Kiem tra diem da co trong DB chua
                        //neu co roi thi update neu chua thi tao moi
                        Guid TraineeTopicID = TraineeTopic.ID;
                        Tra_TraineeScore TraineeScore_Current = LstTraineeScoreAll.Where(m => m.TraineeTopicID == TraineeTopicID && m.ScoreTypeID == ScoreType.ID).FirstOrDefault();
                        if (TraineeScore_Current == null)
                        {
                            TraineeScore_Current = new Tra_TraineeScore();
                            TraineeScore_Current.ID = Guid.NewGuid();
                        }
                        TraineeScore_Current.TraineeTopicID = TraineeTopicID;
                        TraineeScore_Current.ScoreTypeID = ScoreType.ID;
                        TraineeScore_Current.Score = TraineeScore.Score;
                        result.Add(TraineeScore_Current);
                    }
                    entity = result.Translate<Tra_TraineeScoreEntity>();
                }
                return entity;
            }

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

示例6: SendMaToPreReject

        public DataErrorCode SendMaToPreReject(string host, Guid recordID, Guid userApprovedID, Guid loginId)
        {
            using (var context = new VnrHrmDataContext())
            {
                string statusMess = string.Empty;
                var Services = new BaseService();
                var UserLogin = string.Empty;
                string status = string.Empty;
                string typeApprover = FinApproverType.Fin_CashAdvance.ToString();

                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
                var repoFin_Approver = new CustomBaseRepository<FIN_ApproverECLAIM>(unitOfWork);

                var repo_JobTitle = new CustomBaseRepository<Cat_JobTitle>(unitOfWork);
                var lstJobTitle = repo_JobTitle.GetAll().Where(s => s.IsDelete == null).ToList();
                var repoOrg = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
                var lstOrg = repoOrg.GetAll().Where(s => s.IsDelete == null).ToList();

                var repoCashItem = new CustomBaseRepository<Fin_CashAdvanceItem>(unitOfWork);
                var totalItem = repoCashItem.GetAll().Where(s => s.CashAdvanceID == recordID && s.Status.Contains("E_APPROVED")).Sum(s => s.Amount);

                var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
                var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
                var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);


                var repoFIN_TravelRequest = new CustomBaseRepository<Fin_CashAdvance>(unitOfWork);
                var record = repoFIN_TravelRequest.FindBy(s => s.ID == recordID).FirstOrDefault();

                string _typeTemplate = EnumDropDown.EmailType.E_REJECTED_CASHADVANCE.ToString();
                var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
                if (template == null)
                    return DataErrorCode.Error_NoTemplateMail;

                var approverEntity = repoFin_Approver.GetAll().Where(s => s.IsDelete == null && s.ApprovedID != null && s.ApprovedID.Value == loginId).FirstOrDefault();

                if (approverEntity != null && approverEntity.OrderNo != null)
                {
                   


                        var userInfo = repoSys_UserInfo.GetAll().Where(s => s.IsDelete == null && s.ID == approverEntity.ApprovedID.Value).FirstOrDefault();

                       

                        if (userInfo != null)
                        {
                            var profileRequest = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(record.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref statusMess).FirstOrDefault();

                            var profileEntity = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(userInfo.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref statusMess).FirstOrDefault();
                           
                            if (profileEntity != null)
                            {
                                var jobTitleEntity = lstJobTitle.Where(s => profileEntity.JobTitleID != null && s.ID == profileEntity.JobTitleID.Value).FirstOrDefault();
                                var orgEntity = lstOrg.Where(s => profileEntity.OrgStructureID != null && s.ID == profileEntity.OrgStructureID.Value).FirstOrDefault();
                                if (template != null)
                                {
                                    try
                                    {
                                        string MailTo = profileRequest.Email;

                                        string urlClickHere = host + "#Hrm_Main_Web/Fin_SendMailApprovedCashAdvance/DetailTravelRequest/" + recordID + "#NewTab";

                                        string linkcontent = string.Empty;

                                        string linkcontentReject = string.Empty;


                                       

                                        linkcontent += "Nhấn vào " + "<a href='" + host + "Fin_SendMailApprovedCashAdvance/ProcessApprovedPage"
                                       + "?loginID=" + approverEntity.ApprovedID
                                       + "&userApprovedID=" + approverEntity.ID
                                       + "&recordID=" + recordID
                                       + "'>đây" + "<a/>" + " để đồng ý.";

                                        linkcontentReject += "Nhấn vào " + "<a href='" + host + "Fin_SendMailApprovedCashAdvance/ProcessRejectPage"
                                      + "?loginID=" + approverEntity.ApprovedID
                                      + "&userApprovedID=" + approverEntity.ID
                                      + "&recordID=" + recordID
                                      + "'>đây" + "<a/>" + " để từ chối.";

                                        #region magreData

                                        string[] strsParaKey = null;
                                        string[] strsParaValues = null;
                                        strsParaKey = new string[] 
                                    { 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_PROFILENAME.ToString(), 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_JOBTITLE.ToString(), 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_AREA.ToString(), 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_USERINFONAME.ToString(), 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_CASHADVANCENAME.ToString(), 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_CASHADVANCECODE.ToString(), 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_TOTALADVANCE.ToString(), 

                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_DENIES.ToString(), 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_LINKCONTENT.ToString(), 
                                        EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_REJECTLINK.ToString(), 
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:FIN_CashAdvanceService.cs

示例7: ReportTransferBonusHold

        public DataTable ReportTransferBonusHold(List<Hre_ProfileEntity> lstProfile, List<String> lstElementCode, DateTime monthStart, DateTime monthEnd, string UserLogin, bool isCreateTemplate, String nameReport)
        {
            using (var context = new VnrHrmDataContext())
            {

                #region Get Data
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoOrgStructure = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
                var repoCostCentre = new CustomBaseRepository<Cat_CostCentre>(unitOfWork);
                var repoElement = new CustomBaseRepository<Cat_Element>(unitOfWork);

                //ds phần tử
                string statusEl = string.Empty;
                var lstObjElement = new List<object>();
                lstObjElement.Add(null);
                lstObjElement.Add(null);
                lstObjElement.Add(null);
                lstObjElement.Add(null);
                lstObjElement.Add(null);
                lstObjElement.Add(1);
                lstObjElement.Add(int.MaxValue - 1);
                List<Cat_ElementEntity> lstElement = GetData<Cat_ElementEntity>(lstObjElement, ConstantSql.hrm_cat_sp_get_Element, UserLogin, ref statusEl);

                lstElement = lstElement.Where(m => lstElementCode.Contains(m.ElementCode)).ToList(); ;
                DataTable tb = GetSchemaTransferBonusHold(lstElement, nameReport);
                if (isCreateTemplate)
                {
                    return tb.ConfigTable();
                }

                //ds thông tin lương
                string statusSI = string.Empty;
                var lstObjSalInfo = new List<object>();
                lstObjSalInfo.AddRange(new object[8]);
                lstObjSalInfo[6] = 1;
                lstObjSalInfo[7] = Int32.MaxValue - 1;
                List<Sal_SalaryInformationEntity> lstSalaryInformation = GetData<Sal_SalaryInformationEntity>(lstObjSalInfo, ConstantSql.hrm_sal_sp_get_Sal_SalaryInformation, UserLogin, ref statusSI);

                //Bảng lương
                string statusTb = string.Empty;
                List<object> listModelprtb = new List<object>();
                listModelprtb = new List<object>();
                listModelprtb.AddRange(new object[6]);
                listModelprtb[2] = monthStart;
                listModelprtb[3] = monthEnd;
                listModelprtb[4] = 1;
                listModelprtb[5] = Int32.MaxValue - 1;
                List<Sal_PayrollTableEntity> listPayrollTable = GetData<Sal_PayrollTableEntity>(listModelprtb, ConstantSql.hrm_sal_sp_get_PayrollTable, UserLogin, ref statusTb);

                List<object> listModel = new List<object>();
                listModel.AddRange(new object[10]);
                listModel[4] = monthStart;
                listModel[5] = monthEnd;
                listModel[8] = 1;
                listModel[9] = Int32.MaxValue - 1;
                List<Sal_HoldSalaryEntity> listHoldSalary = GetData<Sal_HoldSalaryEntity>(listModel, ConstantSql.hrm_sal_sp_get_HoldSalary, UserLogin, ref statusTb);

                string statusTbit = string.Empty;
                List<object> listModelprtbit = new List<object>();
                listModelprtbit = new List<object>();
                listModelprtbit.AddRange(new object[9]);
                listModelprtbit[2] = monthStart;
                listModelprtbit[3] = monthEnd;
                listModelprtbit[7] = 1;
                listModelprtbit[8] = Int32.MaxValue - 1;
                List<Sal_PayrollTableItemEntity> listPayrollTableItem = GetData<Sal_PayrollTableItemEntity>(listModelprtbit, ConstantSql.hrm_sal_sp_get_PayrollTableItem, UserLogin, ref statusTbit);
                listPayrollTableItem = listPayrollTableItem.Where(it => it.Value != null && it.Value != string.Empty).ToList();

                var lstOrgStructure = repoOrgStructure.GetAll().Where(org => org.IsDelete == null).Select(org => new { org.ID, org.Code, org.OrgStructureName }).ToList();
                var lstCostcentre = repoCostCentre.GetAll().Where(cost => cost.IsDelete == null).Select(cost => new { cost.ID, cost.Code, cost.CostCentreName }).ToList();
                #endregion

                #region Process

                lstProfile = lstProfile.Where(m => listHoldSalary.Any(t => t.ProfileID == m.ID)).ToList();
                foreach (var profile in lstProfile)
                {
                    if (profile == null)
                    {
                        continue;
                    }

                    DataRow dr = tb.NewRow();
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.CodeEmp] = profile.CodeEmp;
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.ProfileName] = profile.ProfileName;
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.E_UNIT] = profile.E_UNIT;
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.E_DIVISION] = profile.E_DIVISION;
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.E_DEPARTMENT] = profile.E_DEPARTMENT;
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.E_TEAM] = profile.E_TEAM;
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.E_SECTION] = profile.E_SECTION;
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.WorkingPlace] = profile.WorkPlaceName;
                    dr[Sal_ReportBasicSalaryMonthlyEntity.FieldNames.CodeTax] = profile.CodeTax;

                    #region Add lý do bị giữ lương, ngày nghỉ việc và ngày bắt đầu giữ lương.
                    string remark = string.Empty;
                    string dayleave = string.Empty;
                    string monthsalary = string.Empty;
                    Sal_HoldSalaryEntity HoldSalaryByID = listHoldSalary.Where(m => m.ProfileID == profile.ID).FirstOrDefault();
                    remark = HoldSalaryByID.DayLeave != null ? "Nghỉ " + HoldSalaryByID.DayLeave.ToString() + " ngày\n" : string.Empty;
                    remark += HoldSalaryByID.IsLeaveContinuous == true ? "Nghỉ liên tục 3 ngày\n" : string.Empty;
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:Sal_ReportService.cs

示例8: ActionSubmit

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

                var cashAdvanceID = lstTravelRequestItem.Where(s => s.CashAdvanceID != null && lstId.Contains(s.ID)).Select(s => s.CashAdvanceID).Distinct().FirstOrDefault();
                var userEntity = GetData<Sys_UserInfoEntity>(userId, ConstantSql.hrm_sys_sp_get_UserbyId, UserLogin, ref statusMes).FirstOrDefault();

                var cashAdvanceEntity = new Fin_CashAdvanceEntity();
                if (cashAdvanceID != null)
                {
                    cashAdvanceEntity = GetData<Fin_CashAdvanceEntity>(cashAdvanceID.Value, ConstantSql.hrm_hr_sp_get_CashAdvanceById, UserLogin, ref statusMes).FirstOrDefault();
                }

                if (lstId.Count > 0)
                {

                    if (userEntity != null && cashAdvanceEntity != null)
                    {
                        if (userEntity.ProfileID.Value == cashAdvanceEntity.ProfileID.Value)
                        {
                            lstTravelRequestItem = lstTravelRequestItem.Where(s => lstId.Contains(s.ID)).ToList();
                            foreach (var item in lstTravelRequestItem)
                            {
                                item.Status = status;
                            }
                            repoTravelRequestItem.SaveChanges();
                        }
                    }
                    
                }

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

示例9: ProcessSendMailForFirstApprove

        public string ProcessSendMailForFirstApprove(string host, Guid userId, Guid recordID)
        {
            DataErrorCode status = DataErrorCode.Success;
            using (var context = new VnrHrmDataContext())
            {
                var Services = new BaseService();
                var UserLogin = string.Empty;
                string statusMess = string.Empty;
                string type = ApproveType.E_FIN_CashAdvance.ToString();
                string typeApprover = FinApproverType.Fin_CashAdvance.ToString();
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);

                var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
                var lstUserInfo = repoSys_UserInfo.GetAll().Where(s => s.IsDelete == null).ToList();
                var userInfoEntity = lstUserInfo.Where(s => userId == s.ID).FirstOrDefault();
                var repo_JobTitle = new CustomBaseRepository<Cat_JobTitle>(unitOfWork);
                var lstJobTitle = repo_JobTitle.GetAll().Where(s => s.IsDelete == null).ToList();
                var repoOrg = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
                var lstOrg = repoOrg.GetAll().Where(s => s.IsDelete == null).ToList();
                var repoProfile = new CustomBaseRepository<Hre_Profile>(unitOfWork);
                var lstProfile = repoProfile.GetAll().Where(s => s.IsDelete == null).ToList();

                var repoFIN_TravelRequest = new CustomBaseRepository<Fin_CashAdvance>(unitOfWork);
                var record = repoFIN_TravelRequest.FindBy(s => s.ID == recordID).FirstOrDefault();

                if (record != null)
                {
                    List<Guid> lstIds = new List<Guid>();
                    lstIds.Add(record.ID);
               
                    ActionApprovedAll(lstIds, "E_REQUEST", userId);
                }

                var repoCashItem = new CustomBaseRepository<Fin_CashAdvanceItem>(unitOfWork);
                var totalItem = repoCashItem.GetAll().Where(s => s.IsDelete == null && s.CashAdvanceID != null && s.CashAdvanceID.Value == recordID).Sum(s => s.Amount);

                var repoFin_Approver = new CustomBaseRepository<FIN_ApproverECLAIM>(unitOfWork);
                var lstApprover = repoFin_Approver.GetAll().Where(s => s.IsDelete == null).ToList();

                var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);

                string _typeTemplate = EnumDropDown.EmailType.E_REQUEST_CASHADVANCE.ToString();
                var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();

                if (userInfoEntity != null)
                {
                    var profileInfoEntity = lstProfile.Where(s => s.ID == userInfoEntity.ProfileID.Value).FirstOrDefault();
                    var jobTitleEntity = lstJobTitle.Where(s => profileInfoEntity.JobTitleID != null && s.ID == profileInfoEntity.JobTitleID.Value).FirstOrDefault();
                    var orgEntity = lstOrg.Where(s => profileInfoEntity.OrgStructureID != null && s.ID == profileInfoEntity.OrgStructureID.Value).FirstOrDefault();
                    var lstApproverByClaim = lstApprover.Where(s => s.ProfileID == userInfoEntity.ProfileID && s.ApprovedType == typeApprover && s.ApprovedID != null).OrderBy(s => s.OrderNo).ToList();
                    var approvedEntity = new FIN_ApproverECLAIM();

                   // var firstApprover = lstApprover.Where(s => s.ProfileID == userInfoEntity.ProfileID && s.ApprovedType == typeApprover).OrderBy(s => s.OrderNo).FirstOrDefault();


                    var firstApprover = lstApproverByClaim.FirstOrDefault();
                    foreach (var item in lstApproverByClaim)
                    {
                        if (firstApprover.OrderNo == item.OrderNo)
                        {
                            continue;
                        }
                        approvedEntity = item;
                        break;
                    }

                  //  var userIdSecondApprover = lstApprover.Where(s => s.ProfileID == userInfoEntity.ProfileID && s.ApprovedType == typeApprover && s.OrderNo == 2).FirstOrDefault();
                    var userIdSecondApprover = lstApprover.Where(s => s.ID == approvedEntity.ID).FirstOrDefault();

                    if (firstApprover != null)
                    {
                        var userEnityByProfileID = lstUserInfo.Where(s => s.ID == firstApprover.ApprovedID.Value).FirstOrDefault();
                        var profileEntity = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(userEnityByProfileID.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref statusMess).FirstOrDefault();
                        if (profileEntity != null)
                        {
                            if (userIdSecondApprover != null)
                            {
                                if (template != null)
                                {
                                    string MailTo = profileEntity.Email;

                                    string urlClickHere = host + "#Hrm_Main_Web/Fin_SendMailApprovedCashAdvance/DetailTravelRequest/" + recordID + "#NewTab";

                                    string linkcontent = string.Empty;
                                    string linkcontentReject = string.Empty;

                                    var temp = lstUserInfo.Where(s => s.ID == userIdSecondApprover.ApprovedID.Value).FirstOrDefault();
                                    var name = temp.UserInfoName != null ? temp.UserInfoName : temp.UserLogin;

                                    linkcontent += "Nhấn vào " + "<a href='" + host + "Fin_SendMailApprovedCashAdvance/ProcessApprovedPage"
                                   + "?loginID=" + firstApprover.ApprovedID
                                   + "&userApprovedID=" + userIdSecondApprover.ID
                                   + "&recordID=" + recordID
                                   + "'>đây" + "<a/>" + " để đồng ý.";


                                    linkcontentReject += "Nhấn vào " +  "<a href='" + host + "Fin_SendMailApprovedCashAdvance/ProcessRejectPage"
                                     + "?loginID=" + firstApprover.ApprovedID
                                     + "&userApprovedID=" + userIdSecondApprover.ID
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:FIN_CashAdvanceService.cs

示例10: GetReportProfileInformationMoment

        public DataTable GetReportProfileInformationMoment(List<Hre_ProfileEntity> lstProfile, DateTime DateCheck, bool isCreateTemplate, String nameReport, Guid? workPlaceID, Guid? salaryClassID)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));

                var repoCat_ContractType = new CustomBaseRepository<Cat_ContractType>(unitOfWork);
                var repoHre_Contract = new CustomBaseRepository<Hre_Contract>(unitOfWork);
                var repoHre_AppendixContract = new CustomBaseRepository<Hre_AppendixContract>(unitOfWork);
                var repoCat_OrgStructure = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
                var repoCat_OrgStructureType = new CustomBaseRepository<Cat_OrgStructureType>(unitOfWork);
                var repoCat_Position = new CustomBaseRepository<Cat_Position>(unitOfWork);
                var repoCat_SalaryClass = new CustomBaseRepository<Cat_SalaryClass>(unitOfWork);

                var lstContracType = repoCat_ContractType.FindBy(s => s.IsDelete == null).ToList();

                DataTable tb = GetSchema_ReportProfileInformationMoment(nameReport);
                if (isCreateTemplate)
                {
                    return tb.ConfigTable();
                }


                #region code BC
                List<Guid> lstProfileIDs = lstProfile.Select(m => m.ID).Distinct().ToList();
                string E_APPROVED = HRM.Infrastructure.Utilities.EnumDropDown.Status.E_APPROVED.ToString();
                var lstContractAll = repoHre_Contract.GetAll().Where(m => m.Status == E_APPROVED && m.DateStart <= DateCheck && m.DateEnd >= DateCheck)
                    .Select(m => new { m.ID, m.Code, m.ProfileID, m.DateStart, m.DateEnd, m.ContractNo, m.ContractTypeID }).ToList();

                var lstProfileIDs_ByContract = lstContractAll.Select(m => m.ProfileID).Distinct().ToList();
                lstProfile = lstProfile.Where(m => lstProfileIDs_ByContract.Contains(m.ID)).ToList();

                List<Guid> lstContractIDs = lstContractAll.Select(m => m.ID).ToList();
                var bienthai = repoHre_AppendixContract.GetAll().ToList();
                var lstAppendixContract = repoHre_AppendixContract.GetAll().Where(m => lstContractIDs.Contains(m.ContractID))
                    .Select(m => new { m.ID, m.ContractID, m.Code, m.DateofEffect, m.DateEndAppendixContract }).ToList();

                var lstOrg = repoCat_OrgStructure.GetAll().ToList();
                var orgTypes = repoCat_OrgStructureType.GetAll().ToList();
                var lstPosition = repoCat_Position.GetAll().ToList();
                var lstSalaryClass = repoCat_SalaryClass.GetAll().ToList();
                if (workPlaceID != null)
                {
                    lstProfile = lstProfile.Where(s => s.WorkPlaceID == workPlaceID).ToList();
                }
                if (salaryClassID != null)
                {
                    lstProfile = lstProfile.Where(s => s.SalaryClassID == salaryClassID).ToList();
                }
                int stt = 0;
                foreach (var profile in lstProfile)
                {
                    stt++;
                    DataRow dr = tb.NewRow();
                    dr["Stt"] = stt;
                    dr["CodeEmp"] = profile.CodeEmp;
                    dr["ProfileName"] = profile.ProfileName;


                    //var orgId = profile.OrgStructureID;
                    //var orgBranch = LibraryService.GetNearestParent(orgId, OrgUnit.E_BRANCH, lstOrg, orgTypes);
                    //var orgOrg = LibraryService.GetNearestParent(orgId, OrgUnit.E_DEPARTMENT, lstOrg, orgTypes);
                    //var orgTeam = LibraryService.GetNearestParent(orgId, OrgUnit.E_TEAM, lstOrg, orgTypes);
                    //var orgSection = LibraryService.GetNearestParent(orgId, OrgUnit.E_SECTION, lstOrg, orgTypes);
                    //var orgDivision = LibraryService.GetNearestParent(orgId, OrgUnit.E_DIVISION, lstOrg, orgTypes);
                    //var orgUnit = LibraryService.GetNearestParent(orgId, OrgUnit.E_UNIT, lstOrg, orgTypes);



                    dr["E_DIVISION"] = profile.E_DIVISION;

                    dr["E_UNIT"] = profile.E_UNIT;

                    dr["E_DEPARTMENT"] = profile.E_DEPARTMENT;

                    dr["E_TEAM"] = profile.E_TEAM;

                    dr["E_SECTION"] = profile.E_SECTION;

                    if (profile.PositionID != null)
                    {
                        var Position = lstPosition.Where(m => m.ID == profile.PositionID).FirstOrDefault();
                        if (Position != null)
                        {
                            dr["Position"] = Position.PositionName;
                        }
                    }
                    if (profile.DateOfBirth != null)
                    {
                        dr["DateOfBirth"] = profile.DateOfBirth;
                    }
                    if (profile.Cellphone != null)
                    {
                        dr["CellPhone"] = profile.Cellphone;
                    }
                    if (profile.HomePhone != null)
                    {
                        dr["HomePhone"] = profile.HomePhone;
                    }
                    if (profile.Gender != null)
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:Hre_ReportServices.cs

示例11: ReportUnusualPay

        public DataTable ReportUnusualPay(DateTime monthYear, List<Guid> listProfileIDs, Guid? payrollGroupID, Boolean isIncludeQuitEmp, string codeEmp, string orderNumber, string UserLogin)
        {
            try
            {
                using (var context = new VnrHrmDataContext())
                {


                    #region " Load dữ liệu"
                    string status = string.Empty;
                    var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));

                    //kỳ lương (hiện tại mặc định đầu tháng -> cuối tháng)
                    DateTime from = new DateTime(monthYear.Year, monthYear.Month, 1);
                    DateTime to = new DateTime(monthYear.Year, monthYear.Month, DateTime.DaysInMonth(monthYear.Year, monthYear.Month));

                    //Ds tất cả phòng ban
                    var orgServices = new Cat_OrgStructureServices();
                    var lstObjOrg = new List<object>();
                    //  var reposOrgStructure = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
                    var listOrgAll = orgServices.GetDataNotParam<Cat_OrgStructure>(ConstantSql.hrm_cat_sp_get_AllOrg, UserLogin, ref status).ToList();

                    var lstObjOrgNumber = new List<object>();
                    lstObjOrgNumber.Add(orderNumber);
                    var lstOrgID = orgServices.GetData<Cat_OrgStructureEntity>(lstObjOrgNumber, ConstantSql.hrm_cat_sp_get_OrgStructureByOrderNumber, UserLogin, ref status).Select(s => s.ID).ToList();


                    //Ds cửa Hàng
                    var shopServices = new Cat_ShopServices();
                    var lstObjShop = new List<object>();
                    lstObjShop.Add(null);
                    lstObjShop.Add(null);
                    lstObjShop.Add(null);
                    lstObjShop.Add(1);
                    lstObjShop.Add(int.MaxValue - 1);
                    var lstShop = shopServices.GetData<Cat_ShopEntity>(lstObjShop, ConstantSql.hrm_cat_sp_get_Shop, UserLogin, ref status).ToList();

                    //Ds tất cả loại PB
                    var orgTypeServices = new Cat_OrgStructureTypeServices();
                    var lstObjOrgType = new List<object>();
                    lstObjOrgType.Add(string.Empty);
                    lstObjOrgType.Add(string.Empty);
                    lstObjOrgType.Add(1);
                    lstObjOrgType.Add(int.MaxValue - 1);
                    //    var reposOrgStructureType = new CustomBaseRepository<Cat_OrgStructureType>(unitOfWork);
                    var listOrgType = orgTypeServices.GetData<Cat_OrgStructureType>(lstObjOrgType, ConstantSql.hrm_cat_sp_get_OrgStructureType, UserLogin, ref status).ToList();

                    //Ds nhân viên
                    var reposProfile = new CustomBaseRepository<Hre_Profile>(unitOfWork);
                    var profileServices = new Hre_ProfileServices();
                    var lstObjProfile = new List<object>();
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(string.Empty);
                    lstObjProfile.Add(1);
                    lstObjProfile.Add(int.MaxValue - 1);

                    //lọc theo phòng ban
                    //var listProfile = reposProfile.GetAll().Where(hr => hr.IsDelete == null
                    // && hr.OrgStructureID.HasValue
                    // && listOrgIDs.Contains(hr.OrgStructureID.Value)).ToList();
                    var listProfile = reposProfile.GetAll().Where(s => s.IsDelete != true).ToList();
                    if (listProfileIDs != null)
                    {
                        listProfile = listProfile.Where(s => listProfileIDs.Contains(s.ID)).ToList();
                    }


                    //lọc theo nhóm lương
                    // listProfile = listProfile.Where(hr => hr.PayrollGroupID.HasValue && listPrGroupIDs.Contains(hr.PayrollGroupID.Value)).ToList();
                    List<Guid> listProfileID = listProfile.Select(s => s.ID).Distinct().ToList();

                    //lọc nhân viên nghỉ việc
                    if (!isIncludeQuitEmp)
                    {
                        listProfile = listProfile.Where(pro => pro.DateHire <= to && (pro.DateQuit == null || pro.DateQuit.Value > from)).ToList();
                    }
                    if (payrollGroupID != null && payrollGroupID != Guid.Empty)
                    {
                        listProfile = listProfile.Where(s => s.PayrollGroupID == payrollGroupID).ToList();
                    }

                    //lọc theo tên nhân viên
                    if (!string.IsNullOrEmpty(codeEmp))
                    {
                        listProfile = listProfile.Where(s => s.CodeEmp == codeEmp).ToList();
                    }

                    //ds chế độ lương
                    var saleGradeServices = new Sal_GradeServices();
                    var lstObjSalGrade = new List<object>();
                    lstObjSalGrade.Add(string.Empty);
                    lstObjSalGrade.Add(string.Empty);
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:Sal_ReportService.cs

示例12: ActionRejectTraineeRegister

        public string ActionRejectTraineeRegister(List<Guid> selectedIds, Guid UserId, string Reason)
        {
            using (var context = new VnrHrmDataContext())
            {
                var message = string.Empty;
                var status = string.Empty;
                var UserLogin = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));

                var objTraineeRegister = new List<object>();
                objTraineeRegister.AddRange(new object[12]);
                objTraineeRegister[10] = 1;
                objTraineeRegister[11] = int.MaxValue - 1;
                var lstTraineeRegister = GetData<Tra_TraineeRegisterEntity>(objTraineeRegister, ConstantSql.hrm_tra_sp_get_TraineeRegister, UserLogin, ref status).ToList();

                var repo_UserApproved = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
                var lstUserApproved = repo_UserApproved.GetAll().Where(s => s.IsDelete != null).ToList();

                if (selectedIds.Count > 0)
                {
                    lstTraineeRegister = lstTraineeRegister.Where(s => selectedIds.Contains(s.ID)).ToList();
                }

                foreach (var item in lstTraineeRegister)
                {
                    #region Check Loại Người Duyệt
                    if (item.UserApproveID1 != null && item.UserApproveID1.Value == UserId)
                    {
                    
                                item.Status = EnumDropDown.TraineeRegisterStatus.E_REJECTED.ToString();
                                item.Reason1 = Reason;
                                message = Edit(item);
                            
                          
                        
                    }
                    #endregion

                    #region Người duyệt cuối
                    if (item.UserApproveID2 != null && item.UserApproveID2.Value == UserId)
                    {
                      
                                item.Status = EnumDropDown.TraineeRegisterStatus.E_REJECTED.ToString();
                                item.Reason2 = Reason;
                                message = Edit(item);
                            
                            
                        
                    }
                    #endregion
                }
                return message;
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:54,代码来源:Tra_TraineeRegisterServices.cs

示例13: ApprovedTraineeRegister

        public  string ApprovedTraineeRegister (List<Guid> selectedIds , Guid UserId)
        {
            using (var context = new VnrHrmDataContext())
            {
                var message = string.Empty;
                var status = string.Empty;
                var UserLogin = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var firstApproved = EnumDropDown.TraineeRegisterStatus.E_SUBMIT.ToString();
                var approved = EnumDropDown.TraineeRegisterStatus.E_APPROVED.ToString();
                var objTraineeRegister = new List<object>();
                objTraineeRegister.AddRange(new object[12]);
                objTraineeRegister[10] = 1;
                objTraineeRegister[11] = int.MaxValue - 1;
                var lstTraineeRegister = GetData<Tra_TraineeRegisterEntity>(objTraineeRegister, ConstantSql.hrm_tra_sp_get_TraineeRegister,UserLogin, ref status).ToList();

               var repo_UserApproved = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
               var lstUserApproved = repo_UserApproved.GetAll().Where(s => s.IsDelete == null).ToList();

                if (selectedIds.Count > 0)
                {
                    lstTraineeRegister = lstTraineeRegister.Where(s => selectedIds.Contains(s.ID)).ToList();
                }

                var traineeServices = new Tra_TraineeServices();
                var isTraineeInRequireDetail = traineeServices.IsAddTraineeDependOnRequirementDetail();
                var traineeTopicServices = new Tra_TraineeTopicServices();
                var planServices = new Tra_PlanServices();
                var lstObjPlan = new List<object>();
                lstObjPlan.Add(null);
                lstObjPlan.Add(null);
                lstObjPlan.Add(null);
                lstObjPlan.Add(null);
                lstObjPlan.Add(1);
                lstObjPlan.Add(int.MaxValue - 1);
                var lstPlan = planServices.GetData<Tra_PlanEntity>(lstObjPlan, ConstantSql.hrm_tra_sp_get_Plan,UserLogin, ref status).ToList();


                var planDetailServices = new Tra_PlanDetailServices();
                var lstObjPlanDetail = new List<object>();
                lstObjPlanDetail.Add(null);
                lstObjPlanDetail.Add(1);
                lstObjPlanDetail.Add(int.MaxValue - 1);
                var lstPlanDetail = planDetailServices.GetData<Tra_PlanDetailEntity>(lstObjPlanDetail, ConstantSql.hrm_tra_sp_get_PlanDetail, UserLogin, ref status).ToList();

                var classServices = new Tra_ClassServices();
                var lstObjClass = new List<object>();
                lstObjClass.Add(null);
                lstObjClass.Add(null);
                lstObjClass.Add(null);
                lstObjClass.Add(null);
                lstObjClass.Add(null);
                lstObjClass.Add(null);
                lstObjClass.Add(null);
                lstObjClass.Add(null);
                lstObjClass.Add(1);
                lstObjClass.Add(int.MaxValue - 1);
                var lstClass = classServices.GetData<Tra_ClassEntity>(lstObjClass, ConstantSql.hrm_tra_sp_get_Class, UserLogin, ref status).ToList();

                //var lstObjTraineeInClass = new List<object>();
                //lstObjTraineeInClass.Add(model.ClassID);
                //var lstTraineeInClass = classServices.GetData<Tra_ClassEntity>(lstObjTraineeInClass, ConstantSql.hrm_cat_sp_get_TraineeByClassID, ref status).ToList();

                var courseTopicServices = new Tra_TraineeTopicServices();
                var objCourseTopic = new List<object>();
                objCourseTopic.Add(1);
                objCourseTopic.Add(int.MaxValue - 1);
                var lstCourseTopic = courseTopicServices.GetData<Tra_CourseTopicEntity>(objCourseTopic, ConstantSql.hrm_tra_sp_get_CourseTopic, UserLogin, ref status);


                //var classEntity = lstClass.Where(s => s.ID == model.ClassID).FirstOrDefault();
                var profileServices = new Hre_ProfileServices();

                var requirementServices = new Tra_RequirementTrainServices();
                var objRequirement = new List<object>();
                objRequirement.AddRange(new object[7]);
                objRequirement[5] = 1;
                objRequirement[6] = int.MaxValue - 1;
                var lstRequirement = requirementServices.GetData<Tra_RequirementTrainEntity>(objRequirement, ConstantSql.hrm_tra_sp_get_RequirementTrain, UserLogin, ref status).ToList();

                var requirementDetailServices = new Tra_RequirementTrainDetailServices();
                var objRequirementDetail = new List<object>();
                objRequirementDetail.Add(null);
                objRequirementDetail.Add(1);
                objRequirementDetail.Add(int.MaxValue - 1);
                var lstRequirementDetail = requirementDetailServices.GetData<Tra_RequirementTrainDetailEntity>(objRequirementDetail, ConstantSql.hrm_tra_sp_get_RequirementDetail, UserLogin, ref status).ToList();

                var objTrainee = new List<object>();
                objTrainee.AddRange(new object[15]);
                objTrainee[13] = 1;
                objTrainee[14] = int.MaxValue - 1;
                var lstObjTrainee = traineeServices.GetData<Tra_TraineeEntity>(objTrainee, ConstantSql.hrm_tra_sp_get_Trainee, UserLogin, ref status).ToList();

                foreach (var registerEntity in lstTraineeRegister)
                {
                    var classEntity = lstClass.Where(s => s.ID == registerEntity.ClassID).FirstOrDefault();
                    var traineeEntityInClass = lstObjTrainee.Where(s => s.ClassID == registerEntity.ClassID && registerEntity.ProfileID == s.ProfileID).ToList();

                    #region người duyệt đầu
                    if (registerEntity.UserApproveID1 != null && registerEntity.UserApproveID1.Value == UserId)
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:Tra_TraineeRegisterServices.cs

示例14: SaveLeaveDataItem


//.........这里部分代码省略.........
                }
                #endregion

                //Cap nhat leavedayID cho workday o day
                if (lstLeaveDayInsert.Count > 0)
                {
                    if (lstLeaveDayInsert.Count > 1)
                    {
                        WorkDayInDB.LeaveDayID1 = lstLeaveDayInsert[0].ID;
                        WorkDayInDB.LeaveDayID2 = lstLeaveDayInsert[1].ID;
                        WorkDayInDB.udLeavedayCode1 = leaveTypeCode;
                        WorkDayInDB.udLeavedayCode2 = leaveTypeCode;
                        WorkDayInDB.udLeavedayStatus1 = lstLeaveDayInsert.FirstOrDefault().Status;
                        WorkDayInDB.udLeavedayStatus2 = lstLeaveDayInsert.FirstOrDefault().Status;
                    }
                    else
                    {
                        WorkDayInDB.LeaveDayID1 = lstLeaveDayInsert[0].ID;
                        WorkDayInDB.udLeavedayCode1 = leaveTypeCode;
                        WorkDayInDB.udLeavedayStatus1 = lstLeaveDayInsert.FirstOrDefault().Status;
                    }
                }
                else if (lstLeaveDayInDbUpdate.Count > 0)
                {
                    if (lstLeaveDayInDbUpdate.Count >= 2)
                    {
                        WorkDayInDB.udLeavedayCode1 = leaveTypeCode;
                        WorkDayInDB.udLeavedayCode2 = leaveTypeCode;
                        WorkDayInDB.udLeavedayStatus1 = lstLeaveDayInDbUpdate.FirstOrDefault().Status;
                        WorkDayInDB.udLeavedayStatus2 = lstLeaveDayInDbUpdate.FirstOrDefault().Status;
                    }
                    else
                    {
                        WorkDayInDB.udLeavedayCode1 = leaveTypeCode;
                        WorkDayInDB.udLeavedayStatus1 = lstLeaveDayInDbUpdate.FirstOrDefault().Status;
                        WorkDayInDB.udLeavedayStatus2 = lstLeaveDayInDbUpdate.FirstOrDefault().Status;
                    }
                }

                #region triet.mai cap nhat leaveDays va leaveHours
                List<Cat_LeaveDayType> lstLeaveDayType = repoCat_LeaveDayType.GetAll().ToList<Cat_LeaveDayType>();
                List<Guid> lstProfileID1 = lstLeaveDayInsert.Select(m => m.ProfileID).Distinct().ToList<Guid>();
                List<Hre_Profile> lstProfile = repoHre_Profile.FindBy(m => lstProfileID1.Contains(m.ID)).ToList<Hre_Profile>();
                DateTime dateMin1 = lstLeaveDayInsert.Min(m => m.DateStart).Date;
                DateTime dateMax1 = lstLeaveDayInsert.Max(m => m.DateEnd);
                List<Att_Roster> lstRosterTypeGroup = new List<Att_Roster>();
                List<Att_RosterGroup> lstRosterGroup = new List<Att_RosterGroup>();
                var lstGrade = repoAtt_Grade.FindBy(m => lstProfileID1.Contains((Guid)m.ProfileID))
                    .Select(m => new { m.ID, m.ProfileID, m.MonthStart, m.GradeAttendanceID })
                    .OrderByDescending(m => m.MonthStart)
                    .ToList();
                List<Cat_GradeAttendance> lstGradeCfg = repoCat_GradeAttendance.GetAll().ToList<Cat_GradeAttendance>();
                List<Hre_WorkHistory> listWorkHistory = repoHre_WorkHistory.FindBy(m => m.DateEffective <= dateMax1 && lstProfileID1.Contains(m.ProfileID)).OrderByDescending(m => m.DateEffective).ToList<Hre_WorkHistory>();
                GetRosterGroup(lstProfileID1, dateMin1, dateMax1, out lstRosterTypeGroup, out lstRosterGroup);
                List<Cat_DayOff> lstHoliday = repoCat_DayOff.GetAll().ToList();
                string E_APPROVED1 = RosterStatus.E_APPROVED.ToString();
                string E_ROSTERGROUP = RosterType.E_ROSTERGROUP.ToString();
                List<Att_Roster> lstRoster = repoAtt_Roster.FindBy(m => m.Status == E_APPROVED1 && m.DateStart <= dateMax1 && m.DateEnd >= dateMin1 && lstProfileID1.Contains(m.ProfileID)).ToList<Att_Roster>();
                List<DateTime> lstHolidayType = lstHoliday.Select(m => m.DateOff).ToList<DateTime>();
                //LeaveDayDAO ldDao = new LeaveDayDAO();
                foreach (var item in lstLeaveDayInsert)
                {
                    if (item.DurationType != null && item.DurationType != LeaveDayDurationType.E_FULLSHIFT.ToString())
                        continue;
                    Cat_LeaveDayType leaveDayType = lstLeaveDayType.Where(m => m.ID == item.LeaveDayTypeID).FirstOrDefault();
                    if (leaveDayType == null)
                        continue;
                    Hre_Profile profileInLeave = lstProfile.Where(m => m.ID == item.ProfileID).FirstOrDefault();
                    if (profileInLeave == null)
                        continue;

                    DateTime dateFrom = item.DateStart;
                    DateTime dateTo = item.DateEnd;
                    dateTo = dateTo.AddDays(1).AddMinutes(-1);

                    Guid GradeCfgID = lstGrade.Where(m => m.ProfileID.Value == profileInLeave.ID && m.MonthStart <= dateTo).Select(m => m.GradeAttendanceID.Value).FirstOrDefault();
                    Cat_GradeAttendance gradeCfg = lstGradeCfg.Where(m => m.ID == GradeCfgID).FirstOrDefault();
                    List<Att_Roster> lstRosterByProfile = lstRoster.Where(m => m.ProfileID == profileInLeave.ID).ToList();
                    List<Hre_WorkHistory> listWorkHistoryByProfile = listWorkHistory.Where(m => m.ProfileID == profileInLeave.ID && m.DateEffective < dateTo).ToList();
                    List<Att_Roster> lstRosterByProfileTypeGroup = lstRosterByProfile.Where(m => m.Type == E_ROSTERGROUP).ToList();
                    AnalyseTotalLeaveDaysAndHours(item, leaveDayType, profileInLeave, gradeCfg, lstRosterByProfile, lstRosterGroup, listWorkHistoryByProfile, lstHoliday, shifts);
                }
                #endregion

                //var listWorkDay=repoAtt_Workday.GetAll().ToList();
                //Att_Workday workdayOld = listWorkDay.Where(m => m.ProfileID == WorkDayInDB.ProfileID && m.WorkDate == WorkDayInDB.WorkDate).FirstOrDefault();
                //if (workdayOld != null)
                //{
                //    int index = listWorkDay.IndexOf(workdayOld);
                //    listWorkDay.Remove(workdayOld);
                //    listWorkDay.Insert(index, WorkDayInDB.CopyData<Att_Workday>());
                //}
                repoAtt_LeaveDay.Add(lstLeaveDayInsert);
                unitOfWork.SaveChanges();
                //EntityService.AddEntity<Att_LeaveDay>(GuidContext, lstLeaveDayInsert.ToArray());
                //message = "Susscess";
                return message;
                //return WorkDayInDB;
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:Att_LeavedayServices.cs

示例15: UpdateTotalDuration

        /// <summary>
        /// Hàm cập nhật lại TotalDuration cho nhân viên
        /// </summary>
        /// <param name="lstLeaveIDs"></param>
        public string UpdateTotalDuration(List<Guid> lstLeaveIDs)
        {
            string message = "";

            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoAtt_Leaveday = new CustomBaseRepository<Att_LeaveDay>(unitOfWork);
                var repoCat_LeaveDayType = new CustomBaseRepository<Cat_LeaveDayType>(unitOfWork);
                var repoHre_Profile = new CustomBaseRepository<Hre_Profile>(unitOfWork);
                var repoAtt_Grade = new CustomBaseRepository<Att_Grade>(unitOfWork);
                var repoCat_GradeAttendance = new CustomBaseRepository<Cat_GradeAttendance>(unitOfWork);
                var repoHre_WorkHistory = new CustomBaseRepository<Hre_WorkHistory>(unitOfWork);
                var repoCat_DayOff = new CustomBaseRepository<Cat_DayOff>(unitOfWork);
                var repoAtt_Roster = new CustomBaseRepository<Att_Roster>(unitOfWork);
                var repoCat_Shift = new Cat_ShiftRepository(unitOfWork);
                var shifts = repoCat_Shift.FindBy(s => s.IsDelete == null).ToList();

                List<Att_LeaveDay> lstLeaveDay = repoAtt_Leaveday.FindBy(m => lstLeaveIDs.Contains(m.ID)).ToList<Att_LeaveDay>();
                if (lstLeaveDay == null || lstLeaveDay.Count == 0)
                {
                    message = ConstantMessages.LeavedayIsNotExist.TranslateString();
                    return message;
                }
                foreach (var item in lstLeaveDay)
                {
                    if (item.Status == AttendanceDataStatus.E_FIRST_APPROVED.ToString() || item.Status == AttendanceDataStatus.E_APPROVED.ToString())
                    {
                        message = ConstantMessages.StatusApproveCannotEdit.TranslateString();
                        return message;
                    }
                    if (item.Status == AttendanceDataStatus.E_REJECTED.ToString())
                    {
                        message = ConstantMessages.StatusRejectcannotEdit.TranslateString();
                        return message;
                    }
                }
                List<Cat_LeaveDayType> lstLeaveDayType = repoCat_LeaveDayType.GetAll().ToList<Cat_LeaveDayType>();
                List<Guid> lstProfileIDs = lstLeaveDay.Select(m => m.ProfileID).Distinct().ToList<Guid>();
                List<Hre_Profile> lstProfile = repoHre_Profile.FindBy(m => lstProfileIDs.Contains(m.ID)).ToList<Hre_Profile>();
                DateTime dateMin = lstLeaveDay.Min(m => m.DateStart).Date;
                DateTime dateMax = lstLeaveDay.Max(m => m.DateEnd);
                List<Att_Roster> lstRosterTypeGroup = new List<Att_Roster>();
                List<Att_RosterGroup> lstRosterGroup = new List<Att_RosterGroup>();
                var lstGrade = repoAtt_Grade.FindBy(m => lstProfileIDs.Contains((Guid)m.ProfileID))
                    .Select(m => new { m.ID, m.ProfileID, m.MonthStart, m.GradeAttendanceID })
                    .OrderByDescending(m => m.MonthStart)
                    .ToList();


                List<Cat_GradeAttendance> lstGradeCfg = repoCat_GradeAttendance.GetAll().ToList<Cat_GradeAttendance>();
                List<Hre_WorkHistory> listWorkHistory = repoHre_WorkHistory.FindBy(m => m.DateEffective <= dateMax && lstProfileIDs.Contains(m.ProfileID)).OrderByDescending(m => m.DateEffective).ToList<Hre_WorkHistory>();
                GetRosterGroup(lstProfileIDs, dateMin, dateMax, out lstRosterTypeGroup, out lstRosterGroup);
                List<Cat_DayOff> lstHoliday = repoCat_DayOff.GetAll().ToList<Cat_DayOff>();
                string E_APPROVED = RosterStatus.E_APPROVED.ToString();
                string E_ROSTERGROUP = RosterType.E_ROSTERGROUP.ToString();
                List<Att_Roster> lstRoster = repoAtt_Roster.FindBy(m => m.Status == E_APPROVED && m.DateStart <= dateMax && m.DateEnd >= dateMin && lstProfileIDs.Contains(m.ProfileID)).ToList<Att_Roster>();
                List<DateTime> lstHolidayType = lstHoliday.Select(m => m.DateOff).ToList<DateTime>();
                foreach (var item in lstLeaveDay)
                {
                    if (item.DurationType == null)
                        continue;
                    Cat_LeaveDayType leaveDayType = lstLeaveDayType.Where(m => m.ID == item.LeaveDayTypeID).FirstOrDefault();
                    if (leaveDayType == null)
                        continue;
                    Hre_Profile profile = lstProfile.Where(m => m.ID == item.ProfileID).FirstOrDefault();
                    if (profile == null)
                        continue;

                    DateTime dateFrom = item.DateStart;
                    DateTime dateTo = item.DateEnd;
                    //dateTo = dateTo.AddDays(1).AddMinutes(-1);



                    Guid? GradeCfgID = lstGrade.Where(m => m.ProfileID == profile.ID && m.MonthStart <= dateTo).Select(m => m.GradeAttendanceID).FirstOrDefault();
                    Cat_GradeAttendance gradeCfg = lstGradeCfg.Where(m => m.ID == GradeCfgID).FirstOrDefault();
                    List<Att_Roster> lstRosterByProfile = lstRoster.Where(m => m.ProfileID == profile.ID).ToList();
                    List<Hre_WorkHistory> listWorkHistoryByProfile = listWorkHistory.Where(m => m.ProfileID == profile.ID && m.DateEffective < dateTo).ToList();
                    List<Att_Roster> lstRosterByProfileTypeGroup = lstRosterByProfile.Where(m => m.Type == E_ROSTERGROUP).ToList();

                    AnalyseTotalLeaveDaysAndHours(item, leaveDayType, profile, gradeCfg, lstRosterByProfile, lstRosterGroup, listWorkHistoryByProfile, lstHoliday, shifts);
                    string LeaveDayTypeCode = leaveDayType.Code;

                    if (item.DurationType == null)
                    {
                        item.DurationType = LeaveDayDurationType.E_FULLSHIFT.ToString();
                    }
                    double Totalduration = 0;
                    bool isSetFullLeaveDay = false;
                    for (DateTime idx = dateFrom.Date; idx <= dateTo.Date; idx = idx.AddDays(1))
                    {
                        if (!string.IsNullOrEmpty(LeaveDayTypeCode) && (LeaveDayTypeCode == "SICK"
                                        || LeaveDayTypeCode == "PRG"
                                        || LeaveDayTypeCode == "SU"
                                        || LeaveDayTypeCode == "SD"
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:Att_LeavedayServices.cs


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