예제 #1
0
 public static bool UpdateUserById(int Id, bool status)
 {
     try
     {
         bool result = false;
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             var usr = (from p in db.AppUsers
                        where p.ID == Id
                        select p).FirstOrDefault();
             if (status)
             {
                 usr.isActive = false;
             }
             else
             {
                 usr.isActive = true;
             }
             db.SaveChanges();
             result = true;
         }
         return(result);
     }
     catch (Exception ex)
     {
         Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #2
0
 public static bool AddDirectExpenseATC(DirectBudgetATC astBud)
 {
     try
     {
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             db.DirectBudgetATCs.Add(astBud);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #3
0
 public static bool AddATCHeader(ATCRequestHeader astBud)
 {
     try
     {
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             db.ATCRequestHeaders.Add(astBud);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #4
0
 public static bool AddRevenue(RevenueProjection recpro)
 {
     try
     {
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             db.RevenueProjections.Add(recpro);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #5
0
 public static bool AddDirectorate(Directorate dir)
 {
     try
     {
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             db.Directorates.Add(dir);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #6
0
 public static bool AddExistingStaff(ExistingStaff estf)
 {
     try
     {
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             db.ExistingStaffs.Add(estf);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #7
0
 public static bool AddSalesData(GSS_SalesTbl byr)
 {
     try
     {
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             db.GSS_SalesTbl.Add(byr);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #8
0
 public static bool AddDepartment(Department dept)
 {
     try
     {
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             db.Departments.Add(dept);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #9
0
 public static bool AddUser(AppUser usr)
 {
     try
     {
         using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities())
         {
             db.AppUsers.Add(usr);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #10
0
 public static bool DeleteCapexExpense(CapexBudget astBud)
 {
     try
     {
         bool rst = false;
         using (var db = new BudgetCaptureDBEntities())
         {
             db.Entry(astBud).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
             rst = true;
         }
         return(rst);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #11
0
 public static bool DeleteRevenue(RevenueProjection recpro)
 {
     try
     {
         bool rst = false;
         using (var db = new BudgetCaptureDBEntities())
         {
             db.Entry(recpro).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
             rst = true;
         }
         return(rst);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #12
0
 public static bool DeleteGasSales(GSS_SalesTbl staff)
 {
     try
     {
         bool rst = false;
         using (var db = new BudgetCaptureDBEntities())
         {
             db.Entry(staff).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
             rst = true;
         }
         return(rst);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #13
0
 public static bool UpdateDirectExpenseATC(DirectBudgetATC astBud)
 {
     try
     {
         bool rst = false;
         using (var db = new BudgetCaptureDBEntities())
         {
             db.DirectBudgetATCs.Attach(astBud);
             db.Entry(astBud).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             rst = true;
         }
         return(rst);
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #14
0
 public static bool UpdateUser(AppUser usr)
 {
     try
     {
         bool retVal = false;
         using (var db = new BudgetCaptureDBEntities())
         {
             usr.Department      = null;
             db.Entry(usr).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             retVal = true;
         }
         return(retVal);
     }
     catch (Exception ex)
     {
         Utility.WriteError("Error Msg: " + ex.InnerException);
         throw ex;
     }
 }
예제 #15
0
 public static bool UpdateSalesData(GSS_SalesTbl byr)
 {
     try
     {
         bool rst = false;
         using (var db = new BudgetCaptureDBEntities())
         {
             db.GSS_SalesTbl.Attach(byr);
             db.Entry(byr).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             rst = true;
         }
         return(rst);
     }
     catch (Exception ex)
     {
         //Utility.WriteError("Error Msg: " + ex.InnerException);
         throw ex;
     }
 }
예제 #16
0
 public static bool UpdateRevenue(RevenueProjection recpro)
 {
     try
     {
         bool rst = false;
         using (var db = new BudgetCaptureDBEntities())
         {
             db.RevenueProjections.Attach(recpro);
             db.Entry(recpro).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             rst = true;
         }
         return(rst);
     }
     catch (Exception ex)
     {
         // Utility.WriteError("Error Msg: " + ex.Message);
         throw ex;
     }
 }
예제 #17
0
 public static bool Update(Department dept)
 {
     try
     {
         bool rst = false;
         using (var db = new BudgetCaptureDBEntities())
         {
             db.Departments.Attach(dept);
             db.Entry(dept).State = System.Data.Entity.EntityState.Modified;
             //db.ObjectStateManager.ChangeObjectState(auction, System.Data.EntityState.Modified);
             db.SaveChanges();
             rst = true;
         }
         return(rst);
     }
     catch (Exception ex)
     {
         Utility.WriteError("Error Msg: " + ex.InnerException);
         throw ex;
     }
 }