コード例 #1
0
        /// <summary>
        /// 获取当前用户能够操作的公司ID,以“,”分割
        /// </summary>
        /// <returns></returns>
        public static string GetOwnerCompanyId()
        {
            string allOwnerCompanyId = "";
            bool   bol = true;

            #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(',');
                            SLCache.SaveData <string>(companylist.TrimEnd(','), path);
                        }
                        bol = false;
                    };
                    //等异步完成
                    while (bol)
                    {
                        //等异步完成
                    }
                    ;
                    return(allOwnerCompanyId);
                }
            }
            catch (Exception ee)
            {
                SMT.SaaS.FrameworkUI.ChildWidow.ComfirmWindow.ConfirmationBox("错误信息", ee.Message, "确定");
                return(null);
            }
            #endregion
        }
コード例 #2
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
 }
コード例 #3
0
ファイル: ModelCodeEdit.xaml.cs プロジェクト: JuRogn/OA
 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
 }