public JsonResult getdefaultcountry(string compid)
        {
            BranchViewModel branchVM = new BranchViewModel();
            int             ID       = Convert.ToInt32(compid);

            OrgService.OrganizationServiceClient organizationServiceClient = new OrgService.OrganizationServiceClient();
            string  xmldata = organizationServiceClient.getDefaultCompanyDetails(ID);
            DataSet dsDefaultCompanyDetails = new DataSet();

            dsDefaultCompanyDetails.ReadXml(new StringReader(xmldata));
            branchVM.Country = new List <SelectListItem>();
            if (dsDefaultCompanyDetails.Tables.Count > 0)
            {
                branchVM.Country.Add(new SelectListItem()
                {
                    Text = dsDefaultCompanyDetails.Tables[0].Rows[0]["Country_Name"].ToString(), Value = dsDefaultCompanyDetails.Tables[0].Rows[0]["Country_ID"].ToString()
                });
                branchVM.Country.Add(new SelectListItem()
                {
                    Text = dsDefaultCompanyDetails.Tables[0].Rows[0]["State_Name"].ToString(), Value = dsDefaultCompanyDetails.Tables[0].Rows[0]["State_ID"].ToString()
                });
                branchVM.Country.Add(new SelectListItem()
                {
                    Text = dsDefaultCompanyDetails.Tables[0].Rows[0]["City_Name"].ToString(), Value = dsDefaultCompanyDetails.Tables[0].Rows[0]["City_ID"].ToString()
                });
            }
            return(Json(branchVM.Country, JsonRequestBehavior.AllowGet));
        }
        public JsonResult getyear(int compid, int compliancetypeid)
        {
            int             sd    = 0;
            int             ed    = 0;
            List <string>   years = new List <string>();
            ReportViewModel model = new ReportViewModel();

            OrgService.OrganizationServiceClient organizationservice = new OrgService.OrganizationServiceClient();
            string  strxmlcompliancetype = organizationservice.GetParticularCompliance(compliancetypeid);
            DataSet dsComplianceType     = new DataSet();

            dsComplianceType.ReadXml(new StringReader(strxmlcompliancetype));
            if (dsComplianceType.Tables.Count > 0)
            {
                string   ComplianceName = Convert.ToString(dsComplianceType.Tables[0].Rows[0]["Compliance_Type_Name"]);
                DateTime StartDate      = Convert.ToDateTime(dsComplianceType.Tables[0].Rows[0]["Start_Date"]);
                DateTime EndDate        = Convert.ToDateTime(dsComplianceType.Tables[0].Rows[0]["End_date"]);

                sd = StartDate.Year;
                ed = EndDate.Year;
            }

            string  strxmlyear = organizationservice.getDefaultCompanyDetails(compid);
            DataSet dsyear     = new DataSet();

            dsyear.ReadXml(new StringReader(strxmlyear));
            if (dsyear.Tables.Count > 0)
            {
                model.StartDate = Convert.ToDateTime(dsyear.Tables[0].Rows[0]["Calender_StartDate"]);
                model.yearid    = model.StartDate.Year;
                if (sd == ed)
                {
                    model.years = Enumerable.Range(model.yearid, DateTime.Now.Year - (model.yearid - 1)).OrderByDescending(i => i);
                    //model.yearid = DateTime.Now.Year;
                }
                else
                {
                    int count = DateTime.Now.Year - (model.yearid - 1);
                    for (int i = 1; i <= count; i++)
                    {
                        years.Add(model.yearid.ToString() + "-" + (model.yearid + 1));
                        ++model.yearid;
                    }
                    years.Reverse();

                    return(Json(years, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(model.years, JsonRequestBehavior.AllowGet));
        }
        public JsonResult getCompanyDetailsfroVendor(int compid, string industrytypeid)
        {
            int industryTypeID = 0;

            if (industrytypeid != "")
            {
                industryTypeID = Convert.ToInt32(industrytypeid);
            }
            List <SelectListItem> compliance = new List <SelectListItem>();
            VendorViewModel       vendorVM   = new VendorViewModel();

            vendorVM.location = new BranchLocation();
            OrgService.OrganizationServiceClient organizationservice = new OrgService.OrganizationServiceClient();
            string  strXMLCompanyDetails = organizationservice.getDefaultCompanyDetails(compid);
            DataSet dsCompanyDetails     = new DataSet();

            dsCompanyDetails.ReadXml(new StringReader(strXMLCompanyDetails));
            if (dsCompanyDetails.Tables.Count > 0)
            {
                vendorVM.location.Country_Id  = Convert.ToInt32(dsCompanyDetails.Tables[0].Rows[0]["Country_ID"]);
                vendorVM.location.State_Id    = Convert.ToInt32(dsCompanyDetails.Tables[0].Rows[0]["State_ID"]);
                vendorVM.location.City_Id     = Convert.ToInt32(dsCompanyDetails.Tables[0].Rows[0]["City_ID"]);
                vendorVM.location.Postal_Code = Convert.ToString(dsCompanyDetails.Tables[0].Rows[0]["Postal_Code"]);
                string  strCompliances = organizationservice.GetComplianceType(industryTypeID, vendorVM.location.Country_Id);
                DataSet dsCompliances  = new DataSet();
                dsCompliances.ReadXml(new StringReader(strCompliances));
                if (dsCompliances.Tables.Count > 0)
                {
                    foreach (System.Data.DataRow row in dsCompliances.Tables[0].Rows)
                    {
                        compliance.Add(new SelectListItem()
                        {
                            Text = row["Compliance_Type_Name"].ToString(), Value = row["Compliance_Type_ID"].ToString()
                        });
                    }
                }
            }
            return(Json(compliance, JsonRequestBehavior.AllowGet));
        }