Exemplo n.º 1
0
        private void button7_Click(object sender, EventArgs e)
        {
            FileStream   file1          = new FileStream("this_comp.txt", FileMode.Open);
            StreamReader reader2        = new StreamReader(file1);
            string       competition_id = (reader2.ReadToEnd());

            reader2.Close();
            Form4 f = new Form4();

            f.Owner = this;
            f.Show();
            foreach (category_halder category in categories2)
            {
                int                i         = 0;
                TabPage            myTabPage = new TabPage(category.a.Text);
                DataGridView       l1        = new DataGridView();
                List <archer_comp> smena     = new List <archer_comp>();
                l1.Show();
                tabControl3.TabPages.Add(myTabPage);
                f.tabControl1.TabPages.Add(myTabPage);
                l1.Dock = DockStyle.Fill;
                myTabPage.Controls.Add(l1);
                int i5 = 1;
                foreach (DataGridViewColumn obj in dataGridView3.Columns)
                {
                    i5++;
                    DataGridViewColumn col = new DataGridViewColumn();
                    col.Width        = obj.Width;
                    col.CellTemplate = new DataGridViewTextBoxCell();
                    col.HeaderText   = obj.HeaderText;
                    col.Name         = "col" + i5.ToString();
                    l1.Columns.Add(col);
                }

                l1.ReadOnly              = true;
                l1.AllowUserToAddRows    = false;
                l1.AllowUserToDeleteRows = false;
                string[]      selected = category.d.Text.Split(',');
                int           k        = 0;
                List <string> list_id  = new List <string>()
                {
                };
                for (int j = 0; j < selected.Count(); j++)
                {
                    foreach (object cat in category.d.Items)
                    {
                        checheckedComboBox_category categh = (checheckedComboBox_category)cat;
                        if (categh.name == selected[j] || " " + categh.name == selected[j])
                        {
                            list_id.Add(categh.id);
                        }
                    }
                }
                foreach (string categ_id in list_id)
                {
                    string           smena_buf     = "";
                    string           sqlQuery      = " select  * from(select  * from (SELECT id_comp, id_smena,plase,shield,letter,id as p_id,id_user FROM performance WHERE id IN (SELECT id_perf FROM rounds ) and id_comp = '" + competition_id + "') a inner join  users on a.id_user = users.id) a inner join(select  id as s_id, title from smena_info where s_id = '" + categ_id + "') d on a.id_smena = d.s_id ORDER BY s_id,name ASC; ";
                    SQLiteCommand    command       = new SQLiteCommand(sqlQuery, m_dbConn);
                    SQLiteDataReader archer_reader = command.ExecuteReader();
                    while (archer_reader.Read())
                    {
                        archer_comp archer = new archer_comp();
                        archer.fio             = archer_reader["name"].ToString();
                        archer.age             = Convert.ToDateTime(archer_reader["age"]);
                        archer.region          = archer_reader["region"].ToString();
                        archer.rang            = archer_reader["rang"].ToString();
                        archer.sp_organization = archer_reader["sp_organization"].ToString();
                        archer.vedomstvo       = archer_reader["vedomost"].ToString();
                        archer.id       = archer_reader["id_user"].ToString();
                        archer.id_perf  = archer_reader["p_id"].ToString();
                        archer.id_smena = archer_reader["s_id"].ToString();
                        archer.rounds.Clear();
                        sqlQuery = "select * from rounds where id_perf = '" + archer.id_perf + "'";
                        command  = new SQLiteCommand(sqlQuery, m_dbConn);
                        SQLiteDataReader round_reader = command.ExecuteReader();
                        while (round_reader.Read())
                        {
                            round r = new round();
                            r.id         = round_reader["id"].ToString();
                            r.result     = round_reader["result"].ToString();
                            r.series     = round_reader["array_series"].ToString();
                            r.distantion = round_reader["id_distantion"].ToString();
                            archer.rounds.Add(r);
                            archer.nine = Convert.ToByte(round_reader["nine"]);
                            archer.tens = Convert.ToByte(round_reader["ten"]);
                            archer.x    = Convert.ToByte(round_reader["x"]);
                        }
                        if (smena_buf != archer.id_smena)
                        {
                        }
                        smena.Add(archer);
                        l1.Rows.Add
                        (
                            archer.stand,
                            archer.letter,
                            archer.plase,
                            archer.fio,
                            archer.age.ToString("dd:MM:yyyy"),
                            archer.rang,
                            archer.region,
                            archer.vedomstvo,
                            archer.sp_organization,
                            archer.round,
                            archer.tens,
                            archer.x,
                            archer.summ
                        );
                    }
                    comp_smena.Add(smena);
                    l1.Rows.Add();
                    smena_tables.Add(l1);
                }
                f.comp_smena = comp_smena;
                i++;
            }
        }
Exemplo n.º 2
0
 private void Form6_Load(object sender, EventArgs e)
 {
     Form4 main = this.Owner as Form4;
 }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            ////ดอกเบี้ยบ้าน
            if (int.Parse(textBox1.Text) <= 100000)
            {
                Dataf2 = Dataf2 + int.Parse(textBox1.Text);
            }
            else
            {
                Dataf2 = Dataf2 + 100000;
            }
            if (int.Parse(comboBox1.SelectedItem.ToString()) >= 2562)
            {
                if (int.Parse(textBox2.Text) <= 200000)
                {
                    Dataf2 = Dataf2 + int.Parse(textBox2.Text);
                }
                else
                {
                    Dataf2 = Dataf2 + 200000;
                }
            }
            else
            {
                if (int.Parse(textBox2.Text) <= 3000000)
                {
                    Dataf2 = Dataf2 + int.Parse(textBox2.Text) * 4 / 100;
                }
            }
            ////กระตุ้นเศรษฐกิจภาครัฐ ซื้ออุปกรณ์กีฬา หนังสือ OTOP
            if (int.Parse(textBox8.Text) <= 15000)
            {
                Dataf2 = Dataf2 + int.Parse(textBox8.Text);
            }
            else
            {
                Dataf2 = Dataf2 + 15000;
            }
            if (int.Parse(textBox7.Text) <= 15000)
            {
                Dataf2 = Dataf2 + int.Parse(textBox7.Text);
            }
            else
            {
                Dataf2 = Dataf2 + 15000;
            }
            if (int.Parse(textBox6.Text) <= 15000)
            {
                Dataf2 = Dataf2 + int.Parse(textBox6.Text);
            }
            else
            {
                Dataf2 = Dataf2 + 15000;
            }

            //บริจาคทั่วไป

            if (int.Parse(textBox3.Text) <= Dataf3 * 10 / 100)
            {
                Dataf2 = Dataf2 + int.Parse(textBox3.Text);
            }
            else
            {
                Dataf2 = Dataf2 + Dataf3 * 10 / 100;
            }
            if (int.Parse(textBox4.Text) <= Dataf3 * 10 / 100)
            {
                Dataf2 = Dataf2 + int.Parse(textBox4.Text);
            }
            else
            {
                Dataf2 = Dataf2 + Dataf3 * 10 / 100;
            }
            ///พรรคการเมือง
            if (int.Parse(textBox5.Text) <= 10000)
            {
                Dataf2 = Dataf2 + int.Parse(textBox5.Text);
            }
            else
            {
                Dataf2 = Dataf2 + 10000;
            }

            //เที่ยวทั่วไทย
            if (int.Parse(textBox9.Text) + int.Parse(textBox10.Text) <= 20000)
            {
                Dataf2 = Dataf2 + int.Parse(textBox9.Text) + int.Parse(textBox10.Text);
            }
            else
            {
                Dataf2 = Dataf2 + 20000;
            }

            //ค่าซ่่อมรถกับซ่อมบ้าน
            if (int.Parse(textBox11.Text) + int.Parse(textBox12.Text) <= 100000)
            {
                Dataf2 = Dataf2 + int.Parse(textBox11.Text) + int.Parse(textBox12.Text);
            }
            else
            {
                Dataf2 = Dataf2 + 100000;
            }
            ///โยนข้อมูลไปForm ถัดไป
            Form4 fm4 = new Form4();

            fm4.Dataf4 = Dataf2;
            fm4.Dataf5 = Dataf3;
            fm4.Show();
            this.Hide();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Form4 f4 = new Form4();

            f4.Show();
        }