Example #1
0
        /// <summary>
        /// 选择人员
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LookUp_FindClick(object sender, EventArgs e)
        {
            #region ----多选人员
            OrganizationLookup lookup = new OrganizationLookup();

            lookup.SelectedObjType = OrgTreeItemTypes.Personnel;
            lookup.MultiSelected   = true;
            lookup.SelectedClick  += (obj, ev) =>
            {
                List <ExtOrgObj> ents = lookup.SelectedObj as List <ExtOrgObj>;

                foreach (var employeeInfo in ents)
                {
                    V_EmployeeAddsumView addSumInfo = new V_EmployeeAddsumView();
                    //人员重复跳过
                    var tmp = EmployeeAddsumInfoList.Where(s => s.EMPLOYEEID == employeeInfo.ObjectID).FirstOrDefault();
                    if (tmp != null)
                    {
                        continue;
                    }

                    //岗位
                    ExtOrgObj post     = (ExtOrgObj)employeeInfo.ParentObject;
                    string    postid   = post.ObjectID;
                    string    postName = post.ObjectName;

                    //部门
                    ExtOrgObj dept    = (ExtOrgObj)post.ParentObject;
                    string    deptid  = dept.ObjectID;
                    string    depName = dept.ObjectName;

                    //公司
                    SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY corp = (dept.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT).T_HR_COMPANY;
                    string corpid      = corp.COMPANYID;
                    string companyName = corp.CNAME;

                    //员工信息
                    var temp = employeeInfo.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE;

                    addSumInfo.ADDSUMID          = Guid.NewGuid().ToString();
                    addSumInfo.CompanyName       = companyName;
                    addSumInfo.PostName          = postName;
                    addSumInfo.DepartmentName    = depName;
                    addSumInfo.EMPLOYEECODE      = temp.EMPLOYEECODE;
                    addSumInfo.EMPLOYEEID        = temp.EMPLOYEEID;
                    addSumInfo.EMPLOYEENAME      = temp.EMPLOYEECNAME;// +"-" + postName + "-" + depName + "-" + companyName;
                    addSumInfo.OWNERID           = temp.EMPLOYEEID;
                    addSumInfo.OWNERCOMPANYID    = corpid;
                    addSumInfo.OWNERDEPARTMENTID = deptid;
                    addSumInfo.OWNERPOSTID       = postid;
                    EmployeeAddsumInfoList.Add(addSumInfo);
                }

                DtGrid.ItemsSource = EmployeeAddsumInfoList;
                SetProjectMoneySum();
            };

            lookup.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });
            #endregion
        }
Example #2
0
        /// <summary>
        /// 选择异动人员
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LookUp_FindClick(object sender, EventArgs e)
        {
            #region
            OrganizationLookup lookup = new OrganizationLookup();

            lookup.SelectedObjType = OrgTreeItemTypes.Personnel;
            lookup.SelectedClick  += (obj, ev) =>
            {
                //  SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE ent = lookup.SelectedObj[0].ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE;
                List <ExtOrgObj> ent = lookup.SelectedObj as List <ExtOrgObj>;

                if (ent != null && ent.Count > 0)
                {
                    ExtOrgObj companyInfo = ent.FirstOrDefault();
                    ExtOrgObj post        = (ExtOrgObj)companyInfo.ParentObject;
                    string    postid      = post.ObjectID;
                    //  fromPostLevel=(post as SMT.Saas.Tools.OrganizationWS.T_HR_POST).POSTLEVEL.ToString();

                    ExtOrgObj dept   = (ExtOrgObj)post.ParentObject;
                    string    deptid = dept.ObjectID;

                    // ExtOrgObj corp = (ExtOrgObj)dept.ParentObject;
                    SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY corp = (dept.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT).T_HR_COMPANY;
                    string corpid = corp.COMPANYID;

                    T_HR_EMPLOYEE temp = new T_HR_EMPLOYEE();
                    temp = ent.FirstOrDefault().ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE;

                    lkEmployeeName.DataContext = temp;
                }
            };

            lookup.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });
            #endregion
        }
Example #3
0
        private void DgOrganize_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            ExtOrgObj Organize = (ExtOrgObj)e.Row.DataContext;
            Button    DelBtn   = DgOrganize.Columns[2].GetCellContent(e.Row).FindName("btnDelete") as Button;

            DelBtn.Tag = Organize;
        }
 private void GetCompanyExtOrgObj(List <SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> LstOldCompanys, List <SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> LstCompanys)
 {
     if (LstCompanys.Count() > 0)
     {
         LstCompanys.ToList().ForEach(child =>
         {
             StrCompanyIDsList.Add(child.COMPANYID);
             //issuanceExtOrgObj.Add(item);
             ExtOrgObj objSecond  = new ExtOrgObj();
             objSecond.ObjectID   = child.COMPANYID;
             objSecond.ObjectName = child.CNAME;
             objSecond.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company;
             var ExistEnts        = from ext in entall
                                    where ext.ObjectID == child.COMPANYID &&
                                    ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company
                                    select ext;
             if (ExistEnts.Count() == 0)
             {
                 entall.Add(objSecond);
             }
             var ents = from childcompany in LstOldCompanys
                        where childcompany.T_HR_COMPANY2 != null && childcompany.T_HR_COMPANY2.COMPANYID == child.COMPANYID
                        select childcompany;
             if (ents.Count() > 0)
             {
                 GetCompanyExtOrgObj(LstOldCompanys, ents.ToList());
             }
         });
     }
 }
Example #5
0
        private void lkOrg_FindClick(object sender, EventArgs e)
        {
            string             userID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            string             perm      = (((int)FormTypes.Browse) + 1).ToString(); //zl 3.1
            string             entity    = "MonthlyBudgetAnalysis";
            OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity);

            ogzLookup.MultiSelected   = false;
            ogzLookup.SelectedObjType = OrgTreeItemTypes.All;
            ogzLookup.ShowMessageForSelectOrganization();

            ogzLookup.SelectedClick += (o, ev) =>
            {
                ExtOrgObj objSel = ogzLookup.SelectedObj.FirstOrDefault();
                if (objSel.ObjectInstance == null)
                {
                    return;
                }

                int iTempOrgType = -1;
                switch (objSel.ObjectType)
                {
                case OrgTreeItemTypes.Company:
                    lkOrg.DataContext       = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)objSel.ObjectInstance;
                    lkOrg.DisplayMemberPath = "CNAME";
                    strOrgType   = "COMPANY";
                    strOrgId     = objSel.ObjectID;
                    iTempOrgType = OrgTreeItemTypes.Company.ToInt32();
                    break;

                case OrgTreeItemTypes.Department:
                    lkOrg.DataContext       = (SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT)objSel.ObjectInstance;
                    lkOrg.DisplayMemberPath = "T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME";
                    strOrgType   = "DEPARTMENT";
                    strOrgId     = objSel.ObjectID;
                    iTempOrgType = OrgTreeItemTypes.Department.ToInt32();
                    break;

                case OrgTreeItemTypes.Post:
                    lkOrg.DataContext       = (SMT.Saas.Tools.OrganizationWS.T_HR_POST)objSel.ObjectInstance;
                    lkOrg.DisplayMemberPath = "T_HR_POSTDICTIONARY.POSTNAME";
                    strOrgType   = "POST";
                    strOrgId     = objSel.ObjectID;
                    iTempOrgType = OrgTreeItemTypes.Post.ToInt32();
                    break;

                case OrgTreeItemTypes.Personnel:
                    lkOrg.DataContext       = (SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE)objSel.ObjectInstance;
                    lkOrg.DisplayMemberPath = "EMPLOYEECNAME";
                    strOrgType   = "PERSONNAL";
                    strOrgId     = objSel.ObjectID;
                    iTempOrgType = OrgTreeItemTypes.Personnel.ToInt32();
                    break;
                }

                lkSubject.DataContext = null;
            };
            ogzLookup.Show <string>(DialogMode.ApplicationModal, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, userID);
        }
        void personnerClient_GetEmployeesPostBriefByEmployeeIDCompleted(object sender, GetEmployeesPostBriefByEmployeeIDCompletedEventArgs e)
        {
            RefreshUI(RefreshedTypes.HideProgressBar);
            if (e.Error != null && !string.IsNullOrEmpty(e.Error.Message))
            {
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
            }
            else
            {
                List <V_EMPLOYEEDETAIL> employees = new List <V_EMPLOYEEDETAIL>();
                if (e.Result != null)
                {
                    employees = e.Result.ToList();
                }
                foreach (var ent in employees)
                {
                    ExtOrgObj objPerson = new ExtOrgObj();
                    objPerson.ObjectID   = ent.EMPLOYEEID;
                    objPerson.ObjectName = ent.EMPLOYEENAME;
                    objPerson.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel;
                    var ExistEnts = from ext in entall
                                    where ext.ObjectID == objPerson.ObjectID &&
                                    ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel
                                    select ext;
                    if (ExistEnts.Count() == 0)
                    {
                        T_HR_BALANCEPOSTDETAIL detail = new T_HR_BALANCEPOSTDETAIL();
                        detail.BALANCEPOSTDETAIL  = Guid.NewGuid().ToString();
                        detail.BALANCEPOSTASIGNID = EmployeeAddBalancePost.EMPLOYEESALARYPOSTASIGNID;
                        detail.EMPLOYEEID         = ent.EMPLOYEEID;
                        detail.EMPLOYEENAME       = ent.EMPLOYEENAME;

                        var ents = from ent1 in ent.EMPLOYEEPOSTS
                                   where ent1.ISAGENCY == "0"
                                   select ent1;
                        if (ents.Count() > 0)
                        {
                            detail.EMPLOYEEPOSTID         = ents.FirstOrDefault().POSTID;
                            detail.EMPLOYEEPOSTNAME       = ents.FirstOrDefault().PostName;
                            detail.EMPLOYEEDEPARTMENTID   = ents.FirstOrDefault().DepartmentID;
                            detail.EMPLOYEEDEPARTMENTNAME = ents.FirstOrDefault().DepartmentName;
                            detail.EMPLOYEECOMPANYID      = ents.FirstOrDefault().CompanyID;
                            detail.EMPLOYEECOMPANYNAME    = ents.FirstOrDefault().CompanyName;
                        }
                        //detail.EDITSTATE = "0";
                        detail.CREATEUSERID     = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        detail.UPDATEDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        detail.CREATEDATE       = DateTime.Now;
                        detail.UPDATEDATE       = DateTime.Now;
                        EmployeeBalanceInfoList.Add(detail);
                        objPerson.ObjectName = ent.EMPLOYEENAME + "-" + detail.EMPLOYEEPOSTNAME + "-" + detail.EMPLOYEEDEPARTMENTNAME + "-" + detail.EMPLOYEECOMPANYNAME;
                        entall.Add(objPerson);
                    }
                }
                issuanceExtOrgObj = entall;
                //BindData();
            }
        }
Example #7
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            Button    delBtn = sender as Button;
            ExtOrgObj Org    = new ExtOrgObj();

            Org = delBtn.Tag as ExtOrgObj;
            issuanceExtOrgObj.Remove(Org);
            BindData();
        }
Example #8
0
        private void lkSelectObj_FindClick(object sender, EventArgs e)
        {
            string userID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            string perm   = (((int)FormTypes.Browse) + 1).ToString(); //zl 3.1
            //string entity = "MonthlyBudgetAnalysis";
            //OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity);
            OrganizationLookup ogzLookup = new OrganizationLookup();

            ogzLookup.MultiSelected   = true;
            ogzLookup.SelectedObjType = OrgTreeItemTypes.Company;
            //ogzLookup.ShowMessageForSelectOrganization();

            ogzLookup.SelectedClick += (o, ev) =>
            {
                StrCompanyIDsList.Clear();
                List <ExtOrgObj> ent = ogzLookup.SelectedObj as List <ExtOrgObj>;
                if (ent.Count() == 0)
                {
                    return;
                }
                List <ExtOrgObj> entall = new List <ExtOrgObj>();
                if (ent != null && ent.Count > 0)
                {
                    //issuanceExtOrgObj = ent;
                    string StrCompanyName = "";
                    foreach (var h in ent)
                    {
                        if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company)//公司
                        {
                            StrCompanyIDsList.Add(h.ObjectID);
                            //先添加总公司
                            ExtOrgObj obj2 = new ExtOrgObj();
                            obj2.ObjectID   = h.ObjectID;
                            obj2.ObjectName = h.ObjectName;
                            obj2.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company;
                            entall.Add(obj2);
                            lkSelectObj.DataContext       = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)h.ObjectInstance;
                            lkSelectObj.DisplayMemberPath = "CNAME";
                            StrCompanyName += h.ObjectName + ",";
                        }
                    }
                    if (!string.IsNullOrEmpty(StrCompanyName))
                    {
                        StrCompanyName = StrCompanyName.Substring(0, StrCompanyName.Length - 1);
                    }
                    ToolTipService.SetToolTip(lkSelectObj.TxtLookUp, StrCompanyName);
                }
            };

            ogzLookup.Show <string>(DialogMode.ApplicationModal, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, userID);
        }
        IssuanceObjectType GetObjectType(ExtOrgObj objExt)//判断过滤LookUp
        {
            switch (objExt.ObjectType)
            {
            case FrUi.OrgTreeItemTypes.Company:
                return(IssuanceObjectType.Company);

            case FrUi.OrgTreeItemTypes.Department:
                return(IssuanceObjectType.Department);

            case FrUi.OrgTreeItemTypes.Post:
                return(IssuanceObjectType.Post);

            default:
                return(IssuanceObjectType.Employee);
            }
        }
        private void lkSelectObj_FindClick(object sender, EventArgs e)
        {
            string             userID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            string             perm      = (((int)FormTypes.Browse) + 1).ToString(); //zl 3.1
            OrganizationLookup ogzLookup = new OrganizationLookup();

            ogzLookup.MultiSelected   = false;
            ogzLookup.SelectedObjType = OrgTreeItemTypes.Company;

            ogzLookup.SelectedClick += (o, ev) =>
            {
                StrCompanyIDs = "";
                List <ExtOrgObj> ent = ogzLookup.SelectedObj as List <ExtOrgObj>;
                if (ent.Count() == 0)
                {
                    return;
                }
                List <ExtOrgObj> entall = new List <ExtOrgObj>();
                if (ent != null && ent.Count > 0)
                {
                    foreach (var h in ent)
                    {
                        if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company)//公司
                        {
                            StrCompanyIDs = h.ObjectID;
                            //先添加总公司
                            ExtOrgObj obj2 = new ExtOrgObj();
                            obj2.ObjectID   = h.ObjectID;
                            obj2.ObjectName = h.ObjectName;
                            obj2.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company;
                            entall.Add(obj2);
                            lkSelectObj.DataContext       = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)h.ObjectInstance;
                            lkSelectObj.DisplayMemberPath = "CNAME";
                        }
                    }
                }
            };
            ogzLookup.Show <string>(DialogMode.ApplicationModal, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, userID);
        }
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            Button delBtn = sender as Button;
            //SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEPOST MeetingV = delBtn.Tag as SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEPOST;
            ExtOrgObj ext = delBtn.Tag as ExtOrgObj;

            List <Saas.Tools.PersonnelWS.V_EMPLOYEEPOST> listpost = new List <Saas.Tools.PersonnelWS.V_EMPLOYEEPOST>();

            switch (ext.ObjectType)
            {
            case SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel:
                var persons = from ent in issuanceExtOrgObj
                              where ent.ObjectID == ext.ObjectID
                              select ent;
                //listpost = persons.Count() > 0 ? persons.ToList() : null;
                break;
            }
            if (listpost != null)
            {
                foreach (var ent in listpost)
                {
                    StaffList.Remove(ent.T_HR_EMPLOYEE.EMPLOYEEID);
                }
            }

            issuanceExtOrgObj.Remove(ext);
            var ents = from ent in EmployeeBalanceInfoList
                       where ent.EMPLOYEEID == ext.ObjectID
                       select ent;

            if (ents.Count() > 0)
            {
                EmployeeBalanceInfoList.Remove(ents.FirstOrDefault());
            }

            //BindData();
        }
Example #12
0
        public void InitOrganization()
        {
            string perm   = "3";
            string entity = ReferencedDataInfo.OrderInfo.Type;

            if (OperationType == OperationTypes.Edit)
            {
                perm = ((int)Permissions.Edit).ToString();
            }
            else if (OperationType == OperationTypes.Add)
            {
                perm = ((int)Permissions.Add).ToString();
            }
            else
            {
                perm = ((int)Permissions.Browse).ToString();
            }

            string userID = DataCore.CurrentUser.Value.ToString();
            //             BF06E969-1B2C-4a89-B0AE-A91CA1244053
            OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity);

            if (ReferencedDataInfo.Type == typeof(CompanyData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Company;
            }
            else if (ReferencedDataInfo.Type == typeof(EmployeerData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Personnel;
            }
            else if (ReferencedDataInfo.Type == typeof(DepartmentData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.Department;
            }
            else if (ReferencedDataInfo.Type == typeof(OrgObjectData).Name)
            {
                ogzLookup.SelectedObjType = OrgTreeItemTypes.All;
            }

            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;

            ogzLookup.SelectedClick += (o, e) =>
            {
                if (ogzLookup.SelectedObj.Count > 0)
                {
                    ITextValueItem item = null;
                    string         id   = ogzLookup.SelectedObj[0].ObjectID;
                    if (ReferencedDataInfo.Type == typeof(EmployeerData).Name)
                    {
                        EmployeerData eData = new EmployeerData();
                        eData.Value = ogzLookup.SelectedObj[0].ObjectID;
                        eData.Text  = ogzLookup.SelectedObj[0].ObjectName;
                        ExtOrgObj post = ogzLookup.SelectedObj[0].ParentObject as ExtOrgObj;
                        ExtOrgObj dept = post.ParentObject as ExtOrgObj;

                        // ExtOrgObj com = dept.ParentObject as ExtOrgObj;
                        ITextValueItem pdata = DataCore.FindReferencedData <PostData>(post.ObjectID);
                        ITextValueItem ddata = DataCore.FindReferencedData <DepartmentData>(dept.ObjectID);
                        ITextValueItem cdata = (ddata as DepartmentData).Company;

                        eData.Company    = cdata as CompanyData;
                        eData.Department = ddata as DepartmentData;
                        eData.Post       = pdata as PostData;
                        item             = eData;
                    }
                    else
                    {
                        item = DataCore.FindRefData(ReferencedDataInfo.Type, id);
                    }
                    this.SelectItem = item;
                }
            };
            ogzLookup.Show <string>(DialogMode.ApplicationModal, plRoot, "", (result) => { });
        }
Example #13
0
        /// <summary>
        /// 选择机构
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lkObject_FindClick(object sender, EventArgs e)
        {
            string             userID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            string             perm      = (((int)FormTypes.Browse) + 1).ToString(); //zl 3.1
            string             entity    = "ContactDetailsView";
            OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity);

            ogzLookup.MultiSelected   = false;
            ogzLookup.SelectedObjType = OrgTreeItemTypes.All;
            ogzLookup.ShowMessageForSelectOrganization();


            ogzLookup.SelectedClick += (o, ev) =>
            {
                ExtOrgObj objSel = ogzLookup.SelectedObj.FirstOrDefault();
                if (objSel.ObjectInstance == null)
                {
                    return;
                }

                int iTempOrgType = -1;
                switch (objSel.ObjectType)
                {
                case OrgTreeItemTypes.Company:
                    lkObject.DataContext       = (SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY)objSel.ObjectInstance;
                    lkObject.DisplayMemberPath = "CNAME";
                    strOrgType   = "COMPANY";
                    strOrgId     = objSel.ObjectID;
                    dpStart.Text = "1900-1-1";
                    iTempOrgType = OrgTreeItemTypes.Company.ToInt32();
                    break;

                case OrgTreeItemTypes.Department:
                    lkObject.DataContext       = (SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT)objSel.ObjectInstance;
                    lkObject.DisplayMemberPath = "T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME";
                    strOrgType   = "DEPARTMENT";
                    strOrgId     = objSel.ObjectID;
                    dpStart.Text = "1900-1-1";
                    iTempOrgType = OrgTreeItemTypes.Department.ToInt32();
                    break;

                case OrgTreeItemTypes.Post:
                    lkObject.DataContext       = (SMT.Saas.Tools.OrganizationWS.T_HR_POST)objSel.ObjectInstance;
                    lkObject.DisplayMemberPath = "T_HR_POSTDICTIONARY.POSTNAME";
                    strOrgType   = "POST";
                    strOrgId     = objSel.ObjectID;
                    dpStart.Text = DateTime.Now.Year.ToString() + "-1-1";
                    iTempOrgType = OrgTreeItemTypes.Post.ToInt32();
                    break;

                case OrgTreeItemTypes.Personnel:
                    lkObject.DataContext       = (SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE)objSel.ObjectInstance;
                    lkObject.DisplayMemberPath = "EMPLOYEECNAME";
                    strOrgType   = "PERSONAL";
                    strOrgId     = objSel.ObjectID;
                    dpStart.Text = DateTime.Now.Year.ToString() + "-1-1";
                    iTempOrgType = OrgTreeItemTypes.Personnel.ToInt32();
                    break;
                }

                if (lkObject.DataContext != null)
                {
                    if (iTempOrgType == 0 || iTempOrgType == 1)
                    {
                        dgDeptQueryResult.Visibility      = System.Windows.Visibility.Visible;
                        spDeptTotalBorrowMoney.Visibility = System.Windows.Visibility.Visible;

                        tbStartTitle.Visibility        = System.Windows.Visibility.Collapsed;
                        dpStart.Visibility             = System.Windows.Visibility.Collapsed;
                        tbEndTitle.Visibility          = System.Windows.Visibility.Collapsed;
                        dgPersQueryResult.Visibility   = System.Windows.Visibility.Collapsed;
                        spPersBeforeAccount.Visibility = System.Windows.Visibility.Collapsed;
                        spPersAfterAccount.Visibility  = System.Windows.Visibility.Collapsed;
                    }
                    else if (iTempOrgType == 2 || iTempOrgType == 3)
                    {
                        dgDeptQueryResult.Visibility      = System.Windows.Visibility.Collapsed;
                        spDeptTotalBorrowMoney.Visibility = System.Windows.Visibility.Collapsed;

                        tbStartTitle.Visibility        = System.Windows.Visibility.Visible;
                        dpStart.Visibility             = System.Windows.Visibility.Visible;
                        tbEndTitle.Visibility          = System.Windows.Visibility.Visible;
                        dgPersQueryResult.Visibility   = System.Windows.Visibility.Visible;
                        dgPersQueryResult.Visibility   = System.Windows.Visibility.Visible;
                        spPersBeforeAccount.Visibility = System.Windows.Visibility.Visible;
                        spPersAfterAccount.Visibility  = System.Windows.Visibility.Visible;
                    }
                    else
                    {
                        dgDeptQueryResult.Visibility      = System.Windows.Visibility.Visible;
                        spDeptTotalBorrowMoney.Visibility = System.Windows.Visibility.Visible;

                        tbStartTitle.Visibility        = System.Windows.Visibility.Collapsed;
                        dpStart.Visibility             = System.Windows.Visibility.Collapsed;
                        tbEndTitle.Visibility          = System.Windows.Visibility.Collapsed;
                        dgPersQueryResult.Visibility   = System.Windows.Visibility.Collapsed;
                        spPersBeforeAccount.Visibility = System.Windows.Visibility.Collapsed;
                        spPersAfterAccount.Visibility  = System.Windows.Visibility.Collapsed;
                    }

                    if (dataPager.PageIndex != 1)
                    {
                        dataPager.PageIndex = 1;
                    }
                }
            };
            ogzLookup.Show <string>(DialogMode.ApplicationModal, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, userID);
        }
Example #14
0
        void dGrid_ToolBarItemClick(object sender, ToolBarItemClickEventArgs e)
        {
            if (e.Action != Actions.Add)
            {
                return;
            }
            e.Action = Actions.Cancel;
            string perm   = "3";
            string entity = typeof(T_FB_PERSONMONEYASSIGNMASTER).Name;

            if (this.EditForm.OperationType == OperationTypes.Edit)
            {
                perm = ((int)Permissions.Edit).ToString();
            }
            else if (this.EditForm.OperationType == OperationTypes.Add)
            {
                perm = ((int)Permissions.Add + 1).ToString();
            }
            else
            {
                perm = ((int)Permissions.Browse).ToString();
            }

            string userID = DataCore.CurrentUser.Value.ToString();
            //             BF06E969-1B2C-4a89-B0AE-A91CA1244053
            OrganizationLookup ogzLookup = new OrganizationLookup();

            ogzLookup.SelectedObjType = OrgTreeItemTypes.Personnel;
            ogzLookup.MultiSelected   = true;

            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;

            try
            {
                ogzLookup.SelectedClick += (o, ea) =>
                {
                    if (ogzLookup.SelectedObj.Count > 0)
                    {
                        //处理岗位及下拨
                        SMT.Saas.Tools.PersonnelWS.PersonnelServiceClient pe = new SMT.Saas.Tools.PersonnelWS.PersonnelServiceClient();
                        ObservableCollection <SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEFUNDS> vlistpostinfo = new ObservableCollection <SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEFUNDS>();

                        var assignDetail = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name);

                        var selectedObjects = ogzLookup.SelectedObj;
                        selectedObjects.ForEach(obj =>
                        {
                            ExtOrgObj post = obj.ParentObject as ExtOrgObj;
                            ExtOrgObj dept = post.ParentObject as ExtOrgObj;

                            // ExtOrgObj com = dept.ParentObject as ExtOrgObj;
                            ITextValueItem pdata = DataCore.FindReferencedData <PostData>(post.ObjectID);
                            ITextValueItem ddata = DataCore.FindReferencedData <DepartmentData>(dept.ObjectID);
                            ITextValueItem cdata = (ddata as DepartmentData).Company;

                            var existDetail = assignDetail.FirstOrDefault(item =>
                            {
                                T_FB_PERSONMONEYASSIGNDETAIL cd = item.Entity as T_FB_PERSONMONEYASSIGNDETAIL;
                                return(cd.OWNERID == obj.ObjectID && cd.OWNERPOSTID == pdata.Value.ToString());
                            });

                            T_FB_PERSONMONEYASSIGNDETAIL detail = new T_FB_PERSONMONEYASSIGNDETAIL();
                            if (existDetail != null)
                            {
                                detail.PERSONBUDGETAPPLYDETAILID    = (existDetail.Entity as T_FB_PERSONMONEYASSIGNDETAIL).PERSONBUDGETAPPLYDETAILID;
                                detail.T_FB_PERSONMONEYASSIGNMASTER = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;
                            }
                            else
                            {
                                detail.PERSONBUDGETAPPLYDETAILID    = Guid.NewGuid().ToString();
                                detail.T_FB_PERSONMONEYASSIGNMASTER = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;
                                detail.BUDGETMONEY = 0;
                            }

                            // start 添加岗位级别,用于排序
                            var employee1 = obj.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE;
                            if (employee1 != null)
                            {
                                var ep = employee1.T_HR_EMPLOYEEPOST.FirstOrDefault();
                                if (ep != null)
                                {
                                    detail.POSTLEVEL = ep.POSTLEVEL;
                                }
                            }


                            // end

                            detail.OWNERID             = obj.ObjectID;
                            detail.OWNERNAME           = obj.ObjectName;
                            detail.OWNERPOSTID         = pdata.Value.ToString();
                            detail.OWNERPOSTNAME       = pdata.Text;
                            detail.OWNERDEPARTMENTID   = ddata.Value.ToString();
                            detail.OWNERDEPARTMENTNAME = ddata.Text;
                            detail.OWNERCOMPANYID      = cdata.Value.ToString();
                            detail.OWNERCOMPANYNAME    = cdata.Text;

                            //SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEPOSTFORFB vpostinfo = new SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEPOSTFORFB();
                            //vpostinfo.PERSONBUDGETAPPLYDETAILID = detail.PERSONBUDGETAPPLYDETAILID;
                            //vpostinfo.OWNERID = detail.OWNERID;
                            //vpostinfo.OWNERPOSTID = detail.OWNERPOSTID;
                            //vlistpostinfo.Add(vpostinfo);

                            SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEFUNDS vpostinfo = new SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEFUNDS();

                            vpostinfo.EMPLOYEEID = detail.OWNERID;
                            vpostinfo.POSTID     = detail.OWNERPOSTID;
                            vpostinfo.COMPANYID  = detail.OWNERCOMPANYID;
                            vlistpostinfo.Add(vpostinfo);

                            if (existDetail != null)
                            {
                                return;
                            }
                            else
                            {
                                FBEntity fbEntity      = detail.ToFBEntity();
                                fbEntity.FBEntityState = FBEntityState.Added;
                                assignDetail.Add(fbEntity);
                            }
                        });
                        if (vlistpostinfo != null && vlistpostinfo.Count > 0)
                        {
                            this.ShowProcess();
                            pe.GetEmployeeFundsListCompleted += new EventHandler <Saas.Tools.PersonnelWS.GetEmployeeFundsListCompletedEventArgs>(pe_GetEmployeeFundsListCompleted);
                            pe.GetEmployeeFundsListAsync(vlistpostinfo);
                        }
                    }
                };
                ogzLookup.Show <string>(DialogMode.ApplicationModal, plRoot, "", (result) => { });
            }
            catch (Exception ex)
            {
                CommonFunction.ShowErrorMessage("调用HR服务返回异常信息:" + ex.ToString());
            }
        }
        /// <summary>
        /// 分配对象为员工时,检查选择的多个员工是否为同一公司
        /// </summary>
        /// <param name="ents"></param>
        private void CheckSelectedObj(List <ExtOrgObj> ents)
        {
            string strIds = string.Empty, strSelEmpNames = string.Empty, strMsg = string.Empty;

            List <string> entCompanyIds    = new List <string>();
            List <string> entPostIds       = new List <string>();
            List <string> entDepartmentIds = new List <string>();

            foreach (ExtOrgObj item in ents)
            {
                ExtOrgObj objPost = (ExtOrgObj)item.ParentObject;
                if (objPost == null)
                {
                    continue;
                }

                SMT.Saas.Tools.OrganizationWS.T_HR_POST entPost = objPost.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_POST;
                if (entPost == null)
                {
                    continue;
                }

                //这句阻断,不知道为什么
                //if (entPost.T_HR_DEPARTMENT == null)
                //{
                //    continue;
                //}

                ExtOrgObj objDepartment = (ExtOrgObj)objPost.ParentObject;
                if (objDepartment == null)
                {
                    continue;
                }

                SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT entDepartment = objDepartment.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT;
                if (entDepartment.T_HR_COMPANY == null)
                {
                    continue;
                }

                if (entPostIds.Contains(entPost.POSTID) == false)
                {
                    entPostIds.Add(entPost.POSTID);
                }

                if (entDepartmentIds.Contains(entDepartment.DEPARTMENTID) == false)
                {
                    entDepartmentIds.Add(entDepartment.DEPARTMENTID);
                }

                if (entCompanyIds.Contains(entDepartment.T_HR_COMPANY.COMPANYID) == false)
                {
                    entCompanyIds.Add(entDepartment.T_HR_COMPANY.COMPANYID);
                }

                SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE entEmp = item.ObjectInstance as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEE;
                strIds         += entEmp.EMPLOYEEID + ",";
                strSelEmpNames += entDepartment.T_HR_COMPANY.CNAME + "-"
                                  + entDepartment.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME + "-"
                                  + entPost.T_HR_POSTDICTIONARY.POSTNAME + "-" + entEmp.EMPLOYEECNAME + ";";
            }

            lkAssignObject.TxtLookUp.Text = strSelEmpNames;

            //entity.ASSIGNEDOBJECTTYPE = (Convert.ToInt32(AssignedObjectType.Personnel) + 1).ToString();
            entity.EMPLOYEEID   = strIds;
            entity.EMPLOYEENAME = strSelEmpNames;



            SetRecordOwner(entCompanyIds[0]);
        }
Example #16
0
        private void GetData()
        {
            int    pageCount = 0;
            string filter    = "";                                                                                    //查询过滤条件
            ObservableCollection <object> paras = new System.Collections.ObjectModel.ObservableCollection <object>(); //参数值

            string strChargeCode = string.Empty, strDateStart = string.Empty, strDateEnd = string.Empty;

            strChargeCode = txtCode.Text.ToString();

            if (dpStart.SelectedDate != null)
            {
                strDateStart = dpStart.SelectedDate.Value.ToString("yyyy-MM-dd");
            }

            if (dpEnd.SelectedDate != null)
            {
                strDateEnd = dpEnd.SelectedDate.Value.ToString();
            }

            if (!string.IsNullOrEmpty(strChargeCode))
            {
                if (!string.IsNullOrEmpty(filter))
                {
                    filter += " and ";
                }
                filter += "@" + paras.Count().ToString() + ".Contains(REPAYAPPLYCODE) "; //费用申请单编号
                paras.Add(strChargeCode);
            }

            if (lkOrg.DataContext != null)
            {
                SMT.FBAnalysis.UI.CommonTools.MultiValuesItem <ExtOrgObj> mutilValues = lkOrg.SelectItem as SMT.FBAnalysis.UI.CommonTools.MultiValuesItem <ExtOrgObj>;
                if (mutilValues != null)
                {
                    Dictionary <OrgTreeItemTypes, string> dictTypes = new Dictionary <OrgTreeItemTypes, string>();
                    dictTypes.Add(OrgTreeItemTypes.Company, "OWNERCOMPANYID");
                    dictTypes.Add(OrgTreeItemTypes.Department, "OWNERDEPARTMENTID");
                    dictTypes.Add(OrgTreeItemTypes.Personnel, "OWNERID");
                    dictTypes.Add(OrgTreeItemTypes.Post, "OWNERPOSTID");

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

                    filter += " (";
                    for (int i = 0; i < mutilValues.Values.Count(); i++)
                    {
                        if (i > 0 && i < mutilValues.Values.Count() - 1)
                        {
                            filter += " OR ";
                        }

                        ExtOrgObj item         = mutilValues.Values[i];
                        string    propertyName = dictTypes[item.ObjectType];
                        string    strOrgID     = item.ObjectID;

                        filter += propertyName + " ==@" + paras.Count().ToString();
                        paras.Add(strOrgID);
                    }
                    ;

                    filter += " )";
                }
            }

            strOwnerID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

            loadbar.Start();
            client.GetRepayApplyMasterListByMultSearchAsync(strOwnerID, strDateStart, strDateEnd, checkState, filter, paras,
                                                            "UPDATEDATE DESC", dataPager.PageIndex, dataPager.PageSize, pageCount);
        }
        private void AddOrgObjectInList(TreeViewItem item)
        {
            if (item == null)
            {
                return;
            }

            if (ListCustomerpermission.Count() == 0)
            {
                return;
            }

            TreeViewItem     menuitem      = (TreeViewItem)treeMenu.SelectedItem;
            T_SYS_ENTITYMENU entMenu       = menuitem.DataContext as T_SYS_ENTITYMENU;
            T_SYS_PERMISSION entPermission = DtGrid.SelectedItem as T_SYS_PERMISSION;

            ExtOrgObj obj = item.DataContext as ExtOrgObj;

            FrameworkUI.OrgTreeItemTypes nodeType = obj.ObjectType;
            OrgObject entTemp = new OrgObject();

            switch (nodeType)
            {
            case FrameworkUI.OrgTreeItemTypes.Company:
                T_HR_COMPANY tmpOrg = (T_HR_COMPANY)obj.ObjectInstance;
                if (tmpOrg != null)
                {
                    entTemp.OrgID   = tmpOrg.COMPANYID;
                    entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Company).ToString();
                }
                break;

            case FrameworkUI.OrgTreeItemTypes.Department:
                T_HR_DEPARTMENT tmpDep = obj.ObjectInstance as T_HR_DEPARTMENT;
                if (tmpDep != null)
                {
                    entTemp.OrgID   = tmpDep.DEPARTMENTID;
                    entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Department).ToString();
                }
                break;

            case FrameworkUI.OrgTreeItemTypes.Post:
                T_HR_POST tmpPost = obj.ObjectInstance as T_HR_POST;
                if (tmpPost != null)
                {
                    entTemp.OrgID   = tmpPost.POSTID;
                    entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Post).ToString();
                }
                break;

            default:
                break;
            }

            if (!string.IsNullOrEmpty(entTemp.OrgID) && !string.IsNullOrEmpty(entTemp.OrgType))
            {
                foreach (CustomerPermission parentitem in ListCustomerpermission)
                {
                    if (parentitem.EntityMenuId != entMenu.ENTITYMENUID)
                    {
                        continue;
                    }

                    var per = from p in parentitem.PermissionValue
                              where p.Permission == entPermission.PERMISSIONID
                              select p;

                    if (per.Count() == 0)
                    {
                        break;
                    }

                    foreach (PermissionValue childitem in per)
                    {
                        ObservableCollection <OrgObject> entsOrg = new ObservableCollection <OrgObject>();
                        if (childitem.OrgObjects == null)
                        {
                            entsOrg.Add(entTemp);
                            childitem.OrgObjects = entsOrg;
                        }
                        else if (childitem.OrgObjects.Count() == 0)
                        {
                            entsOrg.Add(entTemp);
                            childitem.OrgObjects = entsOrg;
                        }
                        else if ((childitem.OrgObjects.Count() > 0))
                        {
                            var pcc = from o in childitem.OrgObjects
                                      where o.OrgID == entTemp.OrgID && o.OrgType == entTemp.OrgType
                                      select o;
                            if (pcc.Count() == 0)
                            {
                                childitem.OrgObjects.Add(entTemp);
                            }
                        }
                    }
                }

                this.DataContext = ListCustomerpermission;
            }
        }