예제 #1
0
        //Красим таблицу
        private void dataGridView1_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            DGV_Info dgv = (DGV_Info)e.Row.DataContext;

            using (MySqlConnection connection = new MySqlConnection(conn))
            {
                connection.Open();
                MySqlCommand command = new MySqlCommand($"SELECT COUNT(*) FROM journal_wisiting WHERE id_journal=\"{dgv.NumberZapis}\"", connection);
                if (Convert.ToInt32(command.ExecuteScalar()) == 1)
                {
                    e.Row.Background = new SolidColorBrush(Color.FromRgb(10, 142, 160));
                }
                else
                {
                    e.Row.Background = new SolidColorBrush(Color.FromRgb(255, 200, 69));
                }
            }

            /*
             * DGV_Info dgv = (DGV_Info)e.Row.DataContext;
             * if (dgv.DateReceipt == "23.11.12")
             * {
             *  e.Row.Background = new SolidColorBrush(Colors.Aquamarine);
             * }
             */
        }
예제 #2
0
파일: Form1.cs 프로젝트: jamesb6313/PDF_app
        /// <summary>
        /// BTNProcessPDF_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BTNProcessFillDGV_Click(object sender, EventArgs e)
        {
            //var fileType = (sender as Button).Name.ToLower();

            DGV_Info.DataSource = null;
            //myPDFList.Clear();

            DGV_Info.Rows.Clear();
            DGV_Info.Refresh();

            if ((TBX_XCELFile.Text != null) && (TBX_XCELFile.Text.Trim() != ""))
            {
                var form2 = new FRM_XCELType();
                if (form2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    myIPAMList.Clear();
                    curXCELType = form2.XCELType;

                    ReadXCELFile(TBX_XCELFile.Text.Trim(), curXCELType);

                    if (myIPAMList.Count > 0)
                    {
                        DGV_Info.DataSource = myIPAMList;
                        LBL_PDF.Text        = curXCELType + " CBS File Type";
                    }
                    //BTN_ProcessXCEL.Visible = false;
                    BTN_UpdatePDF.Visible = true;
                    BTN_SaveIPAM.Visible  = true;
                    //BTN_UpdatePDF.Visible = true;
                }
                else
                {
                    MessageBox.Show("Action Cancelled");
                }
            }
            else
            {
                MessageBox.Show("No file selected");
            }
        }