Beispiel #1
0
        /// <summary>
        /// 根据请假记录ID获取对应调休假
        /// </summary>
        /// <param name="strLeaveRecordID">请假记录ID</param>
        /// <returns></returns>
        public List <V_ADJUSTLEAVE> GetAdjustLeaveDetailListByLeaveRecordID(string strLeaveRecordID)
        {
            List <V_ADJUSTLEAVE> entViews = new List <V_ADJUSTLEAVE>();


            IQueryable <T_HR_ADJUSTLEAVE> entAds = from a in dal.GetObjects().Include("T_HR_EMPLOYEELEAVERECORD")
                                                   join l in dal.GetObjects <T_HR_LEAVETYPESET>() on a.LEAVETYPESETID equals l.LEAVETYPESETID
                                                   where a.T_HR_EMPLOYEELEAVERECORD.LEAVERECORDID == strLeaveRecordID
                                                   select a;

            if (entAds.Count() == 0)
            {
                return(entViews);
            }

            foreach (T_HR_ADJUSTLEAVE item in entAds)
            {
                var q = from ec in dal.GetObjects <T_HR_EMPLOYEELEVELDAYCOUNT>()
                        where ec.LEAVETYPESETID == item.LEAVETYPESETID && ec.EMPLOYEEID == item.EMPLOYEEID
                        select ec;

                if (q.Count() == 0)
                {
                    continue;
                }

                T_HR_EMPLOYEELEVELDAYCOUNT entDayCount = q.FirstOrDefault();

                V_ADJUSTLEAVE entView = new V_ADJUSTLEAVE();
                entView.T_HR_ADJUSTLEAVE = item;
                entView.VacationType     = entDayCount.VACATIONTYPE;
                entView.VacationDays     = entDayCount.DAYS;

                entViews.Add(entView);
            }

            return(entViews);
        }
        /// <summary>
        /// 新增(临时,已提交审核的记录将禁止使用此按钮)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnNew_Click(object sender, RoutedEventArgs e)
        {
            if (lkLeaveTypeName.DataContext == null)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("LEAVETYPESET"), string.Format(Utility.GetResourceStr("REQUIRED"), Utility.GetResourceStr("LEAVETYPESET")));
                return;
            }

            ObservableCollection<V_ADJUSTLEAVE> ents = new ObservableCollection<V_ADJUSTLEAVE>();

            if (dgLevelDayList.ItemsSource != null)
            {
                ents = dgLevelDayList.ItemsSource as ObservableCollection<V_ADJUSTLEAVE>;
            }

            V_ADJUSTLEAVE ent = new V_ADJUSTLEAVE();
            T_HR_ADJUSTLEAVE entAdjust = new T_HR_ADJUSTLEAVE();
            entAdjust.ADJUSTLEAVEID = Guid.NewGuid().ToString();
            entAdjust.CREATEDATE = DateTime.Now;
            entAdjust.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            entAdjust.T_HR_EMPLOYEELEAVERECORD = LeaveRecord;
            //添加人所属部门ID
            entAdjust.CREATEPOSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
            entAdjust.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
            entAdjust.CREATECOMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
            //出差记录只能本人申请请
            entAdjust.EMPLOYEEID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            entAdjust.EMPLOYEENAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
            entAdjust.EMPLOYEECODE = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeCode;

            ent.VacationType = string.Empty;
            ent.VacationDays = 0;
            ent.T_HR_ADJUSTLEAVE = entAdjust;

            ents.Add(ent);

            dgLevelDayList.ItemsSource = ents;
        }