public AddEmployee(Department dprt) { InitializeComponent(); rdo_female.Checked = true; main_page = (Microwave_v1._0.Forms.ShowEmployee)Application.OpenForms["ShowEmployee"]; System.IO.Directory.CreateDirectory(pic_dest_path); picture_event = new Picture_Events(pic_dest_path, picture_default_file, ref this.pic_employee); pic_new_source_path = picture_event.Pic_source_file; this.lbl_message.Text = ""; Fill_Comboboxes(); if (dprt != null) { this.cb_department.SelectedIndex = cb_department.Items.IndexOf(dprt.Name); this.cb_department.Enabled = false; } else { this.cb_department.SelectedIndex = 0; this.cb_department.Enabled = true; } this.BringToFront(); }
public AddEmployee(Employee employee) { InitializeComponent(); main_page = (Microwave_v1._0.Forms.ShowEmployee)Application.OpenForms["ShowEmployee"]; System.IO.Directory.CreateDirectory(pic_dest_path); picture_event = new Picture_Events(pic_dest_path, picture_default_file, ref this.pic_employee); this.lbl_message.Text = ""; employee_to_edit = employee; Fill_Comboboxes(); this.cb_department.SelectedIndex = this.cb_department.Items.IndexOf(employee.Deparment_name); this.tb_name.Text = employee.Name; this.tb_name.ForeColor = Color.LightGray; this.tb_surname.Text = employee.Surname; this.tb_surname.ForeColor = Color.LightGray; this.tb_email.Text = employee.Email; this.tb_email.ForeColor = Color.LightGray; this.dtp_time.Value = employee.Birth_date_dt; if (employee.Gender == "Female") { rdo_female.Checked = true; } else { rdo_male.Checked = true; } pic_new_source_path = picture_event.Pic_source_file = employee.Cover_path_file; pic_employee.Image = Picture_Events.Get_Copy_Image_Bitmap(pic_new_source_path); is_edit = true; this.BringToFront(); }