Ejemplo n.º 1
0
        void client_GetCompanyViewCompleted(object sender, GetCompanyViewCompletedEventArgs 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;
                    allCompanys.Add(company);
                }

                UICache.CreateCache("ORGTREESYSCompanyInfo" + Perm + Entity, allCompanys);

                client.GetDepartmentViewAsync(CurrentUserID, Perm, Entity);
            }
            else
            {
                loadbar.Stop();
            }
        }