public ActionResult UpdateMerchantInfo(string id) { if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Portal", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } if (id == null) { return(new HttpStatusCodeResult(statusCode: 400)); } //Business Category for dropdown List <t_BusinessCategory> category_list = new List <t_BusinessCategory>(); using (Models.MerchantService db = new Models.MerchantService()) { category_list = db.t_BusinessCategory.ToList(); } ViewBag.Category = category_list; //Get Merchant Info mMerchant merchantinfo = new mMerchant(); try { using (Models.MerchantService db = new Models.MerchantService()) { t_Merchant_Info merch_info = db.t_Merchant_Info.Where(x => x.MPU_Merchant_ID == id).FirstOrDefault(); merchantinfo.MPU_Merchant_ID = merch_info.MPU_Merchant_ID; merchantinfo.Merchant_Name = merch_info.Merchant_Name; merchantinfo.Merchant_Address = merch_info.Merchant_Address; merchantinfo.Merchant_Email = merch_info.Merchant_Email; merchantinfo.Merchant_Phone = merch_info.Merchant_Phone; merchantinfo.OMPURate = merch_info.OMPURate; merchantinfo.OJCBRate = merch_info.OJCBRate; merchantinfo.OUPIRate = merch_info.OUPIRate; merchantinfo.MPURate = merch_info.MPURate; merchantinfo.JCBRate = merch_info.JCBRate; merchantinfo.UPIRate = merch_info.UPIRate; merchantinfo.Settlement_Acc = merch_info.Settlement_Acc; merchantinfo.SettAccountName = merch_info.SettAccountName; merchantinfo.BusinessCategoryID = merch_info.BusinessCategoryID; } return(View(merchantinfo)); } catch (Exception ex) { TempData["Message"] = ex.Message; TempData.Keep(); return(View()); } }
public ActionResult AddMerchant(mMerchant model) { if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Portal", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } try { using (Models.MerchantService db = new Models.MerchantService()) { t_Merchant_Info merchant = new t_Merchant_Info(); merchant.MPU_Merchant_ID = model.MPU_Merchant_ID; merchant.Merchant_Name = model.Merchant_Name; merchant.Merchant_Phone = model.Merchant_Phone; merchant.Merchant_Email = model.Merchant_Email; merchant.Merchant_Address = model.Merchant_Address; merchant.OMPURate = model.OMPURate; merchant.OJCBRate = model.OJCBRate; merchant.OUPIRate = model.OUPIRate; merchant.MPURate = model.MPURate; merchant.JCBRate = model.JCBRate; merchant.UPIRate = model.UPIRate; merchant.Settlement_Acc = model.Settlement_Acc; merchant.SettAccountName = model.SettAccountName; merchant.BusinessCategoryID = model.BusinessCategoryID; merchant.MStatusID = 100; merchant.CreationDate = DateTime.Now.Date; db.t_Merchant_Info.Add(merchant); db.SaveChanges(); TempData["Message"] = "Saved"; TempData.Keep(); } } catch (Exception ex) { TempData["Message"] = ex.InnerException.InnerException.Message; TempData.Keep(); } return(RedirectToAction("CreateMerchant")); }
public ActionResult Termination() { if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Portal", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } return(View()); }
public ActionResult ViewDetails(string merchantid) { if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Portal", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } mMerchant merchant = new mMerchant(); if (merchantid != null) { try { using (Models.MerchantService db = new Models.MerchantService()) { v_Merchant merchant_info = new v_Merchant(); merchant_info = db.v_Merchant.Where(x => x.MPU_Merchant_ID == merchantid).SingleOrDefault(); merchant.MPU_Merchant_ID = merchant_info.MPU_Merchant_ID; merchant.Merchant_Name = merchant_info.Merchant_Name; merchant.Merchant_Address = merchant_info.Merchant_Address; merchant.Merchant_Email = merchant_info.Merchant_Email; merchant.Merchant_Phone = merchant_info.Merchant_Phone; merchant.OMPURate = merchant_info.OMPURate; merchant.OJCBRate = merchant_info.OJCBRate; merchant.OUPIRate = merchant_info.OUPIRate; merchant.MPURate = merchant_info.MPURate; merchant.JCBRate = merchant_info.JCBRate; merchant.UPIRate = merchant_info.UPIRate; merchant.Settlement_Acc = merchant_info.Settlement_Acc; merchant.SettAccountName = merchant_info.SettAccountName; merchant.BusinessCategoryID = merchant_info.BusinessCategoryID; merchant.BusinessCategory = merchant_info.BusinessCategory; } } catch (Exception ex) { TempData["Message"] = ex.Message; TempData.Keep(); } } return(View(merchant)); }
public ActionResult TerminateMerchant(string mid) { if (HttpContext.Session["UID"] == null) { return(Json(new { success = true, msg = "Session Error" }, JsonRequestBehavior.AllowGet)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } return(Terminate(mid)); }
public ActionResult ExportMerchant() { if (HttpContext.Session["UID"] != null) { mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } return(ExportExcel()); } else { return(RedirectToAction("Index", "Portal", null)); } }
public ActionResult UpdateMerchant(mMerchant model) { if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Portal", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } try { using (Models.MerchantService db = new Models.MerchantService()) { //Call Update Method mMerchant merchant = new mMerchant(); merchant.UpdateMerchant(model); TempData["Message"] = "Success"; TempData.Keep(); } } catch (Exception ex) { TempData["Message"] = ex.Message; TempData.Keep(); } //Business Category for dropdown List <t_BusinessCategory> category_list = new List <t_BusinessCategory>(); using (Models.MerchantService db = new Models.MerchantService()) { category_list = db.t_BusinessCategory.ToList(); } ViewBag.Category = category_list; return(RedirectToAction("UpdateMerchantInfo", new { id = model.MPU_Merchant_ID })); }
public ActionResult Delete(string[] trxid) { var data = new { status = "", message = "" }; if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Portal", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 2)) { return(RedirectToAction("Denied", "Portal", null)); } if (trxid == null) { data = new { status = "ok", message = "Invalid TRXID" }; } try { ViewBag.TRXId = trxid; string uid = Session["UID"].ToString(); for (int i = 0; i < trxid.Length; i++) { string tx = trxid[i]; mTransaction t = new mTransaction(); t.TrxID = int.Parse(tx); t.Delete(uid); } var message = String.Format("No of Transactions : {0} had been deleted...", trxid.Length); data = new { status = "ok", message = message }; } catch (Exception ex) { data = new { status = "ok", message = "Transaction List is empty or\n" + ex.Message }; } return(Json(data, JsonRequestBehavior.AllowGet)); }
public PartialViewResult TRX_PartialView(string trxdate, string TrxType) { List <mTransaction> trx_list = new List <mTransaction>(); ViewBag.TrxType = TrxType; ViewBag.TrxDate = trxdate; if (HttpContext.Session["UID"] == null) { TempData["ErrorMessage"] = "Session Error"; TempData.Keep(); return(PartialView(trx_list)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 2)) { TempData["ErrorMessage"] = "Access Denied"; TempData.Keep(); return(PartialView(trx_list)); } try { DateTime trxDate = Convert.ToDateTime(trxdate); using (Models.MerchantService db = new Models.MerchantService()) { List <t_Transactions> ts = new List <t_Transactions>(); ts = db.t_Transactions.Where(x => x.TrxDate == trxDate && x.RecordType == TrxType).ToList(); trx_list = ts.Select(x => new mTransaction { TrxID = x.TrxID, TrxDate = x.TrxDate, MPU_Merchant_ID = x.MPU_Merchant_ID, CardNo = x.CardNo, CardType = x.CardType, TRXMDRRate = x.TRXMDRRate, TrxAmount = x.TrxAmount, SettAmount = x.SettAmount, ProcessingCode = x.ProcessingCode, TerminalID = x.TerminalID, RecordType = x.RecordType }).ToList(); } } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; TempData.Keep(); } return(PartialView(trx_list)); }
// GET: Merchant public ActionResult Index(string keyworksearch) { if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Portal", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } List <v_Merchant> merchant_list = new List <v_Merchant>(); using (MerchantService.Models.MerchantService db = new Models.MerchantService()) { merchant_list = db.v_Merchant.Where(x => x.Merchant_Name.Contains(keyworksearch) || keyworksearch == null).ToList(); } return(View(merchant_list)); }
public ActionResult CreateMerchant() { if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Merchant", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 1)) { return(RedirectToAction("Denied", "Portal", null)); } //Business Category for dropdown List <t_BusinessCategory> category_list = new List <t_BusinessCategory>(); using (Models.MerchantService db = new Models.MerchantService()) { category_list = db.t_BusinessCategory.ToList(); } ViewBag.Category = category_list; return(View()); }
public ActionResult Index(HttpPostedFileBase postedFile, string chkType) { if (HttpContext.Session["UID"] == null) { return(RedirectToAction("Index", "Portal", null)); } mUser u = new mUser(); if (!u.check_user_right(Session["UID"].ToString(), 2)) { return(RedirectToAction("Denied", "Portal", null)); } // ViewBag.ChkType = chkType; //Transaction List to get return value and return to view List <mTransaction> Tran_List = new List <mTransaction>(); if (postedFile != null) { //Set FileName For View ViewBag.FileName = postedFile.FileName; //Get Filename , upload to server's Temp dir var filename = Path.GetFileName(postedFile.FileName); var filepath = Path.Combine(Server.MapPath("~/Temp"), filename); if (!Directory.Exists(Server.MapPath("~/Temp"))) { Directory.CreateDirectory(Server.MapPath("~/Temp")); } postedFile.SaveAs(filepath); //determine inc or bcom (old file or new file) if (chkType == "inc") { //Get return value from Function Tran_List = ReadJCB_INC(filepath); } else if (chkType == "bcom") { } } if (Global_Error == true) { //Clear Readed data not to pass to view if there is error. Otherwise user can click submit. Tran_List = new List <mTransaction>(); } else { //Insert data to database foreach (mTransaction t in Tran_List) { bool isSuccess = t.InsertTran(); if (!isSuccess) { TempData["TRX_Message"] = "Error on inserting"; TempData.Keep(); //break; } else { TempData["TRX_Message"] = "Successfully Inserted"; } } } return(View()); }