Пример #1
0
 public bool UnDeleteEmployee(long admin_id, long employee_id)
 {
     using (VIMSDBContext context = new VIMSDBContext())
     {
         Employee employee = context.Employees.Find(employee_id);
         if (employee != null && employee.Active != true)
         {
             employee.Active    = true; // just set to active
             employee.UpdatedBy = admin_id;
             employee.UpdatedDt = System.DateTime.Now;
             context.SaveChanges();
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
 public bool UnDeleteOrganization(long admin_id, long organization_id)
 {
     using (VIMSDBContext context = new VIMSDBContext())
     {
         Organization organization = context.Organizations.Find(organization_id);
         if (organization != null && organization.Active != true)
         {
             organization.Active    = true; // just set to active
             organization.UpdatedBy = admin_id;
             organization.UpdatedDt = System.DateTime.Now;
             context.SaveChanges();
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
        public bool UnEditOrganization(Organization organization)
        {
            using (VIMSDBContext context = new VIMSDBContext())
            {
                Organization current_organization = context.Organizations.Find(organization.Id);
                if (organization != null && (bool)organization.Active) // BKP fix should not be nullable
                {
                    int count = context.Organizations.
                                Where(m => m.Name == organization.Name && m.Id != organization.Id).
                                Count();

                    if (count == 0)
                    {
                        context.Entry(current_organization).CurrentValues.SetValues(organization);
                        context.SaveChanges();
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #4
0
        public bool EditEmployee(Employee employee)
        {
            using (VIMSDBContext context = new VIMSDBContext())
            {
                Employee current_employee = context.Employees.Find(employee.Id);
                if (employee != null && (bool)employee.Active) // BKP fix should not be nullable
                {
                    int count = context.Employees.
                                Where(m => m.UserName == employee.UserName && m.Id != employee.Id).
                                Count();

                    if (count == 0)
                    {
                        employee.UpdatedDt = System.DateTime.Now;
                        context.Entry(current_employee).CurrentValues.SetValues(employee);
                        context.SaveChanges();
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #5
0
 public LookUpRepository(VIMSDBContext context)
 {
     this.context = context;
 }
Пример #6
0
 public EmployeeRepository(VIMSDBContext vimsDBContext)
 {
     this.vimsDBContext = vimsDBContext;
 }
Пример #7
0
 public OrganizationRepository(VIMSDBContext context) : base(context)
 {
 }
 public LookUpRepository(VIMSDBContext vimsDBContext)
 {
     this.vimsDBContext = vimsDBContext;
 }
Пример #9
0
 public LocationRepository(VIMSDBContext context) : base(context)
 {
 }
Пример #10
0
 public Repository(VIMSDBContext context)
 {
     this.context = context;
     entities     = context.Set <TEntity>();
 }
 public VolunteerInfoRepository(VIMSDBContext vimsDBContext)
 {
     this.vimsDBContext = vimsDBContext;
 }
Пример #12
0
 public EmployeeRepository(VIMSDBContext context) : base(context)
 {
 }
Пример #13
0
 public VolunteerInfoRepository(VIMSDBContext context) : base(context)
 {
 }