public FrmAddDealers(string userName) { try { COM_MESSAGE = new CommonControls.Classes.ClsMessages(); VALIDATION = new CommonControls.Classes.ClsValidation(); COMM_METHODS = new CommonControls.Classes.ClsCommonMethods(); ADD_DEALER = new BLL.ClsDealerData(); MANAGEDB = new BLL.ClsMetaDataDbChanges(); InitializeComponent(); USERNAME = userName; btn_cancel.Visible = true; btn_create.Visible = true; btn_delete.Visible = false; btn_update.Visible = false; this.WindowState = FormWindowState.Maximized; this.ActiveControl = txt_dealerName; } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }
private void grd_editDealer_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; int dealerId = 0; BLL.ClsDealerData dealerData = new BLL.ClsDealerData(); try { //check for do action if (COMM_METHODS.checkActPermission(this.Name, USERNAME)) { if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { dealerId = Convert.ToInt32(senderGrid.SelectedCells[e.ColumnIndex].Value); dealerData = MANAGEDB.getSingleDealerData(dealerId); FrmAddDealers frmDealer = new FrmAddDealers(dealerData, USERNAME); frmDealer.WindowState = FormWindowState.Normal; frmDealer.ShowDialog(); grd_editDealer.DataSource = MANAGEDB.getDealerDetails(); } } else { COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!"); } } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }
private void fillData(BLL.ClsDealerData dealerData) { try { txt_dealerID.Text = dealerData._dealerId.ToString(); txt_dealerName.Text = dealerData._dealerName; txt_companyName.Text = dealerData._companyName; txt_address.Text = dealerData._address; txt_phoneNo.Text = dealerData._phoneNo; txt_mobile.Text = dealerData._mobile; } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }
public FrmAddDealers(BLL.ClsDealerData dealerDetails, string userName) { COM_MESSAGE = new CommonControls.Classes.ClsMessages(); VALIDATION = new CommonControls.Classes.ClsValidation(); COMM_METHODS = new CommonControls.Classes.ClsCommonMethods(); ADD_DEALER = new BLL.ClsDealerData(); MANAGEDB = new BLL.ClsMetaDataDbChanges(); InitializeComponent(); IS_UPDATING = true; USERNAME = userName; btn_cancel.Visible = true; btn_create.Visible = false; btn_delete.Visible = true; btn_update.Visible = true; fillData(dealerDetails); this.StartPosition = FormStartPosition.CenterScreen; this.ActiveControl = txt_dealerName; }