public JsonResult Create(FulfillmentViewModel model)
        {
            if (model.V3 != true)
            {
                return(Json(new { result = Constants.UnSuccess }));
            }

            return(EditData(model));
        }
        public ActionResult LoadDataDetailList(int id, string enable)
        {
            var detailList = _service.ListConditionDetail(id, enable);
            var model      = new FulfillmentViewModel
            {
                StockInDetailList = detailList,
                TotalRecords      = detailList.Count()
            };

            return(PartialView("_StockInDetailPartial", model));
        }
        public ActionResult LoadDataList(int page, int size, int store, int poType, string status, int po, int supplier, string srv, string stockCode, string stockName, string fd, string td, string enable)
        {
            var userName    = System.Web.HttpContext.Current.User.Identity.Name;
            var totalRecord = _service.ListConditionCount(page, size, store, poType, status, po, supplier, srv, stockCode, stockName, fd, td, enable);
            var totalTemp   = Convert.ToDecimal(totalRecord) / Convert.ToDecimal(size);
            var totalPages  = Convert.ToInt32(Math.Ceiling(totalTemp));
            var model       = new FulfillmentViewModel
            {
                UserLogin    = _systemService.GetUserAndRole(0, userName),
                StockInList  = _service.ListCondition(page, size, store, poType, status, po, supplier, srv, stockCode, stockName, fd, td, enable),
                TotalRecords = Convert.ToInt32(totalRecord),
                TotalPages   = totalPages,
                CurrentPage  = page,
                PageSize     = size
            };

            return(PartialView("_StockInPartial", model));
        }
示例#4
0
        public async Task <IActionResult> Fulfillment()
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }
            using (var context = _context){
                user = context.Users.Include(ApplicationUser => ApplicationUser.AlexaSessions).Include(ApplicationUser => ApplicationUser.Fulfillments)
                       .Single(u => u.Id == user.Id);
            }
            var model = new FulfillmentViewModel
            {
                Fulfillments = user.Fulfillments.ToList()
            };

            return(View(model));
        }
        public ActionResult Create(int?id)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user     = _systemService.GetUserAndRole(0, userName);

            if (user == null)
            {
                return(RedirectToAction("Index", "Login"));
            }

            if (user.StockInR == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var pe = new WAMS_PURCHASE_ORDER();
            var stockInDetailList  = new List <V3_List_StockIn_Detail>();
            var totalDetailRecords = 0;

            if (id.HasValue)
            {
                pe = _peservice.GetByKey(id.Value);
                stockInDetailList  = _service.ListConditionDetail(id.Value, "1");
                totalDetailRecords = stockInDetailList.Count();
            }

            var peCodeModel = _systemService.Ddlpe(1, 100, 0, 0, Constants.StatusOpen);
            var model       = new FulfillmentViewModel
            {
                vPOID             = pe.Id,
                iStore            = pe.iStore,
                UserLogin         = user,
                Stores            = new SelectList(_systemService.StoreList(), "Id", "Name"),
                Suppliers         = new SelectList(_systemService.SupplierList(), "Id", "Name"),
                SupplierId        = pe.bSupplierID,
                PEs               = new SelectList(peCodeModel.PEs, "Id", "Code"),
                StockInDetailList = stockInDetailList,
                TotalRecords      = totalDetailRecords
            };

            return(View(model));
        }
        private JsonResult EditData(FulfillmentViewModel model)
        {
            try
            {
                //var srvNew = _service.SRVLastest("F");

                if (!string.IsNullOrEmpty(model.LstDeleteDetailItem))
                {
                    var listStrLineElements = model.LstDeleteDetailItem.Split(';').ToList();
                    foreach (var itemDetail in listStrLineElements)
                    {
                        _service.DeleteDetail(Convert.ToInt32(itemDetail));
                    }
                }
                _service.Insert(model.ListFulfillmentDetail, model.LoginId);
                return(Json(new { result = Constants.Success }));
            }
            catch (Exception e)
            {
                Log.Error("Update PO!", e);
                return(Json(new { result = Constants.UnSuccess }));
            }
        }
        public ActionResult Index()
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user     = _systemService.GetUserAndRole(0, userName);

            if (user == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            if (user.StockInR == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var model = new FulfillmentViewModel
            {
                UserLogin  = user,
                Stores     = new SelectList(_systemService.StoreList(), "Id", "Name"),
                PoTypes    = new SelectList(_systemService.PoTypeList(), "Id", "Name"),
                Suppliers  = new SelectList(_systemService.SupplierList(), "Id", "Name"),
                PeStockIns = new SelectList(_systemService.PeStockIn(string.Empty), "Key", "Value")
            };

            return(View(model));
        }
示例#8
0
 public AddCommand(FulfillmentViewModel fulfillment)
 {
     Fulfillment = fulfillment;
 }
示例#9
0
        public JsonResult Create(FulfillmentViewModel model)
        {
            if (model.V3 != true)
            {
                return Json(new { result = Constants.UnSuccess });
            }

            return EditData(model);
        }
示例#10
0
        private JsonResult EditData(FulfillmentViewModel model)
        {
            try
            {
                //var srvNew = _service.SRVLastest("F");

                if (!string.IsNullOrEmpty(model.LstDeleteDetailItem))
                {
                    var listStrLineElements = model.LstDeleteDetailItem.Split(';').ToList();
                    foreach (var itemDetail in listStrLineElements)
                    {
                        _service.DeleteDetail(Convert.ToInt32(itemDetail));
                    }
                }
                _service.Insert(model.ListFulfillmentDetail, model.LoginId);
                return Json(new { result = Constants.Success });
            }
            catch (Exception e)
            {
                Log.Error("Update PO!", e);
                return Json(new { result = Constants.UnSuccess });
            }
        }
示例#11
0
        public ActionResult Create(int? id)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user = _systemService.GetUserAndRole(0, userName);
            if (user == null)
            {
                return RedirectToAction("Index", "Login");
            }

            if (user.StockInR == 0)
            {
                return RedirectToAction("Index", "Home");
            }
            var pe = new WAMS_PURCHASE_ORDER();
            var stockInDetailList = new List<V3_List_StockIn_Detail>();
            var totalDetailRecords = 0;
            if (id.HasValue)
            {
                pe = _peservice.GetByKey(id.Value);
                stockInDetailList = _service.ListConditionDetail(id.Value, "1");
                totalDetailRecords = stockInDetailList.Count();
            }

            var peCodeModel = _systemService.Ddlpe(1, 100, 0, 0, Constants.StatusOpen);
            var model = new FulfillmentViewModel
            {
                vPOID = pe.Id,
                iStore = pe.iStore,
                UserLogin = user,
                Stores = new SelectList(_systemService.StoreList(), "Id", "Name"),
                Suppliers = new SelectList(_systemService.SupplierList(), "Id", "Name"),
                SupplierId= pe.bSupplierID,
                PEs = new SelectList(peCodeModel.PEs, "Id", "Code"),
                StockInDetailList = stockInDetailList,
                TotalRecords = totalDetailRecords
            };

            return View(model);
        }
示例#12
0
        public ActionResult LoadDataList(int page, int size, int store, int poType, string status, string po, int supplier, string srv, string stockCode, string stockName, string fd, string td, string enable)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var totalRecord = _service.ListConditionCount(page, size, store, poType, status, po, supplier, srv, stockCode, stockName, fd, td, enable);
            var totalTemp = Convert.ToDecimal(totalRecord) / Convert.ToDecimal(size);
            var totalPages = Convert.ToInt32(Math.Ceiling(totalTemp));
            var model = new FulfillmentViewModel
            {
                UserLogin = _systemService.GetUserAndRole(0, userName),
                StockInList = _service.ListCondition(page, size, store, poType, status, po, supplier, srv, stockCode, stockName, fd, td, enable),
                TotalRecords = Convert.ToInt32(totalRecord),
                TotalPages = totalPages,
                CurrentPage = page,
                PageSize = size
            };

            return PartialView("_StockInPartial", model);
        }
示例#13
0
        public ActionResult LoadDataDetailList(int id, string enable)
        {
            var detailList = _service.ListConditionDetail(id, enable);
            var model = new FulfillmentViewModel
            {
                StockInDetailList = detailList,
                TotalRecords = detailList.Count()
            };

            return PartialView("_StockInDetailPartial", model);
        }
示例#14
0
 public ActionResult Index()
 {
     var userName = System.Web.HttpContext.Current.User.Identity.Name;
     var user = _systemService.GetUserAndRole(0, userName);
     if (user == null) return RedirectToAction("Index", "Login");
     if (user.StockInR == 0) return RedirectToAction("Index", "Home");
     var model = new FulfillmentViewModel
     {
         UserLogin = user,
         Stores = new SelectList(_systemService.StoreList(), "Id", "Name"),
         PoTypes = new SelectList(_systemService.PoTypeList(), "Id", "Name"),
         Suppliers = new SelectList(_systemService.SupplierList(), "Id", "Name")
     };
     return View(model);
 }
示例#15
0
        public async Task <FulfillmentViewModel> GetByCode(string code)
        {
            FulfillmentViewModel result = null;
            string cmd = $@"SELECT * FROM `fulfillment` f
                            LEFT JOIN `address` a ON a.id = f.address_id AND a.is_used = 1 AND a.is_deleted = 0
                            LEFT JOIN `contact` cc ON cc.id = f.contact_id AND cc.is_used = 1 AND cc.is_deleted = 0
                            WHERE f.code = '{code}' and f.is_deleted = 0";

            if (DbConnection != null)
            {
                var rd = await DbConnection.QueryMultipleAsync(cmd, transaction : DbTransaction);

                rd.Read <Fulfillment, Address, Contact, FulfillmentViewModel>(
                    (fRs, aRs, ccRs) =>
                {
                    if (result == null)
                    {
                        result = CommonHelper.Mapper <Fulfillment, FulfillmentViewModel>(fRs);
                    }

                    if (result.Address == null)
                    {
                        result.Address = aRs;
                    }

                    if (result.Contact == null)
                    {
                        result.Contact = ccRs;
                    }

                    return(result);
                }
                    );

                return(result);
            }
            else
            {
                using (var conn = DALHelper.GetConnection())
                {
                    var rd = await conn.QueryMultipleAsync(cmd);

                    rd.Read <Fulfillment, Address, Contact, FulfillmentViewModel>(
                        (fRs, aRs, ccRs) =>
                    {
                        if (result == null)
                        {
                            result = CommonHelper.Mapper <Fulfillment, FulfillmentViewModel>(fRs);
                        }

                        if (result.Address == null)
                        {
                            result.Address = aRs;
                        }

                        if (result.Contact == null)
                        {
                            result.Contact = ccRs;
                        }

                        return(result);
                    }
                        );

                    return(result);
                }
            }
        }
示例#16
0
 public UpdateCommand(FulfillmentViewModel fulfillment)
 {
     Fulfillment = fulfillment;
 }