public override void edit_button_Click(object sender, EventArgs e) { if (roles_textBox.Text == "" || roles_textBox.Enabled == true) { CodingSourceClass.ShowMsg("Please select a record to edit.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } else { CodingSourceClass.enable(left_panel); edit = true; add_button.Enabled = false; //can't add delete_button.Enabled = false; //can't delete view_button.Enabled = false; //can't view save_button.Enabled = true; } }
private void PAYMENT_Load(object sender, EventArgs e) { try { edit_button.Enabled = false; LoadPayments(); SQL_TASKS.LoadList("st_getSHOPS", shop_comboBox_payments, "ID", "Name"); cheque_no_textBox.Visible = false; cheque_no_label.Visible = false; bank_and_branch_label.Visible = false; bank_and_branch_textBox.Visible = false; clearing_date_label.Visible = false; clearing_date_dateTimePicker.Visible = false; base.edit_button.Text = "CANNOT EDIT"; CodingSourceClass.disable_reset(left_panel); } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void edit_button_Click(object sender, EventArgs e) { try { if (shops_comboBox_customers.SelectedIndex == -1) { throw new Exception("Please select a record to edit."); } else { CodingSourceClass.enable(left_panel); edit = true; //editing option enabled add_button.Enabled = false; //can't add delete_button.Enabled = false; //can't delete view_button.Enabled = false; //can't view save_button.Enabled = true; //can save after editing } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void edit_button_Click(object sender, EventArgs e) { if (name_textBox.Text == "" || phone_textBox.Text == "" || address_textBox.Text == "" || password_textBox.Text == "" || username_textBox.Text == "" || roles_comboBox.SelectedIndex == -1) { CodingSourceClass.ShowMsg("Please select a record to edit.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } else { CodingSourceClass.enable(left_panel); edit = true; //editing option enabled add_button.Enabled = false; //can't add delete_button.Enabled = false; //can't delete view_button.Enabled = false; //can't view save_button.Enabled = true; //can save after editing } }
private void sales_invoice_comboBox_payments_SelectedIndexChanged(object sender, EventArgs e) { try { if (sales_invoice_comboBox_payments.SelectedIndex != -1) { Hashtable ht = new Hashtable(); ht.Add("@custID", Convert.ToInt32(customer_comboBox_payments.SelectedValue.ToString())); ht.Add("@salesinvoiceID", Convert.ToInt64(sales_invoice_comboBox_payments.SelectedValue.ToString())); double[] arr = SQL_TASKS.SaleInvoiceAmounts("st_getSALESINVOICEAMOUNT", ht); total_amount_textBox_payments.Text = arr[0].ToString(); amount_paid_textBox_payments.Text = arr[1].ToString(); remaining_amount_textBox_payments.Text = arr[2].ToString(); } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
private void SALES_RETURN_Load(object sender, EventArgs e) { try { CodingSourceClass.disable_reset(left_panel); edit_button.Enabled = false; delete_button.Enabled = false; LoadSalesReturn(); SQL_TASKS.LoadList("st_getSHOPS", shop_comboBox_salesreturn, "ID", "Name"); base.delete_button.Text = "CANNOT DELETE"; base.delete_button.Enabled = false; base.edit_button.Text = "CANNOT EDIT"; base.edit_button.Enabled = false; } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void view_button_Click(object sender, EventArgs e) { enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); LoadVendors(); }
private void ROLES_Load(object sender, EventArgs e) { LoadRoles(); SQL_TASKS.TotalRecords("getTOTALROLES", total_roles_label); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); //add,delete,update..... }
private void customers_Load(object sender, EventArgs e) { SQL_TASKS.LoadList("st_getSHOPS", shops_comboBox_customers, "ID", "Name"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadCustomers(); }
private void USERS_Load(object sender, EventArgs e) { LoadUsers(); SQL_TASKS.LoadList("st_getROLESdata", roles_comboBox, "ID", "Role"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); }
public override void view_button_Click(object sender, EventArgs e) { CodingSourceClass.disable_reset(left_panel); LoadRoles(); CodingSourceClass.disable_reset(left_panel); SQL_TASKS.TotalRecords("getTOTALROLES", total_roles_label); }
private void users_dataGridView_CellClick_1(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { add_button.Enabled = false; if (edit == true) //updating member { save_button.Enabled = true; } else if (edit == false) //adding member { save_button.Enabled = false; } DataGridViewRow row = users_dataGridView.Rows[e.RowIndex]; userID = Convert.ToInt32(row.Cells[0].Value.ToString()); name_textBox.Text = row.Cells[1].Value.ToString(); username_textBox.Text = row.Cells[2].Value.ToString(); password_textBox.Text = row.Cells[3].Value.ToString(); phone_textBox.Text = row.Cells[4].Value.ToString(); address_textBox.Text = row.Cells[5].Value.ToString(); roles_comboBox.SelectedValue = row.Cells[6].Value; CodingSourceClass.disable(left_panel); delete_button.Enabled = true; edit_button.Enabled = true; save_button.Enabled = false; cancel_button.Enabled = true; view_button.Enabled = true; } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } }
public override void delete_button_Click(object sender, EventArgs e) { try { if (roles_textBox.Text != "" && roles_textBox.Enabled == false) { Hashtable ht = new Hashtable(); DialogResult dr = MessageBox.Show("Are you sure? ", "Question.....", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { //key , value ht.Add("@id", roleID); if (SQL_TASKS.insert_update_delete("st_deleteROLES", ht) > 0) { MainClass.CodingSourceClass.ShowMsg(roles_textBox.Text + " deleted successfully from the system.", "Success"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadRoles(); SQL_TASKS.TotalRecords("getTOTALROLES", total_roles_label); } else { CodingSourceClass.ShowMsg("Unable to delete.", "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } } } else { CodingSourceClass.ShowMsg("Select a record to delete.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
private void customers_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { add_button.Enabled = false; if (edit == true) //updating member { save_button.Enabled = true; } else if (edit == false) //adding member { save_button.Enabled = false; } DataGridViewRow row = customers_dataGridView.Rows[e.RowIndex]; customerID = Convert.ToInt32(row.Cells[0].Value.ToString()); customer_name_textBox.Text = row.Cells["CustomernameGV"].Value.ToString(); shops_comboBox_customers.SelectedValue = Convert.ToInt32(row.Cells["ShopIDGV"].Value.ToString()); email_textBox_customers.Text = row.Cells["CustomeremailGV"].Value.ToString(); phone_textBox_customers.Text = row.Cells["CustomerphoneGV"].Value.ToString(); CodingSourceClass.disable(left_panel); delete_button.Enabled = true; edit_button.Enabled = true; save_button.Enabled = false; cancel_button.Enabled = true; view_button.Enabled = true; } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void delete_button_Click(object sender, EventArgs e) { try { if (name_textBox.Text != "" && phone_textBox.Text != "" && address_textBox.Text != "" && password_textBox.Text != "" && username_textBox.Text != "" && roles_comboBox.SelectedIndex != -1) { Hashtable ht = new Hashtable(); DialogResult dr = MessageBox.Show("Are you sure? ", "Question.....", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { ht.Add("@id", userID); if (SQL_TASKS.insert_update_delete("st_deleteUSERS", ht) > 0) { CodingSourceClass.ShowMsg("Record deleted successfully from the system.", "Success"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); LoadUsers(); } else { CodingSourceClass.ShowMsg("Unable to delete.An error occured.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } } } else { throw new Exception("Select a record to delete."); } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void delete_button_Click(object sender, EventArgs e) { try { if (true) { Hashtable ht = new Hashtable(); DialogResult dr = MessageBox.Show("Are you sure? ", "Question.....", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { ht.Add("@payid", paymentID); if (SQL_TASKS.insert_update_delete("st_deletePAYMENTS", ht) > 0) { CodingSourceClass.ShowMsg("Record deleted successfully from the system.", "Success"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); LoadPayments(); } else { CodingSourceClass.ShowMsg("Unable to delete.An error occured.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } } } else { throw new Exception("Select a record to delete."); } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
private void SALES_INVOICE_Load(object sender, EventArgs e) { try { base.edit_button.Enabled = false; base.edit_button.Text = "CANNOT EDIT"; LoadSalesInvoice(); SQL_TASKS.LoadList("st_getSHOPS", shops_comboBox_sales_invoice, "ID", "Name"); CodingSourceClass.disable_reset(left_panel); } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); } }
public override void delete_button_Click(object sender, EventArgs e) { try { if (shops_comboBox_sales_invoice.SelectedIndex == -1 || order_details_textBox.Text == "" || amount_textBox_sales_invoice.Text == "") { throw new Exception("Please enter/select a record."); } else { DialogResult dr = MessageBox.Show("SaleInvoice " + bill_no_textBox_salesinvoice.Text + "is associated with Payments,Sales Return and Vendor/Owner Ledger.\nDeleting this invoice will delete the particular data related to that invoice from Payments,Sales Return and Vendor/Owner Ledger.\nAlso particular data of Customer Leder which is associated with Payments will be deleted.\nWe recommend you to not delete this.\nAre you sure you want to delete?", "!!!WARNING!!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (DialogResult.Yes == dr) { Hashtable ht = new Hashtable(); ht.Add("@salesinvoiceID", salesinvoiceID); if (SQL_TASKS.insert_update_delete("st_deleteSALESINVOICE", ht) > 0) { CodingSourceClass.ShowMsg("Record deleted successfully.", "Success"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadSalesInvoice(); } else { throw new Exception("Unabled to delete record."); } } } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void delete_button_Click(object sender, EventArgs e) { try { if (shop_name_textBox.Text != "" || vendors_comboBox_shops.SelectedIndex != -1 || shop_branch_address_textBox.Text != "" || managers_comboBox_shops.SelectedIndex != -1) { Hashtable ht = new Hashtable(); DialogResult dr = MessageBox.Show("Are you sure? ", "Question.....", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { ht.Add("@id", shopID); if (SQL_TASKS.insert_update_delete("st_deleteSHOPS", ht) > 0) { CodingSourceClass.ShowMsg("Record deleted successfully from the system.", "Success"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadShops(); } } } else { throw new Exception("Select a record to delete."); } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void save_button_Click(object sender, EventArgs e) { try { if (shops_comboBox_sales_invoice.SelectedIndex == -1 || customers_comboBox_sales_invoice.SelectedIndex == -1 || order_details_textBox.Text == "" || dateTimePicker_sales_invoice.Text == "" || amount_textBox_sales_invoice.Text == "" || (cash_radioButton_sales_invoice.Checked == false && credit_card_radioButton_sales_invoice.Checked == false)) { throw new Exception("Please enter/select a record."); } else { //0 is for crash and 1 is for debit Int16?type = cash_radioButton_sales_invoice.Checked ? Convert.ToInt16(0) : Convert.ToInt16(1); if (type != null) { double debit = 0, credit = 0, bal = 0; if (edit == false) //code for save { using (TransactionScope sc = new TransactionScope()) { Hashtable ht = new Hashtable(); ht.Add("@shopID", Convert.ToInt32(shops_comboBox_sales_invoice.SelectedValue.ToString())); ht.Add("@customerID", Convert.ToInt32(customers_comboBox_sales_invoice.SelectedValue.ToString())); ht.Add("@details", order_details_textBox.Text); ht.Add("@amount", amount_textBox_sales_invoice.Text); ht.Add("@type", type); if (LoginCodeClass.isAdmin) { throw new Exception("Admin cannot make salesinvoice."); } else { ht.Add("@userID", LoginCodeClass.USERID); } ht.Add("@billno", bill_no_textBox_salesinvoice.Text); ht.Add("@status", 0); //0 = not paid, 1 = partially paid, 2 = completely paid if (SQL_TASKS.insert_update_delete("st_insertSALESINVOICE", ht) > 0) { Hashtable loadht = new Hashtable(); loadht.Add("@custID", Convert.ToInt32(customers_comboBox_sales_invoice.SelectedValue.ToString())); loadht.Add("@shopID", Convert.ToInt32(shops_comboBox_sales_invoice.SelectedValue.ToString())); double[] dd = SQL_TASKS.LoadLastBalance("st_getLASTBALANCES", loadht); bal = dd[0]; //customer balance debit = Convert.ToDouble(amount_textBox_sales_invoice.Text); credit = 0; bal += debit - credit; Hashtable ht2 = new Hashtable(); ht2.Add("@custID", Convert.ToInt32(customers_comboBox_sales_invoice.SelectedValue.ToString())); ht2.Add("@desc", order_details_textBox.Text); ht2.Add("@debit", debit); ht2.Add("@credit", credit); ht2.Add("@balance", bal); ht2.Add("@date", dateTimePicker_sales_invoice.Value); ht2.Add("@salesinvoiceid", salesinvoiceID); SQL_TASKS.insert_update_delete("st_insertCUSTOMERLEDGER", ht2); bal = dd[1]; //shop balance debit = 0; credit = Convert.ToDouble(amount_textBox_sales_invoice.Text); bal += debit - credit; Hashtable ht3 = new Hashtable(); ht3.Add("@shopID", Convert.ToInt32(shops_comboBox_sales_invoice.SelectedValue.ToString())); ht3.Add("@desc", order_details_textBox.Text); ht3.Add("@debit", debit); ht3.Add("@credit", credit); ht3.Add("@balance", bal); ht3.Add("@date", dateTimePicker_sales_invoice.Value); ht3.Add("@salesinvoiceid", salesinvoiceID); SQL_TASKS.insert_update_delete("insertVENDORLEDGER", ht3); CodingSourceClass.ShowMsg("Record added successfully into the system.", "Success"); CodingSourceClass.disable_reset(left_panel); LoadSalesInvoice(); sc.Complete(); } else { throw new Exception("Unable to save record."); } } } } else { throw new Exception("Please fill all fields."); } } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
private void payments_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { add_button.Enabled = false; if (edit == true) //updating member { save_button.Enabled = true; } else if (edit == false) //adding member { save_button.Enabled = false; } DataGridViewRow row = payments_dataGridView.Rows[e.RowIndex]; paymentID = Convert.ToInt32(row.Cells[0].Value.ToString()); customer_comboBox_payments.Text = row.Cells["customernameGV"].Value.ToString(); sales_invoice_comboBox_payments.Text = row.Cells["billnoGV"].Value.ToString(); shop_comboBox_payments.Text = row.Cells["shopGV"].Value.ToString(); customerID = Convert.ToInt32(row.Cells["customerIDGV"].Value); salesinvoiceID = Convert.ToInt32(row.Cells["salesinvoiceIDGV"].Value); if (/*sales_invoice_comboBox_payments.SelectedIndex != -1*/ true) { Hashtable ht = new Hashtable(); ht.Add("@custID", customerID); ht.Add("@salesinvoiceID", salesinvoiceID); double[] arr = SQL_TASKS.SaleInvoiceAmounts("st_getSALESINVOICEAMOUNT", ht); total_amount_textBox_payments.Text = arr[0].ToString(); amount_paid_textBox_payments.Text = arr[1].ToString(); remaining_amount_textBox_payments.Text = arr[2].ToString(); } dateTimePicker_payments.Value = Convert.ToDateTime(row.Cells[1].Value); userID = Convert.ToInt32(row.Cells[3].Value.ToString()); postedby = row.Cells[4].Value.ToString(); amount_to_pay_textBox_payments.Text = row.Cells[10].Value.ToString(); cheque_no_textBox.Text = row.Cells[11].Value.ToString(); bank_and_branch_textBox.Text = row.Cells[12].Value.ToString(); clearing_date_dateTimePicker.Text = row.Cells["clearingdateGV"].Value.ToString(); if (cheque_no_textBox.Text == "" && bank_and_branch_textBox.Text == "") { cash_radioButton_sales_invoice.Checked = true; } else { cheque_radioButton.Checked = true; } CodingSourceClass.disable(left_panel); delete_button.Enabled = true; edit_button.Enabled = true; save_button.Enabled = false; cancel_button.Enabled = true; view_button.Enabled = true; } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } }
public override void cancel_button_Click(object sender, EventArgs e) { CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); }
public override void save_button_Click(object sender, EventArgs e) { try { if (name_textBox.Text == "" || phone_textBox.Text == "" || address_textBox.Text == "" || password_textBox.Text == "" || username_textBox.Text == "" || roles_comboBox.SelectedIndex == -1) { throw new Exception("Please enter/select a record."); } else { if (edit == false) //code for save { Hashtable ht = new Hashtable(); ht.Add("@name", name_textBox.Text); ht.Add("@username", username_textBox.Text); ht.Add("@password", password_textBox.Text); ht.Add("@phone", phone_textBox.Text); ht.Add("@address", address_textBox.Text); ht.Add("@roleID", (Convert.ToInt32(roles_comboBox.SelectedValue.ToString()))); if (SQL_TASKS.insert_update_delete("st_insertUSERS", ht) > 0) { CodingSourceClass.ShowMsg(name_textBox.Text + " added successfully to the system.", "Success"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); LoadUsers(); } else { throw new Exception("Unable to save record.An error occured."); } } else if (edit == true) //code for update { Hashtable ht = new Hashtable(); ht.Add("@name", name_textBox.Text); ht.Add("@username", username_textBox.Text); ht.Add("@password", password_textBox.Text); ht.Add("@phone", address_textBox.Text); ht.Add("@address", phone_textBox.Text); ht.Add("@roleID", Convert.ToInt32(roles_comboBox.SelectedValue.ToString())); ht.Add("@id", userID); if (SQL_TASKS.insert_update_delete("st_updateUSERS", ht) > 0) { CodingSourceClass.ShowMsg("Record updated successfully into the system.", "Success"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); LoadUsers(); } else { throw new Exception("Unable to update.An error occured"); } } } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } }
public override void save_button_Click(object sender, EventArgs e) { try { if (shop_comboBox_payments.SelectedIndex == -1 || customer_comboBox_payments.SelectedIndex == -1 || sales_invoice_comboBox_payments.SelectedIndex == -1 || total_amount_textBox_payments.Text == "" || amount_paid_textBox_payments.Text == "" || remaining_amount_textBox_payments.Text == "" || amount_to_pay_textBox_payments.Text == "" || (cash_radioButton_sales_invoice.Checked == false && cheque_radioButton.Checked == false)) { throw new Exception("Please enter/select a record."); } else if ((shop_comboBox_payments.SelectedIndex != -1 && customer_comboBox_payments.SelectedIndex != -1 && sales_invoice_comboBox_payments.SelectedIndex != -1 && total_amount_textBox_payments.Text != "" && amount_paid_textBox_payments.Text != "" && remaining_amount_textBox_payments.Text != "" && amount_to_pay_textBox_payments.Text != "" && cheque_radioButton.Checked == true) && (clearing_date_dateTimePicker.Text == "" || bank_and_branch_textBox.Text == "" || cheque_no_textBox.Text == "")) { throw new Exception("Please enter/select a record."); } else { if (Convert.ToDouble(amount_to_pay_textBox_payments.Text) > Convert.ToDouble(total_amount_textBox_payments.Text)) { throw new Exception("Amount to pay cannot be greater than total amount."); } else { double debit = 0, credit = 0, bal = 0; using (TransactionScope sc = new TransactionScope()) { Hashtable ht = new Hashtable(); if (cash_radioButton_sales_invoice.Checked == true) { ht.Add("@salesinvoiceid", Convert.ToInt32(sales_invoice_comboBox_payments.SelectedValue.ToString())); ht.Add("@amount", Convert.ToInt32(amount_to_pay_textBox_payments.Text)); ht.Add("@date", dateTimePicker_payments.Value); if (LoginCodeClass.isAdmin) { throw new Exception("Admin cannot enter payments."); } else { ht.Add("@userID", LoginCodeClass.USERID); } SQL_TASKS.insert_update_delete("st_insertPAYMENTSwrtCASH", ht); } else { ht.Add("@salesinvoiceid", Convert.ToInt32(sales_invoice_comboBox_payments.SelectedValue.ToString())); ht.Add("@amount", Convert.ToInt32(amount_to_pay_textBox_payments.Text)); ht.Add("@date", dateTimePicker_payments.Value); if (LoginCodeClass.isAdmin) { ht.Add("@userID", LoginCodeClass.idOFadmin); } else { ht.Add("@userID", LoginCodeClass.USERID); } ht.Add("@cheque", cheque_no_textBox.Text); ht.Add("@bank", bank_and_branch_textBox.Text); ht.Add("@clearing", clearing_date_dateTimePicker.Value); SQL_TASKS.insert_update_delete("st_insertPAYMENTSwrtCHEQUE", ht); } Hashtable loadht = new Hashtable(); loadht.Add("@custID", Convert.ToInt32(customer_comboBox_payments.SelectedValue.ToString())); loadht.Add("@shopID", Convert.ToInt32(shop_comboBox_payments.SelectedValue.ToString())); double[] dd = SQL_TASKS.LoadLastBalance("st_getLASTBALANCES", loadht); bal = dd[0]; //customer balance debit = 0; credit = Convert.ToDouble(amount_to_pay_textBox_payments.Text); bal += debit - credit; Hashtable ht2 = new Hashtable(); Int64 salesinvoiceID = Convert.ToInt64(sales_invoice_comboBox_payments.SelectedValue.ToString()); DataRowView drvcustomer = customer_comboBox_payments.SelectedItem as DataRowView; DataRowView drvshop = shop_comboBox_payments.SelectedItem as DataRowView; DataRowView drvsalesinvoice = sales_invoice_comboBox_payments.SelectedItem as DataRowView; ht2.Add("@custID", Convert.ToInt32(customer_comboBox_payments.SelectedValue.ToString())); ht2.Add("@desc", drvcustomer[1].ToString() + " has done the payment of Rs. " + amount_to_pay_textBox_payments.Text + " on bill # " + drvsalesinvoice[1].ToString() + " to " + drvshop[1].ToString()); ht2.Add("@debit", debit); ht2.Add("@credit", credit); ht2.Add("@balance", bal); ht2.Add("@date", dateTimePicker_payments.Value); ht2.Add("@salesinvoiceid", salesinvoiceID); SQL_TASKS.insert_update_delete("st_insertCUSTOMERLEDGER", ht2); bal = dd[1]; //shop balance debit = Convert.ToDouble(amount_to_pay_textBox_payments.Text); credit = 0; bal += debit - credit; Hashtable ht3 = new Hashtable(); ht3.Add("@shopID", Convert.ToInt32(shop_comboBox_payments.SelectedValue.ToString())); ht3.Add("@desc", drvshop[1].ToString() + " has received Rs. " + amount_to_pay_textBox_payments.Text + " as paid from customer " + drvcustomer[1].ToString() + " on bill # " + drvsalesinvoice[1].ToString()); ht3.Add("@debit", debit); ht3.Add("@credit", credit); ht3.Add("@balance", bal); ht3.Add("@date", dateTimePicker_payments.Value); ht3.Add("@salesinvoiceid", salesinvoiceID); SQL_TASKS.insert_update_delete("insertVENDORLEDGER", ht3); Hashtable ht4 = new Hashtable(); if (Convert.ToDouble(amount_to_pay_textBox_payments.Text) == Convert.ToDouble(total_amount_textBox_payments.Text)) { //complete payment ht4.Add("@status", 2); } else if (Convert.ToDouble(amount_to_pay_textBox_payments.Text) < Convert.ToDouble(total_amount_textBox_payments.Text)) { //partial payment ht4.Add("@status", 1); } /*else //if status == 2 * { * ht4.Add("@status", 0); * }*/ ht4.Add("@salesinvoiceid", salesinvoiceID); CodingSourceClass.ShowMsg("Record added successfully into the system.", "Success"); CodingSourceClass.disable_reset(left_panel); LoadPayments(); sc.Complete(); } } } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); } }
public override void save_button_Click(object sender, EventArgs e) { try { if (shops_comboBox_customers.SelectedIndex == -1) { throw new Exception("Please enter/select a record."); } else { if (edit == false) //code for save { Hashtable ht = new Hashtable(); ht.Add("@name", customer_name_textBox.Text); ht.Add("@phone", phone_textBox_customers.Text); ht.Add("@shopID", Convert.ToInt32(shops_comboBox_customers.SelectedValue.ToString())); ht.Add("@email", email_textBox_customers.Text); if (SQL_TASKS.insert_update_delete("st_insertCUSTOMERS", ht) > 0) { CodingSourceClass.ShowMsg(customer_name_textBox.Text + " added successfully to the system.", "Success"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadCustomers(); } else { throw new Exception("Unable to save record."); } } else if (edit == true) //code for update { Hashtable ht = new Hashtable(); ht.Add("@name", customer_name_textBox.Text); ht.Add("@phone", phone_textBox_customers.Text); ht.Add("@shopID", Convert.ToInt32(shops_comboBox_customers.SelectedValue.ToString())); ht.Add("@email", email_textBox_customers.Text); ht.Add("@id", customerID); if (SQL_TASKS.insert_update_delete("st_updateCUSTOMERS", ht) > 0) { CodingSourceClass.ShowMsg("Record updated successfully into the system.", "Success"); CodingSourceClass.disable_reset(left_panel); LoadCustomers(); } else { throw new Exception("Unable to update."); } } } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void save_button_Click(object sender, EventArgs e) { try { if (vendor_name_textBox.Text == "" || vendor_phone_textBox.Text == "" || vendor_address_textBox.Text == "") { throw new Exception("Please enter/select a record."); } else { if (edit == false) //code for save { Hashtable ht = new Hashtable(); ht.Add("@name", vendor_name_textBox.Text); ht.Add("@phone", vendor_phone_textBox.Text); ht.Add("@address", vendor_address_textBox.Text); if (SQL_TASKS.insert_update_delete("st_insertVENDORS", ht) > 0) { CodingSourceClass.ShowMsg(vendor_name_textBox.Text + " added successfully into the system.", "Success"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadVendors(); } else { throw new Exception("Unable to save record."); } } else if (edit == true) //code for update { Hashtable ht = new Hashtable(); ht.Add("@name", vendor_name_textBox.Text); ht.Add("@phone", vendor_phone_textBox.Text); ht.Add("@address", vendor_address_textBox.Text); ht.Add("@id", vendorID); if (SQL_TASKS.insert_update_delete("st_updateVENDORS", ht) > 0) { CodingSourceClass.ShowMsg("Record updated successfully.", "Success"); CodingSourceClass.disable_reset(left_panel); LoadVendors(); } else { throw new Exception("Unable to update."); } } } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadVendors(); } }
private void Vendors_Load(object sender, EventArgs e) { LoadVendors(); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); }
public override void save_button_Click(object sender, EventArgs e) { if (roles_textBox.Text == "") { CodingSourceClass.ShowMsg("Please enter/select a role.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } else { if (edit == false) //code for save { Hashtable ht = new Hashtable(); ht.Add("@name", roles_textBox.Text); if (SQL_TASKS.insert_update_delete("st_insertROLES", ht) > 0) { CodingSourceClass.ShowMsg(roles_textBox.Text + " added successfully to the system.", "Success"); LoadRoles(); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); SQL_TASKS.TotalRecords("getTOTALROLES", total_roles_label); } else { CodingSourceClass.ShowMsg("Unable to save record.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } } else if (edit == true) //code for update { Hashtable ht = new Hashtable(); ht.Add("@name", roles_textBox.Text); ht.Add("@id", roleID); if (SQL_TASKS.insert_update_delete("st_updateROLES", ht) > 0) { CodingSourceClass.ShowMsg(roles_textBox.Text + " updated successfully.", "Success"); LoadRoles(); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } else { CodingSourceClass.ShowMsg("Unable to update record.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } } } }
public override void save_button_Click(object sender, EventArgs e) { try { if (shop_name_textBox.Text == "" || vendors_comboBox_shops.SelectedIndex == -1 || shop_branch_address_textBox.Text == "" || managers_comboBox_shops.SelectedIndex == -1) { throw new Exception("Please enter/select a record."); } else { if (edit == false) //code for save { Hashtable ht = new Hashtable(); ht.Add("@name", shop_name_textBox.Text); ht.Add("@shopvendorID", Convert.ToInt32(vendors_comboBox_shops.SelectedValue.ToString())); ht.Add("@branchaddress", shop_branch_address_textBox.Text); ht.Add("@managerID", Convert.ToInt32(managers_comboBox_shops.SelectedValue.ToString())); if (SQL_TASKS.insert_update_delete("st_insertSHOPS", ht) > 0) { CodingSourceClass.ShowMsg(shop_name_textBox.Text + " added successfully into the system.", "Success"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadShops(); } else { throw new Exception("Unable to save record."); } } else if (edit == true) //code for update { Hashtable ht = new Hashtable(); ht.Add("@name", shop_name_textBox.Text); ht.Add("@shopvendorID", Convert.ToInt32(vendors_comboBox_shops.SelectedValue.ToString())); ht.Add("@branchaddress", shop_branch_address_textBox.Text); ht.Add("@managerID", Convert.ToInt32(managers_comboBox_shops.SelectedValue.ToString())); ht.Add("@shopID", shopID); if (SQL_TASKS.insert_update_delete("st_updateSHOPS", ht) > 0) { CodingSourceClass.ShowMsg(shop_name_textBox.Text + " updated successfully.", "Success"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadShops(); } else { throw new Exception("Unable to update record."); } } } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void save_button_Click(object sender, EventArgs e) { try { if (shop_comboBox_salesreturn.SelectedIndex == -1 || customer_comboBox_salesreturn.SelectedIndex == -1 || sales_invoice_comboBox_salesreturn.SelectedIndex == -1 || total_amount_textBox_salesreturn.Text == "" || amount_paid_textBox_salesreturn.Text == "" || remaining_amount_textBox_salesreturn.Text == "" || amount_to_return_textBox_salesreturn.Text == "" || dateTimePicker_salesreturn.Text == "") { throw new Exception("Please enter/select a record."); } else { double debit = 0, credit = 0, bal = 0; using (TransactionScope sc = new TransactionScope()) { Hashtable ht = new Hashtable(); ht.Add("@salesinvoiceID", Convert.ToInt32(sales_invoice_comboBox_salesreturn.SelectedValue.ToString())); ht.Add("@amount", Convert.ToInt32(amount_to_return_textBox_salesreturn.Text)); ht.Add("@date", dateTimePicker_salesreturn.Value); if (LoginCodeClass.isAdmin) { throw new Exception("Admin cannot perfom current task."); } else { ht.Add("@userID", LoginCodeClass.USERID); } if (SQL_TASKS.insert_update_delete("st_insertSALESRETURN", ht) > 0) { Hashtable loadht = new Hashtable(); loadht.Add("@custID", Convert.ToInt32(customer_comboBox_salesreturn.SelectedValue.ToString())); loadht.Add("@shopID", Convert.ToInt32(shop_comboBox_salesreturn.SelectedValue.ToString())); double[] dd = SQL_TASKS.LoadLastBalance("st_getLASTBALANCES", loadht); bal = dd[0]; //customer balance debit = 0; credit = Convert.ToDouble(amount_to_return_textBox_salesreturn.Text); bal += debit - credit; Hashtable ht2 = new Hashtable(); Int64 salesinvoiceID = Convert.ToInt64(sales_invoice_comboBox_salesreturn.SelectedValue.ToString()); DataRowView drvcustomer = customer_comboBox_salesreturn.SelectedItem as DataRowView; DataRowView drvshop = shop_comboBox_salesreturn.SelectedItem as DataRowView; DataRowView drvsalesinvoice = sales_invoice_comboBox_salesreturn.SelectedItem as DataRowView; ht2.Add("@custID", Convert.ToInt32(customer_comboBox_salesreturn.SelectedValue.ToString())); ht2.Add("@desc", drvcustomer[1].ToString() + " has return the goods worth Rs. " + amount_to_return_textBox_salesreturn.Text + " on bill # " + drvsalesinvoice[1].ToString() + " to " + drvshop[1].ToString() + " shop "); ht2.Add("@debit", debit); ht2.Add("@credit", credit); ht2.Add("@balance", bal); ht2.Add("@date", dateTimePicker_salesreturn.Value); ht2.Add("@salesinvoiceid", salesinvoiceID); SQL_TASKS.insert_update_delete("st_insertCUSTOMERLEDGER", ht2); bal = dd[1]; //shop balance debit = Convert.ToDouble(amount_to_return_textBox_salesreturn.Text); credit = 0; bal += debit - credit; Hashtable ht3 = new Hashtable(); ht3.Add("@shopID", Convert.ToInt32(shop_comboBox_salesreturn.SelectedValue.ToString())); ht3.Add("@desc", drvshop[1].ToString() + " has received Rs. " + amount_to_return_textBox_salesreturn.Text + " as returned from customer " + drvcustomer[1].ToString() + " on bill # " + drvsalesinvoice[1].ToString()); ht3.Add("@debit", debit); ht3.Add("@credit", credit); ht3.Add("@balance", bal); ht3.Add("@date", dateTimePicker_salesreturn.Value); ht3.Add("@salesinvoiceid", salesinvoiceID); SQL_TASKS.insert_update_delete("insertVENDORLEDGER", ht3); CodingSourceClass.ShowMsg("Record added successfully into the system.", "Success"); CodingSourceClass.disable_reset(left_panel); LoadSalesReturn(); sc.Complete(); } else { throw new Exception("Unable to save record."); } } } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }