Browse Source

вывод в datagrid

chernyshyov.2000 4 years ago
parent
commit
949232e040
5 changed files with 233 additions and 129 deletions
  1. 64 60
      testkonkurs1/Form2.Designer.cs
  2. 20 0
      testkonkurs1/Form2.cs
  3. 33 35
      testkonkurs1/Form3.Designer.cs
  4. 107 31
      testkonkurs1/Form3.cs
  5. 9 3
      testkonkurs1/Form3.resx

+ 64 - 60
testkonkurs1/Form2.Designer.cs

@@ -30,19 +30,19 @@
         {
             this.tabControl1 = new System.Windows.Forms.TabControl();
             this.tabPage1 = new System.Windows.Forms.TabPage();
-            this.tabPage2 = new System.Windows.Forms.TabPage();
-            this.login = new System.Windows.Forms.TextBox();
-            this.password = new System.Windows.Forms.TextBox();
+            this.AddUser = new System.Windows.Forms.Button();
             this.panel1 = new System.Windows.Forms.Panel();
-            this.admin = new System.Windows.Forms.RadioButton();
             this.manager = new System.Windows.Forms.RadioButton();
-            this.AddUser = new System.Windows.Forms.Button();
-            this.LoginDel = new System.Windows.Forms.TextBox();
+            this.admin = new System.Windows.Forms.RadioButton();
+            this.password = new System.Windows.Forms.TextBox();
+            this.login = new System.Windows.Forms.TextBox();
+            this.tabPage2 = new System.Windows.Forms.TabPage();
             this.Delete = new System.Windows.Forms.Button();
+            this.LoginDel = new System.Windows.Forms.TextBox();
             this.tabControl1.SuspendLayout();
             this.tabPage1.SuspendLayout();
-            this.tabPage2.SuspendLayout();
             this.panel1.SuspendLayout();
+            this.tabPage2.SuspendLayout();
             this.SuspendLayout();
             // 
             // tabControl1
@@ -52,7 +52,7 @@
             this.tabControl1.Location = new System.Drawing.Point(0, 0);
             this.tabControl1.Name = "tabControl1";
             this.tabControl1.SelectedIndex = 0;
-            this.tabControl1.Size = new System.Drawing.Size(788, 438);
+            this.tabControl1.Size = new System.Drawing.Size(369, 438);
             this.tabControl1.TabIndex = 0;
             // 
             // tabPage1
@@ -64,45 +64,42 @@
             this.tabPage1.Location = new System.Drawing.Point(4, 22);
             this.tabPage1.Name = "tabPage1";
             this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
-            this.tabPage1.Size = new System.Drawing.Size(780, 412);
+            this.tabPage1.Size = new System.Drawing.Size(361, 412);
             this.tabPage1.TabIndex = 0;
             this.tabPage1.Text = "Добавить";
             this.tabPage1.UseVisualStyleBackColor = true;
+            this.tabPage1.Click += new System.EventHandler(this.tabPage1_Click);
             // 
-            // tabPage2
-            // 
-            this.tabPage2.Controls.Add(this.Delete);
-            this.tabPage2.Controls.Add(this.LoginDel);
-            this.tabPage2.Location = new System.Drawing.Point(4, 22);
-            this.tabPage2.Name = "tabPage2";
-            this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
-            this.tabPage2.Size = new System.Drawing.Size(780, 412);
-            this.tabPage2.TabIndex = 1;
-            this.tabPage2.Text = "Удалить";
-            this.tabPage2.UseVisualStyleBackColor = true;
-            // 
-            // login
-            // 
-            this.login.Location = new System.Drawing.Point(150, 76);
-            this.login.Name = "login";
-            this.login.Size = new System.Drawing.Size(152, 20);
-            this.login.TabIndex = 0;
-            // 
-            // password
+            // AddUser
             // 
-            this.password.Location = new System.Drawing.Point(150, 123);
-            this.password.Name = "password";
-            this.password.Size = new System.Drawing.Size(151, 20);
-            this.password.TabIndex = 1;
+            this.AddUser.Location = new System.Drawing.Point(75, 298);
+            this.AddUser.Name = "AddUser";
+            this.AddUser.Size = new System.Drawing.Size(151, 34);
+            this.AddUser.TabIndex = 3;
+            this.AddUser.Text = "Добавить пользователя";
+            this.AddUser.UseVisualStyleBackColor = true;
+            this.AddUser.Click += new System.EventHandler(this.AddUser_Click);
             // 
             // panel1
             // 
             this.panel1.Controls.Add(this.manager);
             this.panel1.Controls.Add(this.admin);
-            this.panel1.Location = new System.Drawing.Point(127, 218);
+            this.panel1.Location = new System.Drawing.Point(52, 214);
             this.panel1.Name = "panel1";
             this.panel1.Size = new System.Drawing.Size(237, 49);
             this.panel1.TabIndex = 2;
+            this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
+            // 
+            // manager
+            // 
+            this.manager.AutoSize = true;
+            this.manager.Location = new System.Drawing.Point(121, 13);
+            this.manager.Name = "manager";
+            this.manager.Size = new System.Drawing.Size(77, 17);
+            this.manager.TabIndex = 1;
+            this.manager.TabStop = true;
+            this.manager.Text = "менеджер";
+            this.manager.UseVisualStyleBackColor = true;
             // 
             // admin
             // 
@@ -115,37 +112,37 @@
             this.admin.Text = "Админ";
             this.admin.UseVisualStyleBackColor = true;
             // 
-            // manager
+            // password
             // 
-            this.manager.AutoSize = true;
-            this.manager.Location = new System.Drawing.Point(121, 13);
-            this.manager.Name = "manager";
-            this.manager.Size = new System.Drawing.Size(77, 17);
-            this.manager.TabIndex = 1;
-            this.manager.TabStop = true;
-            this.manager.Text = "менеджер";
-            this.manager.UseVisualStyleBackColor = true;
+            this.password.Location = new System.Drawing.Point(75, 119);
+            this.password.Name = "password";
+            this.password.Size = new System.Drawing.Size(151, 20);
+            this.password.TabIndex = 1;
+            this.password.TextChanged += new System.EventHandler(this.password_TextChanged);
             // 
-            // AddUser
+            // login
             // 
-            this.AddUser.Location = new System.Drawing.Point(150, 302);
-            this.AddUser.Name = "AddUser";
-            this.AddUser.Size = new System.Drawing.Size(151, 34);
-            this.AddUser.TabIndex = 3;
-            this.AddUser.Text = "Добавить пользователя";
-            this.AddUser.UseVisualStyleBackColor = true;
-            this.AddUser.Click += new System.EventHandler(this.AddUser_Click);
+            this.login.Location = new System.Drawing.Point(75, 72);
+            this.login.Name = "login";
+            this.login.Size = new System.Drawing.Size(152, 20);
+            this.login.TabIndex = 0;
+            this.login.TextChanged += new System.EventHandler(this.login_TextChanged);
             // 
-            // LoginDel
+            // tabPage2
             // 
-            this.LoginDel.Location = new System.Drawing.Point(20, 22);
-            this.LoginDel.Name = "LoginDel";
-            this.LoginDel.Size = new System.Drawing.Size(100, 20);
-            this.LoginDel.TabIndex = 0;
+            this.tabPage2.Controls.Add(this.Delete);
+            this.tabPage2.Controls.Add(this.LoginDel);
+            this.tabPage2.Location = new System.Drawing.Point(4, 22);
+            this.tabPage2.Name = "tabPage2";
+            this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
+            this.tabPage2.Size = new System.Drawing.Size(361, 412);
+            this.tabPage2.TabIndex = 1;
+            this.tabPage2.Text = "Удалить";
+            this.tabPage2.UseVisualStyleBackColor = true;
             // 
             // Delete
             // 
-            this.Delete.Location = new System.Drawing.Point(8, 74);
+            this.Delete.Location = new System.Drawing.Point(94, 206);
             this.Delete.Name = "Delete";
             this.Delete.Size = new System.Drawing.Size(154, 23);
             this.Delete.TabIndex = 1;
@@ -153,11 +150,18 @@
             this.Delete.UseVisualStyleBackColor = true;
             this.Delete.Click += new System.EventHandler(this.Delete_Click);
             // 
+            // LoginDel
+            // 
+            this.LoginDel.Location = new System.Drawing.Point(120, 150);
+            this.LoginDel.Name = "LoginDel";
+            this.LoginDel.Size = new System.Drawing.Size(100, 20);
+            this.LoginDel.TabIndex = 0;
+            // 
             // Form2
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(800, 450);
+            this.ClientSize = new System.Drawing.Size(376, 450);
             this.Controls.Add(this.tabControl1);
             this.Name = "Form2";
             this.Text = "ПанельУправления";
@@ -165,10 +169,10 @@
             this.tabControl1.ResumeLayout(false);
             this.tabPage1.ResumeLayout(false);
             this.tabPage1.PerformLayout();
-            this.tabPage2.ResumeLayout(false);
-            this.tabPage2.PerformLayout();
             this.panel1.ResumeLayout(false);
             this.panel1.PerformLayout();
+            this.tabPage2.ResumeLayout(false);
+            this.tabPage2.PerformLayout();
             this.ResumeLayout(false);
 
         }

+ 20 - 0
testkonkurs1/Form2.cs

@@ -75,5 +75,25 @@ namespace testkonkurs1
                 MessageBox.Show(ex.Message.ToString(), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
+
+        private void tabPage1_Click(object sender, EventArgs e)
+        {
+
+        }
+
+        private void panel1_Paint(object sender, PaintEventArgs e)
+        {
+
+        }
+
+        private void password_TextChanged(object sender, EventArgs e)
+        {
+
+        }
+
+        private void login_TextChanged(object sender, EventArgs e)
+        {
+
+        }
     }
 }

+ 33 - 35
testkonkurs1/Form3.Designer.cs

@@ -35,16 +35,17 @@
             this.comboBox1 = new System.Windows.Forms.ComboBox();
             this.button1 = new System.Windows.Forms.Button();
             this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
-            this.listBox1 = new System.Windows.Forms.ListBox();
             this.dataGridView1 = new System.Windows.Forms.DataGridView();
+            this.konkursDataSetBindingSource1 = new System.Windows.Forms.BindingSource(this.components);
             this.konkursDataSet = new testkonkurs1.konkursDataSet();
             this.konkursDataSetBindingSource = new System.Windows.Forms.BindingSource(this.components);
-            this.konkursDataSetBindingSource1 = new System.Windows.Forms.BindingSource(this.components);
-            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.comfortBindingSource = new System.Windows.Forms.BindingSource(this.components);
+            this.comfortTableAdapter = new testkonkurs1.konkursDataSetTableAdapters.comfortTableAdapter();
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.konkursDataSetBindingSource1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.konkursDataSet)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.konkursDataSetBindingSource)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.konkursDataSetBindingSource1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.comfortBindingSource)).BeginInit();
             this.SuspendLayout();
             // 
             // directorySearcher1
@@ -55,61 +56,58 @@
             // 
             // dateTimePicker1
             // 
-            this.dateTimePicker1.Location = new System.Drawing.Point(40, 37);
+            this.dateTimePicker1.Location = new System.Drawing.Point(62, 68);
             this.dateTimePicker1.Name = "dateTimePicker1";
             this.dateTimePicker1.Size = new System.Drawing.Size(184, 20);
             this.dateTimePicker1.TabIndex = 0;
+            this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
             // 
             // textBox1
             // 
-            this.textBox1.Location = new System.Drawing.Point(271, 37);
+            this.textBox1.Location = new System.Drawing.Point(279, 68);
             this.textBox1.Name = "textBox1";
             this.textBox1.Size = new System.Drawing.Size(125, 20);
             this.textBox1.TabIndex = 1;
+            this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
             // 
             // comboBox1
             // 
             this.comboBox1.FormattingEnabled = true;
             this.comboBox1.Items.AddRange(new object[] {
             "1-комнатный",
-            "2-комнатный"});
-            this.comboBox1.Location = new System.Drawing.Point(438, 36);
+            "2-комнатный",
+            "показать все"});
+            this.comboBox1.Location = new System.Drawing.Point(444, 67);
             this.comboBox1.Name = "comboBox1";
             this.comboBox1.Size = new System.Drawing.Size(133, 21);
             this.comboBox1.TabIndex = 2;
             this.comboBox1.Text = "1-комнатный";
+            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
             // 
             // button1
             // 
-            this.button1.Location = new System.Drawing.Point(438, 95);
+            this.button1.Location = new System.Drawing.Point(634, 93);
             this.button1.Name = "button1";
             this.button1.Size = new System.Drawing.Size(133, 50);
             this.button1.TabIndex = 3;
-            this.button1.Text = "d";
+            this.button1.Text = "Показать список свободных номеров";
             this.button1.UseVisualStyleBackColor = true;
             this.button1.Click += new System.EventHandler(this.button1_Click);
             // 
-            // listBox1
-            // 
-            this.listBox1.FormattingEnabled = true;
-            this.listBox1.Location = new System.Drawing.Point(43, 158);
-            this.listBox1.Name = "listBox1";
-            this.listBox1.Size = new System.Drawing.Size(365, 212);
-            this.listBox1.TabIndex = 4;
-            // 
             // dataGridView1
             // 
-            this.dataGridView1.AutoGenerateColumns = false;
             this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
-            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
-            this.Column1});
-            this.dataGridView1.DataSource = this.konkursDataSetBindingSource1;
-            this.dataGridView1.Location = new System.Drawing.Point(528, 219);
+            this.dataGridView1.Location = new System.Drawing.Point(76, 181);
             this.dataGridView1.Name = "dataGridView1";
-            this.dataGridView1.Size = new System.Drawing.Size(196, 98);
+            this.dataGridView1.Size = new System.Drawing.Size(807, 276);
             this.dataGridView1.TabIndex = 5;
             this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
             // 
+            // konkursDataSetBindingSource1
+            // 
+            this.konkursDataSetBindingSource1.DataSource = this.konkursDataSet;
+            this.konkursDataSetBindingSource1.Position = 0;
+            // 
             // konkursDataSet
             // 
             this.konkursDataSet.DataSetName = "konkursDataSet";
@@ -120,23 +118,21 @@
             this.konkursDataSetBindingSource.DataSource = this.konkursDataSet;
             this.konkursDataSetBindingSource.Position = 0;
             // 
-            // konkursDataSetBindingSource1
+            // comfortBindingSource
             // 
-            this.konkursDataSetBindingSource1.DataSource = this.konkursDataSet;
-            this.konkursDataSetBindingSource1.Position = 0;
+            this.comfortBindingSource.DataMember = "comfort";
+            this.comfortBindingSource.DataSource = this.konkursDataSetBindingSource;
             // 
-            // Column1
+            // comfortTableAdapter
             // 
-            this.Column1.HeaderText = "Column1";
-            this.Column1.Name = "Column1";
+            this.comfortTableAdapter.ClearBeforeFill = true;
             // 
             // Form3
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(800, 450);
+            this.ClientSize = new System.Drawing.Size(959, 492);
             this.Controls.Add(this.dataGridView1);
-            this.Controls.Add(this.listBox1);
             this.Controls.Add(this.button1);
             this.Controls.Add(this.comboBox1);
             this.Controls.Add(this.textBox1);
@@ -144,10 +140,12 @@
             this.Name = "Form3";
             this.Text = "Form3";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form3_FormClosing);
+            this.Load += new System.EventHandler(this.Form3_Load);
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.konkursDataSetBindingSource1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.konkursDataSet)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.konkursDataSetBindingSource)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.konkursDataSetBindingSource1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.comfortBindingSource)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -161,11 +159,11 @@
         private System.Windows.Forms.ComboBox comboBox1;
         private System.Windows.Forms.Button button1;
         private System.ComponentModel.BackgroundWorker backgroundWorker1;
-        private System.Windows.Forms.ListBox listBox1;
         private System.Windows.Forms.DataGridView dataGridView1;
-        private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
         private System.Windows.Forms.BindingSource konkursDataSetBindingSource1;
         private konkursDataSet konkursDataSet;
         private System.Windows.Forms.BindingSource konkursDataSetBindingSource;
+        private System.Windows.Forms.BindingSource comfortBindingSource;
+        private konkursDataSetTableAdapters.comfortTableAdapter comfortTableAdapter;
     }
 }

+ 107 - 31
testkonkurs1/Form3.cs

@@ -30,14 +30,17 @@ namespace testkonkurs1
             conn.Open();
             SqlDataReader Reader = null;
 
-            try{
+            try
+            {
+                dataGridView1.Rows.Clear();
+                dataGridView1.Columns.Clear();
                 DateTime date_1start = dateTimePicker1.Value;
                 DateTime date_1end = date_1start.AddDays(Convert.ToInt32(textBox1.Text));
                 Reader = command.ExecuteReader();
-                listBox1.Items.Clear();
-                if(comboBox1.SelectedItem.ToString() == "1-комнатный")
+
+                if (comboBox1.SelectedItem.ToString() == "1-комнатный")
                 {
-                    
+
                 }
 
                 int[] cod_mesta = new int[20];
@@ -45,29 +48,45 @@ namespace testkonkurs1
                 String[] lvl_comfort = new String[20];
                 String[] price = new String[20];
                 int i = 0;
-                while (Reader.Read()) {
+                while (Reader.Read())
+                {
                     DateTime date_2_start = Convert.ToDateTime(Reader["date_zaezda"]);
                     DateTime date_2_end = date_2_start.AddDays(Convert.ToInt16(Reader["kol_days"]));
                     // bool intersect = !(date_2_end < date_1start || date_2_start > date_1end);
                     bool intersect = date_2_end >= date_1start && date_2_start <= date_1end;
-                    if (!intersect) {
-                        cod_mesta[i] = Convert.ToInt32( Reader["nomer_mesta"]);
-                        i+=1;
+                    if (!intersect)
+                    {
+                        cod_mesta[i] = Convert.ToInt32(Reader["nomer_mesta"]);
+                        i += 1;
                     }
                 }
                 Reader.Close();
 
-            
-                
+
+                DataGridViewTextBoxColumn nomer_comnatColum = new DataGridViewTextBoxColumn();
+                nomer_comnatColum.HeaderText = "номер комнаты";
+                nomer_comnatColum.Name = "text";
+                dataGridView1.Columns.AddRange(nomer_comnatColum);
+
+                DataGridViewTextBoxColumn lvlcomfortColum = new DataGridViewTextBoxColumn();
+                lvlcomfortColum.HeaderText = "Уровень комфорта";
+                lvlcomfortColum.Name = "text";
+                dataGridView1.Columns.AddRange(lvlcomfortColum);
+
+                DataGridViewTextBoxColumn pricecolum = new DataGridViewTextBoxColumn();
+                pricecolum.HeaderText = "цена проживания";
+                pricecolum.Name = "text";
+                dataGridView1.Columns.AddRange(pricecolum);
+
                 for (int j = 0; j < 20; j++)
                 {
-                    if(cod_mesta[j] != 0)
+                    if (cod_mesta[j] != 0)
                     {
                         SqlCommand takeMesta = new SqlCommand("SELECT * FROM mesto where cod_mesta = @nomer_mesta", conn);
                         takeMesta.Parameters.AddWithValue("@nomer_mesta", cod_mesta[j]);
                         SqlDataReader Mesta = takeMesta.ExecuteReader();
                         Mesta.Read();
-                        nomer_comnat[j] = Convert.ToInt32( Mesta["nomer_comnat"]);
+                        nomer_comnat[j] = Convert.ToInt32(Mesta["nomer_comnat"]);
                         Mesta.Close();
                     }
                 }
@@ -80,48 +99,105 @@ namespace testkonkurs1
                         takeMesta.Parameters.AddWithValue("@nomer_mesta", nomer_comnat[j]);
                         SqlDataReader Mesta = takeMesta.ExecuteReader();
                         Mesta.Read();
-             
+
                         lvl_comfort[j] = Mesta["lvl_comfort"].ToString();
                         Mesta.Close();
                     }
-                 
-                for (int j = 0; j < 20; j++)
-                {
-                    if (lvl_comfort[j] != null)
+                }
+                    for (int j = 0; j < 20; j++)
                     {
-                        SqlCommand takeMesta = new SqlCommand("SELECT * FROM comfort where [lvl-comfort] = @nomer_mesta", conn);
-                        takeMesta.Parameters.AddWithValue("@nomer_mesta", lvl_comfort[j]);
-                        SqlDataReader Mesta = takeMesta.ExecuteReader();
-                        Mesta.Read();
-                        price[j] = (Mesta["price_life"].ToString());
-                        Mesta.Close();
+                        if (lvl_comfort[j] != null)
+                        {
+                            SqlCommand takeMesta = new SqlCommand("SELECT * FROM comfort where [lvl-comfort] = @nomer_mesta", conn);
+                            takeMesta.Parameters.AddWithValue("@nomer_mesta", lvl_comfort[j]);
+                            SqlDataReader Mesta = takeMesta.ExecuteReader();
+                            Mesta.Read();
+                            price[j] = (Mesta["price_life"].ToString());
+                            Mesta.Close();
+                        }
                     }
-                }
                 for (int j = 0; j < 20; j++)
                 {
-                    if (nomer_comnat[j] != 0)
+                    if (comboBox1.SelectedIndex == 0)
                     {
-                        listBox1.Items.Add(nomer_comnat[j] + " " + lvl_comfort[j] + " " + price[j]);    
+                        if (nomer_comnat[j] != 2)
+                        {
+                            dataGridView1.Rows.Add();
+                            dataGridView1.Rows[j].Cells[0].Value = nomer_comnat[j];
+                            dataGridView1.Rows[j].Cells[1].Value = lvl_comfort[j];
+                            dataGridView1.Rows[j].Cells[2].Value = price[j];
+                        }
                     }
-                   
-                }
+
+                        if (comboBox1.SelectedIndex == 1)
+                        {
+                        if (nomer_comnat[j] != 0)
+                        {
+                            if (lvl_comfort[j].ToString() != "1-местный ")
+                            {
+                                dataGridView1.Rows.Add();
+                                dataGridView1.Rows[j].Cells[0].Value = nomer_comnat[j];
+                                dataGridView1.Rows[j].Cells[1].Value = lvl_comfort[j];
+                                dataGridView1.Rows[j].Cells[2].Value = price[j];
+                            }
+
+
+
+                            if (comboBox1.SelectedIndex == 2)
+                            {
+                                if (nomer_comnat[j] != 0)
+                                {
+                                    if (lvl_comfort[j].ToString() != "2-местный ")
+                                    {
+                                        dataGridView1.Rows.Add();
+                                        dataGridView1.Rows[j].Cells[0].Value = nomer_comnat[j];
+                                        dataGridView1.Rows[j].Cells[1].Value = lvl_comfort[j];
+                                        dataGridView1.Rows[j].Cells[2].Value = price[j];
+                                    }
+
+
+                                }
+                            }
+                        }
+                    }
+
+                    }
+
+
 
             }
+
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message.ToString(), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
+}
 
+        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+  
+        }
 
+        private void Form3_Load(object sender, EventArgs e)
+        {
+            // TODO: данная строка кода позволяет загрузить данные в таблицу "konkursDataSet.comfort". При необходимости она может быть перемещена или удалена.
+            this.comfortTableAdapter.Fill(this.konkursDataSet.comfort);
 
+        }
 
+        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
+        {
 
+        }
 
-}
+        private void textBox1_TextChanged(object sender, EventArgs e)
+        {
 
-        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        }
+
+        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
         {
-  
+
         }
     }
 

+ 9 - 3
testkonkurs1/Form3.resx

@@ -123,16 +123,22 @@
   <metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>171, 17</value>
   </metadata>
-  <metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <metadata name="konkursDataSetBindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>688, 17</value>
   </metadata>
   <metadata name="konkursDataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>335, 17</value>
   </metadata>
+  <metadata name="konkursDataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>335, 17</value>
+  </metadata>
   <metadata name="konkursDataSetBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>472, 17</value>
   </metadata>
+  <metadata name="comfortBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>911, 17</value>
+  </metadata>
+  <metadata name="comfortTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>1085, 17</value>
+  </metadata>
 </root>