private void InitMenuButtons()
        {
            tlpButtons = new TableLayoutPanel();
            pnlButtonPlace.Controls.Add(tlpButtons);
            tlpButtons.BringToFront();
            tlpButtons.Dock = DockStyle.Fill;
            tlpButtons.GrowStyle = TableLayoutPanelGrowStyle.AddRows;

            tlpButtons.RowCount = cl.lCIKKCSOPORT.Count + 1;

            int j = 0;
            for (int i = CikkCsopScrollPos; i < (cl.lCIKKCSOPORT.Count); i++)
            {
                if (j < needScroll)
                {
                    CikkcsopButton bt = new CikkcsopButton(cl.lCIKKCSOPORT[i]);
                    bt.Location = new Point(0, 0);
                    bt.Text = cl.lCIKKCSOPORT[i].NEV;
                    bt.TextAlign = ContentAlignment.BottomLeft;
                    bt.Dock = DockStyle.Fill;

                    bt.BackColor = Color.Transparent;
                    bt.Click += CikkcsopMenuClick;
                    //bt.ImageList = btmImgList;

                    bt.BackgroundImageLayout = ImageLayout.Stretch;

                    //bt.ImageIndex = 0;
                    tlpButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(SizeType.Absolute, CCSOP_BTN_SIZE));
                    tlpButtons.Controls.Add(bt);
                    //bt.Invalidate();
                }
                j++;
            }
            //tlpButtons.AutoScroll = true;
            tlpButtons.Refresh();
        }
Beispiel #2
0
        //========================================================================================
        /// <summary>
        /// Createa and populates the table in the xml editor.
        /// </summary>
        /// <param name="obj"> Object the editor is editing </param>
        //========================================================================================
        private static void CreateEditorTable( XmlObject obj )
        {
            // Read the xml properties of the object:

            XmlObjectData xml_data = ReadXml(obj);

            // Get the xml fields:

            LinkedList<string> xml_fields = xml_data.GetFields();

            // Make the table

            s_table = new TableLayoutPanel(); s_table.Parent = s_form;

            s_table.Top = 60;

            // Create the arrays of fields and values:

            s_fields = new TextBox[xml_fields.Count];
            s_values = new TextBox[xml_fields.Count];

            // Set number of rows and columns in table:

            s_table.ColumnCount     = 2;
            s_table.RowCount        = xml_fields.Count;
            s_table.Width           = 600;
            s_table.Height          = 5000;

            // Refresh

            s_table.Refresh();

            // Populate the rows and columns:

            int row_num = 0;

            foreach ( string field in xml_fields )
            {
                // Make a text box control:

                TextBox text_box1 = new TextBox(); text_box1.Text = field;

                text_box1.Width     = 200;
                text_box1.Enabled   = false;

                // Add this field into the table and array:

                s_table.Controls.Add( text_box1 , 0 , row_num );
                s_fields[row_num] = text_box1;

                // Create a text box control:

                TextBox text_box2 = new TextBox();

                text_box2.Width = 400;

                // Set the text box's value:

                string field_value = ""; xml_data.ReadString( field, ref field_value );

                text_box2.Text = field_value;

                // Add the text box into the table and array:

                s_table.Controls.Add( text_box2 , 1 , row_num );
                s_values[row_num] = text_box2;

                // Increment the row number:

                row_num++;
            }
        }
        private void CikkcsopMenuClick(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                if (AktSzerkesztettCikk != null)
                {
                    checkBox1.Text = ((CikkcsopButton)sender)._Cikkcsoport.NEV;
                    AktSzerkesztettCikk.CIKKCSOPORT_ID = ((CikkcsopButton)sender)._Cikkcsoport.ID;
                    AktSzerkesztettCikk.Save();
                }
                AktSzerkesztettCikk = new Cikk(AktSzerkesztettCikk.CIKK_ID, true);
                checkBox1.Checked = false;
                ((CikkcsopButton)sender).Checked = false;
                lblCikkcsopSelectInfo.Visible = false;
            }
            else
            {
                if (reset_scrolls)
                {
                    AlCsopScrollPos = 0;
                }

                LastCikkcsopMenu = sender;
                LastOtherFilterMenu = null;

                OTF_list otf = new OTF_list(((CikkcsopButton)sender)._Cikkcsoport.ID, new SqlConnection(DEFS.ConSTR));
                Alcsop_MaxScroll = otf.lOTF.Count;
                if (otf.lOTF.Count > 0)
                {
                    pnlOtherFilter.Visible = true;

                    TableLayoutPanel tlpOTFButtons = new TableLayoutPanel();

                    pnlOtherFilter.Controls.Add(tlpOTFButtons);
                    tlpOTFButtons.Dock = DockStyle.Fill;
                    tlpOTFButtons.BringToFront();
                    tlpOTFButtons.GrowStyle = TableLayoutPanelGrowStyle.AddColumns;

                    tlpOTFButtons.ColumnCount = otf.lOTF.Count + 1;
                    tlpOTFButtons.RowCount = 1;

                    for (int i = AlCsopScrollPos; i < (otf.lOTF.Count); i++)
                    {

                        OtherFButton bt = new OtherFButton(otf.lOTF[i]);
                        bt.Location = new Point(0, 0);
                        bt.Text = otf.lOTF[i].ONEV;
                        bt.TextAlign = ContentAlignment.TopCenter;
                        bt.Dock = DockStyle.Fill;
                        bt.Click += AlcsopMenuClick;

                        tlpOTFButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.Absolute, 120));
                        tlpOTFButtons.Controls.Add(bt);
                    }
                    tlpOTFButtons.Refresh();
                }
                else { pnlOtherFilter.Visible = false;/* pnlOldalsav.Visible = false;*/ }

                if (pnlOtherFilter.Visible)
                {
                    //pnlOldalsav.Visible = true;
                    //pnlOldalsav.Height = ((CikkcsopButton)sender).Parent.Parent.Location.Y + ((CikkcsopButton)sender).Location.Y + ((CikkcsopButton)sender).Height - pnlOtherFilter.Height;
                }
                ((CikkcsopButton)sender).Refresh();
                loadCikkek(((CikkcsopButton)sender)._Cikkcsoport.ID, -1, null);
                //if (Call) { loadCikkek(((CikkcsopButton)sender)._Cikkcsoport.fCIKKCSOPORT_ID, -1); }

                Alcsop_needScroll = pnlOtherFilter.Width / 120;
            }
        }
Beispiel #4
0
        public static void RunVerify(string domainCode, string yearTermCode, TableLayoutPanel tablePanel, ProgressBar progressBar)
        {
            // Prep report factory for correct student totals.
            ReportFactory factory = new ReportFactory();
            factory.GetTotalStudentCount(yearTermCode, ref _sqlConn);

            // Delete current contents.
            tablePanel.Invoke(new MethodInvoker(delegate
            {
                tablePanel.Controls.Clear();
                tablePanel.RowStyles.Clear();
            }));

            // Grab reports listing.
            string sqlCmdStr = "SELECT * FROM [" + WorkingDB + "].[barobba].[" +
                ReportTable + "] WHERE [Domain] = '" + domainCode + "';";
            SqlCommand sqlCmd = new SqlCommand(sqlCmdStr);
            sqlCmd.Connection = _sqlConn;

            List<Dictionary<string, string>> reportItems = new List<Dictionary<string,string>>();

            SqlDataReader reader = sqlCmd.ExecuteReader();
            while (reader.Read())
            {
                Dictionary<string, string> report = new Dictionary<string, string>(6);

                if (report != null)
                {
                    report.Add("Type", reader["Type"].ToString());
                    report.Add("Command", reader["Command"].ToString());
                    report.Add("Title", reader["Title"].ToString());
                    report.Add("Library", reader["Library"].ToString());
                    report.Add("Item", reader["Item"].ToString());
                    report.Add("Other", reader["Other"].ToString());

                    reportItems.Add(report);
                }
                else
                {
                    MessageBox.Show("Failure executing query for " + domainCode + " item " + reader["Item"].ToString() + ". Please contact technical support.", "Failure Running Report", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            reader.Close();

            progressBar.Invoke(new MethodInvoker(delegate { progressBar.Value = 10; }));

            int row = 0;
            if (reportItems.Count > 0)
            {
                foreach (Dictionary<string, string> report in reportItems)
                {
                    ITableLayoutRowItem rowItem = factory.NewReport(yearTermCode, report, ref _sqlConn);

                    tablePanel.Invoke(new MethodInvoker(delegate
                    {
                        tablePanel.RowStyles.Add(new RowStyle(SizeType.Absolute, TableLayoutRowHeight));
                        tablePanel.Controls.Add(rowItem.ControlAt(0), 0, row);
                        tablePanel.Controls.Add(rowItem.ControlAt(1), 1, row);
                        tablePanel.Controls.Add(rowItem.ControlAt(2), 2, row);
                        tablePanel.Controls.Add(rowItem.ControlAt(3), 3, row);
                    }));
                    row++;

                    progressBar.Invoke(new MethodInvoker(delegate { progressBar.Value = 10 + ((90 / reportItems.Count) * row); }));
                }
            }
            else
            {
                MessageBox.Show("No " + domainCode + " verification reports were found or processed in database. Please contact technical support for more information.", "No Available Reports", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            // Add bottom spacer and set final layout.
            tablePanel.Invoke(new MethodInvoker(delegate
            {
                tablePanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                tablePanel.RowCount = ++row;
                tablePanel.PerformLayout();
                tablePanel.VerticalScroll.Enabled = true;
                tablePanel.VerticalScroll.Visible = true;
                tablePanel.HorizontalScroll.Enabled = false;
                tablePanel.HorizontalScroll.Visible = false;
                tablePanel.Refresh();
            }));
        }