Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        public ActionResult Reset(string uid)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            mUser User = new mUser();

            try
            {
                using (Models.MerchantService db = new Models.MerchantService())
                {
                    t_Users u = new t_Users();
                    u           = db.t_Users.Where(x => x.UserID == uid).SingleOrDefault();
                    User.UserID = u.UserID;
                    //User.Passwd = u.Passwd;
                }
            }
            catch (Exception ex)
            {
                TempData["StatusMessage"] = ex.Message;
                TempData.Keep();
            }
            return(View(User));
        }
Ejemplo n.º 3
0
        public ActionResult Create(mUser User)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            try
            {
                using (Models.MerchantService db = new Models.MerchantService())
                {
                    t_Users user = new t_Users();
                    user.StaffID    = User.StaffID;
                    user.UserID     = User.UserID;
                    user.Passwd     = mUser.EncryptPassword(User.Passwd);
                    user.UserLevel  = User.UserLevel;
                    user.AdminLogin = User.AdminLogin;

                    db.t_Users.Add(user);
                    db.SaveChanges();

                    TempData["StatusMessage"] = "Success";
                    TempData.Keep();
                }
            }
            catch (Exception ex)
            {
                TempData["StatusMessage"] = ex.Message;
                TempData.Keep();
            }
            return(View("Create"));
        }
Ejemplo n.º 4
0
        public ActionResult ViewDetails(string staffid)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            if (staffid == null)
            {
                return(new HttpStatusCodeResult(400));
            }

            mStaff s = new mStaff();

            try
            {
                int id = int.Parse(staffid);
                using (Models.MerchantService db = new Models.MerchantService())
                {
                    v_Staff staff = db.v_Staff.Where(x => x.StaffID == id).SingleOrDefault();
                    s.StaffID    = staff.StaffID;
                    s.StaffName  = staff.StaffName;
                    s.Department = staff.Department;
                    s.Office     = staff.Office;
                }
            }
            catch (Exception ex)
            {
                TempData["StatusMessage"] = ex.Message;
            }
            return(View(s));
        }
Ejemplo n.º 5
0
        internal JsonResult RetrieveMerchantInfo(string mid)
        {
            v_Merchant m = new v_Merchant();

            using (MerchantService.Models.MerchantService db = new Models.MerchantService())
            {
                m = db.v_Merchant.Where(x => x.MPU_Merchant_ID == mid && x.MStatusID == 100).SingleOrDefault();
            }

            return(Json(new { success = true, merchant = m }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        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"));
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        public ActionResult Update(string staffid)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            mStaff Mstaff = new mStaff();

            if (staffid == null)
            {
                return(new HttpStatusCodeResult(statusCode: 400));
            }

            int staff_id = int.Parse(staffid);

            try
            {
                using (Models.MerchantService db = new Models.MerchantService())
                {
                    //Load data for dropdown list
                    List <t_Department> departments = new List <t_Department>();
                    departments = db.t_Department.ToList();

                    List <t_Office> Offices = new List <t_Office>();
                    Offices = db.t_Office.ToList();

                    ViewBag.DepartmentList = departments;
                    ViewBag.OfficeList     = Offices;


                    t_Staff staff = db.t_Staff.Where(x => x.StaffID == staff_id).SingleOrDefault();
                    Mstaff.StaffID      = staff.StaffID;
                    Mstaff.StaffName    = staff.StaffName;
                    Mstaff.DepartmentID = staff.DepartmentID;
                    Mstaff.OfficeID     = staff.OfficeID;
                }
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                TempData.Keep();
            }
            return(View(Mstaff));
        }
Ejemplo n.º 9
0
        // GET: User
        public ActionResult Index(string keywordsearch)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }
            List <mUser> users = new List <mUser>();

            using (Models.MerchantService db = new Models.MerchantService())
            {
                List <v_UserInfo> userinfos = db.v_UserInfo.Where(x => x.StaffName.Contains(keywordsearch) || keywordsearch == null).ToList();
                users = userinfos.Select(x => new mUser {
                    StaffID = x.StaffID, StaffName = x.StaffName, DepartmentID = x.DepartmentID, Department = x.Department, OfficeID = x.OfficeID, Office = x.Office, UserID = x.UserID, UserLevel = x.UserLevel, AdminLogin = x.AdminLogin
                }).ToList();
            }

            return(View(users));
        }
Ejemplo n.º 10
0
        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 }));
        }
Ejemplo n.º 11
0
        public ActionResult ChooseStaff()
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(new HttpStatusCodeResult(400));
            }
            List <mStaff> s = new List <mStaff>();

            using (Models.MerchantService db = new Models.MerchantService())
            {
                List <v_Staff> staffs = new List <v_Staff>();
                staffs = db.v_Staff.ToList();

                s = staffs.Select(x => new mStaff {
                    StaffID = x.StaffID, StaffName = x.StaffName, Department = x.Department, Office = x.Office
                }).ToList();
            }
            return(View(s));
        }
Ejemplo n.º 12
0
        public ActionResult Update(mStaff Staff)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            mStaff Mstaff = new mStaff();

            try
            {
                using (Models.MerchantService db = new Models.MerchantService())
                {
                    //Load data for dropdown list
                    List <t_Department> departments = new List <t_Department>();
                    departments = db.t_Department.ToList();

                    List <t_Office> Offices = new List <t_Office>();
                    Offices = db.t_Office.ToList();

                    ViewBag.DepartmentList = departments;
                    ViewBag.OfficeList     = Offices;

                    //update info call procedure
                    bool is_success = Staff.UpdateStaffInfo();
                    if (is_success)
                    {
                        TempData["StatusMessage"] = "Success";
                    }
                    else
                    {
                        TempData["StatusMessage"] = "Error";
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                TempData.Keep();
            }

            return(View());
        }
Ejemplo n.º 13
0
        // GET: Staff
        public ActionResult Index(string keywordsearch)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            List <mStaff> StaffList = new List <mStaff>();

            using (MerchantService.Models.MerchantService db = new Models.MerchantService())
            {
                List <v_Staff> Staffs = db.v_Staff.Where(x => x.StaffName.Contains(keywordsearch) || keywordsearch == null).ToList();
                StaffList = Staffs.Select(x => new mStaff {
                    StaffID = x.StaffID, StaffName = x.StaffName, DepartmentID = x.DepartmentID, Department = x.Department, OfficeID = x.OfficeID, Office = x.Office
                }).ToList();
            }

            return(View(StaffList));
        }
Ejemplo n.º 14
0
        public ActionResult AddStaff()
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            using (MerchantService.Models.MerchantService db = new Models.MerchantService())
            {
                List <t_Department> departments = new List <t_Department>();
                departments = db.t_Department.ToList();

                List <t_Office> Offices = new List <t_Office>();
                Offices = db.t_Office.ToList();

                ViewBag.DepartmentList = departments;
                ViewBag.OfficeList     = Offices;
            }
            return(View());
        }
Ejemplo n.º 15
0
        public bool Check(string staffid, string uid)
        {
            bool isPass = false;

            using (Models.MerchantService db = new Models.MerchantService())
            {
                t_Users u = new t_Users();
                u = db.t_Users.Where(x => x.UserID == uid).SingleOrDefault();

                if (u != null)
                {
                    isPass = false;
                }
                else
                {
                    isPass = true;
                }
            }
            return(isPass);
        }
        public PartialViewResult ActiveMerchantResult(DateTime startdate, DateTime enddate)
        {
            if (HttpContext.Session["UID"] == null)
            {
                TempData["ErrorMessage"] = "Session Error";
                TempData.Keep();
                return(PartialView());
            }

            using (Models.MerchantService db = new Models.MerchantService())
            {
                List <mMerchant> merchantList = getActiveMerchant(startdate, enddate);

                ViewBag.MerchantVB = merchantList;

                ViewData["startdate"] = startdate.Date;
                ViewData["enddate"]   = enddate.Date;
            }
            return(PartialView());
        }
        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));
        }
Ejemplo n.º 18
0
        public ActionResult Edit(string uid)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            mUser user = new mUser();

            using (Models.MerchantService db = new Models.MerchantService())
            {
                t_Users u = new t_Users();
                u = db.t_Users.Where(x => x.UserID == uid).SingleOrDefault();

                user.UserID     = u.UserID;
                user.AdminLogin = u.AdminLogin;
                user.UserLevel  = u.UserLevel;
            }

            return(View(user));
        }
Ejemplo n.º 19
0
        public ActionResult AddStaff(mStaff Staff)
        {
            if (HttpContext.Session["AID"] == null)
            {
                return(RedirectToAction("AdminLogin", "Portal", null));
            }

            using (MerchantService.Models.MerchantService db = new Models.MerchantService())
            {
                //Insert To Table
                try
                {
                    t_Staff Tstaff = new t_Staff();
                    Tstaff.StaffName    = Staff.StaffName;
                    Tstaff.DepartmentID = Staff.DepartmentID;
                    Tstaff.OfficeID     = Staff.OfficeID;

                    db.t_Staff.Add(Tstaff);
                    db.SaveChanges();
                    TempData["StatusMessage"] = "Success";
                    TempData.Keep();
                }
                catch (Exception ex)
                {
                    TempData["StatusMessage"] = ex.Message;
                    TempData.Keep();
                }

                //Load data for dropdown list
                List <t_Department> departments = new List <t_Department>();
                departments = db.t_Department.ToList();

                List <t_Office> Offices = new List <t_Office>();
                Offices = db.t_Office.ToList();

                ViewBag.DepartmentList = departments;
                ViewBag.OfficeList     = Offices;
            }
            return(View());
        }
Ejemplo n.º 20
0
        // 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));
        }
Ejemplo n.º 21
0
        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());
        }
Ejemplo n.º 22
0
        internal FileResult ExportExcel()
        {
            if (HttpContext.Session["UID"] != null)
            {
                List <v_Merchant> merchant_list = new List <v_Merchant>();
                using (MerchantService.Models.MerchantService db = new Models.MerchantService())
                {
                    merchant_list = db.v_Merchant.ToList();
                }
                ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
                ExcelPackage   Ep    = new ExcelPackage();
                ExcelWorksheet Sheet = Ep.Workbook.Worksheets.Add("Report");
                Sheet.Cells["A1"].Value = "MID";
                Sheet.Cells["B1"].Value = "Merchant";
                Sheet.Cells["C1"].Value = "Phone";
                Sheet.Cells["D1"].Value = "Email";
                Sheet.Cells["E1"].Value = "Address";
                Sheet.Cells["F1"].Value = "MPU Rate";
                Sheet.Cells["G1"].Value = "UPI Rate";
                Sheet.Cells["H1"].Value = "JCB Rate";
                Sheet.Cells["I1"].Value = "MPU(on us) Rate";
                Sheet.Cells["J1"].Value = "UPI(on us) Rate";
                Sheet.Cells["K1"].Value = "JCB(on us) Rate";
                Sheet.Cells["L1"].Value = "Settlement Account";
                Sheet.Cells["M1"].Value = "Account Name";
                int row = 2;
                foreach (var item in merchant_list)
                {
                    Sheet.Cells[string.Format("A{0}", row)].Value = item.MPU_Merchant_ID;
                    Sheet.Cells[string.Format("B{0}", row)].Value = item.Merchant_Name;
                    Sheet.Cells[string.Format("C{0}", row)].Value = item.Merchant_Phone;
                    Sheet.Cells[string.Format("D{0}", row)].Value = item.Merchant_Email;
                    Sheet.Cells[string.Format("E{0}", row)].Value = item.Merchant_Address;
                    Sheet.Cells[string.Format("F{0}", row)].Value = item.MPURate;
                    Sheet.Cells[string.Format("G{0}", row)].Value = item.UPIRate;
                    Sheet.Cells[string.Format("H{0}", row)].Value = item.JCBRate;
                    Sheet.Cells[string.Format("I{0}", row)].Value = item.OMPURate;
                    Sheet.Cells[string.Format("J{0}", row)].Value = item.OUPIRate;
                    Sheet.Cells[string.Format("K{0}", row)].Value = item.OJCBRate;
                    Sheet.Cells[string.Format("L{0}", row)].Value = item.Settlement_Acc;
                    Sheet.Cells[string.Format("M{0}", row)].Value = item.SettAccountName;
                    row++;
                }


                Sheet.Cells["A:AZ"].AutoFitColumns();
                //Response.Clear();
                //Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                //Response.AddHeader("content-disposition", "attachment: filename=" + "MerchantList.xlsx");
                //Response.BinaryWrite(Ep.GetAsByteArray());
                //Response.End();

                var FileByteArray = Ep.GetAsByteArray();

                return(File(FileByteArray, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "MerchantList.xlsx"));
            }
            else
            {
                return(File(new Byte[0], "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "MerchantList.xlsx"));
            }
        }