private void BindDataGridView() { DECustomer customer = new DECustomer(); BLLCustomer obj_BLLCustomer = new BLLCustomer(); DataTable dt_Customer; if (txt_FilteredCustomerDescription.Text.Trim().Length <= 0) { dt_Customer = obj_BLLCustomer.LoadCustomerTableForAllData(); } else { customer.Customer_Description = txt_FilteredCustomerDescription.Text; dt_Customer = obj_BLLCustomer.LoadCustomerTableForAllDataByCustomerDescription(customer); } dgv_Customer.DataSource = dt_Customer; this.dt_Customer = dt_Customer; NumberingTableForDataGridView(dt_Customer); FormatDataGridView(); }
private void btn_Delete_Click(object sender, EventArgs e) { if (dgv_Customer.CurrentRow != null) { DialogResult Colse_Result; Colse_Result = MessageBox.Show(" Are you sure you want to Delete ?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Colse_Result == DialogResult.Yes) { DECustomer customer = new DECustomer(); customer.Customer_Id = Convert.ToInt32(dgv_Customer.CurrentRow.Cells[1].Value); customer.Active = false; BLLCustomer obj_BLLCustomer = new BLLCustomer(); int int_Result = obj_BLLCustomer.UpdateCustomerOnlyActiveByCustomerId(customer); if (int_Result > 0) { //MessageBox.Show("Delete Successfully"); BindDataGridView(); } obj_BLLCustomer = null; customer = null; } } }
private void save() { DECustomer customer = new DECustomer(); AssignData(customer); BLLCustomer obj_BLLCustomer = new BLLCustomer(); try { int int_Result = obj_BLLCustomer.InsertData(customer); if (int_Result > 0) { MessageBox.Show(UIConstantMessage.Const_strSaveSuccessfully); BindDataGridView(); clearScreen(); } } catch (Exception ex) { throw ex; } finally { customer = null; obj_BLLCustomer = null; } }
private void bindCustomerCombo() { BLLCustomer obj_BLLCustomer = new BLLCustomer(); DataTable dt_Customer = obj_BLLCustomer.LoadCustomerTableForAllData(); cbx_Customer.Items.Clear(); cbx_Customer.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable; cbx_Customer.SourceDataString = new string[] { "Customer_Description", "Address", "Phone", "Customer_Id" }; cbx_Customer.ColumnNum = 4; cbx_Customer.ColumnWidth = "150;0;0;0"; cbx_Customer.SourceDataTable = dt_Customer; cbx_Customer.Text = string.Empty; }
private void dgv_Customer_DoubleClick(object sender, EventArgs e) { DECustomer customer = new DECustomer(); customer.Customer_Id = Convert.ToInt32(dgv_Customer.CurrentRow.Cells[1].Value); BLLCustomer obj_BLLCustomer = new BLLCustomer(); bool bool_Result = obj_BLLCustomer.LoadCustomerRow(customer); if (bool_Result == true) { DisplayData(customer); } else { MessageBox.Show("Record is not found."); } customer = null; obj_BLLCustomer = null; }