public ActionResult SaveIssRecSrcDest(IssRecSrcDest lSrcDestId)
        {
            using (var transaction = new TransactionScope())
            {
                try
                {
                    RBACUser rUser = new RBACUser(Session["UserName"].ToString());
                    if (!rUser.HasPermission("IssRecSrcDest_Insert"))
                    {
                        return(Json("X", JsonRequestBehavior.AllowGet));
                    }
                    //var IfExit = _issRecSrcDestService.All().Where(x => x.ActionCtrl == lSrcDestId.ActionCtrl).ToList();
                    //if (IfExit.Count == 0)
                    //{

                    IssRecSrcDest issRecSrcDestAdd = new IssRecSrcDest();
                    issRecSrcDestAdd = lSrcDestId;
                    //select COUNT(srcdestId)from IssRecSrcDest
                    var srcDestId = _issRecSrcDestService.All().Select(x => x.SrcDestId).Count();
                    issRecSrcDestAdd.SrcDestId = (srcDestId + 1).ToString();
                    _issRecSrcDestService.Add(issRecSrcDestAdd);
                    _issRecSrcDestService.Save();

                    transaction.Complete();
                    //}
                    var ecode = 1;
                    return(Json(ecode, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    transaction.Dispose();
                    return(Json("0", JsonRequestBehavior.AllowGet));
                }
            }
        }
Example #2
0
        // GET: Store
        public ActionResult StoreRpt(string errMsg)
        {
            if (Session["UserID"] != null)
            {
                var Fydd = _FYDDService.All().FirstOrDefault(s => s.FinYear == Session["FinYear"].ToString());

                ViewBag.BranchCode = new SelectList(_BranchService.All().ToList(), "BranchCode", "BranchName");
                ViewBag.ItemCode   = new SelectList(_ItemInfoService.All().ToList(), "ItemCode", "ItemName");
                ViewBag.Source     = new SelectList(_issRecvSrcDestService.All().ToList().Where(x => x.Type == "S"), "SrcDestId", "SrcDestName");
                ViewBag.DesLocCode = new SelectList(_issRecvSrcDestService.All().ToList().Where(x => x.Type == "D"), "SrcDestId", "SrcDestName");
                ViewBag.FyddFDate  = Fydd.FYDF;
                ViewBag.FyddTDate  = Fydd.FYDT;
                ViewBag.Message    = errMsg;
                return(View());
            }
            else
            {
                return(RedirectToAction("SecUserLogin", "SecUserLogin"));
            }
        }