Beispiel #1
0
 public static Event SalectEventByUserId(int u_id)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Event.FirstOrDefault(e => e.user_id == u_id));
     }
 }
Beispiel #2
0
 public static List <Guest> SelectGuestsByCatagory(string category)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Guest.Where(e => e.Guest_catagory.guest_catagory_des == category).ToList());
     }
 }
Beispiel #3
0
 public static Event SalectEvent(int code)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Event.FirstOrDefault(e => e.event_id == code));
     }
 }
Beispiel #4
0
 public static int GetHID()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Guest.Max(e => e.guest_id));
     }
 }
Beispiel #5
0
        //public static int UpdateEvent(Event event)
        //{
        //    try
        //    {
        //        using (YourPlaceEntities db = new YourPlaceEntities())
        //        {
        //            var q1=db.Event.FirstOrDefault(e => e.event_code==event.event_code);
        //            if (q1 == null)
        //                return 0;
        //            else
        //            {
        //                //עדכן
        //                ////ctx.Workers.Attach(worker);
        //                // ctx.Entry(worker).State = EntityState.Modified;

        //                q1.event_code = event.event_code;

        //                //שמור שינוי
        //                return db.SaveChanges();

        //            }
        //        }
        //    }
        //    catch
        //    {
        //        throw;
        //    }
        //}

//    public static int AddEvent(Event event)
//    {
//      try
//      {
//        using (YourPlaceEntities db = new YourPlaceEntities())
//        {
//          var q1 = db.Event.Add(event);
//    //שמור שינוי
//    db.SaveChanges();
//          return 1;//יתכן שנשקול להוסיף את המספור האוטמטי החדש

//        }
//}
//      catch
//{
//  throw;
//}
//    }
        public static int DeleteEvent(int code)
        {
            try
            {
                using (YourPlaceEntities db = new YourPlaceEntities())
                {
                    var q1 = db.Event.FirstOrDefault(e => e.event_id == code);
                    if (q1 == null)
                    {
                        return(0);
                    }
                    else
                    {
                        //מחק
                        db.Event.Remove(q1);
                        //שמור שינוי
                        db.SaveChanges();
                        //החזר 1
                        return(1);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Beispiel #6
0
 public static Users SalectUser(string mail)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Users.FirstOrDefault(u => u.user_email == mail));
     }
 }
Beispiel #7
0
 public static int GetHID()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.guest_table_member.Max(e => e.table_members_id));
     }
 }
Beispiel #8
0
 public static List <Guest> SelectGuestsById(int id)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Guest.Where(e => e.guest_id == id).ToList());
     }
 }
Beispiel #9
0
 public static List <Guest> GetAllGuestByEventId(int eventId)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Guest.Where(e => e.event_id == eventId).ToList());
     }
 }
Beispiel #10
0
 public static string SelectCategoryById(int g_id)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(GetCategoryByCId((int)db.Guest.FirstOrDefault(e => e.guest_id == g_id).guest_catagory_id));
     }
 }
Beispiel #11
0
 public static string GetCategoryByCId(int c_id)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Guest_catagory.FirstOrDefault(e => e.guest_catagory_id == c_id).guest_catagory_des);
     }
 }
Beispiel #12
0
 public static List <Event> SelectEvents()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Event.ToList());
     }
 }
Beispiel #13
0
        public static string GetInvatation(int id)
        {
            try
            {
                using (YourPlaceEntities db = new YourPlaceEntities())
                {
                    Event event1 = db.Event.FirstOrDefault(e => e.event_id == id);

                    return((string)event1.invitation_file);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            //using (YourPlaceEntities db = new YourPlaceEntities())
            //{
            //  string invatation = null;

            //  string query = @"SELECT e.invitation_file FROM Event e  where e.event_id=" + id + ";";
            //  SqlCommand cmd = new SqlCommand(query);
            //  SqlDataReader dr = cmd.ExecuteReader();

            //  if (dr.HasRows)
            //    while (dr.Read())
            //      invatation = dr.GetString(0);
            //  else
            //    Console.WriteLine("No data found.");

            //  return invatation;
            //}
        }
Beispiel #14
0
 public static int UpdateEvent(Event event1)
 {
     //אמור להיות update
     try
     {
         using (YourPlaceEntities db = new YourPlaceEntities())
         {
             var ev = db.Event.FirstOrDefault(e => e.event_id == event1.event_id);
             //שמור שינוי
             ev.invitation_file           = event1.invitation_file;
             ev.event_type_id             = event1.event_type_id;
             ev.event_date                = event1.event_date;
             ev.event_des                 = event1.event_des;
             ev.user_id                   = event1.user_id;
             ev.due_date                  = event1.due_date;
             ev.num_places_around_a_table = event1.num_places_around_a_table;
             ev.num_tables                = event1.num_tables;
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #15
0
 public static int DeleteGuest(Guest guest)
 {
     try
     {
         using (YourPlaceEntities db = new YourPlaceEntities())
         {
             //אמור למחוק את האורח שקיבל
             var q1 = db.Guest.FirstOrDefault();
             if (q1 == null)
             {
                 return(0);
             }
             else
             {
                 //מחק
                 db.Guest.Remove(q1);
                 //שמור שינוי
                 db.SaveChanges();
                 //החזר 1
                 return(1);
             }
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #16
0
 public static int GetHID()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         return(db.Users.Max(e => e.user_id));
     }
 }
Beispiel #17
0
 public static int GetNumOfSeatsAroundTable()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         var o = db.Event.FirstOrDefault();
         return((int)o.num_places_around_a_table);
     }
 }
Beispiel #18
0
        public static List <Guest> GetAllGuestNotConfirmed()
        {
            using (YourPlaceEntities db = new YourPlaceEntities())
            {
//אמור להיות כל מי שלא אישר השתתפות
                return(db.Guest.Where(e => e.gender == "male").ToList());
            }
        }
Beispiel #19
0
 public static List <Guest> GetAllGuestConfirmed()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         //tnur kvhu, to thar va,,pu,
         return(db.Guest.Where(e => e.gender == "female").ToList());
     }
 }
Beispiel #20
0
 public static List <EventType> SelectEventType()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         List <EventType> f = db.EventType.ToList();
         return(f);
     }
 }
Beispiel #21
0
 public static int SelectNumOfGuestsByCatagory(int category)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         List <Guest> L = new List <Guest>();
         L = db.Guest.Where(e => e.Guest_catagory.guest_catagory_id == category).ToList();
         return(L.Count());
     }
 }
Beispiel #22
0
 public static List <Users> SelectUsers()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         //Context.Connection.Open();
         // Content.Connection.Open();
         return(db.Users.ToList());
     }
 }
Beispiel #23
0
 public static List <Guest> SelectGuests()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         //לא נראה לי צריך שורות אלו
         //Context.Connection.Open();
         //Content.Connection.Open();
         return(db.Guest.ToList());
     }
 }
Beispiel #24
0
 public static List <Guest_catagory> SelectCatagoryList()
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         //List<EventType> f = new List<EventType>();
         //f.Add();
         List <Guest_catagory> f = db.Guest_catagory.ToList();
         return(f);
     }
 }
Beispiel #25
0
        public static List <Event> SelectEvents()
        {
            using (YourPlaceEntities db = new YourPlaceEntities())
            {
                //Context.Connection.Open();
                //Content.Connection.Open();

                return(db.Event.ToList());
            }
        }
Beispiel #26
0
 public static bool SalectUser(string mail, string password)
 {
     using (YourPlaceEntities db = new YourPlaceEntities())
     {
         Users q1 = db.Users.FirstOrDefault(u => u.user_email == mail & u.user_password == password);
         if (q1 != null)
         {
             return(true);
         }
         return(false);
     }
 }
Beispiel #27
0
 public static int GetGuest1priority(int guest_id)
 {
     try
     {
         using (YourPlaceEntities db = new YourPlaceEntities())
         {
             guest_table_member tm1 = db.guest_table_member.FirstOrDefault(u => u.guest_id == guest_id & u.guestPriority == 1);
             return((int)tm1.friend_id);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #28
0
 public static int GetPriorityByFriend(int id, int f_id)
 {
     try
     {
         using (YourPlaceEntities db = new YourPlaceEntities())
         {
             guest_table_member tm = db.guest_table_member.Where(e => e.guest_id == id & e.friend_id == f_id).FirstOrDefault();
             return((int)tm.guestPriority);
         }
     }
     catch
     {
         return(0);
     }
 }
Beispiel #29
0
 public static int GetPriority()
 {
     try
     {
         using (YourPlaceEntities db = new YourPlaceEntities())
         {
             var o = db.guest_table_member.FirstOrDefault();
             return((int)o.guestPriority);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #30
0
 public static bool GetstatusOfFById(int id, int f_id)
 {
     try
     {
         using (YourPlaceEntities db = new YourPlaceEntities())
         {
             var o = db.guest_table_member.Where(e => e.guest_id == id & e.friend_id == f_id).FirstOrDefault();
             return((bool)o.like_or_not);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }