public ActionResult selectbranch(AuditorpageViewModel model) { model.companyList = new List <SelectListItem>(); model.BranchList = new List <SelectListItem>(); model.VendorList = new List <Organization>(); OrgService.OrganizationServiceClient client = new OrgService.OrganizationServiceClient(); int groupid = Convert.ToInt32(Session["GroupCompanyId"]); string xmldata = client.getCompanyListDropDown(groupid); DataSet ds = new DataSet(); ds.ReadXml(new StringReader(xmldata)); model.companyList = new List <SelectListItem>(); if (ds.Tables.Count > 0) { foreach (System.Data.DataRow row in ds.Tables[0].Rows) { model.companyList.Add(new SelectListItem { Text = Convert.ToString(row["Company_Name"]), Value = Convert.ToString(row["Org_Hier_ID"]) }); } } model.BranchList = new List <SelectListItem>(); xmldata = client.GeSpecifictBranchList(model.companyid); ds = new DataSet(); ds.ReadXml(new StringReader(xmldata)); if (ds.Tables.Count > 0) { foreach (System.Data.DataRow row in ds.Tables[0].Rows) { model.BranchList.Add(new SelectListItem { Text = Convert.ToString(row["Company_Name"]), Value = Convert.ToString(row["Org_Hier_ID"]) }); } } VendorService.VendorServiceClient vendorServiceClient = new VendorService.VendorServiceClient(); xmldata = vendorServiceClient.GetAssignedVendorsforBranch(model.branchid); ds = new DataSet(); ds.ReadXml(new StringReader(xmldata)); if (ds.Tables.Count > 0) { foreach (System.Data.DataRow row in ds.Tables[0].Rows) { model.VendorList.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("_SelectBranch", model)); }
public ActionResult SMEdashboard(AllocateActandRuleViewModel model) { model.Companylist = new List <SelectListItem>(); OrgService.OrganizationServiceClient client = new OrgService.OrganizationServiceClient(); int groupid = Convert.ToInt32(Session["GroupCompanyId"]); string xmldata = client.getCompanyListDropDown(groupid); DataSet ds = new DataSet(); ds.ReadXml(new StringReader(xmldata)); model.Companylist = new List <SelectListItem>() { new SelectListItem { Text = "--Select Company--", Value = "0" } }; if (ds.Tables.Count > 0) { foreach (System.Data.DataRow row in ds.Tables[0].Rows) { model.Companylist.Add(new SelectListItem { Text = Convert.ToString(row["Company_Name"]), Value = Convert.ToString(row["Org_Hier_ID"]) }); } } model.Branch = new List <Organization>(); xmldata = client.GeSpecifictBranchList(model.CompanyId); ds = new DataSet(); ds.ReadXml(new StringReader(xmldata)); if (ds.Tables.Count > 0) { foreach (System.Data.DataRow row in ds.Tables[0].Rows) { model.Branch.Add(new Organization { Company_Name = Convert.ToString(row["Company_Name"]), Company_Id = Convert.ToInt32(row["Org_Hier_ID"]) }); //model.BranchList.Add(new SelectListItem { Text = Convert.ToString(row["Company_Name"]), Value = Convert.ToString(row["Org_Hier_ID"]) }); } } return(View("_SMEDashboard", model)); }
public ActionResult SMEdashboard() { AllocateActandRuleViewModel model = new AllocateActandRuleViewModel(); OrgService.OrganizationServiceClient client = new OrgService.OrganizationServiceClient(); int groupid = Convert.ToInt32(Session["GroupCompanyId"]); string xmldata = client.getCompanyListDropDown(groupid); DataSet ds = new DataSet(); ds.ReadXml(new StringReader(xmldata)); model.Companylist = new List <SelectListItem>() { new SelectListItem { Text = "--Select Company--", Value = "0" } }; if (ds.Tables.Count > 0) { model.CompanyId = Convert.ToInt32(ds.Tables[0].Rows[0]["Org_Hier_ID"]); foreach (System.Data.DataRow row in ds.Tables[0].Rows) { model.Companylist.Add(new SelectListItem { Text = Convert.ToString(row["Company_Name"]), Value = Convert.ToString(row["Org_Hier_ID"]) }); } } model.Branch = new List <Organization>(); OrgService.OrganizationServiceClient organizationservice = new OrgService.OrganizationServiceClient(); string strxmlCompanies = organizationservice.GeSpecifictBranchList(model.CompanyId); DataSet dsSpecificBranchList = new DataSet(); dsSpecificBranchList.ReadXml(new StringReader(strxmlCompanies)); if (dsSpecificBranchList.Tables.Count > 0) { foreach (System.Data.DataRow row in dsSpecificBranchList.Tables[0].Rows) { model.Branch.Add(new Organization { Company_Name = Convert.ToString(row["Company_Name"]), Company_Id = Convert.ToInt32(row["Org_Hier_ID"]) }); } } else { ViewBag.Message = ConfigurationManager.AppSettings["No_Branches"]; } //model.Vendor = new List<Organization>(); //xmldata = organizationservice.GetVendors(model.CompanyId); //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["Org_Hier_ID"]) }); // } //} return(View("_SMEDashboard", model)); }