Example #1
0
 private void frm_user_Load(object sender, EventArgs e)
 {
     lblTime.Text        = DateTime.Now.ToLongTimeString();
     lblDate.Text        = DateTime.Now.ToShortDateString();
     lb_curent_user.Text = Main_Form.curnt_emp;
     try
     {
         user = new cls_user();
         dt   = user.select();
         if (dt.Rows.Count > 0)
         {
             user_id = dt.Rows[dt.Rows.Count - 1][0].ToString();
         }
         else
         {
             user_id = "user_100";
         }
         dv = new DataView(dt);
         dgv_user.DataSource            = dv;
         dgv_user.Columns[0].HeaderText = "كود المستخدم";
         dgv_user.Columns[1].HeaderText = "اسم المستخدم";
         dgv_user.Columns[2].Visible    = false;
         dgv_user.Columns[3].HeaderText = "كود الموظف";
         dgv_user.Columns[4].HeaderText = "اسم الموظف";
         // dgv_user.Columns[0].Visible = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #2
0
 private void ts_btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         user = new cls_user();
         if (this.Name == "add_user")
         {
             if (validate())
             {
                 if (user.insertdata("insert", txt_user_id.Text, txt_user_name.Text, txt_password.Text, txt_emp_id.Text))
                 {
                     if (con.ExecuteQueries("insert into tb_priv(priv_screen_id,priv_user_id) select screen_id,'" + txt_user_id.Text + "' from tb_screen;"))
                     {
                         MessageBox.Show("تمت الاضافة بنجاح ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         this.Close();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #3
0
 private void ts_btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         user = new cls_user();
         if (this.Name == "update_user")
         {
             if (validate())
             {
                 if (user.updatedata("update", txt_user_id.Text, txt_user_name.Text, txt_password.Text, txt_emp_id.Text))
                 {
                     MessageBox.Show("تمت التعديل بنجاح ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.Close();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }