Exemplo n.º 1
0
 private void ts_btn_save_Click(object sender, EventArgs e)
 {
     dep = new cls_department();
     try
     {
         if (vaildate_text())
         {
             if (this.Name == "add_dep")
             {
                 if (dep.insertdata("insert", txt_DeptCode.Text, txt_DEPTname.Text, txtDEPTplace.Text, txt_DEPT_notes.Text))
                 {
                     MessageBox.Show("تمت الاضافة بنجاح ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.Close();
                 }
             }
             else if (this.Name == "update_dep")
             {
                 if (dep.updatedata("update", txt_DeptCode.Text, txt_DEPTname.Text, txtDEPTplace.Text, txt_DEPT_notes.Text))
                 {
                     MessageBox.Show("تمت التعديل بنجاح ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.Close();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 2
0
 private void frm_department_Load(object sender, EventArgs e)
 {
     try
     {
         dep = new cls_department();
         dv  = new DataView(dep.selct_department());
         dgv_department.DataSource            = dv;
         dgv_department.Columns[0].HeaderText = "كود القسم";
         dgv_department.Columns[1].HeaderText = "اسم القسم";
         dgv_department.Columns[2].HeaderText = "مكان القسم";
         dgv_department.Columns[3].HeaderText = "ملاحظات";
         dgv_department.Columns[0].Visible    = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 3
0
 private void frm_department_Load(object sender, EventArgs e)
 {
     try
     {
         lblTime.Text        = DateTime.Now.ToLongTimeString();
         lblDate.Text        = DateTime.Now.ToShortDateString();
         lb_curent_user.Text = Main_Form.curnt_emp;
         //this.KeyDown += new System.Windows.Forms.KeyEventHandler(KeyEvent);
         dep = new cls_department();
         dt  = dep.selct_department();
         if (dt.Rows.Count > 0)
         {
             dep_code = dt.Rows[dt.Rows.Count - 1][0].ToString();
         }
         else
         {
             dep_code = "Dep_100";
         }
         dv = new DataView(dt);
         if (dt.Rows.Count > 0)
         {
             dgv_department.DataSource            = dv;
             dgv_department.Columns[0].HeaderText = "كود القسم";
             dgv_department.Columns[0].Width      = 150;
             dgv_department.Columns[1].HeaderText = "اسم القسم";
             dgv_department.Columns[1].Width      = 300;
             dgv_department.Columns[2].HeaderText = "مكان القسم";
             dgv_department.Columns[2].Width      = 300;
             dgv_department.Columns[3].HeaderText = "ملاحظات";
             // dgv_department.Columns[0].Visible = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }