Пример #1
0
        public ActionResult AddVendor()
        {
            int             id = 0;
            VendorViewModel vendorViewModel = new VendorViewModel();

            VendorService.VendorServiceClient    vendorServiceClient       = new VendorService.VendorServiceClient();
            OrgService.OrganizationServiceClient organizationServiceClient = new OrgService.OrganizationServiceClient();
            vendorViewModel.vendor          = new VendorMaster();
            vendorViewModel.vendor.VendorID = 0;

            string  strXMLGroupCompanyList = organizationServiceClient.GetGroupCompaniesList();
            DataSet dsGroupCompanyList     = new DataSet();

            dsGroupCompanyList.ReadXml(new StringReader(strXMLGroupCompanyList));
            vendorViewModel.GroupCompaniesList = new List <SelectListItem>();
            vendorViewModel.GroupCompaniesList.Add(new SelectListItem {
                Text = "--Select Group Company--", Value = "0"
            });

            foreach (System.Data.DataRow row in dsGroupCompanyList.Tables[0].Rows)
            {
                vendorViewModel.GroupCompaniesList.Add(new SelectListItem()
                {
                    Text = row["Company_Name"].ToString(), Value = row["Org_Hier_ID"].ToString()
                });
            }


            string  strXMLCompanyList = organizationServiceClient.GeSpecifictCompaniesList(id);
            DataSet dsCompanyList     = new DataSet();

            dsCompanyList.ReadXml(new StringReader(strXMLCompanyList));
            vendorViewModel.CompaniesList = new List <SelectListItem>();
            vendorViewModel.CompaniesList.Add(new SelectListItem {
                Text = "--Select Company--", Value = "0"
            });

            foreach (System.Data.DataRow row in dsCompanyList.Tables[0].Rows)
            {
                vendorViewModel.CompaniesList.Add(new SelectListItem()
                {
                    Text = row["Company_Name"].ToString(), Value = row["Org_Hier_ID"].ToString()
                });
            }



            return(View("_Vendor", vendorViewModel));
        }
        public JsonResult getcompany(string groupcompid)
        {
            List <SelectListItem> company = new List <SelectListItem>();
            int ID = Convert.ToInt32(groupcompid);

            OrgService.OrganizationServiceClient client = new OrgService.OrganizationServiceClient();
            string  xmldata = client.GeSpecifictCompaniesList(ID);
            DataSet ds      = new DataSet();

            ds.ReadXml(new StringReader(xmldata));
            company = new List <SelectListItem>();
            if (ds.Tables.Count > 0)
            {
                foreach (System.Data.DataRow row in ds.Tables[0].Rows)
                {
                    company.Add(new SelectListItem {
                        Text = Convert.ToString(row["Company_Name"]), Value = Convert.ToString(row["Org_Hier_ID"])
                    });
                }
            }
            Session["Company"] = company;
            return(Json(company, JsonRequestBehavior.AllowGet));
        }