// tạo lô hàng mới public int CreateBatch(CreateBatchInputModel input, int CreateUserID) { try { if (CheckDuplicateBatchCode(input.BatchCode)) { return(SystemParam.DUPLICATE_NAME); } if (input.Note == null) { input.Note = ""; } Batch batch = new Batch(); batch.CreateUserID = CreateUserID; batch.BatchName = input.BatchName; batch.BatchCode = input.BatchCode; batch.Point = Convert.ToInt32((input.Point).ToString().Replace(",", "")); batch.QTY = Convert.ToInt32((input.QTY).ToString().Replace(",", "")); batch.Price = Convert.ToInt32((input.Price).ToString().Replace(",", "")); batch.Note = input.Note; batch.IsActive = SystemParam.ACTIVE; batch.CreateDate = DateTime.Today; batch.Products = CreateProductOfBatch(batch.BatchCode, batch.QTY); cnn.Batches.Add(batch); cnn.SaveChanges(); return(SystemParam.RETURN_TRUE); } catch (Exception ex) { ex.ToString(); return(SystemParam.RETURN_FALSE); } }
public int CreateBatch(CreateBatchInputModel input) { try { UserDetailOutputModel userLogin = UserLogins; return(batchBusiness.CreateBatch(input, userLogin.UserID)); } catch { return(SystemParam.RETURN_FALSE); } }