예제 #1
0
 //  Method Name: Delete
 //      Purpose: Deletes an employee object from the database
 //      Accepts: a String
 //      Returns: bool
 public bool Delete(string id)
 {
     bool deleteOk = false;
     ObjectId empid = new ObjectId(id);
     try
     {
         DbContext ctx = new DbContext();
         Employee emp = ctx.Employees.FirstOrDefault(e => e._id == empid);
         ctx.Delete<Employee>(emp, "employees");
         deleteOk = true;
     }
     catch(Exception e)
     {
         DALUtils.ErrorRoutine(e, "EmployeeDAO", "Delete");
     }
     return deleteOk;
 }
예제 #2
0
        public bool Delete(string id)
        {
            bool deleteOk = false;
            ObjectId prbId = new ObjectId(id);

            try
            {
                DbContext ctx = new DbContext();
                Problem prb = ctx.Problems.FirstOrDefault(p => p._id == prbId);
                ctx.Delete<Problem>(prb, "problems");
                deleteOk = true;
            } catch (Exception ex)
            {
                DALUtils.ErrorRoutine(ex, "ProblemDAO", "Delete");
            }

            return deleteOk;
        }
예제 #3
0
        public bool Delete(string id)
        {
            bool deleteOk = false;
            ObjectId depId = new ObjectId(id);

            try
            {
                DbContext ctx = new DbContext();
                Department dep = ctx.Departments.FirstOrDefault(d => d._id == depId);
                ctx.Delete<Department>(dep, "departments");
                deleteOk = true;
            } catch (Exception ex)
            {
                DALUtils.ErrorRoutine(ex, "DepartmentDAO", "Delete");
            }

            return deleteOk;
        }
예제 #4
0
        //  Method Name: Delete
        //      Purpose: Deletes an employee object from the database
        //      Accepts: a String
        //      Returns: bool
        public bool Delete(string id)
        {
            bool     deleteOk = false;
            ObjectId empid    = new ObjectId(id);

            try
            {
                DbContext ctx = new DbContext();
                Employee  emp = ctx.Employees.FirstOrDefault(e => e._id == empid);
                ctx.Delete <Employee>(emp, "employees");
                deleteOk = true;
            }
            catch (Exception e)
            {
                DALUtils.ErrorRoutine(e, "EmployeeDAO", "Delete");
            }
            return(deleteOk);
        }
예제 #5
0
        public bool Delete(string id)
        {
            bool     deleteOk = false;
            ObjectId callid   = new ObjectId(id);

            try
            {
                DbContext ctx  = new DbContext();
                Call      call = ctx.Calls.FirstOrDefault(c => c._id == callid);
                ctx.Delete <Call>(call, "calls");
                deleteOk = true;
            }
            catch (Exception ex)
            {
                DALUtils.ErrorRoutine(ex, "CallDAO", "Delete");
            }

            return(deleteOk);
        }
예제 #6
0
        public bool Delete(string id)
        {
            bool     deleteOk = false;
            ObjectId depid    = new ObjectId(id);

            try
            {
                DbContext  ctx = new DbContext();
                Department dep = ctx.Departments.FirstOrDefault(d => d._id == depid);
                ctx.Delete <Department>(dep, "departments");
                deleteOk = true;
            }
            catch (Exception ex)
            {
                DALUtils.ErrorRoutine(ex, "DepartmentDAO", "Delete");
            }

            return(deleteOk);
        }