Exemple #1
0
        /// <summary>
        /// 加载部门数据
        /// </summary>
        private void LoadDepartmentInfo()
        {
            organClient.GetAllDepartmentViewCompleted += (o, e) =>
            {
                if (e.Error == null)
                {
                    if (e.Result != null)
                    {
                        allDepartmentsView = e.Result.ToList();
                        ReFillDataToDepartment();
                    }
                }
            };

            if (!Application.Current.Resources.Contains("SYS_DepartmentInfo"))
            {
                organClient.GetAllDepartmentViewAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
            }
            else
            {
                LoadPostInfo();
            }
            //if (V_DepartmentInfoVM.IsExists(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID) == false)
            //{
            //    organClient.GetAllDepartmentViewAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
            //}
            //else
            //{
            //    GetDepartmentsByLocal(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID);
            //}
        }
Exemple #2
0
        void organClient_GetALLCompanyViewCompleted(object sender, GetALLCompanyViewCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (e.Result != null)
                {
                    List <V_COMPANY> entTemps = e.Result.ToList();
                    allCompanys = new List <T_HR_COMPANY>();
                    var ents = entTemps.OrderBy(c => c.FATHERID);
                    foreach (var ent in ents)
                    {
                        T_HR_COMPANY company = new T_HR_COMPANY();
                        company.COMPANYID = ent.COMPANYID;
                        company.CNAME     = ent.CNAME;
                        company.ENAME     = ent.ENAME;
                        if (!string.IsNullOrEmpty(ent.BRIEFNAME))
                        {
                            company.BRIEFNAME = ent.BRIEFNAME;
                        }
                        else
                        {
                            company.BRIEFNAME = ent.CNAME;
                        }

                        company.COMPANRYCODE = ent.COMPANRYCODE;
                        company.SORTINDEX    = ent.SORTINDEX;
                        if (!string.IsNullOrEmpty(ent.FATHERCOMPANYID))
                        {
                            company.T_HR_COMPANY2           = new T_HR_COMPANY();
                            company.T_HR_COMPANY2.COMPANYID = ent.FATHERCOMPANYID;
                            company.T_HR_COMPANY2.CNAME     = entTemps.Where(s => s.COMPANYID == ent.FATHERCOMPANYID).FirstOrDefault().CNAME;
                        }
                        company.FATHERID   = ent.FATHERID;
                        company.FATHERTYPE = ent.FATHERTYPE;
                        company.CHECKSTATE = ent.CHECKSTATE;
                        company.EDITSTATE  = ent.EDITSTATE;
                        allCompanys.Add(company);
                    }
                    if (App.Current.Resources["SYS_CompanyInfo"] != null)
                    {
                        App.Current.Resources.Remove("SYS_CompanyInfo");
                        App.Current.Resources.Add("SYS_CompanyInfo", allCompanys);
                    }
                    else
                    {
                        App.Current.Resources.Add("SYS_CompanyInfo", allCompanys);
                    }

                    organClient.GetAllDepartmentViewAsync("");
                }
            }
        }
        /// <summary>
        /// 获取正常的公司
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        void client_GetALLCompanyViewCompleted(object sender, GetALLCompanyViewCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (e.Result == null)
                {
                    return;
                }

                ObservableCollection <V_COMPANY> entTemps = e.Result;
                allCompanys = new List <T_HR_COMPANY>();
                allCompanys.Clear();
                var ents = entTemps.OrderBy(c => c.FATHERID);
                foreach (var ent in ents)
                {
                    T_HR_COMPANY company = new T_HR_COMPANY();
                    company.COMPANYID = ent.COMPANYID;
                    company.CNAME     = ent.CNAME;
                    company.ENAME     = ent.ENAME;
                    if (!string.IsNullOrEmpty(ent.BRIEFNAME))
                    {
                        company.BRIEFNAME = ent.BRIEFNAME;
                    }
                    else
                    {
                        company.BRIEFNAME = ent.CNAME;
                    }

                    company.COMPANRYCODE            = ent.COMPANRYCODE;
                    company.SORTINDEX               = ent.SORTINDEX;
                    company.T_HR_COMPANY2           = new T_HR_COMPANY();
                    company.T_HR_COMPANY2.COMPANYID = ent.FATHERCOMPANYID;
                    company.FATHERID    = ent.FATHERID;
                    company.FATHERTYPE  = ent.FATHERTYPE;
                    company.CHECKSTATE  = ent.CHECKSTATE;
                    company.EDITSTATE   = ent.EDITSTATE;
                    company.COMPANYTYPE = ent.COMPANYTYPE;
                    allCompanys.Add(company);
                }

                UICache.CreateCache("ORGTREESYSCompanyInfo", allCompanys);

                client.GetAllDepartmentViewAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
            }
            else
            {
                loadbar.Stop();
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERRORINFO"),
                                               Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
            }
        }
Exemple #4
0
        private void LoadDepartmentInfo()
        {
            organClient.GetAllDepartmentViewCompleted += (o, e) =>
            {
                if (e.Error == null)
                {
                    if (e.Result != null)
                    {
                        List <SMT.Saas.Tools.OrganizationWS.V_DEPARTMENT> entTemps = e.Result.ToList();
                        allDepartments = new List <SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT>();
                        var ents = entTemps.OrderBy(c => c.FATHERID);
                        //把部门视图集合转换成部门实体集合
                        foreach (var ent in ents)
                        {
                            SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT dep = new SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT();
                            dep.DEPARTMENTID = ent.DEPARTMENTID;
                            dep.FATHERID     = ent.FATHERID;
                            dep.FATHERTYPE   = ent.FATHERTYPE;
                            dep.T_HR_DEPARTMENTDICTIONARY = new SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENTDICTIONARY();
                            dep.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTDICTIONARYID = ent.DEPARTMENTDICTIONARYID;
                            dep.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME         = ent.DEPARTMENTNAME;
                            dep.T_HR_COMPANY = new SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY();
                            dep.T_HR_COMPANY = allCompanys.Where(s => s.COMPANYID == ent.COMPANYID).FirstOrDefault();

                            dep.DEPARTMENTBOSSHEAD = ent.DEPARTMENTBOSSHEAD;
                            dep.SORTINDEX          = ent.SORTINDEX;
                            dep.CHECKSTATE         = ent.CHECKSTATE;
                            dep.EDITSTATE          = ent.EDITSTATE;
                            allDepartments.Add(dep);
                        }
                        //把部门实体集合存入缓存和独立存储
                        AddToResourceDictionary <List <SMT.Saas.Tools.OrganizationWS.T_HR_DEPARTMENT> >(ConstStrings.RES_DEPARTMENTINFO_KEY, allDepartments);
                        LoadPostInfo();
                    }
                }
            };
            organClient.GetAllDepartmentViewAsync(_UserEmployeeID);
        }