예제 #1
0
 public ExportData(Events evnt, EventDay[] days, Task[] tasks, FacilityBookingConfirmed[][] facilities, Program[][] programs, Guest[][] guests, Participant[] participants
     , OptimizedBudgetItems optitems, BudgetIncome[] budgetincomes, Field[] field)
 {
     this.evnts = evnt;
     this.days = days;
     this.tasks = tasks;
     this.facilities = facilities;
     this.programs = programs;
     this.guests = guests;
     this.participants = participants;
     this.optitems = optitems;
     this.budgetincomes = budgetincomes;
     this.field = field;
 }
예제 #2
0
        public override bool saveChanges()
        {
            if (txtName.Text.Trim() == "")
            {
                MessageBox.Show("Please enter guest's name.");
                return false;
            }
            try
            {
                GuestHelper client = new GuestHelper();
                if (selectedIndex == -1)
                {
                    Guest g = new Guest();
                    g.Name = txtName.Text;
                    g.Description = txtDescription.Text;
                    g.Contact = txtContact.Text;
                    g.GuestId = client.AddGuest(user, eventDay_.DayID, g.Name, g.Contact, g.Description);
                    guestList.Add(g);
                    CollectionViewSource.GetDefaultView(lstGuestList.ItemsSource).Refresh();
                    clearAll();
                }
                else
                {
                    Guest g = guestList[selectedIndex];
                    g.Name = txtName.Text;
                    g.Description = txtDescription.Text;
                    g.Contact = txtContact.Text;
                    client.EditGuest(user, g.GuestId, g.Name, g.Description, g.Contact);
                    guestList[selectedIndex] = g;
                    CollectionViewSource.GetDefaultView(lstGuestList.ItemsSource).Refresh();
                    changed = false;
                    clearAll();
                }
                client.Close();

                MessageBox.Show("Operation succeeded!");
                return true;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
        }
예제 #3
0
        public static void AddGuest(int dayID, string GuestName, string GuestContact, string GuestDescription, DAL dalDataContext)
        {
            try
            {

                Table<Guest> guests = dalDataContext.guests;
                Guest creatingguest = new Guest(GuestName, GuestContact, GuestDescription, dayID);

                guests.InsertOnSubmit(creatingguest);
                guests.Context.SubmitChanges();

            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Guest, Please Try Again!"));
            }
        }
예제 #4
0
        public static int AddGuest(User user, int dayID, string GuestName, string GuestContact, string GuestDescription)
        {
            if (!user.isAuthorized(EventController.GetEvent(DayController.GetDay(dayID).EventID), EnumFunctions.Add_Guest))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Add Guests!"));
            try
            {
                DAL dalDataContext = new DAL();
                Table<Guest> guests = dalDataContext.guests;
                Guest creatingguest = new Guest(GuestName, GuestContact, GuestDescription, dayID);

                guests.InsertOnSubmit(creatingguest);
                guests.Context.SubmitChanges();

                return creatingguest.GuestId;
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Guest, Please Try Again!"));
            }
        }
예제 #5
0
        public static int GetEventID(Guest g)
        {
            try
            {
                DAL dalDataContext = new DAL();

                EventDay matchday = (from day in dalDataContext.days
                                where day.DayID == g.DayID
                                select day).FirstOrDefault();
                if (matchday == null)
                {
                    throw new Exception("day doesnt not exist");
                }
                return matchday.EventID;
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(ex.Message),
                   new FaultReason("An Error occured While getting event, Please Try Again!"));
            }
        }
예제 #6
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                MessageBox.Show("Please enter guest's name.");
                return;
            }
            try
            {
                //GuestHelper client = new GuestHelper();

                // adds guest info to listview and clear all info in textboxes
                if (lstGuestList.SelectedIndex == -1)
                {
                    Guest g = new Guest();
                    g.Name = txtName.Text;
                    g.Contact = txtContact.Text;
                    g.Description = txtDescription.Text;
                    //g.GuestId = client.AddGuest(user, eventDay_.DayID, g.Name, g.Contact, g.Description);
                    //guestList.Add(g);
                    //CollectionViewSource.GetDefaultView(lstGuestList.ItemsSource).Refresh();
                    lstGuestList.Items.Add(g);

                    guests[cboDay.SelectedIndex].Add(g);
                    //List<Guest> guestList = new List<Guest>();
                    //guestList.Add(g);

                        //for (int i = 0; i < guests.Count(); i++)
                        //{
                        //    List<Guest> guest = guests[i];
                        //    //List<Guest> guest;
                        //    guest.Add(g);
                        //    guests.Add(guest);

                    //guests.Add(guestList);
                    //guests.Add(
                    clearAll();
                }
                else
                {
                    Guest g = (Guest)lstGuestList.SelectedItem;
                    g.Name = txtName.Text;
                    g.Description = txtDescription.Text;
                    g.Contact = txtContact.Text;
                    // to refresh the listview
                    lstGuestList.BeginInit();
                    lstGuestList.EndInit();

                    //client.EditGuest(user, g.GuestId, g.Name, g.Description, g.Contact);
                    //guestList[selectedIndex] = g;
                    //CollectionViewSource.GetDefaultView(lstGuestList.ItemsSource).Refresh();
                    //changed = false;
                }
                //client.Close();

                MessageBox.Show("Operation succeeded!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #7
0
        private void clone(List<List<Guest>> g1, List<List<Guest>> g2)
        {
            g2.Clear();

            for (int x = 0; x < g1.Count; x++)
            {

                List<Guest> lstguest = new List<Guest>();

                for (int y = 0; y < g1[x].Count; y++)
                {
                    Guest g = new Guest();

                    g.Description = g1[x][y].Description;
                    g.Name = g1[x][y].Name;
                    g.Contact = g1[x][y].Contact;

                    lstguest.Add(g);
                }

                g2.Add(lstguest);
            }
        }