예제 #1
0
        public void startComponents()
        {
            int XLoc   = 20;
            int YLoc   = btnAddJob.Location.Y + 60;
            int Width  = this.Size.Width - 60;
            int Height = 200;

            clearDataGridControls();
            setControlState();

            if (Backend.bFileLoaded)
            {
                FlowLayoutPanel DGVContain = new FlowLayoutPanel();
                DGVContain.Size                   = new Size(Width, this.Size.Height);
                DGVContain.Location               = new Point(XLoc, YLoc);
                DGVContain.MaximumSize            = DGVContain.Size;
                DGVContain.AutoScroll             = true;
                DGVContain.AutoSize               = true;
                DGVContain.VerticalScroll.Visible = true;
                DGVContain.Anchor                 = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom);

                DGVContain.Name = "ContainerforDGV";
                foreach (Categories c in Backend.lsCategories)
                {
                    DataTable table = new DataTable("Jobs");
                    table.Columns.Add("Job ID");
                    table.Columns.Add("Job Name");
                    table.Columns.Add("Job Desc");
                    table.Columns.Add("Job Type");
                    table.Columns.Add("Attachment");
                    Label tableHead = new Label();
                    tableHead.Text      = c.getCategoryName();
                    tableHead.Location  = new Point(XLoc, YLoc);
                    tableHead.Size      = new Size(DGVContain.Size.Width - 20, 20);
                    tableHead.TextAlign = ContentAlignment.MiddleCenter;
                    YLoc = YLoc + 30;
                    DataGridView Cate = new DataGridView();
                    Backend.SetDGV(Cate, c.getCategoryName() + c.getCategoryID().ToString(), c.getColor(), new Point(XLoc, YLoc), new Size(DGVContain.Size.Width - 20, Height));
                    Cate.CellDoubleClick += new DataGridViewCellEventHandler(this.Grid_MouseDoubleClick);

                    foreach (JobType JT in Backend.lsJobTypes)
                    {
                        if (JT.getJobTypeCate() == c)
                        {
                            foreach (Job J in Backend.lsJobs)
                            {
                                if (J.GetJobType() == JT)
                                {
                                    table.Rows.Add(J.getJobID(), J.getJobName(), J.getJobDesc(),
                                                   J.GetJobType().getJobTypeName(), J.getAttachment());
                                }
                            }
                        }
                    }

                    Cate.DataSource = table;
                    DGVContain.Controls.Add(tableHead);
                    DGVContain.Controls.Add(Cate);

                    YLoc = YLoc + Height + 20;
                }
                this.Controls.Add(DGVContain);
            }
        }
예제 #2
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Backend.Save();
 }