private void grd_editDestination_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; int destinationId = 0; BLL.ClsDestinationData destinationData = new BLL.ClsDestinationData(); try { //check for do action if (COMM_METHODS.checkActPermission(this.Name, USERNAME)) { if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { destinationId = Convert.ToInt32(senderGrid.SelectedCells[e.ColumnIndex].Value); destinationData = MANAGEDB.getSingleDestinationData(destinationId); FrmAddDestinations frmAddDestination = new FrmAddDestinations(destinationData, USERNAME); frmAddDestination.WindowState = FormWindowState.Normal; frmAddDestination.ShowDialog(); grd_editDestination.DataSource = MANAGEDB.getDestinationDetails(); } } else { COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!"); } } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }
public FrmAddDestinations(BLL.ClsDestinationData destination, string userName) { try { COM_MESSAGE = new CommonControls.Classes.ClsMessages(); VALIDATION = new CommonControls.Classes.ClsValidation(); COMM_METHODS = new CommonControls.Classes.ClsCommonMethods(); ADD_DESTINATION = new BLL.ClsDestinationData(); 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(destination); this.StartPosition = FormStartPosition.CenterScreen; this.ActiveControl = txt_destinationName; } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }
public FrmAddDestinations(string userName) { try { COM_MESSAGE = new CommonControls.Classes.ClsMessages(); VALIDATION = new CommonControls.Classes.ClsValidation(); COMM_METHODS = new CommonControls.Classes.ClsCommonMethods(); ADD_DESTINATION = new BLL.ClsDestinationData(); 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_destinationName; } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }
private void fillData(BLL.ClsDestinationData destinationData) { try { txt_destinationId.Text = destinationData._destId.ToString(); txt_destinationName.Text = destinationData._destName; txt_ownerName.Text = destinationData._ownerName; txt_address.Text = destinationData._address; txt_phoneNo.Text = destinationData._phoneNo; txt_mobile.Text = destinationData._mobile; } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }