private void Delete(Employee_Certification objUI) { if (objUI != null) { // Get current group in dbContext Employee_Certification objDb = GetById(objUI.ID.ToString()); if (objDb != null) { // Set delete info // Submit changes to dbContext dbContext.Employee_Certifications.DeleteOnSubmit(objDb); dbContext.SubmitChanges(); } } }
public Message Insert(Employee_Certification objUI) { TrainingCertificationDao trainDao = new TrainingCertificationDao(); Message msg = null; try { Employee_Certification empCer = GetEmployeeAssignedCertification(objUI.EmployeeId, objUI.CertificationId); if (objUI != null && empCer == null) { dbContext.Employee_Certifications.InsertOnSubmit(objUI); dbContext.SubmitChanges(); // Show success message objUI.Training_CertificationMaster = trainDao.GetById(objUI.CertificationId.ToString()); msg = new Message(MessageConstants.I0001, MessageType.Info, "Certification '" + objUI.Training_CertificationMaster.Name + "'", "added"); } else { objUI.Training_CertificationMaster = trainDao.GetById(objUI.CertificationId.ToString()); msg = new Message(MessageConstants.E0020, MessageType.Error, "Certification '" + objUI.Training_CertificationMaster.Name + "'", "this employee"); } } catch (Exception ex) { msg = new Message(MessageConstants.E0007, MessageType.Error); throw ex; } return msg; }
public Message UpdateTrainingEmployeeCertification(Employee_Certification objUI) { Message msg = null; try { if (objUI != null) { // Get current group in dbContext Employee_Certification objDb = GetById(objUI.ID.ToString()); if (objDb != null) { objDb.EmployeeId = objUI.EmployeeId; objDb.CertificationId = objUI.CertificationId; objDb.Remark = objUI.Remark; dbContext.SubmitChanges(); msg = new Message(MessageConstants.I0001, MessageType.Info, "Certification '" + objDb.CertificationId + "'", "updated"); } } } catch { // Show system error msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }