public ActionResult EnterProduct(ProductModel productmodel, int id) { string soluong = Request.Form["product_more_quantity"]; var dao = new ProductDao(); var product = new PRODUCT(); var warehouse = new WAREHOUSE(); if (soluong == "") { ViewData["error"] = "Hãy nhập số lượng sản phẩm "; } else { product.product_Remain = (Convert.ToInt32(productmodel.product_Remain) + Convert.ToInt32(soluong)).ToString(); warehouse.product_more_quantity = soluong; warehouse.productId = id; warehouse.sl_Ngaynhap = DateTime.Now; var result = dao.EnterProduct(product, id); if (result) { ViewData["success"] = "Nhập thêm hàng thành công"; dao.InsertWareHose(warehouse, id); } else { ViewData["error"] = "Nhập thêm hàng thất bại"; } } return(View()); }
//[AuthorizeAdmin(Permissions = new Permission[] { Permission.Floor_Create, Permission.Floor_Edit })] public ActionResult CreateEdit(WAREHOUSE model) { if (model.ID == 0) { var result = KhoService.Create(model); return (Json( new RedirectCommand() { Code = result.Code, Message = result.Message, Url = Url.Action("Index", new { id = model.ID }) }, JsonRequestBehavior.AllowGet)); } else { var result = KhoService.Edit(model); return (Json( new RedirectCommand() { Code = result.Code, Message = result.Message, Url = Url.Action("Index", new { id = model.ID }) }, JsonRequestBehavior.AllowGet)); } }
public static CommandResult Create(WAREHOUSE c) { using (var context = new GST_MockProjectEntities()) { context.WAREHOUSEs.Add(c); context.SaveChanges(); //TODO //context.Log(c, LogType.BankBranch_Create, userId, "", HttpContext.Current.Request.Form); return(new CommandResult()); } }
private List <ACCESSORYStorageDto> GetStoredAccessories(WAREHOUSE warehouse) { var warehouseTable = new List <WAREHOUSE>(); warehouseTable.Add(warehouse); var accessories = warehouseTable.Join(db.ACCESSORY_STORED, w => w.ID, g => g.WAREHOUSE_ID, (w, g) => new { g.ACCESSORY_ID, g.QUANTITY }).Join(db.ACCESSORY, w => w.ACCESSORY_ID, a => a.ID, (w, a) => new ACCESSORYStorageDto() { id = "AC" + w.ACCESSORY_ID, model = a.MODEL_NUMBER, type = a.TYPE_NAME, number = w.QUANTITY }).ToList(); return(accessories); }
private List <EQStorageDto> GetStoredEQ(WAREHOUSE warehouse) { var warehouseTable = new List <WAREHOUSE>(); warehouseTable.Add(warehouse); var eqs = warehouseTable.Join(db.EQ_STORED, w => w.ID, g => g.WAREHOUSE_ID, (w, g) => new { g.ID, g.EQ_TYPE_ID }).Join(db.EQ_TYPE, w => w.EQ_TYPE_ID, e => e.ID, (w, e) => new EQStorageDto() { id = "WH" + w.ID, model = e.MODEL_NUMBER, type = e.TYPE_NAME }).ToList(); return(eqs); }
internal static void SelectNation(ref Packet result, byte nation, string strUserID) { KODatabase db = new KODatabase(); ACCOUNT_CHAR aChar = db.ACCOUNT_CHAR.Where(acc => acc.strAccountID == strUserID).FirstOrDefault(); WAREHOUSE wHouse = db.WAREHOUSE.Where(wh => wh.strAccountID == strUserID).FirstOrDefault(); if (wHouse == null) { wHouse = new WAREHOUSE(); wHouse.strAccountID = strUserID; wHouse.nMoney = 0; wHouse.dwTime = 0; wHouse.WarehouseData = new byte[1536]; wHouse.strSerial = new byte[1536]; wHouse.WarehouseDataTime = new byte[1536]; db.WAREHOUSE.Add(wHouse); Debug.WriteLine("WAREHOUSE hesabı bulunamadığından yeni WAREHOUSE eklendi."); } if (aChar == null) { aChar = new ACCOUNT_CHAR(); aChar.strAccountID = strUserID; aChar.bNation = nation; aChar.strCharID1 = null; aChar.strCharID2 = null; aChar.strCharID3 = null; db.ACCOUNT_CHAR.Add(aChar); Debug.WriteLine("Hesap bulunamadığından yeni account eklendi."); } else { nation = aChar.bNation; Debug.WriteLine("Hesap bilgileri alındı. Seçilen ırk {0}", nation); } db.SaveChanges(); if (nation != KARUS && nation != ELMORAD) { result.SetByte(0); return; } result.SetByte(nation); }
public static CommandResult Edit(WAREHOUSE c) { using (var context = new GST_MockProjectEntities()) { var Kho = context.WAREHOUSEs.First(x => x.ID == c.ID); Kho.WarehouseName = c.WarehouseName; Kho.Address = c.Address; Kho.Status = c.Status; context.SaveChanges(); //TODO // context.Log(c, LogType.Customer_Edit, userId, "", HttpContext.Current.Request.Form); return(new CommandResult()); } }
public int InsertWareHose(WAREHOUSE entity, int id) { db.WAREHOUSEs.Add(entity); db.SaveChanges(); return(entity.id_warehouse); }