//進貨單 public ActionResult 進貨單建立() { MotaiDataEntities dbContext = new MotaiDataEntities(); if (Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] != null) { StockCreateViewModel model = new StockCreateViewModel(); StockDetailViewModel detail = new StockDetailViewModel(); tEmployee emp = Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] as tEmployee; model.sEmployeeId = emp.EmployeeId; var productNames = productRespoitory.GetNameAll(); List <SelectListItem> productlist = productRespoitory.GetPositionName(productNames); var warehouseNames = commodityRespoitory.GetWarehouseAll(); List <SelectListItem> warehouselist = commodityRespoitory.GetSelectList(warehouseNames); detail.WareHouseNames = warehouselist; detail.ProductNames = productlist; DateTime today = DateTime.Now.Date; var count = dbContext.tStockLists.Where(s => s.sStockDate == today).ToList().Count; count++; model.sStockSerialValue = Convert.ToInt32(DateTime.Now.ToString("yyMMdd") + count.ToString("0000")); model.StockDetail = detail; model.sStockDate = DateTime.Now; return(View(model)); } else { return(RedirectToAction("員工登入", "Employee")); } }
public ActionResult 新增日誌() { tEmployee emp = Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] as tEmployee; ViewBag.name = emp.eName; ViewBag.empId = emp.EmployeeId; DiaryViewModel newDiary = new DiaryViewModel(); var warehouses = commodityRespoitory.GetWarehouseAll(); List <SelectListItem> WareList = commodityRespoitory.GetSelectList(warehouses); newDiary.warehouses = WareList; newDiary.dDate = DateTime.Now; return(View(newDiary)); }
public ActionResult 購物車清單() { if (Session[CSession關鍵字.SK_LOGINED_CUSTOMER] != null) { MotaiDataEntities dbContext = new MotaiDataEntities(); tCustomer cust = Session[CSession關鍵字.SK_LOGINED_CUSTOMER] as tCustomer; int count = dbContext.tStatus.Where(c => c.sCustomerId == cust.CustomerId).ToList().Count; ViewBag.Count = count + "項"; List <tStatu> StateList = dbContext.tStatus.Where(c => c.sCustomerId == cust.CustomerId).ToList(); List <StatusCartViewModel> cartList = new List <StatusCartViewModel>(); StatusCartGoToPayViewModel Cart = new StatusCartGoToPayViewModel(); foreach (var items in StateList) { tProduct cartProd = dbContext.tProducts.Where(p => p.ProductId == items.sProductId).FirstOrDefault(); StatusCartViewModel cartC = new StatusCartViewModel(); cartC.StatusId = items.StatusId; cartC.ProductId = items.sProductId; cartC.pName = cartProd.pName; cartC.pPrice = cartProd.pPrice; cartC.sProductQty = items.sProductQty; cartList.Add(cartC); } Cart.Carts = cartList; var warehouseNames = commodityRespoitory.GetWarehouseAll(); List <SelectListItem> warehouselist = commodityRespoitory.GetSelectList(warehouseNames); Cart.warehouses = warehouselist; return(View(Cart)); } else { return(RedirectToAction("首頁")); } }
public ActionResult 實體店新增訂單() { if (Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] != null) { tEmployee emp = Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] as tEmployee; EmployeeOrderViewModel model = new EmployeeOrderViewModel(); model.oEmployeeId = emp.EmployeeId; var warehouseNames = commodityRespoitory.GetWarehouseAll(); List <SelectListItem> warehouselist = commodityRespoitory.GetSelectList(warehouseNames); model.WareHouseNames = warehouselist; return(View(model)); } else { return(RedirectToAction("員工登入", "Employee")); } }
//進貨單 public ActionResult 進貨單建立() { if (Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] != null) { StockCreateViewModel model = new StockCreateViewModel(); StockDetailViewModel detail = new StockDetailViewModel(); tEmployee emp = Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] as tEmployee; model.sEmployeeId = emp.EmployeeId; var productNames = productRespoitory.GetNameAll(); List <SelectListItem> productlist = productRespoitory.GetSelectList(productNames); var warehouseNames = commodityRespoitory.GetWarehouseAll(); List <SelectListItem> warehouselist = commodityRespoitory.GetSelectList(warehouseNames); detail.WareHouseNames = warehouselist; detail.ProductNames = productlist; model.StockDetail = detail; return(View(model)); } return(RedirectToAction("員工登入", "Employee")); }
public ActionResult 實體店新增訂單() { if (Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] != null) { tEmployee emp = Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] as tEmployee; EmployeeOrderViewModel model = new EmployeeOrderViewModel(); EmployeeOrderDetailViewModel detail = new EmployeeOrderDetailViewModel(); model.oEmployeeId = emp.EmployeeId; var warehouseNames = commodityRespoitory.GetWarehouseAll(); List <SelectListItem> warehouselist = commodityRespoitory.GetSelectList(warehouseNames); var productNames = productRespoitory.GetNameAll(); List <SelectListItem> productlist = commodityRespoitory.GetSelectList(productNames); model.WareHouseNames = warehouselist; detail.ProductNames = productlist; detail.oProductQty = 1; model.oDate = DateTime.Now.Date; model.empOrderDetail = detail; return(View(model)); } else { return(RedirectToAction("員工登入", "Employee")); } }