protected override int SaveData() { int result = 1; //var tableChanged = dsDictionary.InventoryItem.GetChanges(); //if (tableChanged == null) //{ // return (int)EnumResultInsertUpdate.Success; //} //else //{ // if (tableChanged.Rows.Count == 0) // return (int)EnumResultInsertUpdate.Success; //} DictionaryDataSet.InventoryItemRow drObjectChange = (DictionaryDataSet.InventoryItemRow)((System.Data.DataRowView)bsDetail.Current).Row; if (drObjectChange != null) { var oldID = drObjectChange.InventoryItemID; if (FormActionMode == ActionMode.AddNew || FormActionMode == ActionMode.Copy) { drObjectChange.InventoryItemID = Guid.NewGuid(); } result = objBLDetail.InsertUpdate(drObjectChange, oldID); } return(result); }
protected override void InitCopyRow() { base.InitNewRow(); DictionaryDataSet.InventoryItemRow drCurrent = (DictionaryDataSet.InventoryItemRow)((DataRowView)bsDetail.Current).Row; objBLDetail.InitCopyRow(DsDictionary.InventoryItem, drCurrent); BsDetail.MoveFirst(); txtInventoryItemCode.Focus(); }
public int InsertUpdate(DictionaryDataSet.InventoryItemRow drObjectChange, Guid oldID) { ServiceResult result = CloudServiceFactory.ExecuteFunction("InventoryItem/InsertUpdate", new InsertUpdateParameter <InventoryItem>(oldID, CommonFunction.GetItem <InventoryItem>(drObjectChange)), HeaderParameter); if (result.Success == false) { if (result.ErrorCode == ErrorCode.DuplicateCode) { return(2); } return(0); } return(1); }
public DataRow InitCopyRow(DictionaryDataSet.InventoryItemDataTable table, DictionaryDataSet.InventoryItemRow row) { DictionaryDataSet.InventoryItemRow drNewRow = table.NewInventoryItemRow(); drNewRow.InventoryItemID = Guid.NewGuid(); drNewRow.InventoryItemCode = row.InventoryItemCode; drNewRow.InventoryItemName = row.InventoryItemName; drNewRow.InventoryItemType = row.InventoryItemType; if (row.IsInventoryItemCategoryIDNull()) { drNewRow.SetInventoryItemCategoryIDNull(); } else { drNewRow.InventoryItemCategoryID = row.InventoryItemCategoryID; } if (row.IsUnitIDNull()) { drNewRow.SetUnitIDNull(); } else { drNewRow.UnitID = row.UnitID; } drNewRow.Description = row.Description; if (row.IsFileResourceNull()) { drNewRow.SetFileResourceNull(); } else { drNewRow.FileResource = row.FileResource; } drNewRow.CourseType = row.CourseType; drNewRow.UnitPrice = row.IsUnitPriceNull() ? 0 : row.UnitPrice; drNewRow.Inactive = row.Inactive; drNewRow.CreatedDate = DateTime.Now; drNewRow.ModifiedDate = DateTime.Now; drNewRow.CreatedBy = Session.UserLogin.DisplayName; drNewRow.ModifiedBy = Session.UserLogin.DisplayName; drNewRow.OldIDs = row.OldIDs; table.Rows.InsertAt(drNewRow, 0); return(drNewRow); }
/// <summary> /// Thêm mới món ăn /// </summary> /// <param name="inventoryItem"></param> /// <returns></returns> private UctChooseFood CreateUctChooseFood(DictionaryDataSet.InventoryItemRow inventoryItem) { DictionaryDataSet.OrderRow master = (DictionaryDataSet.OrderRow)dsDictionary.Order.FindByOrderID(OrderID); var row = dsDictionary.OrderDetail.FirstOrDefault((t) => t.RowState != DataRowState.Deleted && t.InventoryItemID == inventoryItem.InventoryItemID && t.OrderDetailStatus == (int)EnumOrderDetailStatus.Ordering); if (row != null) { row.Quantity += 1; return(null); } else { DictionaryDataSet.OrderDetailRow orderDetail = (DictionaryDataSet.OrderDetailRow)_oBL.InitNewRowDetail(dsDictionary.OrderDetail, master, inventoryItem.InventoryItemID); var uct = new UctChooseFood(orderDetail); uct.Click += ChooseFood_Click; uct.CalculateAmount += new EventHandler(CalculateAmount); return(uct); } }
protected override void BindingData() { base.BindingData(); txtInventoryItemCode.DataBindings.Add(new Binding("Text", BsDetail, DsDictionary.InventoryItem.InventoryItemCodeColumn.ColumnName, true)); txtInventoryItemName.DataBindings.Add(new Binding("Text", BsDetail, DsDictionary.InventoryItem.InventoryItemNameColumn.ColumnName, true)); cboInventoryItemCategory.DataBindings.Add(new Binding("Value", BsDetail, DsDictionary.InventoryItem.InventoryItemCategoryIDColumn.ColumnName, true)); cboUnit.DataBindings.Add(new Binding("Value", BsDetail, DsDictionary.InventoryItem.UnitIDColumn.ColumnName, true)); cboInventoryItemType.DataBindings.Add(new Binding("Value", BsDetail, DsDictionary.InventoryItem.InventoryItemTypeColumn.ColumnName, true)); cboCourseType.DataBindings.Add(new Binding("Value", BsDetail, DsDictionary.InventoryItem.CourseTypeColumn.ColumnName, true)); txtUnitPrice.DataBindings.Add(new Binding("Text", BsDetail, DsDictionary.InventoryItem.UnitPriceColumn.ColumnName, true)); txtDescription.DataBindings.Add(new Binding("Text", BsDetail, DsDictionary.InventoryItem.DescriptionColumn.ColumnName, true)); imgFileResource.DataBindings.Add(new Binding("Image", BsDetail, DsDictionary.InventoryItem.FileResourceColumn.ColumnName, true)); DictionaryDataSet.InventoryItemRow dr = (DictionaryDataSet.InventoryItemRow)CurrentRow; if (dr != null && !dr.IsFileResourceNull()) { MemoryStream mem = new MemoryStream(dr.FileResource); imgFileResource.Image = Image.FromStream(mem); } }
/// <summary> /// Khởi tạo dữ liệu /// </summary> /// <param name="table"></param> public DataRow InitNewRow(DictionaryDataSet.InventoryItemDataTable table) { DictionaryDataSet.InventoryItemRow drNewRow = table.NewInventoryItemRow(); drNewRow.InventoryItemID = Guid.NewGuid(); drNewRow.InventoryItemCode = ""; drNewRow.InventoryItemName = ""; drNewRow.InventoryItemType = 0; drNewRow.SetInventoryItemCategoryIDNull(); drNewRow.SetUnitIDNull(); drNewRow.Description = ""; drNewRow.SetFileResourceNull(); drNewRow.CourseType = 0; drNewRow.UnitPrice = 0; drNewRow.Inactive = false; drNewRow.CreatedDate = DateTime.Now; drNewRow.ModifiedDate = DateTime.Now; drNewRow.CreatedBy = Session.UserLogin.DisplayName; drNewRow.ModifiedBy = Session.UserLogin.DisplayName; drNewRow.OldIDs = ""; table.Rows.InsertAt(drNewRow, 0); return(drNewRow); }
public DictionaryDataSet.InventoryItemRow GetByID(Guid objectID) { var table = new DataTable(); using (var sqlAdapter = new SqlDataAdapter()) { using (var sqlCommand = CreateSqlCommand("Proc_GetInventoryItemByID")) { sqlCommand.Parameters.AddWithValue("InventoryItemID", objectID); sqlAdapter.SelectCommand = sqlCommand; sqlAdapter.Fill(table); sqlCommand.Connection.Close(); } } if (table != null && table.Rows.Count > 0) { var ds = new DictionaryDataSet(); ds.InventoryItem.Merge(table); DictionaryDataSet.InventoryItemRow result = (DictionaryDataSet.InventoryItemRow)ds.InventoryItem[0]; return(result); } return(null); }
public UctFood(DictionaryDataSet.InventoryItemRow itemRow) { InitializeComponent(); DataInventoryItemRow = itemRow; }
public bool CheckCodeExists(DictionaryDataSet.InventoryItemRow drObjectChange) { ServiceResult result = CloudServiceFactory.ExecuteFunction("InventoryItem/CheckCodeExists", CommonFunction.GetItem <InventoryItem>(drObjectChange), HeaderParameter); return(result.Success); }
public bool CheckCodeExists(DictionaryDataSet.InventoryItemRow drObjectChange) { drObjectChange.ModifiedDate = DateTime.Now; drObjectChange.ModifiedBy = Session.UserLogin.DisplayName; return(new DL.DLInventoryItem(Session.Token).CheckCodeExists(drObjectChange)); }
public int InsertUpdate(DictionaryDataSet.InventoryItemRow drObjectChange, Guid oldID) { return(new DL.DLInventoryItem(Session.Token).InsertUpdate(drObjectChange, oldID)); }
/// <summary> /// Khởi tạo UserControl TableMapping /// </summary> /// <param name="iAreaTable"></param> /// <returns></returns> private UctFood CreateUctFood(DictionaryDataSet.InventoryItemRow iInventoryItem) { return(new UctFood(iInventoryItem)); }