Exemple #1
0
        public async Task <ActionResult> Index(string m)
        {
            //ViewBag.RoleId = roleId;
            //ViewBag.MenuId = menuId;
            try
            {
                // GetMenuId();
                menuId = SmartUtil.GetMenuId(m);
                if (menuId == 0)
                {
                    return(RedirectToAction("Error", "Home"));
                }
                ViewBag.MenuId = menuId;
                var rec = await _repo.GetCompanyProfileAsync(0, false);

                var country = await _repo.GetCountryAsync(0, true, "Active");

                ViewBag.Country = new SelectList(country, "COUNTRY_CODE", "COUNTRY_NAME");
                var state = await _repo.GetStateAsync(0, true, "Active", countryCode : rec.COMPANY_COUNTRY);

                ViewBag.State = new SelectList(state, "STATECODE", "STATENAME");
                var banks = await _repo.GetInstitutionAsync(0, true, "Active");

                ViewBag.BankList = new SelectList(banks.Where(d => d.IS_BANK != null && d.IS_BANK.ToLower() == "y").ToList(), "CBN_CODE", "INSTITUTION_NAME");
                BindCity(rec.COMPANY_COUNTRY, rec.COMPANY_STATE);
                GetPriv();
                return(View(rec));
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
 public ActionResult Index(string m)
 {
     try
     {
         // GetMenuId();
         menuId = SmartUtil.GetMenuId(m);
         if (menuId == 0)
         {
             return(RedirectToAction("Index", "Home"));
         }
         ViewBag.MenuId = HttpUtility.UrlEncode(m);
         GetPriv();
         return(View());
     }
     catch
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Exemple #3
0
        public ActionResult Index(string m)
        {
            //if (Session["sessionid"] == null)
            //    Session["sessionid"] = "empty";

            //// check to see if your ID in the Logins table has
            //// LoggedIn = true - if so, continue, otherwise, redirect to Login page.
            //if (_repoL.IsYourLoginStillTrue
            //(System.Web.HttpContext.Current.User.Identity.Name, Session["sessionid"].ToString()))
            //{
            //    // check to see if your user ID is being used elsewhere under a different session ID
            //    if (!_repoL.IsUserLoggedOnElsewhere
            //    (System.Web.HttpContext.Current.User.Identity.Name, Session["sessionid"].ToString()))
            //    {

            //    }
            //    else
            //    {
            //        // if it is being used elsewhere, update all their
            //        // Logins records to LoggedIn = false, except for your session ID
            //        _repoL.LogEveryoneElseOut
            //        (System.Web.HttpContext.Current.User.Identity.Name, Session["sessionid"].ToString());

            //    }

            //}
            //else
            //{
            //    //FormsAuthentication.SignOut();
            //    AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            //    return RedirectToAction("Login", "Account");
            //}
            // GetMenuId();
            menuId = SmartUtil.GetMenuId(m);
            if (menuId == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ViewBag.MenuId = HttpUtility.UrlEncode(m);
            GetPriv();
            return(View());
        }
        public ActionResult Index(string m)
        {
            try
            {
                menuId = SmartUtil.GetMenuId(m);
                if (menuId == 0)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                var rec = _repo.GetCountry(0, true, "Active");
                ViewBag.CountryList = ViewBag.RecordStatus = new SelectList(rec, "COUNTRY_CODE", "COUNTRY_NAME", "NGN");

                ViewBag.MenuId = HttpUtility.UrlEncode(m);
                GetPriv();
                return(View());
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Exemple #5
0
        public async Task <ActionResult> SPolicy(string m)
        {
            //ViewBag.RoleId = roleId;
            //ViewBag.MenuId = menuId;
            try
            {
                // GetMenuId();
                menuId = SmartUtil.GetMenuId(m);
                if (menuId == 0)
                {
                    return(RedirectToAction("Error", "Home"));
                }
                ViewBag.MenuId = menuId;
                var rec = await _repo.GetCompanyProfileAsync(0, false);

                GetPriv();
                return(View(rec));
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
        public ActionResult Create(FrequencyObj model, string m)
        {
            try
            {
                menuId         = SmartUtil.GetMenuId(m);
                ViewBag.MenuId = HttpUtility.UrlDecode(m);

                var errorMsg = "";
                if (ModelState.IsValid)
                {
                    if (model.ITBID > 0)
                    {
                        //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew))
                        //{
                        var BType = new SM_FREQUENCYTEMP()
                        {
                            FREQUENCY_DESC = model.FREQUENCY_DESC,
                            WORKDAYS       = model.WORKDAYS,
                            STATUS         = open,
                            RECORDID       = model.ITBID,
                            USERID         = User.Identity.Name,
                            CREATEDATE     = DateTime.Now
                        };
                        repoFreqTemp.Insert(BType);
                        if (uow.Save(User.Identity.Name) > 0)
                        {
                            SM_AUTHLIST auth = new SM_AUTHLIST()
                            {
                                CREATEDATE = DateTime.Now,
                                EVENTTYPE  = model.STATUS == active ? eventEdit : model.STATUS,
                                MENUID     = menuId,
                                //MENUNAME = "",
                                RECORDID = BType.ITBID,
                                STATUS   = open,
                                // TABLENAME = "ADMIN_DEPARTMENT",
                                URL               = Request.FilePath,
                                USERID            = User.Identity.Name,
                                INSTITUTION_ITBID = institutionId,
                                POSTTYPE          = Single
                            };
                            repoAuth.Insert(auth);
                            var rst = uow.Save(User.Identity.Name) > 0 ? true : false;
                            if (rst)
                            {
                                EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Frequency Record");
                                TempData["msg"] = "Record Updated SuccessFully...Authorization Pending.";
                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                                return(RedirectToAction("Index", "Frequency", new { m = m }));
                                //return Json(new { RespCode = 0, RespMessage = "Record Updated SuccessFully...Authorization Pending." });
                            }
                            else
                            {
                                ViewBag.Message = "Problem Updating Record.";
                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                                return(View("Add", new { m = m, id = model.ITBID }));
                                //return Json(new { RespCode = 1, RespMessage = "Problem Updating Record." });
                            }
                        }

                        //    var ret = _repo.PostRole(model, 1);
                        //if (ret != null && ret.RespCode == 0)
                        //{
                        //    model.RoleId = int.Parse(ret.OutputKey.ToString());
                        //    return Json(new { data = model, RespCode = 0, RespMessage = "Record Created Successfully" });
                        //}
                    }
                    else
                    {
                        var BType = new SM_FREQUENCYTEMP()
                        {
                            FREQUENCY_DESC = model.FREQUENCY_DESC,
                            WORKDAYS       = model.WORKDAYS,
                            STATUS         = open,
                            RECORDID       = model.ITBID,
                            USERID         = User.Identity.Name,
                            CREATEDATE     = DateTime.Now
                        };
                        repoFreqTemp.Insert(BType);
                        if (uow.Save(User.Identity.Name) > 0)
                        {
                            //var controller =  ControllerContext.Controller..ToString();
                            SM_AUTHLIST auth = new SM_AUTHLIST()
                            {
                                CREATEDATE = DateTime.Now,
                                EVENTTYPE  = eventInsert,
                                MENUID     = menuId,
                                //MENUNAME = "",
                                RECORDID = BType.ITBID,
                                STATUS   = open,
                                // TABLENAME = "ADMIN_DEPARTMENT",
                                URL               = Request.FilePath,
                                USERID            = User.Identity.Name,
                                INSTITUTION_ITBID = institutionId,
                                POSTTYPE          = Single
                            };
                            repoAuth.Insert(auth);
                            var rst = uow.Save(User.Identity.Name) > 0 ? true : false;
                            if (rst)
                            {
                                //newR = 1;
                                EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Frequency Record");
                                TempData["msg"] = "Record Created SuccessFully...Authorization Pending.";
                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                                return(RedirectToAction("Index", new { m = m }));

                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                            }
                            else
                            {
                                ViewBag.Message = "Problem Updating Record.";
                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                                return(View("Add", new { m = m }));

                                // return Json(new { RespCode = 1, RespMessage = "Problem Creating Record." });
                            }
                        }
                    }
                }
                // If we got this far, something failed, redisplay form
                return(Json(new { RespCode = 1, RespMessage = errorMsg }));
            }
            catch (SqlException ex)
            {
                ViewBag.Message = "Problem Updating Record.";
                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                return(View("Add", new { m = m }));

                //return Json(new { RespCode = 1, RespMessage = ex.Message });
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Problem Updating Record.";
                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                return(View("Add", new { m = m }));
                //return Json(new { RespCode = 1, RespMessage = ex.Message });
            }
        }
Exemple #7
0
        public ActionResult Add(SERVICEChannelObj model, string m)
        {
            try
            {
                menuId         = SmartUtil.GetMenuId(m);
                ViewBag.MenuId = HttpUtility.UrlDecode(m);

                var errorMsg = "";
                if (ModelState.IsValid)
                {
                    if (model.ITBID == 0)
                    {
                        ViewBag.HeaderTitle   = "Add ServiceChannel";
                        ViewBag.StatusVisible = false;
                        ViewBag.ButtonText    = "Save";
                    }
                    else
                    {
                        //var d = _repo.GetSession(0, true);
                        ViewBag.HeaderTitle   = "Edit ServiceChannel";
                        ViewBag.StatusVisible = true;
                        ViewBag.ButtonText    = "Update";
                    }
                    if (model.ITBID > 0)
                    {
                        //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew))
                        //{
                        var BType = new SM_SERVICECHANNELSTEMP()
                        {
                            CODE        = model.CODE,
                            DESCRIPTION = model.DESCRIPTION,
                            ChannelID   = model.ChannelID,
                            BankCode    = model.BankCode,
                            BankAccount = model.BankAccount,
                            STATUS      = open,
                            RECORDID    = model.ITBID,
                            USERID      = User.Identity.Name,
                            CREATEDATE  = DateTime.Now
                        };
                        repoServiceChannelTemp.Insert(BType);
                        if (uow.Save(User.Identity.Name) > 0)
                        {
                            SM_AUTHLIST auth = new SM_AUTHLIST()
                            {
                                CREATEDATE = DateTime.Now,
                                EVENTTYPE  = model.STATUS == active ? eventEdit : model.STATUS,
                                MENUID     = menuId,
                                //MENUNAME = "",
                                RECORDID = BType.ITBID,
                                STATUS   = open,
                                // TABLENAME = "ADMIN_DEPARTMENT",
                                URL               = Request.FilePath,
                                USERID            = User.Identity.Name,
                                INSTITUTION_ITBID = institutionId,
                                POSTTYPE          = Single
                            };
                            repoAuth.Insert(auth);
                            var rst = uow.Save(User.Identity.Name) > 0 ? true : false;
                            if (rst)
                            {
                                EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "ServiceChannel Record");
                                TempData["msg"] = "Record Updated SuccessFully...Authorization Pending.";
                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                                return(RedirectToAction("Index", "ServiceChannel", new { m = m }));
                                //return Json(new { RespCode = 0, RespMessage = "Record Updated SuccessFully...Authorization Pending." });
                            }
                            else
                            {
                                ViewBag.Message = "Problem Updating Record.";
                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                                return(View("Add", model));
                                //return Json(new { RespCode = 1, RespMessage = "Problem Updating Record." });
                            }
                        }
                    }
                    else
                    {
                        var BType = new SM_SERVICECHANNELSTEMP()
                        {
                            CODE        = model.CODE,
                            DESCRIPTION = model.DESCRIPTION,
                            STATUS      = open,
                            RECORDID    = model.ITBID,
                            ChannelID   = model.ChannelID,
                            BankCode    = model.BankCode,
                            BankAccount = model.BankAccount,
                            USERID      = User.Identity.Name,
                            CREATEDATE  = DateTime.Now
                        };
                        repoServiceChannelTemp.Insert(BType);
                        if (uow.Save(User.Identity.Name) > 0)
                        {
                            //var controller =  ControllerContext.Controller..ToString();
                            SM_AUTHLIST auth = new SM_AUTHLIST()
                            {
                                CREATEDATE = DateTime.Now,
                                EVENTTYPE  = eventInsert,
                                MENUID     = menuId,
                                //MENUNAME = "",
                                RECORDID = BType.ITBID,
                                STATUS   = open,
                                // TABLENAME = "ADMIN_DEPARTMENT",
                                URL               = Request.FilePath,
                                USERID            = User.Identity.Name,
                                INSTITUTION_ITBID = institutionId,
                                POSTTYPE          = Single
                            };
                            repoAuth.Insert(auth);
                            var rst = uow.Save(User.Identity.Name) > 0 ? true : false;
                            if (rst)
                            {
                                //newR = 1;
                                EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "ServiceChannel Record");
                                TempData["msg"] = "Record Created SuccessFully...Authorization Pending.";
                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                                return(RedirectToAction("Index", new { m = m }));

                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                            }
                            else
                            {
                                ViewBag.Message = "Problem Updating Record.";
                                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                                return(View("Add", model));

                                // return Json(new { RespCode = 1, RespMessage = "Problem Creating Record." });
                            }
                        }
                    }
                }
                // If we got this far, something failed, redisplay form
                //errorMsg = GetModelError();
                errorMsg        = ModelStateErrorHandler.StringifyModelErrors(ModelState);
                ViewBag.Message = errorMsg;
                return(View("Add", model));
            }
            catch (SqlException ex)
            {
                ViewBag.Message = "Problem Updating Record.";
                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                return(View("Add", model));

                //return Json(new { RespCode = 1, RespMessage = ex.Message });
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Problem Updating Record.";
                //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." });
                return(View("Add", model));
                //return Json(new { RespCode = 1, RespMessage = ex.Message });
            }
        }