Exemplo n.º 1
0
        private void btnAdEvent_Click_1(object sender, EventArgs e)
        {
            Boolean             evetCreaete = true;
            EventModel          eventModel  = null;
            EventcreateFormView eventView   = new EventcreateFormView(loggedInUser, evetCreaete, eventModel);

            this.Hide();
            eventView.ShowDialog();
            this.Close();
        }
        private void button_action_edit_event(object sender, EventArgs e)
        {
            if (sender is Button)
            {
                Button temp = (Button)sender;
                // FlowLayoutPanel flowLayout = (FlowLayoutPanel)temp.Parent;
                TableLayoutPanel tableLayoutPanel = (TableLayoutPanel)temp.Parent;
                //   MessageBox.Show(sender.ToString());
                //TableLayoutPanel tableLayoutPanel1 = (TableLayoutPanel)tableLayoutPanel.Parent;

                EventDisplayController eventDisplayController = (EventDisplayController)tableLayoutPanel.Parent;

                string description = eventDisplayController.description;
                string title       = eventDisplayController.title;
                string location    = eventDisplayController.location;
                // Int32 contactNumber = Convert.ToInt32(m.ContactNumber);
                string eventVareity = eventDisplayController.EventVareity;


                DateTime startingTime = DateTime.Parse(eventDisplayController.startingTime);
                DateTime EndingTime   = DateTime.Parse(eventDisplayController.EndingTime);

                int eventId = Convert.ToInt32(eventDisplayController.id);

                int userId     = loggedInUser.Id;
                int recureType = 0;

                if (eventDisplayController.recurType == "Daily")
                {
                    recureType = 2;
                }
                else if (eventDisplayController.recurType == "weekly")
                {
                    recureType = 3;
                }
                else if (eventDisplayController.recurType == "Once")
                {
                    recureType = 1;
                }

                //edit recuring events
                // if(re)

                //MessageBox.Show(name + email + mobileNo);
                if (MessageBox.Show("Do you wish to edit Event ", "Edit Event",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                {
                    EventModel eventModel = new EventModel();

                    eventModel.Event_title            = title;
                    eventModel.Event_description      = description;
                    eventModel.Event_begin_time       = startingTime;
                    eventModel.Event_end_time         = EndingTime;
                    eventModel.Event_location         = location;
                    eventModel.Event_variety          = eventVareity;
                    eventModel.Event_recuring_variety = recureType;

                    eventModel.UserId   = userId;
                    eventModel.Event_id = eventId;

                    Boolean create = false;

                    EventcreateFormView eventView = new EventcreateFormView(loggedInUser, create, eventModel);
                    this.Hide();
                    eventView.ShowDialog();
                    this.Close();
                }
            }
        }