예제 #1
0
 private void TsmiAdd_Click(object sender, EventArgs e)
 {
     try
     {
         FrmUser frmUser = new FrmUser
         {
             WorkingState = WorkingState.Add,
         };
         DialogResult dialogResult = frmUser.ShowDialog(this);
         if (DialogResult.OK == dialogResult)
         {
             LoadAllUser();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
 private void TsmiEdit_Click(object sender, EventArgs e)
 {
     try
     {
         DataRow dataRow = (dataGridView1.SelectedRows[0].DataBoundItem as DataRowView).Row;
         var     item    = dataRow.ToExpression <UserInfo>();
         FrmUser frmUser = new FrmUser
         {
             User         = item(dataRow),
             WorkingState = WorkingState.Modify,
         };
         DialogResult dialogResult = frmUser.ShowDialog(this);
         if (DialogResult.OK == dialogResult)
         {
             LoadAllUser();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }