Пример #1
0
 public static List <GetRequestByDay_Result> GetRequestByDay(long DayId)
 {
     using (var db = new EZER_LAYOLEDETEntities())
     {
         return(db.GetRequestByDay(DayId).ToList());
     }
 }
Пример #2
0
 public static List <Users> selectUser()
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         return(db.Users.ToList());
     }
 }
Пример #3
0
 public static List <VolunteerApproval_Result> VolunteerApproval(long ServiceManagmentId, long VolunteerId)
 {
     using (var db = new EZER_LAYOLEDETEntities())
     {
         return(db.VolunteerApproval(ServiceManagmentId, VolunteerId).ToList());
     }
 }
Пример #4
0
 public static int GetNumOfMothers()
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         return(db.Mother.Count());
     }
 }
Пример #5
0
 public static List <selectMotherByServiceAndDay_Result> selectMotherByServiceAndDay(long VolunteerId)
 {
     using (var db = new EZER_LAYOLEDETEntities())
     {
         return(db.selectMotherByServiceAndDay(VolunteerId).ToList());
     }
 }
Пример #6
0
 public static List <Birth> CheckTimeOfBirth()
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         return(db.Birth.ToList());
     }
 }
 public static List <GetRequestByService_Result> GetByService(long ServiceId)
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         return(db.GetRequestByService(ServiceId).ToList());
     }
 }
 public static List <AllRequest_Result> GetAllReques()
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         return(db.AllRequest().ToList());
     }
 }
Пример #9
0
 public static Users selectUserById(long id)
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         return(db.Users.FirstOrDefault(w => w.UserId == id));
     }
 }
Пример #10
0
 public static List <SelectVolunteerByServiceNew_Result> SelectByService(long VolunteerId)
 {
     using (var db = new EZER_LAYOLEDETEntities())
     {
         return(db.SelectVolunteerByServiceNew(VolunteerId).ToList());
     }
 }
Пример #11
0
 public static string GetDay(int id)
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         var d = db.Days.FirstOrDefault(w => w.DayId == id);
         return(d.Describe);
     }
 }
Пример #12
0
 public static int GetStatusRequest(long ServiceManagmentId)
 {
     using (var db = new EZER_LAYOLEDETEntities())
     {
         var a = db.ServiceManagementToBirth.FirstOrDefault(w => w.ServiceManagementId == ServiceManagmentId);
         return(a.StatusRequest);
     }
 }
Пример #13
0
 public static void UpdateUsersActive(long MotherId)
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         var a = db.Users.FirstOrDefault(w => w.UserId == MotherId);
         a.Active = 0;
         db.SaveChanges();
     }
 }
        public static List <ServiceManagementToBirth> CheckActiveRequest(long BirthId)
        {
            using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
            {
                var selectByBirth =
                    from ServiceManagementToBirth in db.ServiceManagementToBirth

                    where ServiceManagementToBirth.BirthId == BirthId && ServiceManagementToBirth.StatusRequest == 1
                    select new { StatusRequest = ServiceManagementToBirth.StatusRequest };
                return((List <ServiceManagementToBirth>)selectByBirth);
            }
        }
Пример #15
0
 public static long PostServiceAndDayVolunteer(List <ServiceAndDaysToVolunteer> d)
 {
     using (var db = new EZER_LAYOLEDETEntities())
     {
         foreach (var item in d)
         {
             db.ServiceAndDaysToVolunteer.Add(item);
             db.SaveChanges();
             UserId = item.UserId;
         }
         return(UserId);
     }
 }
Пример #16
0
 public static long AddBirth(Birth birth)
 {
     try
     {
         using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
         {
             var newBirth = db.Birth.Add(birth);
             db.SaveChanges();
             return(newBirth.UserId);
         }
     }
     catch
     {
         throw;
     }
 }
 public static void AddServiceVolunteerToBirth(ServiceVolunteerToBirth s)
 {
     try
     {
         using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
         {
             var q1 = db.ServiceVolunteerToBirth.Add(s);
             db.SaveChanges();
             // return q1.MotherId;
         }
     }
     catch
     {
         throw;
     }
 }
Пример #18
0
 public static int UpdatePassword(Users u, string pass)
 {
     using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
     {
         var q2 = db.Users.FirstOrDefault(w => w.UserId == u.UserId);
         if (q2 == null)
         {
             return(0);
         }
         else
         {
             q2.Password = pass;
             return(db.SaveChanges());
         }
     }
 }
Пример #19
0
 public static int AddUser(Users u)
 {
     try
     {
         using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
         {
             var q1 = db.Users.Add(u);
             db.SaveChanges();
             return((int)q1.UserId);
         }
     }
     catch
     {
         throw;
     }
 }
Пример #20
0
        public static void ChangeUserActiveAndStatusRequest(long MotherId)
        {
            List <ServiceManagementToBirth> b = new List <ServiceManagementToBirth>();

            using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
            {
                var a = db.Users.FirstOrDefault(w => w.UserId == MotherId);
                a.Active = 0;
                var c = db.Birth.FirstOrDefault(w => w.UserId == MotherId);
                var e = c.BirthId;

                b = db.ServiceManagementToBirth.Where(w => w.BirthId == e).ToList();
                foreach (var item in b)
                {
                    item.StatusRequest = 0;
                }
            }
        }
Пример #21
0
        public static int UpdateUsers(Users u)
        {
            try
            {
                using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
                {
                    var q2 = db.Users.FirstOrDefault(w => w.UserId == u.UserId);
                    if (q2 == null)
                    {
                        return(0);
                    }
                    else
                    {
                        //  db.Users.Attach(u);
                        // db.Entry(u).State = EntityState.Modified;


                        q2.UserId = u.UserId;

                        q2.RoleId     = u.RoleId;
                        q2.FirstName  = u.FirstName;
                        q2.LastName   = u.LastName;
                        q2.Password   = u.Password;
                        q2.Email      = u.Email;
                        q2.Phone      = u.Phone;
                        q2.Address    = u.Address;
                        q2.NumOfHouse = u.NumOfHouse;
                        q2.Locality   = u.Locality;
                        q2.BirthDate  = u.BirthDate;
                        q2.Active     = u.Active;

                        return(db.SaveChanges());
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Пример #22
0
        public static long AddMother(Mother mother, Birth birth, Kosher kosher1 = null, Kosher kosher2 = null, Kosher kosher3 = null)
        {
            try
            {
                using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
                {
                    var user = db.Users.Add(mother.Users);
                    //var newKosher1 = db.Kosher.Add(kosher1);
                    //var newKosher2 = db.Kosher.Add(kosher2);
                    //var newKosher3 = db.Kosher.Add(kosher3);

                    var newMother = db.Mother.Add(mother);

                    //db.SaveChanges();
                    var newBirth = db.Birth.Add(birth);
                    newMother.Birth.Add(newBirth);


                    //newMother.Users = user;
                    //newMother.UserId = user.UserId;
                    //newMother.Kosher1 = newKosher1.KosherId;
                    //newMother.Kosher2 = newKosher2.KosherId;
                    //newMother.Kosher3 = newKosher3.KosherId;
                    //newMother.Kosher = newKosher1;
                    //newMother.Kosher4 = newKosher2;
                    //newMother.Kosher5 = newKosher3;


                    db.SaveChanges();

                    return(newMother.UserId);
                }
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
        }
Пример #23
0
        public static int AddVolunteer(Users userToAdd)
        {
            try
            {
                using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
                {
                    var user           = db.Users.Add(userToAdd);
                    var volunteerToAdd = new Volunteer
                    {
                        UserId = user.UserId
                    };
                    var volunteer = db.Volunteer.Add(volunteerToAdd);

                    //var Day = db.DaysToVolunteer.Add(v.DaysToVolunteer);
                    //var Service = db.ServiceToVolunteer.Add(v.ServiceToVolunteer);
                    db.SaveChanges();
                    return((int)user.UserId);
                }
            }
            catch
            {
                throw;
            }
        }
Пример #24
0
 public static int DeleteUser(int id)
 {
     try
     {
         using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
         {
             var q3 = db.Users.FirstOrDefault(w => w.UserId == id);
             if (q3 == null)
             {
                 return(0);
             }
             else
             {
                 db.Users.Remove(q3);
                 db.SaveChanges();
                 return(1);
             }
         }
     }
     catch
     {
         throw;
     }
 }
        public static int UpdateRequest(long ServiceManagmentId)
        {
            try
            {
                using (EZER_LAYOLEDETEntities db = new EZER_LAYOLEDETEntities())
                {
                    var q2 = db.ServiceManagementToBirth.FirstOrDefault(w => w.ServiceManagementId == ServiceManagmentId);
                    if (q2 == null)
                    {
                        return(0);
                    }
                    else
                    {
                        q2.StatusRequest = 0;

                        return(db.SaveChanges());
                    }
                }
            }
            catch
            {
                throw;
            }
        }