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


C# UnitOfWork.CurrentDate方法代码示例

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


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

示例1: SyncTAMLog

        public void SyncTAMLog(Guid userID, Guid taskID, bool isExcept,
            DateTime dateFrom, DateTime dateTo, List<Guid> listProfileID)
        {
            using (var context = new VnrHrmDataContext())
            {
                IUnitOfWork unitOfWork = new UnitOfWork(context);
                Sys_AsynTask asynTask = null;
                int pageSize = 200;

                if (taskID != Guid.Empty)
                {
                    asynTask = unitOfWork.CreateQueryable<Sys_AsynTask>(Guid.Empty,
                        d => d.ID == taskID).FirstOrDefault();
                }

                if (listProfileID != null && listProfileID.Count() > 0)
                {
                    double totalComputed = 0;

                    foreach (var listSplitProfileID in listProfileID.Chunk(pageSize))
                    {
                        string serverTamLogConfig1 = string.Empty;
                        string serverTamLogConfig2 = string.Empty;
                        totalComputed += listSplitProfileID.Count();

                        if (IsConnected(AppConfig.HRM_SYS_CAN_TAMSCANLOG_1_, true, ref serverTamLogConfig1))
                        {
                            SyncTAMLog(userID, isExcept, dateFrom, dateTo, serverTamLogConfig1, listSplitProfileID.ToList());
                        }

                        if (IsConnected(AppConfig.HRM_SYS_CAN_TAMSCANLOG_2_, true, ref serverTamLogConfig2))
                        {
                            //Nếu có sử dụng 2 database chấm công thì đẩy dữ liệu vào cả 2
                            SyncTAMLog(userID, isExcept, dateFrom, dateTo, serverTamLogConfig2, listSplitProfileID.ToList());
                        }

                        if (asynTask != null)
                        {
                            asynTask.PercentComplete = totalComputed / (double)listProfileID.Count;
                            unitOfWork.SaveChanges(userID);
                        }
                    }
                }

                if (asynTask != null)
                {
                    asynTask.Status = AsynTaskStatus.Done.ToString();
                    asynTask.PercentComplete = 1D;//Không cần nhân với 100
                    asynTask.TimeEnd = unitOfWork.CurrentDate();
                    unitOfWork.SaveChanges(userID);
                }
            }
        }
开发者ID:dtafe,项目名称:vnr,代码行数:53,代码来源:Can_TamServices.cs

示例2: CheckData

        private void CheckData(List<ImportRosterModel> listRoster, bool check12Hours, bool isAllowEditFutureRoster,
            bool isAllowEditPastRoster, List<string> listProfileCode, List<Cat_Shift> listShiftInfo)
        {
            #region Kiểm tra dữ liệu lỗi

            using (var context = new VnrHrmDataContext())
            {
                IUnitOfWork unitOfWork = new UnitOfWork(context);
                var listRosterCorrect = ImportObjects[LoginUserID];
                var listRosterError = InvalidObjects[LoginUserID];

                var listProfileInfo = unitOfWork.CreateQueryable<Hre_Profile>(LoginUserID,
                    d => listProfileCode.Contains(d.CodeEmp.ToUpper())).Select(d => new { d.ID, d.CodeEmp }).ToList();

                var listProfileID = listProfileInfo.Select(d => d.ID).Distinct().ToList();
                var dateStart = listRoster.Select(d => d.DateStart).OrderBy(d => d).FirstOrDefault();
                var dateEnd = listRoster.Select(d => d.DateEnd).OrderBy(d => d).LastOrDefault();
                var monthStart = dateStart.Date.AddDays(1 - dateStart.Day);
                var monthEnd = monthStart.AddMonths(1).AddSeconds(-1);
                var checkDate = dateStart.AddDays(-1);

                string cancelStatus = RosterStatus.E_CANCEL.ToString();
                string rejectStatus = RosterStatus.E_REJECTED.ToString();
                var currentDate = unitOfWork.CurrentDate();

                var listOldRoster = unitOfWork.CreateQueryable<Att_Roster>(Guid.Empty, d => d.Status != cancelStatus
                    && d.Status != rejectStatus && listProfileID.Contains(d.ProfileID) && d.DateStart <= dateEnd
                    && d.DateEnd >= checkDate).Select(d => new
                    {
                        d.ProfileID,
                        d.DateStart,
                        d.DateEnd,
                        d.MonShiftID,
                        d.TueShiftID,
                        d.WedShiftID,
                        d.ThuShiftID,
                        d.FriShiftID,
                        d.SatShiftID,
                        d.SunShiftID,
                        d.Status,
                        d.Type
                    }).ToList();

                foreach (var roster in listRoster)
                {
                    var profileInfo = listProfileInfo.Where(d => d.CodeEmp != null
                        && d.CodeEmp.ToUpper() == roster.CodeEmp).FirstOrDefault();

                    if (profileInfo != null)
                    {
                        roster.ProfileID = profileInfo.ID;
                        string shiftNotFound = string.Empty;
                        var listShiftNotFound = new List<string>();

                        if (!string.IsNullOrWhiteSpace(roster.MonShift))
                        {
                            var shiftInfo = listShiftInfo.Where(d =>
                                d.Code == roster.MonShift).FirstOrDefault();

                            if (shiftInfo != null)
                            {
                                roster.MonShiftID = shiftInfo.ID;
                            }
                            else
                            {
                                if (!listShiftNotFound.Contains(roster.MonShift))
                                {
                                    listShiftNotFound.Add(roster.MonShift);
                                    shiftNotFound += (string.IsNullOrWhiteSpace(shiftNotFound)
                                        ? string.Empty : ",") + roster.MonShift;
                                }
                            }
                        }

                        if (!string.IsNullOrWhiteSpace(roster.TueShift))
                        {
                            var shiftInfo = listShiftInfo.Where(d =>
                                d.Code == roster.TueShift).FirstOrDefault();

                            if (shiftInfo != null)
                            {
                                roster.TueShiftID = shiftInfo.ID;
                            }
                            else
                            {
                                if (!listShiftNotFound.Contains(roster.TueShift))
                                {
                                    listShiftNotFound.Add(roster.TueShift);
                                    shiftNotFound += (string.IsNullOrWhiteSpace(shiftNotFound)
                                        ? string.Empty : ",") + roster.TueShift;
                                }
                            }
                        }

                        if (!string.IsNullOrWhiteSpace(roster.WedShift))
                        {
                            var shiftInfo = listShiftInfo.Where(d =>
                                d.Code == roster.WedShift).FirstOrDefault();

                            if (shiftInfo != null)
//.........这里部分代码省略.........
开发者ID:dtafe,项目名称:vnr,代码行数:101,代码来源:ImportRosterService.cs


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