コード例 #1
0
        public void LoadCompanyList()
        {
            BatchStoreEmailSystem_WS.CommonSoapClient soapclient_CommonWebService = null;

            try
            {
                soapclient_CommonWebService = GetCommonSoapClient();

                DataSet dsCompanyList = soapclient_CommonWebService.GetCompanyList();

                var dsRows = dsCompanyList.Tables[0].AsEnumerable().Select(r => new
                {
                    CompanyID   = r.Field <System.Guid>("CompanyID").ToString(),
                    CompanyName = r.Field <string>("CompanyName")
                });

                IEnumerable <CompanyListItem> CompanyList = from item in dsRows.AsEnumerable()
                                                            select new CompanyListItem(item.CompanyName, item.CompanyID);

                lstCompanyList.DataSource    = CompanyList.ToList();
                lstCompanyList.DisplayMember = "CompanyName";
                lstCompanyList.ValueMember   = "CompanyID";
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                soapclient_CommonWebService.Close();
                soapclient_CommonWebService = null;
            }
        }
コード例 #2
0
        private BatchStoreEmailSystem_WS.CommonSoapClient GetCommonSoapClient()
        {
            var thisCommonSoapClient = new BatchStoreEmailSystem_WS.CommonSoapClient();

            if (!OverrideWebServiceAddress.Equals("X"))
            {
                thisCommonSoapClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(OverrideWebServiceAddress + "/common.asmx");
            }

            return(thisCommonSoapClient);
        }
コード例 #3
0
        public void LoadSiteListForCompany(string CompanyID)
        {
            BatchStoreEmailSystem_WS.CommonSoapClient soapclient_CommonWebService = null;

            DataSet dsSiteList = null;

            try
            {
                soapclient_CommonWebService = GetCommonSoapClient();

                dsSiteList = soapclient_CommonWebService.GetSitesForCompany_v2(CompanyID);

                thisSiteList = new SiteList();
                //thisSiteList.Load(dsSiteList.Tables[0].CreateDataReader(), LoadOption.OverwriteChanges, thisSiteList.CompanySites);


                if (thisSiteList.LoadFromUntypedDataset(ref dsSiteList))
                {
                    //var VSiteList = thisSiteList.CompanySites.AsEnumerable().Select(r => new
                    // {
                    //     SiteKey = r.Field<System.Guid>("SiteKey").ToString(),
                    //     SiteID = r.Field<int>("SiteID").ToString().PadLeft(3),
                    //     SiteName = r.Field<string>("SiteName"),
                    //     DistrictName = r.Field<string>("DistrictName")
                    // });

                    lstSiteList.Items.Clear();

                    foreach (SiteList.CompanySitesRow s in thisSiteList.CompanySites)//foreach (var s in VSiteList)
                    {
                        ListViewItem i = new ListViewItem(s.SiteID.ToString().PadLeft(3), 0);
                        i.Checked = true;
                        i.SubItems.Add(s.SiteName);
                        i.SubItems.Add(s.DistrictName);
                        i.SubItems.Add(s.SiteKey);

                        lstSiteList.Items.Add(i);
                    }

                    //VSiteList = null;

                    lstSiteList.Update();
                }
                else
                {
                    //TODO : 1 Display Error message because of SiteList load failure
                }

                dsSiteList.Dispose();
                dsSiteList = null;
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                soapclient_CommonWebService.Close();
                soapclient_CommonWebService = null;
            }
        }