예제 #1
0
 public New_Emp(Entity.Employee emp, String mode, EmployeeManager view)
 {
     InitializeComponent();
     this.emp  = emp;
     this.mode = mode;
     this.view = view;
 }
예제 #2
0
 private void Control_button_Click(object sender, EventArgs e)
 {
     if (mode.Equals("Detail"))
     {
         this.Close();
     }
     else if (mode.Equals("Add"))
     {
         String          name     = Emp_name.Text;
         String          Identify = Emp_iden.Text;
         String          dob      = Emp_dob.Text;
         int             Gender   = Emp_gender.SelectedIndex;
         String          Phone    = Emp_phone.Text;
         String          Address  = Emp_Address.Text;
         String          Role     = Emp_role.Text;
         String          Des      = Emp_des.Text;
         int             Salary   = Int32.Parse(Emp_salary.Text);
         String          des      = Emp_des.Text;
         Entity.Employee emp      = new Entity.Employee(name, Identify, dob, Gender, Phone, Address, Role, Salary, des);
         int             check    = DataAccess.EmployeeDao.InsertEmp(emp);
         if (check == 1)
         {
             MessageBox.Show("Add Complete !!");
             view.loadData();
             this.Close();
         }
         else
         {
             MessageBox.Show("Error !!!! \r\n Not Valid Data ");
         }
     }
 }
 private void View_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         DataGridViewRow dr   = View.Rows[e.RowIndex];
         Object          data = dr.DataBoundItem;
         Entity.Employee emp  = (Entity.Employee)data;
         New_Emp         view = new New_Emp(emp, "Detail", this);
         view.Location = new Point(20, 20);
         view.Visible  = true;
     }catch (Exception E)
     {
     }
 }