Exemplo n.º 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));
        }