Beispiel #1
0
        public string EncryptQueryString(string m, string ai, string pt, string url, string retUrl)
        {
            // url =string.Format("/{0}/DetailAuth",url);
            var menuId = HttpUtility.UrlEncode(SmartObj.Encrypt(m));
            var a_i    = HttpUtility.UrlEncode(SmartObj.Encrypt(ai));
            // var postType = HttpUtility.UrlEncode(SmartObj.Encrypt(pt));
            // var rId = HttpUtility.UrlEncode(SmartObj.Encrypt(r));
            var ret = string.Format("{0}/DetailAuth?m={1}&a_i={2}", url, menuId, a_i); // Eval("URL") + "?m=" + HttpUtility.UrlEncode(Eval("MENUID").ToString()) + "&r=" +HttpUtility.UrlEncode(Eval("RECORDID").ToString()) + "&a_i=" + HttpUtility.UrlEncode(Eval("ITBID").ToString())+ "&pt=" + HttpUtility.UrlEncode(Eval("POSTTYPE").ToString()) + "&ReturnUrl=" + Request.RawUrl %>' runat = "server" > View Detail </ asp:HyperLink >

            return(ret);
            // string technology = HttpUtility.UrlEncode(SmartObj.Encrypt(ddlTechnology.SelectedItem.Value));
            // Response.Redirect(string.Format("~/CS2.aspx?name={0}&technology={1}", name, technology));
        }
        public ActionResult Reject(decimal AuthId, int?m, string Narration)
        {
            try
            {
                var rec2 = repoAuth.Find(AuthId);
                if (rec2 == null)
                {
                    respMsg = "Problem processing request. Try again or contact Administrator.";
                    //TempData["msg"] = respMsg;
                    //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(rec2.ITBID.ToString()), m = SmartObj.Encrypt(rec2.MENUID.GetValueOrDefault().ToString()) });
                    return(Json(new { RespCode = 1, RespMessage = respMsg }));
                }
                else if (rec2.STATUS.ToLower() != "open")
                {
                    respMsg = "This request has already been processed by an authorizer.";
                    //TempData["msg"] = respMsg;
                    //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()), m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) });
                    return(Json(new { RespCode = 1, RespMessage = respMsg }));
                }
                int recordId = 0;
                // bool suc = false;
                //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew))
                //{
                var d = new AuthListUtil();
                //menuId = 5;
                var dd = d.GetCheckerRecord(m.GetValueOrDefault(), AuthId, 0, institutionId);
                if (dd.authListObj.Count < checkerNo)
                {
                    var chk = new SM_AUTHCHECKER()
                    {
                        AUTHLIST_ITBID = AuthId,
                        CREATEDATE     = DateTime.Now,
                        NARRATION      = Narration,
                        STATUS         = reject,
                        USERID         = User.Identity.Name,
                    };
                    repoAuthChecker.Insert(chk);
                    var rst = uow.Save(User.Identity.Name);
                    if (rst > 0)
                    {
                        var noA = dd.authListObj.Where(f => f.CHECKERSTATUS == approve).Count();
                        noA += 1;
                        if (noA == checkerNo)
                        {
                            recordId = (int)rec2.RECORDID;
                            //menuId = rec2.MENUID.GetValueOrDefault();
                            var recc = repoFreqTemp.Find(recordId);
                            if (recc != null)
                            {
                                recc.STATUS = reject;
                            }

                            rec2.STATUS = reject;
                            var t = uow.Save(User.Identity.Name);
                            if (t > 0)
                            {
                                sucNew = true;
                                // txscope.Complete();
                            }
                        }
                    }
                }
                //}
                if (sucNew)
                {
                    EmailerNotification.SendApprovalRejectionMail(rec2.USERID, rec2.EVENTTYPE, reject, "Frequency Rejection", null, fullName);
                    respMsg = "Record Rejected. A mail has been sent to the user.";
                    return(Json(new { RespCode = 0, RespMessage = respMsg, status = reject }));
                }
                respMsg = "Problem processing request. Try again or contact Administrator.";

                return(Json(new { RespCode = 1, RespMessage = respMsg }));
            }
            catch (Exception ex)
            {
                //return Json(new { RespCode = 99, RespMessage = "Problem processing request. Try again or contact Administrator." });
                respMsg         = "Problem processing request. Try again or contact Administrator.";
                TempData["msg"] = respMsg;
                return(RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()), m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) }));
            }
        }
Beispiel #3
0
        public ActionResult ApprovePL(decimal AuthId, int?m)
        {
            var sucNew = false;

            try
            {
                var rec2 = repoAuth.Find(AuthId);
                if (rec2 == null)
                {
                    respMsg = "Problem processing request. Try again or contact Administrator.";
                    //TempData["msg"] = respMsg;
                    //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(rec2.ITBID.ToString()), m = SmartObj.Encrypt(rec2.MENUID.GetValueOrDefault().ToString()) });
                    return(Json(new { RespCode = 1, RespMessage = respMsg }));
                }
                else if (rec2.STATUS.ToLower() != "open")
                {
                    respMsg = "This request has already been processed by an authorizer.";
                    //TempData["msg"] = respMsg;
                    //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()), m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) });
                    return(Json(new { RespCode = 1, RespMessage = respMsg }));
                }
                int  recordId = 0;
                bool suc      = false;
                //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew))
                //{
                var d = new AuthListUtil();
                //menuId = 5;
                var dd = d.GetCheckerRecord(m.GetValueOrDefault(), AuthId, 0, institutionId);
                if (dd.authListObj.Count < checkerNo)
                {
                    var chk = new SM_AUTHCHECKER()
                    {
                        AUTHLIST_ITBID = AuthId,
                        CREATEDATE     = DateTime.Now,
                        NARRATION      = null,
                        STATUS         = approve,
                        USERID         = User.Identity.Name,
                    };
                    repoAuthChecker.Insert(chk);
                    var rst = uow.Save(User.Identity.Name);
                    if (rst > 0)
                    {
                        var noA = dd.authListObj.Where(f => f.CHECKERSTATUS == approve).Count();
                        noA += 1;
                        if (noA == checkerNo)
                        {
                            recordId = (int)rec2.RECORDID;
                            menuId   = rec2.MENUID.GetValueOrDefault();
                            switch (rec2.EVENTTYPE)
                            {
                            case "Modify":
                            {
                                suc = ModifyMainRecordPL(recordId);
                                break;
                            }

                            default:
                            {
                                break;
                            }
                            }


                            if (suc)
                            {
                                rec2.STATUS = approve;
                                var t = uow.Save(rec2.USERID, User.Identity.Name);
                                if (t > 0)
                                {
                                    sucNew = true;
                                    //txscope.Complete();
                                }
                            }
                            else
                            {
                                //return Json(new { RespCode = 99, RespMessage = "Problem processing request. Try again or contact Administrator." });
                                //respMsg = "Problem processing request. Try again or contact Administrator.";
                                //TempData["msg"] = respMsg;
                                //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(rec2.ITBID.ToString()), m = SmartObj.Encrypt(rec2.MENUID.GetValueOrDefault().ToString()) });
                                return(Json(new { RespCode = 1, RespMessage = respMsg }));
                            }
                        }

                        //if (!isApprove)
                        //{
                        //    pnlResponse.Visible = true;
                        //    pnlResponse.CssClass = "alert alert-success alert-dismissable alert-bold fade in";

                        //    pnlResponseMsg.Text = "Record Successfully Approved";
                        //}
                    }
                }
                // return Json(new { RespCode = 99, RespMessage = "This request has already been processed by an authorizer." });
                //respMsg = "This request has already been processed by an authorizer.";
                //TempData["msg"] = respMsg;
                //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()), m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) });
                //}
                if (sucNew)
                {
                    EmailerNotification.SendApprovalRejectionMail(rec2.USERID, rec2.EVENTTYPE, approve, "Security Policy Approval", null, fullName);

                    respMsg = "Record Authorized Successfully. A mail has been sent to the user.";

                    return(Json(new { RespCode = 0, RespMessage = respMsg, status = approve }));
                }
                return(Json(new { RespCode = 1, RespMessage = respMsg }));
            }
            catch (Exception ex)
            {
                //return Json(new { RespCode = 99, RespMessage = "Problem processing request. Try again or contact Administrator." });
                respMsg         = "Problem processing request. Try again or contact Administrator.";
                TempData["msg"] = respMsg;
                return(RedirectToAction("DetailAuthPL", new { a_i = SmartObj.Encrypt(AuthId.ToString()), m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) }));
            }
        }