コード例 #1
0
 //  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;
 }
コード例 #2
0
        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;
        }
コード例 #3
0
        //  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);
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        //  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);
        }
コード例 #11
0
        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;
        }
コード例 #12
0
        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;
        }
コード例 #13
0
 //  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;
 }
コード例 #14
0
        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;
        }