private void btnAdd_Click(object sender, EventArgs e) { try { int cnt = dataGridView1.Rows.Count - 1; if (cnt == 0) { cnt = 1; } else { cnt = cnt + 1; } bool Found = false; if (rbNew.Checked == true) { if (Validate1('A', out msg)) { if (dataGridView1.Rows.Count > 0) { //Check if the product Id exists with the same Price foreach (DataGridViewRow row in dataGridView1.Rows) { if (Convert.ToString(row.Cells[1].Value) == cmbSubAccountDr.SelectedValue.ToString()) { //Update the Quantity of the found row Found = true; MyMessageBox.ShowBox("Please Select Different Account For Creadit Voucher"); } } if (!Found) { //Add the row to grid view if (cmdTransactionMode.SelectedIndex.Equals(2) || cmdTransactionMode.SelectedIndex.Equals(4)) { dataGridView1.Rows.Insert(0, cnt, cmbSubAccountDr.Text, cmbSubAccountCr.Text, cmbSubAccountDr.SelectedValue, cmbSubAccountCr.SelectedValue, txtDiscription.Text.ToString(), txtAmount.Text.ToString(), type, cmdTransactionMode.SelectedIndex); } else if (cmdTransactionMode.SelectedIndex.Equals(1) || cmdTransactionMode.SelectedIndex.Equals(3) || cmdTransactionMode.SelectedIndex.Equals(5)) { dataGridView1.Rows.Insert(0, cnt, cmbSubAccountDr.Text, cmbSubAccountCr.Text, cmbSubAccountDr.SelectedValue, cmbSubAccountCr.SelectedValue, txtDiscription.Text.ToString(), txtAmount.Text.ToString(), type, cmdTransactionMode.SelectedIndex); } } } else { //Add the row to grid view for the first time if (cmdTransactionMode.SelectedIndex.Equals(2) || cmdTransactionMode.SelectedIndex.Equals(4)) { dataGridView1.Rows.Insert(0, cnt, cmbSubAccountDr.Text, cmbSubAccountCr.Text, cmbSubAccountDr.SelectedValue, cmbSubAccountCr.SelectedValue, txtDiscription.Text.ToString(), txtAmount.Text.ToString(), type, cmdTransactionMode.SelectedIndex); } else if (cmdTransactionMode.SelectedIndex.Equals(1) || cmdTransactionMode.SelectedIndex.Equals(3) || cmdTransactionMode.SelectedIndex.Equals(5)) { dataGridView1.Rows.Insert(0, cnt, cmbSubAccountDr.Text, cmbSubAccountCr.Text, cmbSubAccountDr.SelectedValue, cmbSubAccountCr.SelectedValue, txtDiscription.Text.ToString(), txtAmount.Text.ToString(), type, cmdTransactionMode.SelectedIndex); } } } else { MyMessageBox.ShowBox(msg); } } else if (rbUpdate.Checked == true) { if (Validate1('U', out msg)) { dataGridView1.Rows[0].Cells["Column2"].Value = cmbSubAccountDr.Text; dataGridView1.Rows[0].Cells["Credit_Account"].Value = cmbSubAccountCr.Text; dataGridView1.Rows[0].Cells["Column1"].Value = cmbSubAccountDr.SelectedValue; dataGridView1.Rows[0].Cells["Credit_Acc_ID"].Value = cmbSubAccountCr.SelectedValue; dataGridView1.Rows[0].Cells["Column3"].Value = txtDiscription.Text.ToString(); dataGridView1.Rows[0].Cells["Column5"].Value = txtAmount.Text.ToString(); dataGridView1.Rows[0].Cells["DC"].Value = type; } else { MyMessageBox.ShowBox(msg); } } else if (rbDelete.Checked == true) { } //gridamountcount(); this.dataGridView1.Sort(dataGridView1.Columns[0], ListSortDirection.Ascending); gridamountcount(); //if (cmdTransactionMode.SelectedIndex > 0) // if (cmdTransactionMode.SelectedIndex.Equals(3)) // { // if (dataGridView1.RowCount < 3) // { // MyMessageBox.ShowBox("Please Enter Credit Vaucher"); // type = "C"; bl_obj.id = "A"; debitcredit(); // cmdTransactionMode.Enabled = false; // txtAmount.Enabled = false; // } // } } catch (Exception err) { err.GetBaseException(); } clear(); }
private void btnSubmit_Click(object sender, EventArgs e) { try { string msg = ""; if (optadd.Checked) { if (Validate('A', out msg)) { // BL bl=new BL(); //bl.Parameter.Add("@flag",txtAddress.Text); //bl_obj.Customer_Id = Convert.ToInt32(txtCustomerId.Text); bl_obj.Comp_Name = txtSuplFirmName.Text; bl_obj.Address = txtAddress.Text; //bl_obj.Customer_No = Convert.ToInt32(txtCustomerNo.Text); bl_obj.Supplier_Mobileno = txtMobileNo.Text; bl_obj.Tin_No = txtTinNo.Text; bl_obj.Vat_No = txtVatNo.Text; FillLVW(bl_obj.INSERT(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyMessageBox.ShowBox(msg); } } else if (optedit.Checked) { if (Validate('U', out msg)) { bl_obj.Supplier_Id = Convert.ToInt32(txtSupplierId.Text); bl_obj.Comp_Name = txtSuplFirmName.Text; bl_obj.Address = txtAddress.Text; //bl_obj.Customer_No = Convert.ToInt32(txtCustomerNo.Text); bl_obj.Supplier_Mobileno = txtMobileNo.Text; bl_obj.Tin_No = txtTinNo.Text; bl_obj.Vat_No = txtVatNo.Text; FillLVW(bl_obj.UPDATE(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record Update Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyMessageBox.ShowBox(msg); } } else if (optdelete.Checked) { if (Validate('D', out msg)) { if (KryptonMessageBox.Show("Do You Want To delete These record(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { foreach (ListViewItem l in lvw.CheckedItems) { //txtCustomerId.Text = l.Tag.ToString(); //l.Tag = txtCustomerId.Text; bl_obj.Supplier_Id = Convert.ToInt32(l.Tag.ToString()); bl_obj.DELETE(bl_obj); } FillLVW(bl_obj.SELECT(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record(s) deleted Successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MyMessageBox.ShowBox(msg); } } customerno(); } catch (Exception err) { err.GetBaseException(); } }
//protected void fill_lvw(DataSet ds) //{ // List<String> col = new List<string>(); // col.Add("0"); // col.Add("1"); // col.Add("2"); // col.Add("3"); // List<String> col_name = new List<string>(); // col_name.Add("ExpencesName"); // col_name.Add("Trans_Date"); // col_name.Add("Description"); // col_name.Add("Amount"); // //col_name.Add("IsActive"); // List<string> col_Size = new List<string>(); // col_Size.Add("10"); // col_Size.Add("10"); // col_Size.Add("10"); // col_Size.Add("10"); // function.filllvw(lvw, ds, col, col_name, 0, 0, 0); //} private void btnsave_Click(object sender, EventArgs e) { string msg = ""; if (optadd.Checked) { if (Validate('A', out msg)) { bl_obj.ExpencesId = int.Parse(comboExpenceName.SelectedValue.ToString()); bl_obj.TransDate = tDate.Value.ToShortDateString(); bl_obj.SysDate = DateTime.Now.ToString(); bl_obj.Desc = txtDescription.Text; bl_obj.Amount = double.Parse(txtAmount.Text); FillLVW(bl_obj.INSERT(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record Save Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyMessageBox.ShowBox(msg); } } else if (optupdate.Checked) { if (Validate('U', out msg)) { bl_obj.TranExpencesId = Convert.ToInt32(txtTransactionId.Text); bl_obj.ExpencesId = int.Parse(comboExpenceName.SelectedValue.ToString()); bl_obj.TransDate = tDate.Value.ToShortDateString(); bl_obj.SysDate = DateTime.Now.ToString(); bl_obj.Desc = txtDescription.Text; bl_obj.Amount = double.Parse(txtAmount.Text); FillLVW(bl_obj.UPDATE(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record Update Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyMessageBox.ShowBox(msg); } } else if (optdelete.Checked) { if (Validate('D', out msg)) { if (KryptonMessageBox.Show("Do You Want To delete These record(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { foreach (ListViewItem l in lvw.CheckedItems) { //bl_obj.RowMaterialId = Convert.ToInt32(l.Tag.ToString()); bl_obj.TranExpencesId = Convert.ToInt32(l.Tag.ToString()); //bl_obj.TranExpencesId = Convert.ToInt32(txtTransactionId.Text); bl_obj.DELETE(bl_obj); } FillLVW(bl_obj.select(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record(s) deleted Successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MyMessageBox.ShowBox(msg); } } }
private void btnSubmit_Click(object sender, EventArgs e) { try { if (Validate('A', out msg)) { if (dataGridView1.RowCount > 1) { //if (cmdTransactionMode.SelectedIndex.Equals(3)) //{ for (int j = 2; j <= dataGridView1.RowCount; j++) { //if (dataGridView1.RowCount == 3) //{ //bl_obj.SubExpences_ID = Convert.ToInt32(dataGridView1.Rows[j - 2].Cells[3].Value); //bl_obj.TransactionModeId = Convert.ToInt32((cmdTransactionMode.SelectedIndex)); //bl_obj.TransationNo = txtTokanNo.Text; //bl_obj.InvoiceNo = Convert.ToInt32(txtInvoiceNo.Text); //bl_obj.Tras_Date = dtpDate.Value.ToString("yyyy-MM-dd"); //bl_obj.Discription = (dataGridView1.Rows[j - 2].Cells[3].Value).ToString(); //bl_obj.Amount = Convert.ToDouble(dataGridView1.Rows[j - 2].Cells[4].Value); //bl_obj.Type = dataGridView1.Rows[j - 2].Cells[5].Value.ToString(); //bl_obj.INSERT(bl_obj); if (rbNew.Checked == true) { ParaName.Clear(); Para.Clear(); ParaName.Add("@Cust_ID"); ParaName.Add("@To_Acc"); ParaName.Add("@Day_Cash"); ParaName.Add("@Paid_Cash"); ParaName.Add("@Pay_Mode_Id"); ParaName.Add("@Description"); ParaName.Add("@Tran_Type"); ParaName.Add("@Cust_Type"); ParaName.Add("@User_ID"); ParaName.Add("@Flag"); ParaName.Add("@Tran_Number"); ParaName.Add("@Tran_Date"); Para.Add((dataGridView1.Rows[j - 2].Cells[3].Value).ToString()); Para.Add((dataGridView1.Rows[j - 2].Cells[4].Value).ToString()); Para.Add((dataGridView1.Rows[j - 2].Cells[6].Value).ToString()); Para.Add("0"); Para.Add(cmdTransactionMode.SelectedIndex.ToString()); Para.Add((dataGridView1.Rows[j - 2].Cells[5].Value).ToString()); Para.Add("E"); Para.Add("E"); Para.Add(MODULE.glb["SHOP_ID"].ToString()); Para.Add("A"); Para.Add(txtTokanNo.Text); Para.Add(dtpDate.Value.ToString("yyyy-MM-dd")); bl_obj.blFill_para_name(ParaName, Para, "sp_Payment_Transaction_Details"); KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (rbUpdate.Checked == true) { ParaName.Clear(); Para.Clear(); ParaName.Add("@T_ID"); ParaName.Add("@Cust_ID"); ParaName.Add("@To_Acc"); ParaName.Add("@Day_Cash"); ParaName.Add("@Paid_Cash"); ParaName.Add("@Pay_Mode_Id"); ParaName.Add("@Description"); ParaName.Add("@Tran_Type"); ParaName.Add("@Cust_Type"); ParaName.Add("@User_ID"); ParaName.Add("@Flag"); ParaName.Add("@Tran_Number"); ParaName.Add("@Tran_Date"); Para.Add(txtT_ID.Text); Para.Add((dataGridView1.Rows[j - 2].Cells[3].Value).ToString()); Para.Add((dataGridView1.Rows[j - 2].Cells[4].Value).ToString()); Para.Add((dataGridView1.Rows[j - 2].Cells[6].Value).ToString()); Para.Add("0"); Para.Add("0"); Para.Add((dataGridView1.Rows[j - 2].Cells[5].Value).ToString()); Para.Add("E"); Para.Add("E"); Para.Add(MODULE.glb["SHOP_ID"].ToString()); Para.Add("U"); Para.Add(txtTokanNo.Text); Para.Add(dtpDate.Value.ToString("yyyy-MM-dd")); bl_obj.blFill_para_name(ParaName, Para, "sp_Payment_Transaction_Details"); KryptonMessageBox.Show("Record Updated Successfilly", "UPDATE", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (rbDelete.Checked == true) { ParaName.Clear(); Para.Clear(); ParaName.Add("@T_ID"); ParaName.Add("@Cust_ID"); ParaName.Add("@To_Acc"); ParaName.Add("@Day_Cash"); ParaName.Add("@Paid_Cash"); ParaName.Add("@Pay_Mode_Id"); ParaName.Add("@Description"); ParaName.Add("@Tran_Type"); ParaName.Add("@Cust_Type"); ParaName.Add("@User_ID"); ParaName.Add("@Flag"); ParaName.Add("@Tran_Number"); ParaName.Add("@Tran_Date"); Para.Add(txtT_ID.Text); Para.Add((dataGridView1.Rows[j - 2].Cells[3].Value).ToString()); Para.Add((dataGridView1.Rows[j - 2].Cells[4].Value).ToString()); Para.Add((dataGridView1.Rows[j - 2].Cells[6].Value).ToString()); Para.Add("0"); Para.Add("0"); Para.Add((dataGridView1.Rows[j - 2].Cells[5].Value).ToString()); Para.Add("E"); Para.Add("E"); Para.Add(MODULE.glb["SHOP_ID"].ToString()); Para.Add("D"); Para.Add(txtTokanNo.Text); Para.Add(dtpDate.Value.ToString("yyyy-MM-dd")); bl_obj.blFill_para_name(ParaName, Para, "sp_Payment_Transaction_Details"); KryptonMessageBox.Show("Record Updated Successfilly", "UPDATE", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { } //} //else //{ // MyMessageBox.ShowBox("Invalid Vhoucher"); clearall(); break; //} } //} //else //{ // for (int j = 2; j <= dataGridView1.RowCount; j++) // { // if (dataGridView1.RowCount == 2) // { // bl_obj.SubExpences_ID = Convert.ToInt32(dataGridView1.Rows[j - 2].Cells[1].Value); // bl_obj.TransactionModeId = Convert.ToInt32((cmdTransactionMode.SelectedIndex)); // bl_obj.TransationNo = txtTokanNo.Text; // bl_obj.InvoiceNo = Convert.ToInt32(txtInvoiceNo.Text); // bl_obj.Tras_Date = dtpDate.Value.ToString("yyyy-MM-dd"); // bl_obj.Discription = (dataGridView1.Rows[j - 2].Cells[3].Value).ToString(); // bl_obj.Amount = Convert.ToDouble(dataGridView1.Rows[j - 2].Cells[4].Value); // bl_obj.Type = dataGridView1.Rows[j - 2].Cells[5].Value.ToString(); // bl_obj.INSERT(bl_obj); // KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // else // { // MyMessageBox.ShowBox("Invalid Vhoucher"); clearall(); break; // } // } //} } } else { MyMessageBox.ShowBox(msg); } clearall(); accounttype(); } catch (Exception err) { err.GetBaseException(); } }
private void btnsave_Click(object sender, EventArgs e) { string msg = ""; try { if (optadd.Checked) { if (Validate('A', out msg)) { if (cmbMainAccount.SelectedIndex == 1) { bl_obj.OptionType = "I"; } if (cmbMainAccount.SelectedIndex == 2) { bl_obj.OptionType = "E"; } if (cmbMainAccount.SelectedIndex == 3) { bl_obj.OptionType = "A"; } if (cmbMainAccount.SelectedIndex == 4) { bl_obj.OptionType = "L"; } bl_obj.ExpencesName = txtExpencesName.Text; FillLVW(bl_obj.INSERT(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record Save Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyMessageBox.ShowBox(msg); } } else if (optupdate.Checked) { if (Validate('U', out msg)) { bl_obj.ExpencesId = Convert.ToInt32(txtExpencesId.Text.ToString()); if (cmbMainAccount.SelectedIndex == 1) { bl_obj.OptionType = "I"; } if (cmbMainAccount.SelectedIndex == 2) { bl_obj.OptionType = "E"; } if (cmbMainAccount.SelectedIndex == 3) { bl_obj.OptionType = "A"; } if (cmbMainAccount.SelectedIndex == 4) { bl_obj.OptionType = "L"; } bl_obj.ExpencesName = txtExpencesName.Text; FillLVW(bl_obj.UPDATE(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record Update Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyMessageBox.ShowBox(msg); } } else if (optdelete.Checked) { if (Validate('D', out msg)) { if (KryptonMessageBox.Show("Do You Want To delete These record(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { foreach (ListViewItem l in lvw.CheckedItems) { bl_obj.ExpencesId = Convert.ToInt32(l.Tag.ToString()); bl_obj.DELETE(bl_obj); } FillLVW(bl_obj.select(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record(s) deleted Successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MyMessageBox.ShowBox(msg); } } } catch (Exception err) { err.GetBaseException(); } }
private void btnSubmit_Click(object sender, EventArgs e) { string msg = ""; //if (optadd.Checked) //{ try { double EnteredAmount = Convert.ToDouble((txtAmount.Text.Trim().CompareTo("") != 0 ? txtAmount.Text.Trim() : "0")); double PaidAmount = 0; if (Validate('A', out msg)) { int i = 0; if (lvw.Items.Count > 0) { foreach (ListViewItem lm in lvw.Items) { if (EnteredAmount > 0) { //bl_obj.SalesRecoveryId = Convert.ToInt32(txtSalesRecoveryId.Text); bl_obj.Purchase_Id = Convert.ToInt32(lm.SubItems[4].Text); if (Convert.ToDouble(lm.SubItems[2].Text.Trim()) < EnteredAmount) { bl_obj.Amount = Convert.ToDouble(lm.SubItems[2].Text.Trim()); PaidAmount = Convert.ToDouble(lm.SubItems[2].Text.Trim()); } else if (Convert.ToDouble(lm.SubItems[2].Text.Trim()) == EnteredAmount) { bl_obj.Amount = Convert.ToDouble(lm.SubItems[2].Text.Trim()); PaidAmount = Convert.ToDouble(lm.SubItems[2].Text.Trim()); } else { bl_obj.Amount = Convert.ToDouble(EnteredAmount); PaidAmount = Convert.ToDouble(EnteredAmount); } //bl_obj.Amount = Convert.ToDouble(lm.SubItems[2].Text); bl_obj.Tran_Date = dtpDate.Value.ToString("yyyy-MM-dd"); //FillLVW(bl_obj.INSERT(bl_obj)); DataSet ds1 = bl_obj.INSERT(bl_obj); ParaName.Clear(); Para.Clear(); ParaName.Add("@Cust_ID"); ParaName.Add("@To_Acc"); ParaName.Add("@Day_Cash"); ParaName.Add("@Paid_Cash"); ParaName.Add("@Pay_Mode_Id"); ParaName.Add("@Description"); ParaName.Add("@Tran_Type"); ParaName.Add("@Cust_Type"); ParaName.Add("@User_ID"); ParaName.Add("@Flag"); ParaName.Add("@Tran_Number"); ParaName.Add("@Tran_Date"); ParaName.Add("@Voucher_No"); Para.Add(cmdName.SelectedValue.ToString()); Para.Add(cmbAccount.SelectedIndex == 0 ? "0" : cmbAccount.SelectedValue.ToString()); Para.Add(i == 0 ? txtAmount.Text.Trim() : "0"); if (Convert.ToDouble(lm.SubItems[2].Text.Trim()) < EnteredAmount) { Para.Add(lm.SubItems[2].Text.Trim()); } else if (Convert.ToDouble(lm.SubItems[2].Text.Trim()) == EnteredAmount) { Para.Add(lm.SubItems[2].Text.Trim()); } else { Para.Add(EnteredAmount.ToString()); } Para.Add(cmbPayMode.SelectedIndex == 0 ? "0" : cmbPayMode.SelectedValue.ToString()); Para.Add(txtDescription.Text.Trim()); Para.Add("VP"); Para.Add("S"); Para.Add(MODULE.glb["SHOP_ID"].ToString()); Para.Add("A"); Para.Add(lm.SubItems[4].Text); Para.Add(dtpDate.Value.ToString("yyyy-MM-dd")); Para.Add(Voucher_ID);//For Voucher Number bl_obj.blFill_para_name(ParaName, Para, "sp_Payment_Transaction_Details"); EnteredAmount = EnteredAmount - PaidAmount; i++; } } } //else //{ if (EnteredAmount != 0) { ParaName.Clear(); Para.Clear(); ParaName.Add("@Cust_ID"); ParaName.Add("@To_Acc"); ParaName.Add("@Day_Cash"); ParaName.Add("@Paid_Cash"); ParaName.Add("@Pay_Mode_Id"); ParaName.Add("@Description"); ParaName.Add("@Tran_Type"); ParaName.Add("@Cust_Type"); ParaName.Add("@User_ID"); ParaName.Add("@Flag"); ParaName.Add("@Tran_Number"); ParaName.Add("@Tran_Date"); ParaName.Add("@Voucher_No"); Para.Add(cmdName.SelectedValue.ToString()); Para.Add(cmbAccount.SelectedIndex == 0 ? "0" : cmbAccount.SelectedValue.ToString()); Para.Add("0"); Para.Add(EnteredAmount.ToString()); Para.Add(cmbPayMode.SelectedIndex == 0 ? "0" : cmbPayMode.SelectedValue.ToString()); Para.Add(txtDescription.Text.Trim()); Para.Add("VP"); Para.Add("S"); Para.Add(MODULE.glb["SHOP_ID"].ToString()); Para.Add("A"); Para.Add("0"); Para.Add(dtpDate.Value.ToString("yyyy-MM-dd")); Para.Add(Voucher_ID); //For Voucher Number bl_obj.blFill_para_name(ParaName, Para, "sp_Payment_Transaction_Details"); } //} KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls(); DataTable dt1 = new DataTable(); GetVoucherNo(dt1); rbadd.Checked = true; cmdName.Focus(); } else { MyMessageBox.ShowBox(msg); } } catch (Exception err) { err.GetBaseException(); } }
private void btnsave_Click(object sender, EventArgs e) { string msg = ""; try { if (optadd.Checked) { if (Validate('A', out msg)) { bl_obj.RowMaterialName = txtRowMaterialName.Text; bl_obj.MeasurmentId = Convert.ToInt32(cmbMeasurement.SelectedValue); bl_obj.RowHedarId = Convert.ToInt32(cmbRowHeaderName.SelectedValue); FillLVW(bl_obj.INSERT(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record Save Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyMessageBox.ShowBox(msg); } } else if (optupdate.Checked) { if (Validate('U', out msg)) { bl_obj.RowMaterialId = Convert.ToInt32(txtRowMaterialId.Text.ToString()); bl_obj.RowMaterialName = txtRowMaterialName.Text; bl_obj.MeasurmentId = Convert.ToInt32(cmbMeasurement.SelectedValue); bl_obj.RowHedarId = Convert.ToInt32(cmbRowHeaderName.SelectedValue); FillLVW(bl_obj.UPDATE(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record Update Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyMessageBox.ShowBox(msg); } } else if (optdelete.Checked) { if (Validate('D', out msg)) { if (KryptonMessageBox.Show("Do You Want To delete These record(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { foreach (ListViewItem l in lvw.CheckedItems) { bl_obj.RowMaterialId = Convert.ToInt32(l.Tag.ToString()); bl_obj.DELETE(bl_obj); } FillLVW(bl_obj.select(bl_obj)); ClearControls(); KryptonMessageBox.Show("Record(s) deleted Successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MyMessageBox.ShowBox(msg); } } } catch (Exception err) { err.GetBaseException(); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (validate(optDelete.Checked) == false) { if (optAdd.Checked == true) { if (function.SearchTextInListView_on_column_bool(lvw, 0, txtUserName.Text, true) == true) { msg = "- Record already exists\n\n"; MyMessageBox.ShowBox(msg); } else if (txtUserName.Text.CompareTo("") != 0) { List <string> para_name = new List <string>(); para_name.Add("@UserName"); para_name.Add("@Password"); para_name.Add("@GroupID"); para_name.Add("@flag"); List <string> para_value = new List <string>(); para_value.Add(txtUserName.Text); para_value.Add(function.Decrypt(txtPassword.Text)); para_value.Add(cmbGroupType.SelectedValue.ToString()); para_value.Add("A"); DataSet ds = bl_obj.blFill_para_name(para_name, para_value, "SP_UserMaster"); KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); FillLVW(ds); cleartext(); } } if (optEdit.Checked == true) { List <string> para_name = new List <string>(); para_name.Add("@UserID"); para_name.Add("@UserName"); para_name.Add("@Password"); para_name.Add("@GroupID"); para_name.Add("@flag"); List <string> para_value = new List <string>(); para_value.Add(txtUserId.Text); para_value.Add(txtUserName.Text); para_value.Add(function.Decrypt(txtPassword.Text)); para_value.Add(cmbGroupType.SelectedValue.ToString()); para_value.Add("U"); DataSet ds = bl_obj.blFill_para_name(para_name, para_value, "SP_UserMaster"); KryptonMessageBox.Show("Record Update Successfilly", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); FillLVW(ds); cleartext(); } if (optDelete.Checked == true) { if (lvw.Items.Count != 0) { DialogResult str = MessageBox.Show(this, "Are U Sure To Delete A Record " + txtUserName.Text + "?", "Delete", MessageBoxButtons.YesNo); for (int i = 0; i < lvw.Items.Count; i++) { if (lvw.Items[i].Checked == true) { if (str.ToString().CompareTo("Yes") == 0) { List <string> para_name = new List <string>(); para_name.Add("@UserID"); para_name.Add("@GroupID"); para_name.Add("@flag"); List <string> para_value = new List <string>(); para_value.Add(lvw.Items[i].SubItems[2].Text); para_value.Add(cmbGroupType.SelectedValue.ToString()); para_value.Add("D"); DataSet ds = bl_obj.blFill_para_name(para_name, para_value, "SP_UserMaster"); KryptonMessageBox.Show("Record Delete Successfilly", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); FillLVW(ds); cleartext(); optAdd.Checked = true; } } } } } } else { //KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); MyMessageBox.ShowBox(msg); //function.Message_Show(this, msg, ); msg = ""; } } catch (Exception err) { err.GetBaseException(); } }
private void btnSubmit_Click(object sender, EventArgs e) { string msg = ""; //if (optadd.Checked) //{ try { if (rbadd.Checked == true) { if (Validate('A', out msg)) { InsertRecords(); //} KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls(); DataTable dt1 = new DataTable(); GetVoucherNo(dt1); rbadd.Checked = true; cmdName.Focus(); } } else if (rbedit.Checked == true) { DataSet ds = new DataSet(); ParaName.Clear(); Para.Clear(); ParaName.Add("@Flag"); ParaName.Add("@Voucher_No"); ParaName.Add("@Cust_Type"); Para.Add("U"); Para.Add(Voucher_ID); Para.Add("C"); ds = bl_obj.blFill_para_name(ParaName, Para, "sp_Payment_Transaction_Details"); FillPendingInvoices(cmdName.SelectedValue.ToString()); InsertRecords(); } else { MyMessageBox.ShowBox(msg); } //} //else if (optedit.Checked) //{ // if (Validate('U', out msg)) // { // bl_obj.Supplier_Id = Convert.ToInt32(txtSupplierId.Text); // bl_obj.Comp_Name = txtSuplFirmName.Text; // bl_obj.Address = txtAddress.Text; // //bl_obj.Customer_No = Convert.ToInt32(txtCustomerNo.Text); // bl_obj.Supplier_Mobileno = Convert.ToInt32(txtMobileNo.Text); // bl_obj.Tin_No = txtTinNo.Text; // bl_obj.Vat_No = txtVatNo.Text; // FillLVW(bl_obj.UPDATE(bl_obj)); // ClearControls(); // KryptonMessageBox.Show("Record Update Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // else // MyMessageBox.ShowBox(msg); //} //else if (optdelete.Checked) //{ // if (Validate('D', out msg)) // { // if (KryptonMessageBox.Show("Do You Want To delete These record(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) // { // foreach (ListViewItem l in lvw.CheckedItems) // { // //txtCustomerId.Text = l.Tag.ToString(); // //l.Tag = txtCustomerId.Text; // bl_obj.Supplier_Id = Convert.ToInt32(l.Tag.ToString()); // bl_obj.DELETE(bl_obj); // } // FillLVW(bl_obj.SELECT(bl_obj)); // ClearControls(); // KryptonMessageBox.Show("Record(s) deleted Successfully", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // } // else // MyMessageBox.ShowBox(msg); //} } catch (Exception err) { err.GetBaseException(); } }