public void Update(Visit new_visit) { try { using (Visit_manager_dbEntities db = new Visit_manager_dbEntities()) { Visit visit_from_db = db.Visit.Find(new_visit.id); if (visit_from_db != null) { visit_from_db.client_name = new_visit.client_name; visit_from_db.client_surname = new_visit.client_surname; visit_from_db.client_tel_number = new_visit.client_tel_number; visit_from_db.client_email = new_visit.client_email; visit_from_db.employee_id = new_visit.employee_id; visit_from_db.start_time = new_visit.start_time; visit_from_db.end_time = new_visit.end_time; visit_from_db.describe = new_visit.describe; visit_from_db.is_removed = false; visit_from_db.price = new_visit.price; visit_from_db.type_id = new_visit.type_id; visit_from_db.type_unclassified = new_visit.type_unclassified; db.SaveChanges(); } } } catch (Exception ex) { NLog_logger.Loger.Error(ex); } }
public void Add(Visit_type visit_type) { try { using (Visit_manager_dbEntities db = new Visit_manager_dbEntities()) { db.Visit_type.Add(visit_type); db.SaveChanges(); } } catch (Exception ex) { NLog_logger.Loger.Error(ex); } }
public void Add(Employee employee) { try { using (Visit_manager_dbEntities db = new Visit_manager_dbEntities()) { db.Employee.Add(employee); db.SaveChanges(); } } catch (Exception ex) { NLog_logger.Loger.Error(ex); } }
public void Remove(long id) { try { using (Visit_manager_dbEntities db = new Visit_manager_dbEntities()) { Visit_type visit_type = db.Visit_type.Find(id); visit_type.is_removed = true; db.SaveChanges(); } } catch (Exception ex) { NLog_logger.Loger.Error(ex); } }
public Employee Add_guid(long id) { Employee employee = new Employee(); try { using (Visit_manager_dbEntities db = new Visit_manager_dbEntities()) { employee = db.Employee.Find(id); employee.guid = Guid.NewGuid().ToString(); db.SaveChanges(); } } catch (Exception ex) { NLog_logger.Loger.Error(ex); } return(employee); }
public void Update(Visit_type visit_type) { try { using (Visit_manager_dbEntities db = new Visit_manager_dbEntities()) { Visit_type visit_type_from_db = db.Visit_type.Find(visit_type.id); if (visit_type_from_db != null) { visit_type_from_db.name = visit_type.name; db.SaveChanges(); } } } catch (Exception ex) { NLog_logger.Loger.Error(ex); } }
public void Update_password(long id, string password) { Employee employee = new Employee(); try { using (Visit_manager_dbEntities db = new Visit_manager_dbEntities()) { employee = db.Employee.Find(id); if (employee != null) { employee.password = password; db.SaveChanges(); } } } catch (Exception ex) { NLog_logger.Loger.Error(ex); } }
public void Update(Employee employee_to_edit) { Employee employee = new Employee(); try { using (Visit_manager_dbEntities db = new Visit_manager_dbEntities()) { employee = db.Employee.Find(employee_to_edit.id); if (employee != null) { employee.name = employee_to_edit.name; employee.surname = employee_to_edit.surname; db.SaveChanges(); } } } catch (Exception ex) { NLog_logger.Loger.Error(ex); } }