Beispiel #1
0
        public ActionResult ResetLockout(string[] selected_value)
        {
            try
            {
                //ViewBag.MenuId = menuId; //HttpUtility.UrlDecode(m);
                var bid      = SmartObj.GenRefNo2();
                var errorMsg = "";
                if (ModelState.IsValid)
                {
                    if (selected_value != null)
                    {
                        foreach (var d in selected_value)
                        {
                            var BType = new SM_RESETLOCKOUT_TEMP()
                            {
                                BatchId    = bid,
                                UserName   = d,
                                Status     = open,
                                UserId     = User.Identity.Name,
                                CreateDate = DateTime.Now,
                            };
                            repoReset.Insert(BType);
                        }

                        if (uow.Save(User.Identity.Name) > 0)
                        {
                            SM_AUTHLIST auth = new SM_AUTHLIST()
                            {
                                CREATEDATE = DateTime.Now,
                                EVENTTYPE  = eventInsert,// model.STATUS == active ? eventEdit : model.STATUS,
                                MENUID     = menuId,
                                BATCHID    = bid,

                                //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, "Lockout Reset Record");

                                return(Json(new { RespCode = 0, RespMessage = "Record Updated SuccessFully...Authorization Pending." }));
                            }
                            else
                            {
                                return(Json(new { RespCode = 1, RespMessage = "Problem Processing Record." }));
                            }
                        }
                    }
                    else
                    {
                        return(Json(new { RespCode = 1, RespMessage = "Problem Processing Record." }));
                    }
                }
                // If we got this far, something failed, redisplay form
                return(Json(new { RespCode = 1, RespMessage = errorMsg }));
            }
            catch (SqlException ex)
            {
                var msg = "Problem Updating Record.";
                return(Json(new { RespCode = 1, RespMessage = msg }));
            }
            catch (Exception ex)
            {
                var msg = "Problem Updating Record.";
                return(Json(new { RespCode = 1, RespMessage = msg }));
            }
        }
        // [ValidateAntiForgeryToken]
        public ActionResult Process()
        {
            string batchId = "";

            try
            {
                var rv  = new SetReconUpldSession();
                var rec = rv.GetSetReconUpload(User.Identity.Name);
                //  isUp = userInstitutionItbid == 1 ? true : false;
                //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew, new TimeSpan(0, 30, 0)))
                //{
                int errorcnt = 0;

                DateTime curDate = DateTime.Now;

                batchId = SmartObj.GenRefNo2();

                int i        = 0;
                int valCount = rec.Count(f => f.VALIDATIONERRORSTATUS == false);
                foreach (var d in rec)
                {
                    if (i == 0)
                    {
                        SM_AUTHLIST auth = new SM_AUTHLIST()
                        {
                            CREATEDATE = DateTime.Now,
                            EVENTTYPE  = eventInsert,
                            MENUID     = menuId,
                            //MENUNAME = "",
                            // RECORDID = objG.ITBID,
                            STATUS = open,
                            //TABLENAME = "SM_FREQUENCY",
                            URL               = Request.FilePath,
                            USERID            = User.Identity.Name,
                            INSTITUTION_ITBID = institutionId,
                            BATCHID           = batchId,
                            POSTTYPE          = Batch
                        };
                        repoAuth.Insert(auth);
                    }
                    i++;
                    if (d.VALIDATIONERRORSTATUS == true)
                    {
                        errorcnt++;
                        continue;
                    }

                    var obj = new SM_SETRECONCILIATION_TEMP()// SM_MERCHANTTERMINALUPLD()
                    {
                        PAYREFNO    = d.PAYREFNO,
                        AMOUNT      = d.AMOUNT,
                        PAYMENTDATE = d.PAYMENTDATE,
                        VALUEDATE   = d.VALUEDATE,
                        //RECEIPTNO = d.RECEIPTNO,
                        CUSTOMERNAME  = d.CUSTOMERNAME,
                        PAYMENTMETHOD = d.PAYMENTMETHOD,
                        //TRANSACTIONSTATUS = d.TRANSACTIONSTATUS,
                        //DEPOSITSLIPNO = d.DEPOSITSLIPNO,
                        BANKNAME = d.BANKNAME,
                        //BRANCHNAME = d.BRANCHNAME,
                        //PAYERID = d.PAYERID,
                        //VALUEGRANTED = d.VALUEGRANTED,
                        //RECONCILE = d.RECONCILE,
                        BATCHID    = batchId,
                        CREATEDATE = curDate,
                        STATUS     = open,
                        USERID     = User.Identity.Name,
                    };
                    repoSetReconciliationTemp.Insert(obj);
                    //cnt++;
                }


                var rst = uow.Save(User.Identity.Name);
                if (rst > 0)
                {
                    //SessionHelper.GetCart(Session).Clear();
                    rv.PurgeSetReconUpload(User.Identity.Name);

                    try
                    {
                        EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, string.Format("Setttlement Reconciliation Upload Batch #{0}", batchId));
                    }
                    catch
                    {
                    }
                    //txscope.Complete();
                }
                else
                {
                    return(Json(new { RespCode = 1, RespMessage = "Problem Processing Request." }));
                }
                //}
            }
            catch (Exception ex)
            {
                return(Json(new { RespCode = 1, RespMessage = ex.Message }));
            }
            var msg = string.Format("<i class='fa fa-check' ></i> Record with Batch-ID #{0} Processed SuccessFully and has been forwarded for authorization", batchId);

            return(Json(new { RespCode = 0, RespMessage = msg }));
        }
        public ActionResult Add(int MenuId, int NoLevel, string m)
        {
            try
            {
                string bid      = SmartObj.GenRefNo2();
                var    errorMsg = "";
                if (ModelState.IsValid)
                {
                    //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew))
                    //{
                    SM_APPROVAL_ROUTE_TEMP BType = new SM_APPROVAL_ROUTE_TEMP()
                    {
                        // BType.PARTY_CODE = int.Parse(txtpartyCode.Value);
                        MENUID     = MenuId,
                        NOLEVEL    = NoLevel,
                        STATUS     = open,
                        CREATEDATE = DateTime.Now,
                        BATCHID    = bid,
                        USERID     = User.Identity.Name,
                        //RECORDID = model.ITBID,
                    };

                    repoAppRouteTemp.Insert(BType);
                    var rst = uow.Save(User.Identity.Name) > 0 ? true : false;
                    if (rst)
                    {
                        SaveRouteOfficerTemp(eventEdit, bid);

                        SM_AUTHLIST auth = new SM_AUTHLIST()
                        {
                            CREATEDATE        = DateTime.Now,
                            EVENTTYPE         = eventEdit,
                            MENUID            = menuId,
                            RECORDID          = BType.ITBID,
                            STATUS            = open,
                            URL               = Request.FilePath,
                            USERID            = User.Identity.Name,
                            POSTTYPE          = Single,
                            BATCHID           = bid,
                            INSTITUTION_ITBID = institutionId
                        };
                        repoAuth.Insert(auth);
                        var rst1 = uow.Save(User.Identity.Name);
                        if (rst1 > 0)
                        {
                            EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Approval Route Record");

                            //txscope.Complete();
                            //TempData["msg"] = "Record Created SuccessFully...Authorization Pending.";
                            return(Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }));
                            //return RedirectToAction("Index", new { m = m });
                        }
                    }
                    //}


                    // If we got this far, something failed, redisplay form
                    return(Json(new { RespCode = 1, RespMessage = errorMsg }));
                }
            }
            catch (SqlException ex)
            {
                //BindCombo();
                //ViewBag.PartyAcct = GetRvHeadLines();
                //ViewBag.Message = ex.Message;
                //return View("Add", model);
                return(Json(new { RespCode = 1, RespMessage = ex.Message }));
            }
            catch (Exception ex)
            {
                //BindCombo();
                //ViewBag.PartyAcct = GetRvHeadLines();
                //ViewBag.Message = ex.Message;
                //return View("Add", model);
                return(Json(new { RespCode = 1, RespMessage = ex.Message }));
            }
            //BindCombo();
            //ViewBag.PartyAcct = GetRvHeadLines();
            //ViewBag.Message = "Problem Processing Request, Try again or Contact Administrator.";
            //return View("Add", model);
            return(Json(new { RespCode = 1, RespMessage = "Problem Processing Request, Try again or Contact Administrator." }));
        }