private void toolStripButtonNew_Click(object sender, EventArgs e) { FormEmployeeInfo dlg = new FormEmployeeInfo(); if (dlg.ShowDialog() == DialogResult.OK) { m_DbAdaHelper.AddEmployee(dlg.m_Personnel); m_DbAdaHelper.AddEmployeeResume(dlg.m_PersonnelResume); dgvEmployee.DataSource = m_DbAdaHelper.GetEmployee(); } }
void ModEmployeeInfo() { if (dgvEmployee.CurrentRow != null) { FormEmployeeInfo dlg = new FormEmployeeInfo(); DataRowView drv = (DataRowView)dgvEmployee.CurrentRow.DataBoundItem; dlg.m_Personnel.Name = drv["Name"].ToString(); dlg.m_Personnel.Alias = drv["Alias"].ToString(); dlg.m_Personnel.Addrees = drv["Addrees"].ToString(); if (!Convert.IsDBNull(drv["Birth"])) { dlg.m_Personnel.Birth = Convert.ToDateTime(drv["Birth"]); } dlg.m_Personnel.EduLevel = drv["EduLevel"].ToString(); dlg.m_Personnel.EMail = drv["EMail"].ToString(); dlg.m_Personnel.Fax = drv["Fax"].ToString(); if (!Convert.IsDBNull(drv["HoldDate"])) { dlg.m_Personnel.HoldDate = Convert.ToDateTime(drv["HoldDate"]); } dlg.m_Personnel.HomePhone = drv["HomePhone"].ToString(); dlg.m_Personnel.IdentityCard = drv["IdentityCard"].ToString(); dlg.m_Personnel.MobilePhone = drv["MobilePhone"].ToString(); dlg.m_Personnel.MSN = drv["MSN"].ToString(); if (!Convert.IsDBNull(drv["Outjob"])) { dlg.m_Personnel.Outjob = Convert.ToInt32(drv["Outjob"]); } dlg.m_Personnel.PersonnelID = Convert.ToInt32(drv["PersonnelID"]); dlg.m_Personnel.QQ = drv["QQ"].ToString(); dlg.m_Personnel.Sex = drv["Sex"].ToString(); dlg.m_Personnel.WorkAddress = drv["WorkAddress"].ToString(); dlg.m_Personnel.WorkID = drv["WorkID"].ToString(); dlg.m_Personnel.WorkPhone = drv["WorkPhone"].ToString(); if (!Convert.IsDBNull(drv["Contract"])) { dlg.m_Personnel.ContractDate = Convert.ToDateTime(drv["Contract"]); } if (!Convert.IsDBNull(drv["DimissionDate"])) { dlg.m_Personnel.DimissionDate = Convert.ToDateTime(drv["DimissionDate"]); } dlg.m_PersonnelResume.PersonnelID = dlg.m_Personnel.PersonnelID; CPersonnelResume PersonnelResume = m_DbAdaHelper.GetEmployeeResume(dlg.m_Personnel.PersonnelID); if (PersonnelResume != null) { dlg.m_PersonnelResume = PersonnelResume; } if (dlg.ShowDialog() == DialogResult.OK) { m_DbAdaHelper.UpdateEmployee(dlg.m_Personnel); m_DbAdaHelper.UpdateEmployeeResume(dlg.m_PersonnelResume); } dgvEmployee.DataSource = m_DbAdaHelper.GetEmployee(); } }