Esempio n. 1
0
        public ToolStripComboBox GetToolStripComboBoxMain(string nameMDI)
        {
            ToolStripComboBox cbo = null;

            foreach (Form f in Application.OpenForms)
            {
                if (f.Name == nameMDI)
                {
                    mdiMain md = (mdiMain)f;

                    foreach (Control c in f.Controls)
                    {
                        if (c is ToolStrip)
                        {
                            ToolStrip tool = (ToolStrip)c;

                            foreach (ToolStripItem tt in tool.Items)
                            {
                                if (tt is ToolStripComboBox)
                                {
                                    cbo = (ToolStripComboBox)tt;
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return(cbo);
        }
Esempio n. 2
0
        public frmWorkKeeper(mdiMain tMDI)
        {
            TopLevel = false;
            _mdiMain = tMDI;
            InitializeComponent();
            Dock = DockStyle.Fill;

            LableLoad();
            FormLoad();
            timer_load.Enabled = true;
            timer_load.Start();
        }
Esempio n. 3
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         con = new SqlConnection(_connectionString);
         con.Open();
         _cmd = new SqlCommand("select * from LoginUser  where username='******'and password='******'", con);
         _sda = new SqlDataAdapter(_cmd);
         DataTable dt = new DataTable();
         _sda.Fill(dt);
         if (dt.Rows.Count == 1)
         {
             int     role    = Convert.ToInt32(dt.Rows[0]["UserRole"]);
             mdiMain mdiform = new mdiMain(role);
             this.Hide();
             mdiform.ShowDialog();
             this.MakeEmpty();
             this.Show();
         }
         else
         if (dt.Rows.Count > 1)
         {
             MessageBox.Show("Username and password duplicate exist");
         }
         else
         {
             MessageBox.Show("Username or Password not Matched!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         con.Close();
     }
 }
Esempio n. 4
0
        public StatusStrip getStatusStripMain(string nameMDI)
        {
            StatusStrip status = null;

            foreach (Form f in Application.OpenForms)
            {
                if (f.Name == nameMDI)
                {
                    mdiMain md = (mdiMain)f;

                    foreach (Control c in f.Controls)
                    {
                        if (c is StatusStrip)
                        {
                            status = (StatusStrip)c;
                            break;
                        }
                    }
                }
            }

            return(status);
        }
Esempio n. 5
0
        /// <summary>
        /// ฟังก์ชั่นสำหรับเพิ่ม/ลดเมนูในแถบเมนูหน้าต่าง
        /// </summary>
        /// <param name="pMdiParent">หน้าจอหลัก</param>
        /// <param name="pChildName">ชื่อเมนู/ชื่อฟอร์ม</param>
        /// <param name="pChildText">Titleเมนู/Titleฟอร์ม</param>
        /// <param name="pIsAdd">เป็นารเพิ่มเมนู</param>
        public static void AddOrRemaveChildName(mdiMain pMdiParent, string pChildName, string pChildText, bool pIsAdd)
        {
            if (pIsAdd)
            {
                //bool isExists = false;
                //foreach (Form child in pMdiParent.MdiChildren)
                //{
                //    if (child.Name.ToLower() == pChildName.ToLower())
                //    {
                //        isExists = true;
                //        break;
                //    }
                //}

                //if (!isExists)
                //{
                pMdiParent.WindowMenu.DropDownItems.Add(
                    new ToolStripMenuItem()
                {
                    Name = pChildName,
                    Text = pChildText
                });
                //}
            }
            else
            {
                foreach (ToolStripMenuItem menu in pMdiParent.WindowMenu.DropDownItems)
                {
                    if (menu.Name == pChildName)
                    {
                        pMdiParent.WindowMenu.DropDownItems.Remove(menu);
                        break;
                    }
                }
            }
        }
Esempio n. 6
0
        private void dgvLinkData_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 6 && dgvLinkData.Columns["PrintTimePerData"].Visible == true) //Print Time Period Results check box column
                                                                                               //check for visible column corrects bug where program crashes if user selects the 'Description' column on the right edge
            {
                // Force the update of the value for the checkbox column.
                // Without this, the value doens't get updated until you move off from the cell.
                dgvLinkData.Rows[e.RowIndex].Cells[6].Value = (bool)dgvLinkData.Rows[e.RowIndex].Cells[6].EditedFormattedValue;

                bool CheckValue = (bool)dgvLinkData.Rows[e.RowIndex].Cells[6].Value;
                if (CheckValue == true)
                {
                    Links[e.RowIndex + 1].PrintTimePerResults = true;
                }
                else
                {
                    Links[e.RowIndex + 1].PrintTimePerResults = false;
                }
            }

            if (e.ColumnIndex == 7) //Add Time Period Data check box column
            {
                dgvLinkData.Rows[e.RowIndex].Cells[7].Value = (bool)dgvLinkData.Rows[e.RowIndex].Cells[7].EditedFormattedValue;

                bool CheckValue = (bool)dgvLinkData.Rows[e.RowIndex].Cells[7].Value;
                if (CheckValue == true)
                {
                    Links[e.RowIndex + 1].TimePerData = true;   //set time period data flag to true
                    Network.NumRestrictedLinks++;
                }
                else
                {
                    Links[e.RowIndex + 1].TimePerData = false;
                    Network.NumRestrictedLinks--;
                }

                //** have check box interact with enabling of edit link in next column
            }

            if (e.ColumnIndex == 8) //Edit Time Period Data Link
            {
                // Create a new instance of the modal form.
                frmLinkTimePerData frmTPdata = new frmLinkTimePerData(Network, Links);
                int RowIndex = e.RowIndex + 1;
                int FromNode = Convert.ToInt32(dgvLinkData.Rows[e.RowIndex].Cells[0].Value);
                int ToNode   = Convert.ToInt32(dgvLinkData.Rows[e.RowIndex].Cells[1].Value);

                GetTimePeriodData(frmTPdata.ShowDialog(RowIndex, FromNode, ToNode, this), RowIndex);
            }

            if (Project.Type == ProjectType.FreewayFacilities)
            {
                if (e.ColumnIndex == 11) //Open FreewayFacilities module
                {
                    if (dgvLinkData.Rows[e.RowIndex].Cells[colPhysicalLink.Name].EditedFormattedValue.ToString() == "Yes")
                    {
                        if (FreewayFacilities[e.RowIndex].TPsegs == null)
                        {
                            FreewayFacilities[e.RowIndex] = InitializeFreewayData();
                        }

                        HCMCalc_Definitions.ProjectData project = new HCMCalc_Definitions.ProjectData("Freeway Facility", AnalysisMode.HCM2016);
                        mdiMain MDIform = new mdiMain(project, FreewayFacilities[e.RowIndex], FreewayFacilities[e.RowIndex].TPsegs);
                        MDIform.ShowDialog();
                    }
                }
                else if (e.ColumnIndex == 12) //Check freeway facility boundary
                {
                    if (FreewayFacilities[e.RowIndex].PhysicalLinkXXE == true)
                    {
                        //!!!!
                        //save freeway facilities first
                        FileListingTitle  = "XXE OD Data File";
                        RegistryDirectory = "Software\\XXE\\ProjectFiles";
                        RegistryPathForStoredFilenames = "Software\\XXE\\ProjectFiles\\MostRecentlyUsedFiles";
                        Filter           = "Network Files (*.xml)|*.xml|All Files (*.*)|*.*";
                        InitialDirectory = Application.StartupPath;
                        HCMCalc_Definitions.ProjectData ProjectFF = new HCMCalc_Definitions.ProjectData("Freeway Facility", AnalysisMode.HCM2016);
                        FreewayFacilityIO FileIOFF = new FreewayFacilityIO();
                        FileIOFF.WriteFreewaysFile(Project.NetworkFileName, false, true, ProjectFF, FreewayFacilities);

                        //load into boundary form

                        FreewayFacility myFreewayFacilityForm = new FreewayFacility(FreewayFacilities[e.RowIndex]);
                        myFreewayFacilityForm.ShowDialog();

                        //!!!
                        //reload freeway facilities, cause TPsegs change in the volume assignment process
                        FreewayFacilities.Clear();
                        FileIOFF.ReadFreewaysFile(Project.NetworkFileName, ref ProjectFF, FreewayFacilities);
                        LoadLinkData();
                        //!!!
                    }
                }
            }
        }