public ActionResult DetailAuth(string a_i, string m)
        {
            try
            {
                int menuId;
                var mid = SmartObj.Decrypt(m);
                var ai  = SmartObj.Decrypt(a_i);
                if (int.TryParse(mid, out menuId) && decimal.TryParse(ai, out authId))
                {
                    var obj = new AuthViewObj();
                    var det = repoAuth.Find(authId);
                    //var d = _repo.GetSession(0, true);

                    ViewBag.HeaderTitle = "Authorize Detail for Country";
                    //ViewBag.StatusVisible = true;
                    if (det != null)
                    {
                        obj.AuthId      = authId;
                        obj.RecordId    = det.RECORDID.GetValueOrDefault();
                        obj.BatchId     = det.BATCHID;
                        obj.PostType    = det.POSTTYPE;
                        obj.MenuId      = det.MENUID.GetValueOrDefault();
                        ViewBag.Message = TempData["msg"];
                        var stat = ViewBag.Message != null ? null : "open";

                        var rec = _repo.GetCountry((int)det.RECORDID, false, status: stat, isTemp: true);      //repoSession.FindAsync(id);
                        if (rec != null && rec.Count > 0)
                        {
                            BindCombo();
                            var model = rec.FirstOrDefault();
                            obj.Status           = det.STATUS;
                            obj.EventType        = det.EVENTTYPE;
                            obj.DateCreated      = det.CREATEDATE.GetValueOrDefault().ToString("dd-MMM-yyyy");
                            obj.User             = model.CREATED_BY;
                            ViewBag.Auth         = obj;
                            ViewBag.DisplayAuth  = det.STATUS == open && !(model.USERID == User.Identity.Name);
                            ViewBag.RecordStatus = new SelectList(SmartObj.GetStatus(), "Code", "Description");
                            // return null;

                            return(View("DetailAuth", model));
                        }
                        //  return Json(rec, JsonRequestBehavior.AllowGet);
                        //var obj1 = new { model = rec.FirstOrDefault(), RespCode = 0, RespMessage = "Success" };
                        // return Json(obj1, JsonRequestBehavior.AllowGet);
                    }


                    return(View("DetailAuth"));
                }
                else
                {
                    return(View("Error", "Home"));
                }
            }
            catch (Exception ex)
            {
                return(View("DetailAuth"));
            }
        }
        public static int GetMenuId(string m)
        {
            int menuId = 0;

            if (!string.IsNullOrEmpty(m))
            {
                var decrypt = SmartObj.Decrypt(m);
                // var m = HttpContext.Current.Request.QueryString["m"];
                if (int.TryParse(decrypt, out menuId))
                {
                    //var urlHelper = new UrlHelper();
                    // urlHelper.Action("Login", "Account");
                    return(menuId);
                }
            }
            return(0);
        }
Beispiel #3
0
        public async Task <ActionResult> Detail(string a_i, string m)
        {
            var mid = SmartObj.Decrypt(m);
            var ai  = SmartObj.Decrypt(a_i);

            if (int.TryParse(mid, out menuId) && decimal.TryParse(ai, out authId))
            {
                var controller = await _repo.GetMenuById(menuId);

                ViewBag.Controller = controller;
                ViewBag.Key        = authId;
                // ViewBag.ReturnUrl = returnUrl;
                return(View());
            }
            else
            {
                return(View("Error", "Home"));
            }
        }
Beispiel #4
0
        public async Task <ActionResult> DetailAuth(string a_i, string m)
        {
            try
            {
                int menuId;
                var mid = SmartObj.Decrypt(m);
                var ai  = SmartObj.Decrypt(a_i);
                if (int.TryParse(mid, out menuId) && decimal.TryParse(ai, out authId))
                {
                    var obj = new AuthViewObj();
                    var det = repoAuth.Find(authId);
                    //var d = _repo.GetSession(0, true);

                    ViewBag.HeaderTitle = "Authorize Detail for Company Profile";
                    //ViewBag.StatusVisible = true;
                    if (det != null)
                    {
                        //ViewBag.AuthId = authId;
                        //ViewBag.RecordId = det.RECORDID;
                        //ViewBag.BatchId = det.BATCHID;
                        //ViewBag.PostType = det.POSTTYPE;
                        //ViewBag.MenuId = det.MENUID;
                        obj.AuthId      = authId;
                        obj.BatchId     = det.BATCHID;
                        obj.RecordId    = det.RECORDID.GetValueOrDefault();
                        obj.PostType    = det.POSTTYPE;
                        obj.MenuId      = det.MENUID.GetValueOrDefault();
                        ViewBag.Message = TempData["msg"];
                        var stat = ViewBag.Message != null ? null : "open";
                        var rec  = await _repo.GetCompanyProfileAsync((int)det.RECORDID, true, status : stat);   //repoSession.FindAsync(id);

                        if (rec != null)
                        {
                            var model   = rec;
                            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_CITY);
                            ViewBag.DisplayAuth = det.STATUS == open && !(model.USERID == User.Identity.Name);
                            obj.EventType       = det.EVENTTYPE;
                            obj.DateCreated     = det.CREATEDATE.GetValueOrDefault().ToString("dd-MMM-yyyy");
                            obj.User            = model.CREATED_BY;
                            obj.Status          = det.STATUS;
                            ViewBag.Auth        = obj;
                            if (det.TABLENAME != null)
                            {
                                return(View("DetailAuth", model));
                            }
                            else
                            {
                                ViewBag.HeaderTitle = "Authorize Detail for Srcurity Policy";

                                return(View("DetailAuthPL", model));
                            }
                        }
                        //  return Json(rec, JsonRequestBehavior.AllowGet);
                        //var obj1 = new { model = rec.FirstOrDefault(), RespCode = 0, RespMessage = "Success" };
                        // return Json(obj1, JsonRequestBehavior.AllowGet);
                    }


                    return(View("DetailAuth"));
                }
                else
                {
                    return(View("Error", "Home"));
                }
            }
            catch (Exception ex)
            {
                return(View("DetailAuth"));
            }
        }