public void BindSupplierComboBox() { try { /***************** Bind the Supplier Combo*******************/ clsSupplierMaster objLoad = new clsSupplierMaster(); objLoad.Mode = "SELECTALL"; objLoad.CompanyID = cId; var dsSupplier = objLoad.GetAllSupplier(); DataTable dtSupplier = dsSupplier.Tables[0]; DataRow dr = dtSupplier.NewRow(); dr["SupplierID"] = "0"; dr["SupplierName"] = "All"; dtSupplier.Rows.InsertAt(dr, 0); cmbSupplier.DataSource = dtSupplier; cmbSupplier.DisplayMember = "SupplierName"; cmbSupplier.ValueMember = "SupplierID"; cmbSupplier.Text = "All"; /***************** Bind the Supplier Combo*******************/ } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "BindSupplierComboBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void BindDataGrid() { try { clsSupplierMaster objLoad = new clsSupplierMaster(); objLoad.Mode = "SELECTALL"; objLoad.CompanyID = cId; dgvSupplierMaster.AutoGenerateColumns = false; var ds = objLoad.GetAllSupplier(); dgvSupplierMaster.DataSource = ds.Tables[0]; lblRecordCount.Text = ds.Tables[0].Rows.Count.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "BindDataGrid", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void SearchBindDataGrid() { try { dgvSupplierMaster.DataSource = null; clsSupplierMaster objLoad = new clsSupplierMaster(); objLoad.CompanyID = cId; objLoad.Mode = "SELECTALL"; objLoad.SupplierName = txtSearchSupplier.Text; objLoad.SupplierContactNo = txtSearchContactPerson.Text; objLoad.SupplierAddress = txtSearchAddress.Text; dgvSupplierMaster.AutoGenerateColumns = false; var ds = objLoad.GetSearchSupplier(); dgvSupplierMaster.DataSource = ds.Tables[0]; lblRecordCount.Text = ds.Tables[0].Rows.Count.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "SearchBindDataGrid", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void SaveFormData(String mode) { try { clsSupplierMaster objSave = new clsSupplierMaster(); objSave.SupplierID = Convert.ToInt32(txtKey.Text); objSave.SupplierName = txtSupplierName.Text; objSave.SupplierAddress = txtSupplierAddress.Text; objSave.SupplierContactPerson = txtContactPerson.Text; objSave.SupplierContactNo = txtContactNo.Text; objSave.CompanyID = cId; String cstDate = dtpCstTinDate.Value.ToString("dd/MM/yyyy"); if (DateTime.Now.ToString("dd/MM/yyyy") != cstDate) { objSave.SupplierCSTDate = clsCommoan.GetDateInddMMYYYY(cstDate); } String gstDate = dtpGstTinDate.Value.ToString("dd/MM/yyyy"); if (DateTime.Now.ToString("dd/MM/yyyy") != gstDate) { objSave.SupplierGSTDate = clsCommoan.GetDateInddMMYYYY(gstDate); } objSave.Mode = mode.ToUpper(); if (mode.ToUpper().Equals("DELETE")) { var confirmation = MessageBox.Show("Are You Sure You Want to Delete " + " " + txtSupplierName.Text, "Supplier Master Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (confirmation.ToString().Equals("Yes")) { objSave.AddUpdateDelete(); BindDataGrid(); ResetFormControl(); } } else { String msg = objSave.Validation(); //if (txtcstTinNo.Text.Length != 11 && txtcstTinNo.Text.Length>0) //{ // if (msg.Length.Equals(0)) // { // msg = "Please Enter the 11 Digit Cst Tin No: "; // } // else // { // msg = msg + "\n Please Enter the 11 Digit Valid Cst Tin No: "; // } //} //if (txtGstTinNo.Text.Length < 11 && txtGstTinNo.Text.Length > 0) //{ // if (txtGstTinNo.Text.Length!=11) // { // if (msg.Length.Equals(0)) // { // msg = "Please Enter the 11 Digit Valid Gst Tin No: "; // } // else // { // msg = msg + "\n Please Enter the 11 Digit Valid Gst Tin No: "; // } // } //} if (msg.Length > 0) { MessageBox.Show(msg, "Supplier Master Alert", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { objSave.SupplierCSTNo = txtcstTinNo.Text; if (txtGstTinNo.Text.Length > 0) { objSave.SupplierGSTNo = txtGstTinNo.Text; } objSave.AddUpdateDelete(); MessageBox.Show(txtSupplierName.Text + " " + mode + " Success Fully", "Supplier Master Save", MessageBoxButtons.OK, MessageBoxIcon.Information); BindDataGrid(); ResetFormControl(); if (pageAction.Equals("Yes")) { this.Close(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "SaveFormData", MessageBoxButtons.OK, MessageBoxIcon.Error); } }