예제 #1
0
        public ActionResult Create(StockCardViewModel stockCardViewModel)
        {
            string itemNo = null;

            if (TempData.ContainsKey("id"))
            {
                itemNo = TempData["id"].ToString();
            }
            InventoryViewModel i = InventoryDAO.GetInventoryByItemNo(itemNo);

            stockCardViewModel.balance      = i.balance;
            stockCardViewModel.category     = i.category;
            stockCardViewModel.description  = i.description;
            stockCardViewModel.itemNo       = i.itemNo;
            stockCardViewModel.dateModified = DateTime.Today;
            bool result = StockCardDAO.CreateStockCard(stockCardViewModel);

            if (result)
            {
                return(RedirectToAction("Index", new { id = itemNo }));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
예제 #2
0
 public DataManager()
 {
     //sqlConn = SqlConnHelper.Connect();
     userDao      = new UserDAO(SqlConnHelper.Connect());
     playerDAO    = new PlayerDAO(SqlConnHelper.Connect());
     inventoryDAO = new InventoryDAO(SqlConnHelper.Connect());
 }
예제 #3
0
        // GET: Inventories/Edit
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            InventoryViewModel inventoryViewModel = InventoryDAO.GetInventoryByItemNo(id);

            if (inventoryViewModel == null)
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
            ;

            // drop down list
            List <String> listItem = new List <string>();

            listItem.Add("Dozen");
            listItem.Add("Box");
            listItem.Add("Each");
            listItem.Add("Set");
            listItem.Add("Packet");
            ViewBag.unitMeasure = new SelectList(listItem, inventoryViewModel.unitMeasure);

            // drop down list
            var categories = InventoryDAO.getAllCategoryId();

            ViewBag.category = new SelectList(categories, inventoryViewModel.category);

            // push to view
            return(View(inventoryViewModel));
        }
        protected void Fetch_Click(object sender, EventArgs e)
        {
            string  name = ddlName.SelectedValue.ToString();
            DataSet D    = new InventoryDAO().getMedicineInfo(name);

            tbID.Text       = D.Tables[0].Rows[0]["ID"].ToString();
            tbQuantity.Text = D.Tables[0].Rows[0]["Quantity"].ToString();
            tbPrice.Text    = D.Tables[0].Rows[0]["Price"].ToString();
            tbSupplier.Text = D.Tables[0].Rows[0]["Supplier"].ToString();
        }
예제 #5
0
        // GET: Inventories/Details
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InventoryViewModel inventory = InventoryDAO.GetInventoryByItemNo(id);

            return(View(inventory));
        }
예제 #6
0
        public ActionResult Create(string itemNo, string supplierId, int?poId, string category)
        {
            ViewBag.poId = poId;

            ViewBag.category = category;

            ViewBag.categoryList = new SelectList(InventoryDAO.getAllCategoryId(), category);

            if (itemNo != null && supplierId != null)
            {
                switch (poId)
                {
                // new po
                case null:
                    var li = Session["pocartItems"] as List <PurchaseOrderViewModel>;
                    PurchaseOrderDAO.IncreasePOList(itemNo, supplierId, ref li);
                    Session["pocartItems"] = li;
                    break;

                // existed po
                default:
                    int count = PurchaseOrderDAO.addPODetail(itemNo, (int)poId);
                    ViewBag.DetailItemCount = count;
                    break;
                }
            }

            List <PurchaseOrderViewModel> list = null;

            if (!string.IsNullOrEmpty(category) && category != "0")
            {
                // only for this category
                if (poId == null)
                {
                    list = PurchaseOrderDAO.getAllPOVM(category);
                }
                else
                {
                    list = PurchaseOrderDAO.getAllPOVM((int)poId, category);
                }
            }
            else
            {
                if (poId == null)
                {
                    list = PurchaseOrderDAO.getAllPOVM();
                }
                else
                {
                    list = PurchaseOrderDAO.getAllPOVM((int)poId);
                }
            }

            return(View(list));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SqlDataReader DR = new InventoryDAO().getMedicineNames();
         while (DR.Read())
         {
             ddlName.Items.Add(DR[0].ToString());
         }
     }
 }
        // GET: AdjustmentVouchers/Create
        public ActionResult Create()
        {
            //ViewBag.category = AdjustmentVoucherDAO.GetCategorySelectList();
            List <InventoryViewModel> items = InventoryDAO.GetInventories();

            ViewBag.stationeryList = new SelectList(items, "itemNo", "description");
            AdjustmentVoucherViewModel model = new AdjustmentVoucherViewModel();

            model.quantity = 1;
            model.remark   = "0";
            return(View(model));
        }
예제 #9
0
        public ActionResult Store(string itemNo, int?requestId, string category)
        {
            ViewBag.requestId = requestId;

            ViewBag.category = category;

            ViewBag.categoryList = new SelectList(InventoryDAO.getAllCategoryId(), category);

            // Click add to cart
            if (itemNo != null)
            {
                switch (requestId)
                {
                // New request (store in session)
                case null:
                {
                    var li = Session["cartItems"] as List <string>;
                    IncreaseStringList(ref li, itemNo);
                    Session["cartItems"] = li;
                }
                break;

                // Existed request (store in database
                default:
                {
                    // insert the request detail
                    RequestViewModel rd = new RequestViewModel()
                    {
                        itemNo               = itemNo,
                        requestId            = Convert.ToInt32(requestId),
                        quantityNeed         = 1,
                        status_requestDetail = "unfulfilled"
                    };

                    int count = RequestDAO.InsertRequestDetail(rd);
                    ViewBag.RequestItemCount = count;
                }
                break;
                }
            }

            List <InventoryViewModel> items = null;

            if (!string.IsNullOrEmpty(category) && category != "0")
            {
                items = InventoryDAO.GetInventories(category);
            }
            else
            {
                items = InventoryDAO.GetInventories();
            }
            return(View(items));
        }
예제 #10
0
        public ActionResult DeleteConfirmed(string id)
        {
            InventoryViewModel inventoryViewModel = InventoryDAO.GetInventoryByItemNo(id);
            bool result = AdjustmentVoucherDAO.DeleteInventories(inventoryViewModel);

            if (!result)
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }

            return(RedirectToAction("Index"));
        }
예제 #11
0
        // GET: Inventories/Delete
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InventoryViewModel inventoryViewModel = InventoryDAO.GetInventoryByItemNo(id);

            if (inventoryViewModel == null)
            {
                return(HttpNotFound());
            }
            return(View(inventoryViewModel));
        }
예제 #12
0
        // GET: StockCard/ViewStockCard
        public ActionResult ViewStockCard(string category)
        {
            List <string> categories = InventoryDAO.getAllCategoryId();

            ViewBag.categoryList = new SelectList(categories, category);

            List <InventoryViewModel> list = new List <InventoryViewModel>();

            if (!String.IsNullOrEmpty(category) && category.ToLower() != "all")
            {
                list = InventoryDAO.GetInventories(category);
            }
            else
            {
                list = InventoryDAO.GetInventories();
            }

            return(View(list));
        }
예제 #13
0
        public ActionResult Edit(InventoryViewModel inventoryViewModel)
        {
            if (!ModelState.IsValidField(nameof(InventoryViewModel.itemNo)) ||
                !ModelState.IsValidField(nameof(InventoryViewModel.category)) ||
                !ModelState.IsValidField(nameof(InventoryViewModel.description)) ||
                !ModelState.IsValidField(nameof(InventoryViewModel.unitMeasure)) ||
                !ModelState.IsValidField(nameof(InventoryViewModel.reorderQuantity)) ||
                !ModelState.IsValidField(nameof(InventoryViewModel.reorderLevel)) ||
                !ModelState.IsValidField(nameof(InventoryViewModel.stdPrice)) ||
                !ModelState.IsValidField(nameof(InventoryViewModel.balance))
                )
            {
                // drop down list
                List <String> listItem = new List <string>();
                listItem.Add("Dozen");
                listItem.Add("Box");
                listItem.Add("Each");
                listItem.Add("Set");
                listItem.Add("Packet");
                ViewBag.unitMeasure = new SelectList(listItem, inventoryViewModel.unitMeasure);

                // drop down list
                var categories = InventoryDAO.getAllCategoryId();
                ViewBag.category = new SelectList(categories, inventoryViewModel.category);

                return(View(inventoryViewModel));
            }

            // biz logic here...
            bool bRes = AdjustmentVoucherDAO.EditInventories(inventoryViewModel);

            if (bRes)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
예제 #14
0
        // GET: StockCard/Create
        public ActionResult Create()
        {
            string itemNo = null;

            if (TempData.ContainsKey("id"))
            {
                itemNo         = TempData["id"].ToString();
                TempData["id"] = itemNo;
            }
            InventoryViewModel i = InventoryDAO.GetInventoryByItemNo(itemNo);
            StockCardViewModel stockCardViewModel = new StockCardViewModel();

            stockCardViewModel.balance     = i.balance;
            stockCardViewModel.category    = i.category;
            stockCardViewModel.description = i.description;
            stockCardViewModel.itemNo      = i.itemNo;
            string today = DateTime.Now.ToShortDateString();

            ViewBag.date = today;

            return(View(stockCardViewModel));
        }
예제 #15
0
 public static bool Delete(int idInventory) => InventoryDAO.Delete(idInventory);
예제 #16
0
        public List <InventoryViewModel> ReadInventory(string categoryId)
        {
            var list = InventoryDAO.GetInventories(categoryId);

            return(list);
        }
예제 #17
0
 public InventoryService()
 {
     _inventoryDAO = new InventoryDAO();
 }
예제 #18
0
 public InventoryController()
 {
     requestCode = RequestCode.Inventory;
     mInv        = new InventoryDAO();
 }
예제 #19
0
 public static bool Add(InventoryDTO invent) => InventoryDAO.Add(invent);
예제 #20
0
 public static bool Update(InventoryDTO invent) => InventoryDAO.Update(invent);
예제 #21
0
        public List <InventoryViewModel> ReadInventory()
        {
            var list = InventoryDAO.GetInventories();

            return(list);
        }
예제 #22
0
 public static List <InventoryDTO> GetInventoryByTimeNow() => InventoryDAO.GetInventoryByTimeNow(DateTime.Now.Month, DateTime.Now.Year);
예제 #23
0
        public List <string> ReadCategories()
        {
            var res = InventoryDAO.getAllCategoryId();

            return(res);
        }