示例#1
0
        private void EventTab_DragLeave(object sender, EventArgs e)
        {
            EventTab _destination = (EventTab)sender;

            _destination.Controls.Remove(dragPanel);
            dragController = true;
        }
示例#2
0
        private void TaskButton_Click(object sender, EventArgs e)
        {
            bool     activeForm = false;
            MainForm mainForm   = (MainForm)Application.OpenForms["MainForm"];

            foreach (TabControlPanelItem tabControlPanelItem in mainForm.TabControlPanel.Controls)
            {
                if (tabControlPanelItem.TabButton.Text == this.Text)
                {
                    tabControlPanelItem.TabButton.HideForms();
                    tabControlPanelItem.BorderStyle = BorderStyle.Fixed3D;
                    tabControlPanelItem.Form.Show();
                    tabControlPanelItem.Form.Location = new Point(0, 0);
                    activeForm = true;
                    break;
                }
            }
            if (!activeForm)
            {
                EventTab eventTab = this.Parent as EventTab;
                TaskForm TaskForm = new TaskForm();
                TaskForm.task      = this.Task;
                TaskForm.projectID = eventTab.projectID;
                TaskForm.MdiParent = mainForm;
                TabControlPanelItem tabControlPanelItem = new TabControlPanelItem(this.Text);
                tabControlPanelItem.Form = TaskForm;
                mainForm.TabControlPanel.Controls.Add(tabControlPanelItem);
                mainForm.TabControlPanel.Controls.SetChildIndex(tabControlPanelItem, 0);
                TaskForm.Show();
            }
        }
示例#3
0
        public List <EventTab> GetList()
        {
            List <EventTab> eventTabs = new List <EventTab>();
            TaskClass       task      = new TaskClass();
            SqlCommand      cmd       = new SqlCommand("select * from eventTab where projectID=@projectID ORDER BY evenTabTableAddDate ASC", connection);

            cmd.Parameters.AddWithValue("@projectID", projectID);
            connection.Open();
            SqlDataReader sdr = cmd.ExecuteReader();

            while (sdr.Read())
            {
                EventTab eventTab = new EventTab(this.projectID);
                eventTab.ID    = (int)sdr["eventTabID"];
                eventTab.tasks = task.Get(eventTab.ID);
                foreach (TaskClass item in eventTab.tasks)
                {
                    eventTab.Controls.Add(item.TaskButton);
                    eventTab.Controls.SetChildIndex(eventTab.BtnEventAdd, eventTab.Controls.Count);
                    eventTab.Height += item.TaskButton.Height + 6;
                }
                eventTab.TopPanel.TbTitle.Text = sdr["eventTabTitle"].ToString();
                eventTabs.Add(eventTab);
            }
            connection.Close();
            return(eventTabs);
        }
示例#4
0
 private void btnListAdd_Click(object sender, EventArgs e)
 {
     eventTab = new EventTab(Project.ID);
     eventTab.Save();
     Project.eventTabs.Add(eventTab);
     SortList();
 }
示例#5
0
        private void ListDeleteButton_Click(object sender, EventArgs e)
        {
            EventTab   eventTab = (EventTab)this.Parent.Parent;
            SqlCommand cmd      = new SqlCommand("delete from eventTab where eventTabID=@ID", connection);

            cmd.Parameters.AddWithValue("@ID", eventTab.ID);
            connection.Open();
            cmd.ExecuteNonQuery();
            connection.Close();
            cmd = new SqlCommand("delete from task where eventTabID=@ID", connection);
            cmd.Parameters.AddWithValue("@ID", eventTab.ID);
            connection.Open();
            cmd.ExecuteNonQuery();
            connection.Close();
            eventTab.Parent.Controls.Remove(eventTab);

            MainForm mainForm = Application.OpenForms["MainForm"] as MainForm;

            foreach (TaskClass task in eventTab.tasks)
            {
                foreach (TabControlPanelItem item in mainForm.TabControlPanel.Controls)
                {
                    if (item.Form.Name == task.ID.ToString())
                    {
                        item.CloseButton.close();
                    }
                }
            }
        }
示例#6
0
 private void ProjectView_Load(object sender, EventArgs e)
 {
     this.Location     = new Point(0, 0);
     this.Size         = new Size(this.Parent.Width - 6, this.Parent.Height - 6);
     Project.eventTabs = new List <EventTab>();
     eventTab          = new EventTab(Project.ID);
     Project.eventTabs = eventTab.GetList();
     SortList();
 }
示例#7
0
 private void TaskButton_ParentChanged(object sender, EventArgs e)
 {
     if (this.Parent != null)
     {
         EventTab eventTab = this.Parent as EventTab;
         if (eventTab.ID != Task.EventTabID)
         {
             Task.EventTabID = eventTab.ID;
             Task.UpdateParent();
         }
     }
 }
示例#8
0
        private void ProjectView_ControlRemoved(object sender, ControlEventArgs e)
        {
            EventTab _eventTab = (EventTab)e.Control;

            Project.eventTabs.Remove(_eventTab);
            if (Project.eventTabs.Count <= 4)
            {
                btnListAdd.Visible  = true;
                btnListAdd.Location = new Point(btnListAdd.Location.X - (btnListAdd.Width + 6), btnListAdd.Location.Y);
            }
            SortList();
        }
示例#9
0
        private void EventTab_DragOver(object sender, DragEventArgs e)
        {
            EventTab _destination = (EventTab)sender;

            if (dragController)
            {
                _destination.Height += 45;
                dragPanel            = new Panel();
                dragPanel.Size       = new Size(240, 40);
                dragPanel.BackColor  = Color.Teal;
                _destination.Controls.Add(dragPanel);
                _destination.Controls.SetChildIndex(dragPanel, _destination.Controls.Count - 2);
                dragController = false;
            }
        }
示例#10
0
        private void TaskAddButton_Click(object sender, EventArgs e)
        {
            EventTab  eventTab = (EventTab)this.Parent;
            TaskClass task     = new TaskClass();

            task.EventTabID = eventTab.ID;
            task.Add();
            eventTab.tasks.Add(task);
            eventTab.Controls.Add(task.TaskButton);
            eventTab.Controls.SetChildIndex(this, eventTab.tasks.Count + 1);

            if ((eventTab.Height + task.TaskButton.Height + 6 + this.Height) < eventTab.Parent.Height)
            {
                eventTab.Size = new Size(eventTab.Width, eventTab.Height + task.TaskButton.Height + 6);
            }
        }
示例#11
0
        private void EventTab_DragDrop(object sender, DragEventArgs e)
        {
            TaskButton selectedButton = (TaskButton)e.Data.GetData(typeof(TaskButton));
            EventTab   _destination   = (EventTab)sender;
            EventTab   _source        = (EventTab)selectedButton.Parent;

            if (_source != _destination)
            {
                _destination.Controls.Add(selectedButton);
                _destination.tasks.Add(selectedButton.Task);
                _destination.Height += 45;
                int index = _destination.Controls.Count;
                _destination.Controls.SetChildIndex(selectedButton, index - 2);
                _destination.Invalidate();
                _source.Invalidate();
                dragController = true;
            }
            else
            {
                dragController = true;
            }
            _destination.Controls.Remove(dragPanel);
        }