public static List <string> GetCountry(string ConnectionString) { UserSessionFacade fac = new UserSessionFacade(ConnectionString); List <CountryEntity> lstCountry = fac.GetCountries(); var Country = (from a in lstCountry select a.CountryWithISOCode).Distinct().ToList(); return(Country); }
public static SelectList GetAllCountry(string ConnectionString) { UserSessionFacade fac = new UserSessionFacade(ConnectionString); List <CountryEntity> lstCountry = fac.GetCountries(); List <SelectListItem> lstAllCountry = new List <SelectListItem>(); foreach (var item in lstCountry) { lstAllCountry.Add(new SelectListItem { Value = item.ISOAlpha2Code, Text = item.CountryWithISOCode }); } return(new SelectList(lstAllCountry, "Value", "Text")); }
public ActionResult popupUserFilter(UserSessionFilterEntity model) { // Save data to database for Session Filter. UserSessionFacade fac = new UserSessionFacade(this.CurrentClient.ApplicationDBConnectionString); int id = model.UserId; model.UserId = Helper.oUser.UserId; fac.InsertOrUpdateUserSessionFilter(model); ViewBag.Message = id > 0 ? "Data created successfully." : "Data updated successfully."; ViewBag.CloseAlert = "<script type='text/javascript'>$(document).ready(function(){parent.backToparent2();});</script>"; TempData.Keep(); return(PartialView("_popupUserFilter", model)); }
public ActionResult popupUserFilterJson(string UserId) { UserSessionFacade fac = new UserSessionFacade(this.CurrentClient.ApplicationDBConnectionString); model = fac.GetUserSessionFilterByUserId(Helper.oUser.UserId); if (model.UserId > 0) { model.OrderByColumn = model.OrderByColumn == null ? "SrcRecordId" : model.OrderByColumn; } else { model = new UserSessionFilterEntity(); model.OrderByColumn = "SrcRecordId"; } TempData.Keep(); return(Json(new { Data = model }, JsonRequestBehavior.AllowGet)); }
public ActionResult popupUserFilter(string UserId) { // Open Session filter popup and set data to Popup UserSessionFacade fac = new UserSessionFacade(this.CurrentClient.ApplicationDBConnectionString); model = fac.GetUserSessionFilterByUserId(Helper.oUser.UserId); if (model.UserId > 0) { model.OrderByColumn = model.OrderByColumn == null ? "SrcRecordId" : model.OrderByColumn; } else { model = new UserSessionFilterEntity(); model.OrderByColumn = "SrcRecordId"; } TempData.Keep(); return(PartialView("_popupUserFilter", model)); }
public ActionResult SaveImportFiler(string ImportProcess, string From) { if (!string.IsNullOrEmpty(ImportProcess)) { ImportProcess = StringCipher.Decrypt(ImportProcess, General.passPhrase); UserSessionFacade fac = new UserSessionFacade(this.CurrentClient.ApplicationDBConnectionString); model = fac.GetUserSessionFilterByUserId(Helper.oUser.UserId); if (model.ImportProcess != ImportProcess) { model.ImportProcess = ImportProcess; fac.InsertOrUpdateUserSessionFilter(model); } } if (From == "MatchData") { return(RedirectToAction("Index", "StewardshipPortal")); } else { return(RedirectToAction("Index", "BadInputData")); } }
public ActionResult FilterCleanData(List <FilterData> filters) { UserSessionFilterEntity filtermodel = new UserSessionFilterEntity(); foreach (var item in filters) { if (item.FieldName == "SrcRecordId") { filtermodel.SrcRecordId = item.FilterValue; } else if (item.FieldName == "CompanyName") { filtermodel.CompanyName = item.FilterValue; } else if (item.FieldName == "City") { filtermodel.City = item.FilterValue; } else if (item.FieldName == "State") { filtermodel.State = item.FilterValue; } else if (item.FieldName == "Country") { filtermodel.CountryISOAlpha2Code = item.FilterValue; } else if (item.FieldName == "ImportProcess") { filtermodel.ImportProcess = item.FilterValue; } else if (item.FieldName == "CountryGroup") { filtermodel.CountryGroupId = Convert.ToInt32(item.FilterValue); } else if (item.FieldName == "Tag") { filtermodel.Tag = item.FilterValue; } else if (item.FieldName == "OrderByColumn") { filtermodel.OrderByColumn = item.FilterValue; } else if (item.FieldName == "ErrorCode") { filtermodel.ErrorCode = item.FilterValue; } } filtermodel.UserId = Helper.oUser.UserId; int pagenumber = 0; if (string.IsNullOrEmpty(Convert.ToString(SessionHelper.BadInputData_IsFirstTimeFilter)) || !SessionHelper.BadInputData_IsFirstTimeFilter) { UserSessionFacade fac = new UserSessionFacade(this.CurrentClient.ApplicationDBConnectionString); fac.InsertOrUpdateUserSessionFilter(filtermodel); pagenumber = 1; } else { if (SessionHelper.BadInputData_IsFirstTimeFilter) { pagenumber = 1; } else { if (!string.IsNullOrEmpty(SessionHelper.CleanMatchPage)) { pagenumber = Convert.ToInt32(SessionHelper.CleanMatchPage); } else { pagenumber = 1; } } } SessionHelper.BadInputData_IsFirstTimeFilter = false; int totalCount = 0; int pagevalue = 0; if (!string.IsNullOrEmpty(SessionHelper.CleanMatchPageNo)) { pagevalue = Convert.ToInt32(SessionHelper.CleanMatchPageNo); } if (pagevalue == null || pagevalue == 0) { SettingFacade sfac = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString); pagevalue = Convert.ToInt32(sfac.GetDefaultPageSize(Helper.oUser.UserId, "BadInputData")); pagevalue = pagevalue == 0 ? 10 : pagevalue; } pagevalue = pagevalue < 5 ? 5 : pagevalue; BadInputDataModel model = new BadInputDataModel(); CompanyFacade cfac = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName); Tuple <List <CompanyEntity>, string> tuplecompany = cfac.GetBIDCompany(Helper.oUser.UserId, 1, pagevalue, out totalCount); model.Companies = tuplecompany.Item1; SessionHelper.CleanQueueMessage = tuplecompany.Item2; SessionHelper.CleanMatchPage = pagenumber.ToString(); SessionHelper.CleanMatchPageNo = Convert.ToString(pagevalue); SessionHelper.CleanTotalCount = Convert.ToString(totalCount); SessionHelper.CleanMatchedCompany = JsonConvert.SerializeObject(model.Companies); IPagedList <CompanyEntity> pagedCompany = new StaticPagedList <CompanyEntity>(model.Companies.ToList(), pagenumber, pagevalue, totalCount);// Set model of Company entity to pass this model to view. return(PartialView("_Index", pagedCompany)); }
public ActionResult GetFilteredCompanyList(int?page, int?sortby, int?sortorder, int?pagevalue, int CompanyMatch = 0, int CityName = 0, int StreetNo = 0, int StateName = 0, int StreetName = 0, int PostalCode = 0, int Telephone = 0, int MatchGrade = 0, string minConfidentCode = "0", string Command = null, bool SelectTopMatch = false, string MatchItemID = null) { UserSessionFacade ufac = new UserSessionFacade(this.CurrentClient.ApplicationDBConnectionString); CompanyFacade fac = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName); // Set page no and Page size for the pagination. if (!string.IsNullOrEmpty(Convert.ToString(TempData["page"]))) { page = Convert.ToInt32(TempData["page"]); } if (!string.IsNullOrEmpty(Convert.ToString(TempData["pageno"]))) { pagevalue = Convert.ToInt32(TempData["pageno"]); } int pageNumber = (page ?? 1); StewardshipPortalModel model = new StewardshipPortalModel(); if (!(sortby.HasValue && sortby.Value > 0)) { sortby = 1; } if (!(sortorder.HasValue && sortorder.Value > 0)) { sortorder = 1; } int sortParam = int.Parse(sortby.ToString() + sortorder.ToString()); int totalCount = 0; if (TempData["TotalCount"] != null) { totalCount = Convert.ToInt32(TempData["TotalCount"]); } int currentPageIndex = page.HasValue ? page.Value : 1; int pageno = pagevalue.HasValue ? pagevalue.Value : 10; pageno = pageno < 5 ? 5 : pageno; ViewBag.SortBy = sortby; ViewBag.SortOrder = sortorder; ViewBag.pagevalue = pagevalue; if (minConfidentCode == "") { minConfidentCode = "0"; } if (minConfidentCode.Contains('.')) { minConfidentCode = minConfidentCode.Substring(0, minConfidentCode.IndexOf('.')); } // Check and filter data from the session Filter. if (TempData["TempCompanies"] != null) { model.Companies = (TempData["TempCompanies"] as List <CompanyEntity>).Copy(); } else { Tuple <List <CompanyEntity>, string> tuplecompany = fac.GetLCMCompany(Helper.oUser.UserId, currentPageIndex, pageno, out totalCount, Helper.IsApprovalScreen); model.Companies = tuplecompany.Item1; TempData["ApproveQueueMessage"] = tuplecompany.Item2; TempData["TempCompanies"] = (model.Companies as List <CompanyEntity>).Copy(); TempData["TotalCount"] = totalCount; } if (sortorder != null && sortby != null) { model.Companies = SortData(model.Companies, Convert.ToInt32(sortorder), Convert.ToInt32(sortby)); } List <CompanyEntity> Companies = new List <CompanyEntity>(); // Set Company matches for the particular company wise. model.Companies = SetOriginalMatchCount(model.Companies); foreach (var co in model.Companies) { List <MatchEntity> matches = (from m in co.Matches where m.DnBConfidenceCode >= Convert.ToInt32(minConfidentCode) where ((CompanyMatch > 0) ? SetMatchGradeFilterString(CompanyMatch).Contains(m.MGCompanyName.ToString()) : m.MGCompanyName.Contains(m.MGCompanyName)) where ((StreetNo > 0) ? SetMatchGradeFilterString(StreetNo).Contains(m.MGStreetNo.ToString()) : m.MGStreetNo.Contains(m.MGStreetNo)) where ((StreetName > 0) ? SetMatchGradeFilterString(StreetName).Contains(m.MGStreetName.ToString()) : m.MGStreetName.Contains(m.MGStreetName)) where ((CityName > 0) ? SetMatchGradeFilterString(CityName).Contains(m.MGCity.ToString()) : m.MGCity.Contains(m.MGCity)) where ((StateName > 0) ? SetMatchGradeFilterString(StateName).Contains(m.MGState.ToString()) : m.MGState.Contains(m.MGState)) where ((Telephone > 0) ? SetMatchGradeFilterString(Telephone).Contains(m.MGTelephone.ToString()) : m.MGTelephone.Contains(m.MGTelephone)) where ((PostalCode > 0) ? SetMatchGradeFilterString(PostalCode).Contains(m.MGZipCode.ToString()) : m.MGZipCode.Contains(m.MGZipCode)) select m).ToList <MatchEntity>(); co.Matches = matches; if (matches.Count == 0) { Companies.Add(co); } } if (Companies != null && Companies.Any()) { foreach (var company in Companies) { model.Companies.Remove(company); } } // if select top 1 match records than select and set first records of each company as selected. if (SelectTopMatch) { model.Companies.ForEach(x => x.Matches.RemoveRange(1, x.Matches.Count - 1)); } if (!string.IsNullOrEmpty(Command)) { if (Command == "Update") { // if Match update than Match set per company. model.Companies.ForEach(x => x.MatchesFiltered = x.Matches); ViewBag.Message = "No record updated."; if (model != null && model.Companies.Any()) { foreach (CompanyEntity company in model.Companies) { if (company.RejectCompany) { RejectMatched(company); } else if (company.SelectedMatchCount > 0) { AcceptedMatched(company); } } } } Tuple <List <CompanyEntity>, string> tuplecompany = fac.GetLCMCompany(Helper.oUser.UserId, pageNumber, pageno, out totalCount, Helper.IsApprovalScreen); model.Companies = tuplecompany.Item1; TempData["ApproveQueueMessage"] = tuplecompany.Item2; if (totalCount <= 0 && model.Companies.Count == 0 && pageNumber > 1) { tuplecompany = fac.GetLCMCompany(Helper.oUser.UserId, pageNumber - 1, pageno, out totalCount, Helper.IsApprovalScreen); model.Companies = tuplecompany.Item1; TempData["ApproveQueueMessage"] = tuplecompany.Item2; TempData["page"] = pageNumber - 1; } model.Companies = SetOriginalMatchCount(model.Companies); TempData["TempCompanies"] = model.Companies; TempData["TotalCount"] = totalCount; if (SelectTopMatch) { model.Companies.ForEach(x => x.Matches.RemoveRange(1, x.Matches.Count - 1)); } } // Set model of Company entity to pass this model to view. IPagedList <CompanyEntity> pagedCompany = new StaticPagedList <CompanyEntity>(model.Companies.ToList(), pageNumber, pageno, totalCount); TempData.Keep(); string ChildViewName = Convert.ToString(Session["ApproveMatchDataCurrentView"]) == "GRID" ? "_Index" : "_panelIndex"; string ViewName = Convert.ToString(Session["ApproveMatchDataCurrentView"]) == "GRID" ? "Index" : "PanelIndex"; if (Request.IsAjaxRequest()) { return(PartialView(ChildViewName, pagedCompany)); } return(View(ViewName, pagedCompany)); }