void ButtonAddClick(object sender, EventArgs e) { using (PhysicalCountItemForm f = new PhysicalCountItemForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { PhysicalCountItem i = GetInDetails(f.Item); if (i != null) { i.AdjustedQty += f.Item.AdjustedQty; } else { count.AddItem(f.Item); } RefreshList(); PhysicalCountItem i3 = f.Item; if (i3.Item.IsFullCase()) { using (PhysicalCountItemForm f2 = new PhysicalCountItemForm()) { string suggestedCode = ItemSuggestionUtility.Suggest(i3.Item.Name.ToUpper().Replace("FC-", "MT-")); f2.FindCode(suggestedCode, i3.AdjustedQty); if (WorkbenchSingleton.AddDialog(f2) == DialogResult.OK) { PhysicalCountItem i2 = GetInDetails(f2.Item); if (i2 != null) { i2.AdjustedQty += f2.Item.AdjustedQty; } else { count.AddItem(f2.Item); } RefreshList(); } } } else if (i3.Item.IsSMBFullCase()) { using (PhysicalCountItemForm f2 = new PhysicalCountItemForm()) { string suggestedCode = ItemSuggestionUtility.Suggest(i3.Item.Name.ToUpper().Replace("SMBFC-", "SMBMT-")); f2.FindCode(suggestedCode, i3.AdjustedQty); if (WorkbenchSingleton.AddDialog(f2) == DialogResult.OK) { PhysicalCountItem i2 = GetInDetails(f2.Item); if (i2 != null) { i2.AdjustedQty += f2.Item.AdjustedQty; } else { count.AddItem(f2.Item); } RefreshList(); } } } } } }
void ButtonFindItemClick(object sender, EventArgs e) { string suggestedCode = ItemSuggestionUtility.Suggest(textBoxCode.Text); // IList<Item> items = Core.Models.Item.FindByName(suggestedCode); // if (items.Count == 1) { // item.Item = items[0]; // textBoxQuantity.Select(); // } else { // using (FindItemForm f = new FindItemForm(items)) { // if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { // item.Item = f.SelectedItem; // textBoxQuantity.Select(); // } else { // textBoxCode.Select(); // } // } // } // TODO: Use delegate in finding item for vendor returned item. }
void ButtonAddClick(object sender, EventArgs e) { using (ItemReceiptItemForm receiptItemForm = new ItemReceiptItemForm()) { receiptItemForm.Vendor = (comboBoxVendor.DataSource as IList <Vendor>)[comboBoxVendor.SelectedIndex]; if (WorkbenchSingleton.AddDialog(receiptItemForm) == DialogResult.OK) { receipt.AddItem(receiptItemForm.ReceiptItem as ItemReceiptItem); UpdateReceiptItems(); ItemReceiptItem receiptItem = receiptItemForm.ReceiptItem; if (receiptItem.Item.IsFullCase()) { using (ItemReceiptItemForm suggestedItemForm = new ItemReceiptItemForm()) { suggestedItemForm.Vendor = (comboBoxVendor.DataSource as IList <Vendor>)[comboBoxVendor.SelectedIndex]; string suggestedCode = ItemSuggestionUtility.Suggest(receiptItem.Item.Name.ToUpper().Replace("FC-", "MT-")); suggestedItemForm.FindCode(suggestedCode, receiptItem.Quantity); if (WorkbenchSingleton.AddDialog(suggestedItemForm) == DialogResult.OK) { receipt.AddItem(suggestedItemForm.ReceiptItem as ItemReceiptItem); UpdateReceiptItems(); } } } else if (receiptItem.Item.IsSMBFullCase()) { using (ItemReceiptItemForm suggestedItemForm = new ItemReceiptItemForm()) { suggestedItemForm.Vendor = (comboBoxVendor.DataSource as IList <Vendor>)[comboBoxVendor.SelectedIndex]; string suggestedCode = ItemSuggestionUtility.Suggest(receiptItem.Item.Name.ToUpper().Replace("SMBFC-", "SMBMT-")); suggestedItemForm.FindCode(suggestedCode, receiptItem.Quantity); if (WorkbenchSingleton.AddDialog(suggestedItemForm) == DialogResult.OK) { receipt.AddItem(suggestedItemForm.ReceiptItem as ItemReceiptItem); UpdateReceiptItems(); } } } } } }