Exemplo n.º 1
0
 public void GetAllOwnerCompanyId()
 {
     allOwnerCompanyId = "";
     #region 加载所有公司
     try
     {
         string path    = "silverlightcache\\" + Utility.CurrentUser.EMPLOYEEID + "ID.txt";
         var    company = SLCache.GetCache <string>(path, 5);
         if (company != null)
         {
             allOwnerCompanyId = company;
             // return company;
         }
         else
         {
             SMT.Saas.Tools.OrganizationWS.OrganizationServiceClient osc = new Saas.Tools.OrganizationWS.OrganizationServiceClient();
             osc.GetCompanyViewAsync(Utility.CurrentUser.EMPLOYEEID, "3", "");
             osc.GetCompanyViewCompleted += (obj, args) =>
             {
                 if (args.Result != null)
                 {
                     string companylist = "";
                     foreach (var ent in args.Result)
                     {
                         companylist += "'" + ent.COMPANYID + "',";
                     }
                     allOwnerCompanyId = companylist.TrimEnd(',');
                     BindCompanyList1();
                     BindCompanyList2();
                     SLCache.SaveData <string>(companylist.TrimEnd(','), path);
                 }
             };
             System.Threading.Thread.Sleep(1000);//等异步完成
         }
     }
     catch (Exception ee)
     {
         ComfirmWindow.ConfirmationBox("错误信息", ee.Message, "确定");
     }
     #endregion
 }
Exemplo n.º 2
0
        private void GetPostLevel()
        {
            string path = "silverlightcache\\POSTLEVEL.txt";

            try
            {
                var postlevel = SLCache.GetCache <List <V_Dictionary> >(path, 10);
                if (postlevel != null)
                {
                    var ents = from a in postlevel
                               orderby a.DICTIONARYNAME ascending
                               select a;
                    cboPostLevel.BindData(ents.ToList(), "DICTIONARYNAME", "DICTIONARYVALUE");
                }
                else
                {
                    PermissionServiceClient psc = new PermissionServiceClient();
                    System.Collections.ObjectModel.ObservableCollection <string> strs = new System.Collections.ObjectModel.ObservableCollection <string>();
                    strs.Add("POSTLEVEL");
                    //   strs.Add("TYPEAPPROVAL");
                    psc.GetDictionaryByCategoryArrayAsync(strs);
                    psc.GetDictionaryByCategoryArrayCompleted += (o, e) =>
                    {
                        if (e.Error == null)
                        {
                            if (e.Result != null)
                            {
                                //System.Collections.ObjectModel.ObservableCollection<V_Dictionary> dics =e.Result;
                                var ents = from a in e.Result
                                           orderby a.DICTIONARYNAME ascending
                                           select a;
                                cboPostLevel.BindData(ents.ToList(), "DICTIONARYNAME", "DICTIONARYVALUE");
                                SLCache.SaveData <List <V_Dictionary> >(e.Result.ToList(), path);
                            }
                        }
                    };
                }
            }
            catch
            {
                PermissionServiceClient psc = new PermissionServiceClient();
                System.Collections.ObjectModel.ObservableCollection <string> strs = new System.Collections.ObjectModel.ObservableCollection <string>();
                strs.Add("POSTLEVEL");
                //   strs.Add("TYPEAPPROVAL");
                psc.GetDictionaryByCategoryArrayAsync(strs);
                psc.GetDictionaryByCategoryArrayCompleted += (o, e) =>
                {
                    if (e.Error == null)
                    {
                        if (e.Result != null)
                        {
                            //System.Collections.ObjectModel.ObservableCollection<V_Dictionary> dics =e.Result;
                            var ents = from a in e.Result
                                       orderby a.DICTIONARYNAME ascending
                                       select a;
                            cboPostLevel.BindData(ents.ToList(), "DICTIONARYNAME", "DICTIONARYVALUE");
                            SLCache.SaveData <List <V_Dictionary> >(e.Result.ToList(), path);
                        }
                    }
                };
            }
        }