public override void Run() { CompanyForm f = new CompanyForm(new Company()); f.CompanySave += delegate(object sender, CompanyEventArgs e) { using (var d = new SaveFileDialog()) { d.Title = "Filename for New Company"; d.FileName = f.Company.Name + ".sqlite"; if (d.ShowDialog() == DialogResult.OK) { SQLiteConnection con = new SQLiteConnection("Data Source=" + d.FileName + ";Version=3"); con.Open(); SQLiteUtility.ExecuteNonQuery(con, new StreamReader(Path.Combine(ApplicationUtility.RootDirectory, "sqlscript.sql")).ReadToEnd()); con.Close(); NHibernateHelper.CloseSession(); NHibernateHelper.Configuration = new SQLiteDatabase(con.ConnectionString).CreateConfiguration(); new NHibernateCompanyRepository().SaveOrUpdate(f.Company); new NHibernateUserRepository().SaveOrUpdate(new User("admin", "root")); } } }; WorkbenchSingleton.AddDialog(f); }
public override void Run() { UserForm form = new UserForm(user); IUserRepository dao = new NHibernateUserRepository(); WorkbenchSingleton.AddDialog(form, "Edit User"); }
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(); } } } } } }
public TruckLoadForm(TruckLoad load) { InitializeComponent(); this.TruckLoad = load; listViewItems.Resize += delegate { columnHeader2.Width = listViewItems.Width - 22 - (columnHeader1.Width + columnHeader3.Width + columnHeader4.Width + columnHeader5.Width + columnHeader6.Width + columnHeader7.Width); }; newToolStripMenuItem.Click += delegate { if (ItemAdding != null) { ItemAdding(new TruckLoadItem(), null); } }; editToolStripMenuItem.Click += delegate { if (listViewItems.SelectedItems.Count > 0) { using (TruckLoadItemForm f = new TruckLoadItemForm(load.Items[listViewItems.SelectedItems[0].Index])) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { LoadItemsChanged(this, null); } } } }; listViewItems.DoubleClick += delegate { editToolStripMenuItem.PerformClick(); }; deleteToolStripMenuItem.Click += delegate { if (listViewItems.SelectedItems.Count > 0) { load.RemoveItem(load.Items[listViewItems.SelectedItems[0].Index]); } }; }
public override void Run() { UserListForm form = new UserListForm(); IUserRepository dao = new NHibernateUserRepository(); form.UsersList += delegate { form.Users = dao.FindActive(); }; WorkbenchSingleton.AddDialog(form); }
void ButtonNewClick(object sender, EventArgs e) { using (ModuleCommandForm f = new ModuleCommandForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { module.AddCommand(f.Command); } } }
void NewToolStripMenuItemClick(object sender, EventArgs e) { using (var f = new TruckReturnItemForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { ret.AddItem(f.ReturnItem); } } }
void ButtonAddressDetailsClick(object sender, EventArgs e) { using (var f = new AddressForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { richTextBoxAddress.Text = f.Address.ToString(); } } }
void ButtonNewClick(object sender, EventArgs e) { using (CustomerDiscountedItemForm f = new CustomerDiscountedItemForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { customer.AddDiscountedItem(f.CustomerDiscountedItem); } } }
void ButtonNewClick(object sender, EventArgs e) { using (var f = new PeriodCategoryForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { period.AddCategory(f.Category); } } }
void ButtonAdd2Click(object sender, EventArgs e) { using (VendorReturnedItemForm f = new VendorReturnedItemForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { receipt.AddReturnedItem(f.Item as VendorReturnedItem); UpdateReceiptReturnedItems(); } } }
void ButtonAddClick(object sender, EventArgs e) { using (SalesInfoDetailForm f = new SalesInfoDetailForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { info.AddDetail(f.Detail); RefreshList(); } } }
void PayToolStripMenuItemClick(object sender, EventArgs e) { if (listViewInvoices.SelectedItems.Count > 0) { using (var f = new AmountForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { } } } }
void EnterPaymentToolStripMenuItemClick(object sender, EventArgs e) { if (listViewInvoices.SelectedItems.Count > 0) { PaymentInvoice invoice = payment.Invoices[listViewInvoices.SelectedItems[0].Index]; using (var f = new PaymentInvoiceForm(invoice)) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { } } } }
void ButtonEditClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { CustomerDiscountedItem item = customer.DiscountedItems[listView1.SelectedItems[0].Index]; using (CustomerDiscountedItemForm f = new CustomerDiscountedItemForm(item)) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { DiscountedItemsChanged(); } } } }
void ListView1DoubleClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { SalesInfoDetail i = info.Details[listView1.SelectedItems[0].Index]; using (SalesInfoDetailForm f = new SalesInfoDetailForm(i)) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { RefreshList(); } } } }
void ListView1DoubleClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { PhysicalCountItem item = count.Items[listView1.SelectedItems[0].Index]; using (PhysicalCountItemForm f = new PhysicalCountItemForm(item)) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { RefreshList(); } } } }
void ListView2DoubleClick(object sender, EventArgs e) { if (listViewItems.SelectedItems.Count > 0) { VendorReturnedItem i = receipt.ReturnedItems[listViewItems.SelectedItems[0].Index]; using (VendorReturnedItemForm f = new VendorReturnedItemForm(i)) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { UpdateReceiptReturnedItems(); } } } }
public override void Run() { CompanyForm form = new CompanyForm(company); ICompanyRepository companyDao = new NHibernateCompanyRepository(); ICountryRepository countryDao = new NHibernateCountryRepository(); form.CountriesList += delegate { form.Countries = countryDao.FindActive(); }; form.LegalCountriesList += delegate { form.LegalCountries = countryDao.FindActive(); }; form.CompanySave += delegate(object sender, CompanyEventArgs e) { companyDao.SaveOrUpdate(e.Company); form.Close(); }; WorkbenchSingleton.AddDialog(form); }
void ButtonEditClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { ModuleCommand command = module.Commands[listView1.SelectedItems[0].Index]; using (ModuleCommandForm f = new ModuleCommandForm(command)) { f.Text = "Edit Module Command"; if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { ModuleCommandsChanged(this, null); } } } }
void CloseToolStripMenuItemClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { using (AdminPasswordForm f = new AdminPasswordForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { foreach (ListViewItem li in listView1.SelectedItems) { SalesInfo s = infos[li.Index]; CloseSalesInfo(s, null); } OnActivated(null); } } } }
public override void Run() { // var view = new ChangePasswordForm(UserSingleton.Instance); // view.SaveUser += delegate(User sender, EventArgs e) { // if (view.NewPassword != string.Empty) { // if (view.NewPassword == view.ConfirmPassword) { // sender.SaveOrUpdate(); // view.Close(); // } else { // MessageService.ShowWarning("Passwords do not match!"); // } // } else { // sender.SaveOrUpdate(); // view.Close(); // } // }; // WorkbenchSingleton.AddDialog(view); ChangePasswordForm form = new ChangePasswordForm(UserSingleton.Instance); WorkbenchSingleton.AddDialog(form); }
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(); } } } } } }
public override void Run() { SalesReceiptForm receiptForm = new SalesReceiptForm(); SalesReceiptItemForm itemForm = new SalesReceiptItemForm(); ISalesReceiptRepository receiptDao = new NHibernateSalesReceiptRepository(); IVehicleTripRepository tripDao = new NHibernateVehicleTripRepository(); IAccountRepository accountDao = new NHibernateAccountRepository(); ICustomerRepository customerDao = new NHibernateCustomerRepository(); IPaymentMethodRepository methodDao = new NHibernatePaymentMethodRepository(); IItemRepository itemDao = new NHibernateItemRepository(); receiptForm.VehicleTripsList += delegate { receiptForm.VehicleTrips = tripDao.FindAll(); }; receiptForm.ListAccounts += delegate { receiptForm.Accounts = accountDao.FindIncomeAccounts(); }; receiptForm.PaymentMethodsList += delegate { receiptForm.PaymentMethods = methodDao.FindActive(); }; receiptForm.CustomersList += delegate { receiptForm.Customers = customerDao.FindActive(); }; itemForm.ItemFind += delegate(object sender, ItemEventArgs e) { IList <Item> items = itemDao.FindByName(e.Item.Name); if (items.Count == 1) { itemForm.ReceiptItem.Item = items[0]; } else { } }; receiptForm.ItemAdding += delegate(object sender, SalesReceiptItemEventArgs e) { itemForm.ReceiptItem = e.ReceiptItem; if (WorkbenchSingleton.AddDialog(itemForm) == DialogResult.OK) { receiptForm.SalesReceipt.AddItem(itemForm.ReceiptItem); } }; receiptForm.SalesReceiptSaveAndClose += delegate(object sender, SalesReceiptEventArgs e) { receiptDao.SaveOrUpdate(e.SalesReceipt); receiptForm.Close(); }; WorkbenchSingleton.AddChild(receiptForm); }
public override void Run() { InvoiceForm invoiceForm = new InvoiceForm(); InvoiceItemForm itemForm = new InvoiceItemForm(); IInvoiceRepository invoiceDao = new NHibernateInvoiceRepository(); IVehicleTripRepository tripDao = new NHibernateVehicleTripRepository(); ICustomerRepository customerDao = new NHibernateCustomerRepository(); IItemRepository itemDao = new NHibernateItemRepository(); IAccountRepository accountDao = new NHibernateAccountRepository(); invoiceForm.VehicleTripsList += delegate { invoiceForm.VehicleTrips = tripDao.FindAll(); }; invoiceForm.AccountsList += delegate { invoiceForm.Accounts = accountDao.FindAccountsReceivables(); }; invoiceForm.CustomersList += delegate { invoiceForm.Customers = customerDao.FindActive(); }; itemForm.ItemFind += delegate(object sender, ItemEventArgs e) { IList <Item> items = itemDao.FindByName(e.Item.Name); if (items.Count == 1) { itemForm.InvoiceItem.Item = items[0]; } else { // TODO: Add item list of value! } }; invoiceForm.ItemAdding += delegate(object sender, InvoiceItemEventArgs e) { itemForm.InvoiceItem = e.InvoiceItem; if (WorkbenchSingleton.AddDialog(itemForm) == DialogResult.OK) { invoiceForm.Invoice.AddItem(itemForm.InvoiceItem); } }; invoiceForm.InvoiceSaveAndClose += delegate(object sender, InvoiceEventArgs e) { invoiceDao.SaveOrUpdate(e.Invoice); invoiceForm.Close(); }; WorkbenchSingleton.AddChild(invoiceForm); }
void ButtonAddClick(object sender, EventArgs e) { WorkbenchSingleton.AddDialog(new UserForm()); }
void ButtonNotesClick(object sender, EventArgs e) { WorkbenchSingleton.AddDialog(new NotepadForm(name)); }
void ButtonShipToAddressClick(object sender, EventArgs e) { WorkbenchSingleton.AddDialog(new ShipToInformationForm(company)); }
public override void Run() { WorkbenchSingleton.AddDialog(new AboutForm()); }