Пример #1
0
        public ActionResult GetPurchaseOrderData()
        {
            var _draw          = Request.Form.GetValues("draw").FirstOrDefault();
            var _start         = Request.Form.GetValues("start").FirstOrDefault();
            var _length        = Request.Form.GetValues("length").FirstOrDefault();
            var _sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][name]").FirstOrDefault();
            var _sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();
            var _searchValue   = Request.Form.GetValues("search[value]").FirstOrDefault();

            int _pageSize = _length != null?Convert.ToInt32(_length) : 0;

            int _skip = _start != null?Convert.ToInt32(_start) : 0;

            var request = new PurchaseOrderRequest
            {
                Draw          = _draw,
                SearchValue   = _searchValue,
                SortColumn    = _sortColumn,
                SortColumnDir = _sortColumnDir,
                PageSize      = _pageSize,
                Skip          = _skip
            };

            var response = new PurchaseOrderHandler(_unitOfWork).GetListData(request);
            var check    = GeneralHandler.authorized("VALIDATION_M_PURCHASEORDER");
            var check1   = GeneralHandler.authorized("APPROVE_M_PURCHASEORDER");

            return(Json(new { data = response.Data, recordsFiltered = response.RecordsFiltered, recordsTotal = response.RecordsTotal, draw = response.Draw }, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult CreateOrEditPurchaseRequest()
        {
            var      lastprnumber = _context.PurchaseRequests.OrderByDescending(x => x.CreatedDate).Select(a => a.prnumber).FirstOrDefault();
            DateTime?getmonth     = _context.PurchaseRequests.OrderByDescending(x => x.CreatedDate).Select(a => a.CreatedDate).FirstOrDefault();
            DateTime?month        = getmonth != null ? getmonth : DateTime.Now;
            string   prnumber     = lastprnumber != null?GeneralHandler.stringincrement(lastprnumber, Convert.ToDateTime(month)) : "00001";

            PurchaseRequestResponse _response = new PurchaseRequestResponse();

            if (Request.QueryString["id"] != null)
            {
                var request = new PurchaseRequestRequest
                {
                    Data = new PurchaseRequestModel
                    {
                        Id = long.Parse(Request.QueryString["id"].ToString())
                    }
                };

                PurchaseRequestResponse resp   = new PurchaseRequestHandler(_unitOfWork).GetDetail(request);
                PurchaseRequestModel    _model = resp.Entity;
                ViewBag.Response = _response;
                return(View(_model));
            }
            else
            {
                if ((GeneralHandler.authorized("ADD_M_PURCHASEREQUEST") == "false"))
                {
                    return(RedirectToAction("PurchaseRequestList"));
                }
                ViewBag.Response   = _response;
                ViewBag.ActionType = ClinicEnums.Action.Add;
                ViewBag.prnumber   = "PR" + ((AccountModel)Session["UserLogon"]).Organization + DateTime.Now.Year + DateTime.Now.Month + prnumber;
                return(View());
            }
        }