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")); } }
public DataManager() { //sqlConn = SqlConnHelper.Connect(); userDao = new UserDAO(SqlConnHelper.Connect()); playerDAO = new PlayerDAO(SqlConnHelper.Connect()); inventoryDAO = new InventoryDAO(SqlConnHelper.Connect()); }
// 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(); }
// GET: Inventories/Details public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InventoryViewModel inventory = InventoryDAO.GetInventoryByItemNo(id); return(View(inventory)); }
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)); }
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)); }
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")); }
// 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)); }
// 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)); }
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")); } }
// 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)); }
public static bool Delete(int idInventory) => InventoryDAO.Delete(idInventory);
public List <InventoryViewModel> ReadInventory(string categoryId) { var list = InventoryDAO.GetInventories(categoryId); return(list); }
public InventoryService() { _inventoryDAO = new InventoryDAO(); }
public InventoryController() { requestCode = RequestCode.Inventory; mInv = new InventoryDAO(); }
public static bool Add(InventoryDTO invent) => InventoryDAO.Add(invent);
public static bool Update(InventoryDTO invent) => InventoryDAO.Update(invent);
public List <InventoryViewModel> ReadInventory() { var list = InventoryDAO.GetInventories(); return(list); }
public static List <InventoryDTO> GetInventoryByTimeNow() => InventoryDAO.GetInventoryByTimeNow(DateTime.Now.Month, DateTime.Now.Year);
public List <string> ReadCategories() { var res = InventoryDAO.getAllCategoryId(); return(res); }