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


C# Entity.VnrHrmDataContext类代码示例

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


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

示例1: DeleteConditionInGroupCondition

        public string DeleteConditionInGroupCondition(Guid GroupConditionID, string ConditionIDs)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Rec_GroupConditionRepository(unitOfWork);
                var ilConditionIDs = ConditionIDs.Split(',');
                List<Guid> lsConditionIDs = new List<Guid>();
                lsConditionIDs = ConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();

                Rec_GroupCondition GroupCondition = repo.GetById(GroupConditionID);
                if (GroupCondition == null)
                    return null;
                List<Guid> lstCondition = new List<Guid>();
                lstCondition = GroupCondition.JobConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
                if (lstCondition != null && lstCondition.Count != 0)
                {
                    lstCondition = lstCondition.Where(x => !lsConditionIDs.Contains(x)).ToList();
                    GroupCondition.JobConditionIDs = string.Join(",", lstCondition);
                    repo.SaveChanges();
                    return GroupCondition.JobConditionIDs;
                }
            }
            return null;
        }
开发者ID:dtafe,项目名称:vnr,代码行数:25,代码来源:Rec_GroupConditionServices.cs

示例2: Approved

        /// <summary>
        /// Lay DS luong hieu luc cua toan cong ty. Moi nhan vien chi co 1 muc luong trong danh sach.
        /// </summary>
        /// <param name="lstSalaryAll">get all Salary</param>
        /// <param name="monthEffect"></param>
        /// <returns></returns>


        public void Approved(List<Guid> selectedIds, string status, string userLoginName)
        {
            using (var context = new VnrHrmDataContext())
            {
                string statusMessage = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoProfile = new Hre_ProfileRepository(unitOfWork);
                var repoHoldSalary = new Sal_HoldSalaryRepository(unitOfWork);
                var lstHoldSalary = repoHoldSalary.FindBy(s => selectedIds.Contains(s.ID)).ToList();
                var lstProfileIDs = lstHoldSalary.Select(s => s.ProfileID).ToList();
                var profileServices = new Hre_ProfileServices();
                var objProfile = new List<object>();
                objProfile.AddRange(new object[17]);
                objProfile[15] = 1;
                objProfile[16] = int.MaxValue - 1;
                var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileAll,userLoginName, ref statusMessage).ToList().Translate<Hre_Profile>();
                //var lstProfiles = repoProfile.FindBy(m => m.ID != null && lstProfileIDs.Contains(m.ID)).ToList();

                foreach (var holdSalary in lstHoldSalary)
                {
                    holdSalary.Status = status;
                    var profileByID = lstProfile.Where(s => s.ID == holdSalary.ProfileID.Value).FirstOrDefault();
                    profileByID.MonthHoldSal = holdSalary.MonthSalary;
                    profileByID.IsHoldSal = true;
                }
                repoHoldSalary.SaveChanges();
                repoProfile.SaveChanges();


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

示例3: DeletePayrollTable

        private bool DeletePayrollTable(List<Guid> listProfileID, Guid cutOffDurationID)
        {
            #region Delete PayrollTable

            try
            {
                using (var context = new VnrHrmDataContext())
                {
                    var unitOfWork = new UnitOfWork(context);
                    int pageSize = 2000;//tối đa là 2100 parameter
                    int result = 0;

                    foreach (var listProfileIDBySize in listProfileID.Chunk(pageSize))
                    {
                        result += unitOfWork.SetIsDelete(context.Sal_PayCommission.Where(m => m.CutoffDurationID != null && m.ProfileID != null && !m.IsDelete.HasValue && (Guid)m.CutoffDurationID == cutOffDurationID && listProfileIDBySize.Contains((Guid)m.ProfileID)));
                    }

                    return true;
                }
            }
            catch (Exception)
            {
                return false;
            }

            #endregion
        }
开发者ID:dtafe,项目名称:vnr,代码行数:27,代码来源:Sal_ComputeCommissionServices.cs

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

示例5: AddMasterDataGroupItems

        public Cat_MasterDataGroupItemEntity AddMasterDataGroupItems(Cat_MasterDataGroupItemEntity model)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoMasterDataGroupItem = new Cat_MasterDataGroupItemRepository(unitOfWork);
                var lstCat_MasterDataGroupItem = new List<Cat_MasterDataGroupItem>();

                #region Lấy ds MasterDataGroupItem theo MasterDataGroupID
                var masterDataGroupItem_objectIdExists = unitOfWork.CreateQueryable<Cat_MasterDataGroupItem>(Guid.Empty, m => m.MasterDataGroupID == model.MasterDataGroupID).Select(p => p.ObjectID).ToList();
                #endregion

                if (model.ObjectIDs.Any())
                {
                    //không lưu những item co objectId đã tồn tại trong masterDataGroupItem theo masterDataGroupID
                    model.ObjectIDs = model.ObjectIDs.Except(masterDataGroupItem_objectIdExists).ToList();

                    foreach (var objectId in model.ObjectIDs)
                    {
                        var masterDataGroupItem= new  Cat_MasterDataGroupItem();
                        masterDataGroupItem.ID = Guid.NewGuid();
                        masterDataGroupItem.ObjectID = objectId;
                        masterDataGroupItem.ObjectName = model.ObjectName;
                        masterDataGroupItem.MasterDataGroupID = model.MasterDataGroupID;
                        lstCat_MasterDataGroupItem.Add(masterDataGroupItem);//add vao repo
                    }
                    if (lstCat_MasterDataGroupItem.Any())
                    {
                        repoMasterDataGroupItem.Add(lstCat_MasterDataGroupItem);
                        repoMasterDataGroupItem.SaveChanges();    
                    }                    
                }
            }
            return model;
        }
开发者ID:dtafe,项目名称:vnr,代码行数:35,代码来源:Cat_MasterDataGroupServices.cs

示例6: GetReportCodeNotInSystem

        public List<Hre_ReportCodeNotInSystemEntity> GetReportCodeNotInSystem(DateTime? DateFrom, DateTime? DateTo)
        {
            List<Hre_ReportCodeNotInSystemEntity> lstReportCodeNotInSystem = new List<Hre_ReportCodeNotInSystemEntity>();
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Hre_ProfileRepository(unitOfWork);
                var codeAttendance = repo.FindBy(s => s.IsDelete == null).Select(m => m.CodeAttendance).Distinct().ToList();
                var repoTAMScanLog = new Att_TAMScanLogRepository(unitOfWork);
                var lstCardHistory = repoTAMScanLog.FindBy(m => m.TimeLog >= DateFrom && m.TimeLog <= DateTo && !codeAttendance.Contains(m.CardCode))
                .Select(m => new { m.CardCode, m.TimeLog, m.MachineNo, m.Type, m.SrcType, m.DateCreate, m.UserCreate }).ToList();

                foreach (var CardHistory in lstCardHistory)
                {
                    Hre_ReportCodeNotInSystemEntity codeNotInSystemEntity = new Hre_ReportCodeNotInSystemEntity();
                    codeNotInSystemEntity.Code = CardHistory.CardCode;
                    codeNotInSystemEntity.Type = CardHistory.Type;
                    codeNotInSystemEntity.Time = CardHistory.TimeLog;
                    codeNotInSystemEntity.Machine = CardHistory.MachineNo;
                    codeNotInSystemEntity.UserCreate = CardHistory.UserCreate;
                    codeNotInSystemEntity.DateCreate = CardHistory.DateCreate;
                    lstReportCodeNotInSystem.Add(codeNotInSystemEntity);
                }
                return lstReportCodeNotInSystem;
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:26,代码来源:Hre_ReportServices.cs

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

示例8: UpdateRecruitmentCampaignActive

        public bool UpdateRecruitmentCampaignActive(string selectedIds, bool Value)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Rec_RecruitmentCampaignRepository(unitOfWork);
                var lstIds = selectedIds.Split(',');
                List<Guid> listID = new List<Guid>();
                for (int i = 0; i < lstIds.Length; i++)
                {
                    try
                    {
                        listID.Add(Guid.Parse(lstIds[i].ToString()));
                    }
                    catch
                    { }
                }
                var listRecruitmentCampaign = repo.FindBy(x => listID.Contains(x.ID)).ToList();
                foreach (var item in listRecruitmentCampaign)
                {
                    item.IsActivate = Value;
                }
                repo.SaveChanges();

            }
            return true;
        }
开发者ID:dtafe,项目名称:vnr,代码行数:27,代码来源:Rec_RecruitmentCampaignServices.cs

示例9: ActionCancel

 public string ActionCancel(string selectedIds, string userLogin)
 {
     using (var context = new VnrHrmDataContext())
     {
         string message = string.Empty;
         var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         var repo = new Hre_StopWorkingRepository(unitOfWork);
         var profileServices = new Hre_ProfileServices();
         string status = string.Empty;
         List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
         var lstStopWorkings = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
         foreach (var StopWorking in lstStopWorkings)
         {
             var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
             profile.StatusSyn = StopWorking.LastStatusSyn;
             StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_CANCEL.ToString();
             profile.StopWorkType = null;
             profile.TypeSuspense = null;
             profile.RequestDate = null;
             profile.DateQuit = null;
             profile.ResReasonID = null;
             profile.IsHoldSal = false;
             profile.ResignNo = null;
             profile.TypeOfStop = null;
             profileServices.Edit(profile);
         }
         repo.SaveChanges();
         message = NotificationType.Success.ToString();
         return message;
     }
 }
开发者ID:dtafe,项目名称:vnr,代码行数:31,代码来源:Hre_StopWorkingServices.cs

示例10: ActionBlackListCandidate

        public string ActionBlackListCandidate(string selectedIds, Guid? _ReasonBlackListID)
        {
            using (var context = new VnrHrmDataContext())
            {
                BaseService service = new BaseService();
                string message = string.Empty;
                string status = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoCandidate = new Rec_CandidateRepository(unitOfWork);
                var repoHistory = new Rec_RecruitmentHistoryRepository(unitOfWork);
                List<Guid> lstcandidateIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
                var lstCandidates = repoCandidate.FindBy(m => m.ID != null && lstcandidateIds.Contains(m.ID)).ToList();

                var lstRecruimentHistory = repoHistory.FindBy(m => m.CandidateID != null && lstcandidateIds.Contains(m.CandidateID)).ToList();

                foreach (var Candidate in lstCandidates)
                {
                    Candidate.IsBlackList = true;
                    Candidate.ReasonBlackListID = _ReasonBlackListID;
                    var hisbycandidate = lstRecruimentHistory.Where(s => s.CandidateID == Candidate.ID).OrderByDescending(s => s.DateApply).FirstOrDefault();
                    hisbycandidate.IsBlackList = true;
                }
                repoCandidate.SaveChanges();
                repoHistory.SaveChanges();
                message = NotificationType.Success.ToString();
                return message;
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:28,代码来源:Rec_CandidateServices.cs

示例11: ActionApprovedCandidate

        public string ActionApprovedCandidate(string selectedIds)
        {
            using (var context = new VnrHrmDataContext())
            {
                BaseService service = new BaseService();
                string message = string.Empty;
                string status = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoCandidate = new Rec_CandidateRepository(unitOfWork);
                var repoHistory = new Rec_RecruitmentHistoryRepository(unitOfWork);
                List<Guid> lstcandidateIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
                var lstCandidates = repoCandidate.FindBy(m => m.ID != null && lstcandidateIds.Contains(m.ID)).ToList();

                var lstRecruimentHistory = repoHistory.FindBy(m => m.CandidateID != null && lstcandidateIds.Contains(m.CandidateID)).ToList();

                foreach (var Candidate in lstCandidates)
                {
                    Candidate.Status = HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_APPROVE.ToString();
                    Candidate.DateUpdate = DateTime.Now;
                    var hisbycandidate = lstRecruimentHistory.Where(s => s.CandidateID == Candidate.ID).OrderByDescending(s => s.DateApply).FirstOrDefault();
                    hisbycandidate.Status = HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_APPROVE.ToString();
                    hisbycandidate.CandidateID = Candidate.ID;
                    hisbycandidate.DateUpdate = DateTime.Now;
                }
                repoCandidate.SaveChanges();
                repoHistory.SaveChanges();
                message = NotificationType.Success.ToString();
                return message;
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:30,代码来源:Rec_CandidateServices.cs

示例12: UpdateResource

        public bool UpdateResource(List<Sys_ResourceEntity> lstResource)
        {
            using (var context = new VnrHrmDataContext())
            {
                var isExistedUser = false;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Sys_ResourceRepository(unitOfWork);
                string status = string.Empty;
                var resources = GetAllUseEntity<Sys_Resource>(ref status);
                var resourceAdding = new List<Sys_Resource>();
                foreach (var sysResource in lstResource)
                {
                    var resourceExist = resources.Where(p => p.ResourceName == sysResource.ResourceName).FirstOrDefault();
                    if (resourceExist == null)
                    {
                        if (sysResource != null && sysResource.ResourceType == HRM.Infrastructure.Utilities.ResourceType.Other.ToString() && !string.IsNullOrEmpty(sysResource.ResourceName))
                        {
                            sysResource.Category = sysResource.ModuleName;
                        }

                        var resourceAddNew = sysResource.CopyData<Sys_Resource>();
                        resourceAddNew.ID = Guid.NewGuid();
                        var resourceExisted = resourceAdding.Where(p => sysResource != null && p.ResourceName == sysResource.ResourceName).FirstOrDefault();
                        if (resourceExisted == null)
                        {
                            resourceAdding.Add(resourceAddNew);
                        }
                    }
                }
                repo.Add(resourceAdding);
                repo.SaveChanges();
            }
            return false;
        }
开发者ID:dtafe,项目名称:vnr,代码行数:34,代码来源:Sys_ResourceServices.cs

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

示例14: CompleteComputingTask

        public void CompleteComputingTask(Guid asynTaskID, Guid userID,
            int totalComputed, int totalProfile, DataErrorCode dataErrorCode)
        {
            #region Lưu Sys_AsynTask khi xử lý xong

            if (asynTaskID != Guid.Empty)
            {
                using (var taskContext = new VnrHrmDataContext())
                {
                    IUnitOfWork taskunitOfWork = new UnitOfWork(taskContext);
                    var asynTask = taskunitOfWork.CreateQueryable<Sys_AsynTask>(s => s.ID == asynTaskID).FirstOrDefault();

                    if (asynTask != null)
                    {
                        asynTask.PercentComplete = 1D;
                        asynTask.TimeEnd = DateTime.Now;
                        asynTask.Status = AsynTaskStatus.Done.ToString();

                        var time = asynTask.TimeEnd.Value.Subtract(asynTask.TimeStart).TotalMinutes;
                        asynTask.Description += " - Result: " + totalComputed + "/" + totalProfile;
                        asynTask.Description += " - Time: " + time.ToString("N2");

                        if (dataErrorCode == DataErrorCode.Locked)
                        {
                            asynTask.PercentComplete = 1D;//Không cần nhân với 100
                            asynTask.Description = "Dữ Liệu Quẹt Thẻ Đã Bị Khóa";
                        }

                        dataErrorCode = taskunitOfWork.SaveChanges();
                    }
                }
            }

            #endregion
        }
开发者ID:dtafe,项目名称:vnr,代码行数:35,代码来源:Can_TamServices.cs

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


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