Ejemplo n.º 1
0
 void btnEdit_Click(object sender, RoutedEventArgs e)
 {
     if (DtGrid.SelectedItems.Count > 0)
     {
         V_EMPLOYEECONTACT tempEnt = DtGrid.SelectedItems[0] as V_EMPLOYEECONTACT;
         //T_HR_EMPLOYEECONTRACT tempEnt = DtGrid.SelectedItems[0] as T_HR_EMPLOYEECONTRACT;
         //if (!SMT.SaaS.FrameworkUI.Common.Utility.ToolBarButtonOperationPermission(tempEnt, "T_HR_EMPLOYEECONTRACT", SMT.SaaS.FrameworkUI.OperationType.Edit, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID))
         //{
         //    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("NOEDITPERMISSION"),
         //  Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
         //    return;
         //}
         EmployeeContractForm form    = new EmployeeContractForm(FormTypes.Edit, tempEnt.EMPLOYEECONTACTIDk__BackingField);
         EntityBrowser        browser = new EntityBrowser(form);
         browser.FormType         = FormTypes.Edit;
         form.MinHeight           = 450;
         browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
         browser.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });
     }
     else
     {
         //ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTDATAALERT"), Utility.GetResourceStr("CONFIRMBUTTON"));
         ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"),
                                        Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
     }
 }
Ejemplo n.º 2
0
 void btnAudit_Click(object sender, RoutedEventArgs e)
 {
     if (DtGrid.SelectedItems.Count > 0)
     {
         //T_HR_EMPLOYEECONTRACT temp = DtGrid.SelectedItems[0] as T_HR_EMPLOYEECONTRACT;
         V_EMPLOYEECONTACT    temp    = DtGrid.SelectedItems[0] as V_EMPLOYEECONTACT;
         EmployeeContractForm form    = new EmployeeContractForm(FormTypes.Audit, temp.EMPLOYEECONTACTIDk__BackingField);
         EntityBrowser        browser = new EntityBrowser(form);
         browser.FormType         = FormTypes.Audit;
         form.MinHeight           = 450;
         browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
         browser.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });
     }
     else
     {
         //ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTDATAALERT"), Utility.GetResourceStr("CONFIRMBUTTON"));
         ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "AUDIT"),
                                        Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
     }
 }
Ejemplo n.º 3
0
        public IQueryable <V_EMPLOYEECONTACT> EmployeeContractViewPaging(int pageIndex, int pageSize, string sort, string filterString, IList <object> paras, ref int pageCount, string strCheckState, string userID, string startToDate, string endToDate, string employeeState)
        {
            List <object> queryParas = new List <object>();

            queryParas.AddRange(paras);
            List <object> objArgs = new List <object>();

            objArgs.Add(paras);
            if (strCheckState != Convert.ToInt32(CheckStates.WaittingApproval).ToString())
            {
                SetOrganizationFilter(ref filterString, ref queryParas, userID, "T_HR_EMPLOYEECONTRACT");


                if (!string.IsNullOrEmpty(strCheckState))
                {
                    if (!string.IsNullOrEmpty(filterString))
                    {
                        filterString += " AND";
                    }

                    filterString += " CHECKSTATE == @" + queryParas.Count();
                    queryParas.Add(strCheckState);
                }
            }
            else
            {
                SetFilterWithflow("EMPLOYEECONTACTID", "T_HR_EMPLOYEECONTRACT", userID, ref strCheckState, ref filterString, ref queryParas);
                if (queryParas.Count() == paras.Count)
                {
                    return(null);
                }
            }

            IQueryable <T_HR_EMPLOYEECONTRACT> ents = null;

            if (employeeState == "1")
            {
                //离职人员
                ents = dal.GetObjects().Include("T_HR_EMPLOYEE").Where(t => t.T_HR_EMPLOYEE.EMPLOYEESTATE == "2");
            }
            else
            {
                //在职人员
                ents = dal.GetObjects().Include("T_HR_EMPLOYEE").Where(t => t.T_HR_EMPLOYEE.EMPLOYEESTATE != "2");
            }

            List <V_EMPLOYEECONTACT> vcontact = new List <V_EMPLOYEECONTACT>();

            #region
            if (!string.IsNullOrEmpty(endToDate))
            {
                DateTime dtEndDate   = DateTime.Parse(endToDate);
                DateTime dtStartDate = DateTime.Parse(startToDate);
                if (!string.IsNullOrEmpty(filterString))
                {
                    ents = ents.Where(filterString, queryParas.ToArray()).Where(t => t.TODATE != null);
                }
                ents.ToList().ForEach(t => {
                    V_EMPLOYEECONTACT obj = new V_EMPLOYEECONTACT();
                    obj.EMPLOYEECONTACTID = t.EMPLOYEECONTACTID;
                    obj.EMPLOYEENAME      = t.T_HR_EMPLOYEE.EMPLOYEECNAME;
                    obj.EMPLOYEECODE      = t.T_HR_EMPLOYEE.EMPLOYEECODE;
                    if (!string.IsNullOrEmpty(t.TODATE))
                    {
                        obj.TODATE = DateTime.Parse(t.TODATE);
                    }

                    obj.FROMDATE    = t.FROMDATE;
                    obj.CHECKSTATE  = t.CHECKSTATE;
                    obj.CONTACTCODE = t.CONTACTCODE;
                    obj.ENDDATE     = t.ENDDATE;

                    if (obj.TODATE != null || obj.ENDDATE != null)
                    {
                        if (obj.TODATE < DateTime.Now || obj.ENDDATE < DateTime.Now)
                        {
                            obj.CONTACTSTATE = "失效";
                        }
                        else
                        {
                            obj.CONTACTSTATE = "有效";
                        }
                    }

                    vcontact.Add(obj);
                });

                List <V_EMPLOYEECONTACT>       afterEnts  = vcontact.Where(t => t.TODATE <= dtEndDate && t.TODATE >= dtStartDate).ToList();
                List <V_EMPLOYEECONTACT>       beforeEnts = vcontact.Where(t => t.TODATE > dtEndDate).ToList();
                IQueryable <V_EMPLOYEECONTACT> source     = afterEnts.Except(beforeEnts, new EmployeeContractCompare()).AsQueryable();
                source = Utility.Pager <V_EMPLOYEECONTACT>(source, pageIndex, pageSize, ref pageCount);
                return(source);
            }
            #endregion

            if (!string.IsNullOrEmpty(filterString))
            {
                ents = ents.Where(filterString, queryParas.ToArray());
            }
            ents = ents.OrderBy(sort);

            ents = Utility.Pager <T_HR_EMPLOYEECONTRACT>(ents, pageIndex, pageSize, ref pageCount);
            ents.ToList().ForEach(t => {
                V_EMPLOYEECONTACT obj = new V_EMPLOYEECONTACT();
                obj.EMPLOYEECONTACTID = t.EMPLOYEECONTACTID;
                obj.EMPLOYEENAME      = t.T_HR_EMPLOYEE.EMPLOYEECNAME;
                obj.EMPLOYEECODE      = t.T_HR_EMPLOYEE.EMPLOYEECODE;
                if (!string.IsNullOrEmpty(t.TODATE))
                {
                    obj.TODATE = DateTime.Parse(t.TODATE);
                }
                obj.FROMDATE    = t.FROMDATE;
                obj.CHECKSTATE  = t.CHECKSTATE;
                obj.CONTACTCODE = t.CONTACTCODE;
                obj.ENDDATE     = t.ENDDATE;
                if (obj.TODATE != null || obj.ENDDATE != null)
                {
                    if (obj.TODATE < DateTime.Now || obj.ENDDATE < DateTime.Now)
                    {
                        obj.CONTACTSTATE = "失效";
                    }
                    else
                    {
                        obj.CONTACTSTATE = "有效";
                    }
                }
                vcontact.Add(obj);
            });

            return(vcontact.AsQueryable());
        }