コード例 #1
0
        public ActionResult Listofvendors(int branchid)
        {
            AllocateActandRuleViewModel model = new AllocateActandRuleViewModel();

            model.BranchId = branchid;
            model.Branch   = new List <Organization>();
            OrgService.OrganizationServiceClient service = new OrgService.OrganizationServiceClient();
            string  xmldata = service.getBranch(model.BranchId);
            DataSet data    = new DataSet();

            data.ReadXml(new StringReader(xmldata));
            model.Branch.Add(new Organization
            {
                Company_Id        = Convert.ToInt32(data.Tables[0].Rows[0]["Org_Hier_ID"]),
                Company_Name      = Convert.ToString(data.Tables[0].Rows[0]["Company_Name"]),
                Parent_Company_Id = Convert.ToInt32(data.Tables[0].Rows[0]["Parent_Company_ID"]),
                logo = Convert.ToString(data.Tables[0].Rows[0]["logo"])
            });
            model.Vendor = new List <Organization>();
            VendorService.VendorServiceClient vendorServiceClient = new VendorService.VendorServiceClient();
            xmldata = vendorServiceClient.GetAssignedVendorsforBranch(branchid);
            DataSet ds = new DataSet();

            ds.ReadXml(new StringReader(xmldata));
            if (ds.Tables.Count > 0)
            {
                foreach (System.Data.DataRow row in ds.Tables[0].Rows)
                {
                    model.Vendor.Add(new Organization {
                        Company_Name = Convert.ToString(row["Company_Name"]), Company_Id = Convert.ToInt32(row["Vendor_ID"]), logo = Convert.ToString(row["logo"])
                    });
                }
            }
            else
            {
                TempData["Message"] = "No Vendors assigned for the selected branch.";
            }
            return(View("_Listofvendorforauditing", model));
        }