예제 #1
0
 private void button_SubmitUsers_Click(object sender, EventArgs e)
 {
     try
     {
         if (!IsEmtyStr(textBoxUserName.Text) && !IsEmtyStr(textBoxUserPercent.Text))
         {
             if (user == null)
             {
                 WarehouseBack.Classes.User newUser = new WarehouseBack.Classes.User();
                 newUser.Name    = textBoxUserName.Text;
                 newUser.Persent = Convert.ToInt32(textBoxUserPercent.Text);
                 newUser.Save();
             }
             else
             {
                 user.Name    = textBoxUserName.Text;
                 user.Persent = Convert.ToInt32(textBoxUserPercent.Text);
                 user.Save();
             }
             textBoxUserPercent.Text = "";
             textBoxUserName.Text    = "";
             user = null;
             MessageBoxOk1();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #2
0
        private void dataGridViewUsers_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int id = Convert.ToInt32(dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value);

            user = WarehouseBack.Classes.User.GetUser(id);
            textBoxUserName.Text    = user.Name;
            textBoxUserPercent.Text = user.Persent.ToString();
        }
예제 #3
0
 private void dataGridViewUsers_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         if (MessageBoxOk())
         {
             int id = Convert.ToInt32(dataGridViewUsers.Rows[e.RowIndex].Cells[0].Value);
             user = WarehouseBack.Classes.User.GetUser(id);
             user.Delete();
         }
     }
 }
예제 #4
0
 private void button_CancelUser_Click(object sender, EventArgs e)
 {
     user = null;
     textBoxUserName.Text    = "";
     textBoxUserPercent.Text = "";
 }