// Method Name: Create // Purpose: Add an Employee document to the employees collection // Accepts: An employee object // Returns: A string public string Create(Employee emp) { string newid = ""; try { DbContext ctx = new DbContext(); ctx.Save(emp, "employees"); newid = emp._id.ToString(); } catch(Exception e) { DALUtils.ErrorRoutine(e, "EmployeeDAO", "Create"); } return newid; }
public string Create(Problem prb) { string newid = ""; try { DbContext ctx = new DbContext(); ctx.Save(prb, "problems"); newid = prb._id.ToString(); } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "ProblemDAO", "Create"); } return newid; }
// Method Name: Create // Purpose: Add an Employee document to the employees collection // Accepts: An employee object // Returns: A string public string Create(Employee emp) { string newid = ""; try { DbContext ctx = new DbContext(); ctx.Save(emp, "employees"); newid = emp._id.ToString(); } catch (Exception e) { DALUtils.ErrorRoutine(e, "EmployeeDAO", "Create"); } return(newid); }
public string Create(Department dep) { string newid = ""; try { DbContext ctx = new DbContext(); ctx.Save(dep, "departments"); newid = dep._id.ToString(); } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "DepartmentDAO", "Create"); } return newid; }
public string Create(Call call) { string newid = ""; try { DbContext ctx = new DbContext(); ctx.Save(call, "calls"); newid = call._id.ToString(); } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "CallDAO", "Create"); } return(newid); }
public string Create(Department dep) { string newid = ""; try { DbContext ctx = new DbContext(); ctx.Save(dep, "departments"); newid = dep._id.ToString(); } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "DepartmentDAO", "Create"); } return(newid); }
public int Update(Call call) { int updateOK = -1; try { DbContext ctx = new DbContext(); ctx.Save <Call>(call, "calls"); updateOK = 1; } catch (MongoConcurrencyException ex) { updateOK = -2; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "CallDAO", "Update"); } return(updateOK); }
public int Update(Employee emp) { int updateOK = -1; try { DbContext ctx = new DbContext(); ctx.Save <Employee>(emp, "employees"); updateOK = 1; } catch (MongoConcurrencyException ex) { updateOK = -2; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "EmployeeDAO", "Update"); } return(updateOK); }
public int Update(Department dep) { int updateOK = -1; try { DbContext ctx = new DbContext(); ctx.Save <Department>(dep, "departments"); updateOK = 1; } catch (MongoConcurrencyException ex) { updateOK = -2; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "DepartmentDAO", "Update"); } return(updateOK); }
// Method Name: Update // Purpose: Updates an Employee in the MongoDatabase, and checks for concurrency // Accepts: An Employee Object // Returns: An int public int Update(Employee emp) { int updateOk = -1; try { DbContext ctx = new DbContext(); ctx.Save <Employee>(emp, "employees"); updateOk = 1; } catch (MongoConcurrencyException e) { updateOk = -2; // DALUtils.ErrorRoutine(e, "EmployeeDAO", "Update"); Console.WriteLine(e.Message); } catch (Exception e) { DALUtils.ErrorRoutine(e, "EmployeeDAO", "Update"); } return(updateOk); }
public int Update(Employee emp) { int update = -1; try { DbContext ctx = new DbContext(); ctx.Save<Employee>(emp, "employees"); update = 1; } catch (MongoConcurrencyException ex) { update = -2; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "EmployeeDAO", "Update:Error"); } return update; }
public int Update(Problem prb) { int update = -1; try { DbContext ctx = new DbContext(); ctx.Save<Problem>(prb, "problems"); update = 1; } catch (MongoConcurrencyException ex) { update = -2; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "ProblemDAO", "Update:Error"); } return update; }
// Method Name: Update // Purpose: Updates an Employee in the MongoDatabase, and checks for concurrency // Accepts: An Employee Object // Returns: An int public int Update(Employee emp) { int updateOk = -1; try { DbContext ctx = new DbContext(); ctx.Save<Employee>(emp, "employees"); updateOk = 1; } catch(MongoConcurrencyException e) { updateOk = -2; // DALUtils.ErrorRoutine(e, "EmployeeDAO", "Update"); Console.WriteLine(e.Message); } catch(Exception e) { DALUtils.ErrorRoutine(e, "EmployeeDAO", "Update"); } return updateOk; }
public int Update(Department dep) { int update = -1; try { DbContext ctx = new DbContext(); ctx.Save<Department>(dep, "departments"); update = 1; } catch (MongoConcurrencyException ex) { update = -2; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "DepartmentDAO", "Update:Error"); } return update; }