public ActionResult AddNote() { TempData.Keep(); IEnumerable<GeneralModel> NoteTypes = new CommonFunctions().RetrieveGeneralTypes("1011"); ViewBag.NoteTypes = new SelectList(NoteTypes, "keyId", "description"); return PartialView("AddNote"); }
public ActionResult CompleteMerchant(MerchantsModel obj, FormCollection obj1) { ViewBag.BusinessTypes = new CommonFunctions().RetrieveGeneralTypes("1002"); //ViewBag.BusinessTypes = new CommonFunctions().RetrieveGeneralTypes("1002"); //IEnumerable<GeneralModel> gm = ((List<GeneralModel>)ViewBag.BusinessTypes).Where(o => o.keyId == obj.businessTypeId); if (ModelState.IsValid) { var merchantid = Request["merchantid"] ?? ""; MerchantTempModel objMerchant = new MerchantTempModel(); objMerchant.businessName = obj.businessName; objMerchant.legalName = obj.legalName; objMerchant.businessTypeId = obj.businessTypeId; objMerchant.businessStartDate = Convert.ToDateTime(obj.businessStartDate); objMerchant.rnc = obj.rnc; objMerchant.industryTypeid = Convert.ToInt32(obj.industryTypeId); objMerchant.ownerName = obj.ownerName; objMerchant.salesRepId = Convert.ToInt32(obj.salesRepId); objMerchant.userId = CurrentUserID; string merchant = null; if (Session["dupmerchantid"] != null) { if (!string.IsNullOrEmpty(Session["dupmerchantid"].ToString()) && Session["dupmerchantid"].ToString() != "0") { objMerchant.IsDuplicate = true; } else objMerchant.IsDuplicate = false; } else objMerchant.IsDuplicate = false; using (var client = new HttpClient()) { string baseAddress = System.Configuration.ConfigurationManager.AppSettings["APIURI"]; client.BaseAddress = new Uri(baseAddress); string restResponse = "merchants/temp/" + CurrentMerchantID + "?isCompleted=1"; var response = client.PutAsJsonAsync(restResponse, objMerchant).Result; Dictionary<string, string> values = JsonConvert.DeserializeObject<Dictionary<string, string>>(response.Content.ReadAsStringAsync().Result); merchant = values["merchantid"]; if (response.StatusCode == HttpStatusCode.OK) ViewBag.SuccessMsg = "Merchant Completed Successfully"; } //string url = string.Format("?merchantid=" + CurrentMerchantID); //return Redirect(url); long uMerchatntId; long.TryParse(merchant, out uMerchatntId); Pecuniaus.UICore.SessionHelper.SetCurrentMerchant(uMerchatntId); Session["dupmerchantid"] = "0"; return RedirectToAction("Index", "Merchant", new { merchantid = merchant }); } IEnumerable<GeneralModel> Industries = new CommonFunctions().RetrieveGeneralTypes("1001"); ViewBag.IndustryTypes = new SelectList(Industries, "keyId", "description"); IEnumerable<SalesRepresentativeModel> SalesRep = new CommonFunctions().RetrieveSalesRep(""); ViewBag.SalesRep = new SelectList(SalesRep, "salesRepId", "fullName"); return View("Index"); }
public ActionResult Index() { //Setting UserID string Querymerchantid = Request.QueryString["dupmerchantid"] ?? ""; if (!string.IsNullOrEmpty(Querymerchantid) && Querymerchantid != "0") { Session["dupmerchantid"] = Querymerchantid; } ViewBag.BaseURL = System.Configuration.ConfigurationManager.AppSettings["APIURI"]; IEnumerable<GeneralModel> Industries = new CommonFunctions().RetrieveGeneralTypes("1001"); ViewBag.IndustryTypes = new SelectList(Industries, "keyId", "description"); IEnumerable<SalesRepresentativeModel> SalesRep = new CommonFunctions().RetrieveSalesRep(""); var selectedSalesResp = SalesRep.FirstOrDefault(a => a.UserId == base.CurrentUserID); long seleSalesRepId = 0; if (selectedSalesResp != null) { seleSalesRepId = selectedSalesResp.salesRepId; } ViewBag.SalesRep = new SelectList(SalesRep, "salesRepId", "fullName", seleSalesRepId); ViewBag.APIURI = System.Configuration.ConfigurationManager.AppSettings["APIURI"]; if (base.CurrentMerchantID != 0) { MerchantsModel result = GetMerchantInfo(base.CurrentMerchantID); return View("Index", result); } else return View(new MerchantsModel { merchantId = 0 }); }