, , - . , , . , .
, , . .
. , . , : , . , , , .
, :
1 . 4 : , , , . , 1 . , , , . , . , (, . ). () , . (, .).
2 . , . , . : , . , , .
3 . , . , . : , . , . .
4 . , . , . . : .ѻ. .
5 . , . , . .
|
|
6 . , . , . : . : .ѻ. .
7 . , . , . : , , . .
:
1 . . . : .. . : .ѻ. , . .
2 . . . . , , . . , . .
3 . . , , , . . , 20%. , . .
4 . . . , . .
5 . . , , . , . , . .
6 . . , , . . , . .
7 . . . , . .
|
|
, . , . , .
, , , .
, : , .
.
, .
, . .
, . , , . , . , . , , .
1 . 3008-95 . .
2 .. . - . 2001, 1071.
3 . SQL. .: - Ȼ, 2003. 644.
4 -, , , , , . . .: . . .: , 2003. 1088.
5 . , . . . , , . . - , 2001. 1111.
6 .., .. ( ). , 2002. 504.
7 .. : . .; -, 2003. 384.
8 : C# .NET , 2004
9 C# 4.0. , 2011 1056.
:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassBilets: Form
{
public ClassBilets()
{
InitializeComponent();
}
public string sSqlQuery = "SELECT * FROM bilet";
public List<Bilets> List4 = new List<Bilets>();
public List<Bilets> List = new List<Bilets>();
public List<Gorod> List2 = new List<Gorod>();
public List<Reyses> List1 = new List<Reyses>();
public List<ZakazBileta> List3 = new List<ZakazBileta>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
List<int> values = new List<int>();
#region
private void ClassBilets_Load(object sender, EventArgs e)
{
string sssSqlQuery = "SELECT * FROM gorod";
DB1.Execute<Gorod>(ref sqlCon, sssSqlQuery, ref List2);
|
|
for (int i = 0; i < List2.Count; ++i)
{
comboBox3.Items.Add(List2.ElementAt(i).NameGoroda);
comboBox4.Items.Add(List2.ElementAt(i).NameGoroda);
}
DB1.Execute<Bilets>(ref sqlCon, this.sSqlQuery, ref List);
for (int i = 0; i < List.Count; ++i)
dataGridView1.Rows.Add(Convert.ToString(List.ElementAt(i).IdBileta), Convert.ToString(List.ElementAt(i).IdReysa), Convert.ToString(List.ElementAt(i).IdZakaza), List.ElementAt(i).PlaceOtpravki, List.ElementAt(i).PlaceNaznachenia, Convert.ToString(List.ElementAt(i).Cena), List.ElementAt(i).SkidkaStudent, List.ElementAt(i).SkidkaPensioner, "");
sozdat_values();
}
#endregion
private void button1_Click(object sender, EventArgs e)
{
ClassInsertBilet f = new ClassInsertBilet();
f.Show();
this.Close();
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
#region Delete
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 8)
{
this.deleteTeacher(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
dataGridView1.Rows.RemoveAt(e.RowIndex);
}
}
public void deleteTeacher(string num_bileta)
{
string sSqlQuery = "DELETE FROM bilet WHERE num_bileta='" + num_bileta + "';";
int res = this.DB1.ExecuteNonQuery(ref this.sqlCon, sSqlQuery);
if (res <= 0)
this.label1.Text = " ";
else
this.label1.Text = " " + num_bileta + " ";
}
#endregion
#region Search
private void sozdat_values()
{
for (int i = 0; i < List.Count; i++) values.Add(i);
}
private void button2_Click(object sender, EventArgs e)
{
values.Clear();
sozdat_values();
dataGridView1.RowCount = 0;
if (textBox1.Text!= "")
{
for (int i = 0; i < values.Count; i++)
{
if (textBox1.Text!= Convert.ToString(List[values[i]].IdReysa))
{
values.RemoveAt(i);
i--;
}
}
}
if (textBox2.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox2.Text!= Convert.ToString(List[values[i]].IdZakaza))
{
values.RemoveAt(i);
i--;
}
}
if (comboBox3.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (comboBox3.Text!= Convert.ToString(List[values[i]].PlaceNaznachenia))
{
values.RemoveAt(i);
i--;
}
}
if (comboBox4.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (comboBox4.Text!= Convert.ToString(List[values[i]].PlaceOtpravki))
{
values.RemoveAt(i);
i--;
}
}
if (textBox4.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox4.Text!= Convert.ToString(List[values[i]].Cena))
{
values.RemoveAt(i);
i--;
}
}
for (int i = 0; i < values.Count; i++)
dataGridView1.Rows.Add(Convert.ToString(List[values[i]].IdBileta), Convert.ToString(List[values[i]].IdReysa), Convert.ToString(List[values[i]].IdZakaza),List[values[i]].PlaceOtpravki,List[values[i]].PlaceNaznachenia, Convert.ToString(List[values[i]].Cena), List[values[i]].SkidkaStudent, List[values[i]].SkidkaPensioner, "");
}
#endregion
private void button4_Click(object sender, EventArgs e)
{
ClassChangeBilet f = new ClassChangeBilet();
f.Show();
}
#region Report
private void button5_Click(object sender, EventArgs e)
{
List<Bilets> ls3 = new List<Bilets>(); //
for (int i = 0; i < values.Count; i++) ls3.Add(List.ElementAt(values[i]));
ClassSerialiaze.SerialiazeToXml<List<Bilets>>(ref ls3, @"C:\Users\Dell\Documents\Visual Studio 2012\Projects\ \xml\Bilets.xml");
|
|
string adres = @"C:\Users\Dell\Documents\Visual Studio 2012\Projects\ \xml\Bilets.frx";
FormReport report_raspizanie = new FormReport(adres);
report_raspizanie.Show();
}
#endregion
private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8 && e.KeyChar!=44)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" : '1-9'");
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8 && e.KeyChar!= 44)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" : '1-9'");
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8 && e.KeyChar!= 44)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" : '1-9'");
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassAvtopark: Form
{
public string sSqlQuery = "SELECT idavtopark, gorod, num_avto, marka, model, color, kolvo_mest FROM avtopark, avtovokzal WHERE avtopark.idavtovokz = avtovokzal.idavtovokz";
// public string sSqlQuery = "SELECT idavtopark, idavtovokz, num_avto, marka, model, color, kolvo_mest FROM avtopark";
public ClassAvtopark()
{
InitializeComponent();
}
public List<Avtopark> List = new List<Avtopark>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
List<int> values = new List<int>();
#region
private void ClassAvtopark_Load(object sender, EventArgs e)
{
Make_table();
}
#endregion
public void Make_table()
{
values.Clear();
List.Clear();
dataGridView1.RowCount = 0;
DB1.Execute<Avtopark>(ref sqlCon, this.sSqlQuery, ref List);
for (int i = 0; i < List.Count; i++)
dataGridView1.Rows.Add(Convert.ToString(List.ElementAt(i).IdAvtopark), Convert.ToString(List.ElementAt(i).IdAvtovokzal), List.ElementAt(i).NumberAvto, List.ElementAt(i).MarkaAvto, List.ElementAt(i).ModelAvto, List.ElementAt(i).ColorAvto, Convert.ToString(List.ElementAt(i).KolichestvoMestAvto), "");
sozdat_values();
}
public void Make_table(object sender, FormClosedEventArgs e) //
{
Make_table();
}
public void Open_form_changeAvtopark()
{
ClassChangeAvtovopark changeAvtopark = new ClassChangeAvtovopark(dataGridView1[0, dataGridView1.SelectedCells[0].RowIndex].Value.ToString()); // ,
changeAvtopark.FormClosed += new FormClosedEventHandler(Make_table); //
changeAvtopark.Show(); // */
}
public void changeAvtopark_closed(object sender, FormClosedEventArgs e) //
{
Make_table();
}
#region Buttons Delete
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 7)
{
this.deleteTeacher(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
dataGridView1.Rows.RemoveAt(e.RowIndex);
}
}
public void deleteTeacher(string idavtopark)
{
string sSqlQuery = "DELETE FROM avtopark WHERE idavtopark='" + idavtopark + "';";
int res = this.DB1.ExecuteNonQuery(ref this.sqlCon, sSqlQuery);
if (res <= 0)
{
this.label2.Text = " ";
}
else
{
this.label2.Text = " " + idavtopark + " ";
}
}
#endregion
private void button1_Click(object sender, EventArgs e)
{
ClassInsertAvtopark f = new ClassInsertAvtopark();
f.Show();
this.Close();
}
#region Search
private void sozdat_values()
{
for (int i = 0; i < List.Count; i++) values.Add(i);
}
private void button3_Click(object sender, EventArgs e)
|
|
{
values.Clear();
sozdat_values();
dataGridView1.RowCount = 0;
if (textBox1.Text!= "")
{
for (int i = 0; i < values.Count; i++)
{
if (textBox1.Text!= List[values[i]].NumberAvto)
{
values.RemoveAt(i);
i--;
}
}
}
if (textBox2.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox2.Text!= List[values[i]].MarkaAvto)
{
values.RemoveAt(i);
i--;
}
}
if (textBox3.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox3.Text!= List[values[i]].ModelAvto)
{
values.RemoveAt(i);
i--;
}
}
if (textBox4.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox4.Text!= List[values[i]].ColorAvto)
{
values.RemoveAt(i);
i--;
}
}
if (textBox5.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox5.Text!= Convert.ToString(List[values[i]].KolichestvoMestAvto))
{
values.RemoveAt(i);
i--;
}
}
for (int i = 0; i < values.Count; i++)
dataGridView1.Rows.Add(Convert.ToString(List[values[i]].IdAvtopark), Convert.ToString(List[values[i]].IdAvtovokzal), List[values[i]].NumberAvto, List[values[i]].MarkaAvto, List[values[i]].ModelAvto, List[values[i]].ColorAvto, Convert.ToString(List[values[i]].KolichestvoMestAvto), "");
}
#endregion
private void button4_Click(object sender, EventArgs e)
{
Open_form_changeAvtopark();
}
#region Report
private void button5_Click(object sender, EventArgs e)
{
List<Avtopark> ls3 = new List<Avtopark>(); //
for (int i = 0; i < values.Count; i++) ls3.Add(List.ElementAt(values[i]));
ClassSerialiaze.SerialiazeToXml<List<Avtopark>>(ref ls3, @"C:\Users\Dell\Documents\Visual Studio 2012\Projects\ \xml\avtopark.xml");
//ref \\not ref???? what for
string adres = @"C:\Users\Dell\Documents\Visual Studio 2012\Projects\ \xml\avtopark.frx";
FormReport report_raspizanie = new FormReport(adres);
report_raspizanie.Show();
}
#endregion
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" !");
}
private void textBox5_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" !");
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassAvtovokzal: Form
{
public ClassAvtovokzal()
{
InitializeComponent();
}
public string sSqlQuery = "SELECT * FROM avtovokzal";
public List<Avtovokzal> List = new List<Avtovokzal>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
List<int> values = new List<int>();
public List<Gorod> List2 = new List<Gorod>();
public void Make_table(object sender, FormClosedEventArgs e) //
{
Make_table();
}
#region
private void ClassAvtovokzal_Load(object sender, EventArgs e)
{
Make_table();
}
public void Make_table()
{
List2.Clear();
values.Clear();
List.Clear();
dataGridView1.RowCount = 0;
string ssSqlQuery = "SELECT * FROM gorod";
DB1.Execute<Gorod>(ref sqlCon, ssSqlQuery, ref List2);
for (int i = 0; i < List2.Count; ++i)
{
comboBox1.Items.Add(List2.ElementAt(i).NameGoroda);
}
DB1.Execute<Avtovokzal>(ref sqlCon, this.sSqlQuery, ref List);
for (int i = 0; i < List.Count; ++i)
dataGridView1.Rows.Add(Convert.ToString(List.ElementAt(i).IdAvtovokzal), List.ElementAt(i).GorodAvtovokzala, List.ElementAt(i).AdresAvtovokzala, List.ElementAt(i).TelefonAvtovokzala, List.ElementAt(i).FioDerectorAvtovokzala, "");
sozdat_values();
}
#endregion
public void Open_form_changeAvtovokzal()
{
ClassChangeAvtovokzal changeAvtovokzal = new ClassChangeAvtovokzal(dataGridView1[0, dataGridView1.SelectedCells[0].RowIndex].Value.ToString()); // ,
changeAvtovokzal.FormClosed += new FormClosedEventHandler(Make_table); //
changeAvtovokzal.Show(); // */
}
public void changeAvtovokzal_closed(object sender, FormClosedEventArgs e) //
{
Make_table();
}
private void button5_Click(object sender, EventArgs e)
{
Open_form_changeAvtovokzal();
}
#region Open form insert avtovokzal
private void button1_Click(object sender, EventArgs e)
{
ClassInsertAvtovokzal f = new ClassInsertAvtovokzal();
f.Show();
this.Close();
}
#endregion
private void button3_Click(object sender, EventArgs e)
{
this.Close();//
}
#region Buttons delete
public void deleteTeacher(string idavtovokz)
{
string sSqlQuery = "DELETE FROM avtovokzal WHERE idavtovokz='" + idavtovokz + "';";
int res = this.DB1.ExecuteNonQuery(ref this.sqlCon, sSqlQuery);
if (res <= 0)
this.label7.Text = " ";
else
this.label7.Text = " " + idavtovokz + " ";
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 5)
{
this.deleteTeacher(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
dataGridView1.Rows.RemoveAt(e.RowIndex);
}
}
#endregion
#region Search
private void sozdat_values()
{
for (int i = 0; i < List.Count; i++) values.Add(i);
}
private void button2_Click(object sender, EventArgs e)
{
{
values.Clear();
sozdat_values();
dataGridView1.RowCount = 0;
if (comboBox1.Text!= "")
{
label7.Text = " ";
for (int i = 0; i < values.Count; i++)
{
if (comboBox1.Text!= List[values[i]].GorodAvtovokzala)
{
values.RemoveAt(i);
i--;
}
}
}
if (textBox3.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox3.Text!= List[values[i]].AdresAvtovokzala)
{
values.RemoveAt(i);
i--;
}
}
if ((maskedTextBox1.Text!= "") && (maskedTextBox1.Text!= " -"))
for (int i = 0; i < values.Count; i++)
{
if (maskedTextBox1.Text!= List[values[i]].TelefonAvtovokzala)
{
values.RemoveAt(i);
i--;
}
}
if (textBox5.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox5.Text!= List[values[i]].FioDerectorAvtovokzala)
{
values.RemoveAt(i);
i--;
}
}
for (int i = 0; i < values.Count; i++)
dataGridView1.Rows.Add(Convert.ToString(List[values[i]].IdAvtovokzal), List[values[i]].GorodAvtovokzala, List[values[i]].AdresAvtovokzala, List[values[i]].TelefonAvtovokzala, List[values[i]].FioDerectorAvtovokzala, "", "");
}
}
#endregion
#region Report
private void button4_Click(object sender, EventArgs e)
{
List<Avtovokzal> ls3 = new List<Avtovokzal>(); //
for (int i = 0; i < values.Count; i++) ls3.Add(List.ElementAt(values[i]));
ClassSerialiaze.SerialiazeToXml<List<Avtovokzal>>(ref ls3, @"C:\Users\Dell\Documents\Visual Studio 2012\Projects\ \xml\avtovokzal.xml");
//ref \\not ref???? what for
string adres = @"C:\Users\Dell\Documents\Visual Studio 2012\Projects\ \xml\avtovokzal.frx";
FormReport report_raspizanie = new FormReport(adres);
report_raspizanie.Show();
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassBilets: Form
{
public ClassBilets()
{
InitializeComponent();
}
public string sSqlQuery = "SELECT * FROM bilet";
public List<Bilets> List4 = new List<Bilets>();
public List<Bilets> List = new List<Bilets>();
public List<Gorod> List2 = new List<Gorod>();
public List<Reyses> List1 = new List<Reyses>();
public List<ZakazBileta> List3 = new List<ZakazBileta>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
List<int> values = new List<int>();
#region
private void ClassBilets_Load(object sender, EventArgs e)
{
Make_table();
}
public void Make_table()
{
List2.Clear();
values.Clear();
List.Clear();
dataGridView1.RowCount = 0;
string sssSqlQuery = "SELECT * FROM gorod";
DB1.Execute<Gorod>(ref sqlCon, sssSqlQuery, ref List2);
for (int i = 0; i < List2.Count; ++i)
{
comboBox3.Items.Add(List2.ElementAt(i).NameGoroda);
comboBox4.Items.Add(List2.ElementAt(i).NameGoroda);
}
DB1.Execute<Bilets>(ref sqlCon, this.sSqlQuery, ref List);
for (int i = 0; i < List.Count; ++i)
dataGridView1.Rows.Add(Convert.ToString(List.ElementAt(i).IdBileta), Convert.ToString(List.ElementAt(i).IdReysa), Convert.ToString(List.ElementAt(i).IdZakaza), List.ElementAt(i).PlaceOtpravki, List.ElementAt(i).PlaceNaznachenia, Convert.ToString(List.ElementAt(i).Cena), List.ElementAt(i).SkidkaStudent, List.ElementAt(i).SkidkaPensioner, "");
sozdat_values();
}
#endregion
public void Make_table(object sender, FormClosedEventArgs e) //
{
Make_table();
}
public void Open_form_changeBilets()
{
ClassChangeBilet changeBilets = new ClassChangeBilet(dataGridView1[0, dataGridView1.SelectedCells[0].RowIndex].Value.ToString()); // ,
changeBilets.FormClosed += new FormClosedEventHandler(Make_table); //
changeBilets.Show(); // */
}
public void changeBilets_closed(object sender, FormClosedEventArgs e) //
{
Make_table();
}
private void button1_Click(object sender, EventArgs e)
{
ClassInsertBilet f = new ClassInsertBilet();
f.Show();
this.Close();
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
#region Delete
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 8)
{
this.deleteTeacher(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
dataGridView1.Rows.RemoveAt(e.RowIndex);
}
}
public void deleteTeacher(string num_bileta)
{
string sSqlQuery = "DELETE FROM bilet WHERE num_bileta='" + num_bileta + "';";
int res = this.DB1.ExecuteNonQuery(ref this.sqlCon, sSqlQuery);
if (res <= 0)
this.label1.Text = " ";
else
this.label1.Text = " " + num_bileta + " ";
}
#endregion
#region Search
private void sozdat_values()
{
for (int i = 0; i < List.Count; i++) values.Add(i);
}
private void button2_Click(object sender, EventArgs e)
{
values.Clear();
sozdat_values();
dataGridView1.RowCount = 0;
if (textBox1.Text!= "")
{
for (int i = 0; i < values.Count; i++)
{
if (textBox1.Text!= Convert.ToString(List[values[i]].IdReysa))
{
values.RemoveAt(i);
i--;
}
}
}
if (textBox2.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox2.Text!= Convert.ToString(List[values[i]].IdZakaza))
{
values.RemoveAt(i);
i--;
}
}
if (comboBox3.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (comboBox3.Text!= Convert.ToString(List[values[i]].PlaceNaznachenia))
{
values.RemoveAt(i);
i--;
}
}
if (comboBox4.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (comboBox4.Text!= Convert.ToString(List[values[i]].PlaceOtpravki))
{
values.RemoveAt(i);
i--;
}
}
if (textBox4.Text!= "")
for (int i = 0; i < values.Count; i++)
{
if (textBox4.Text!= Convert.ToString(List[values[i]].Cena))
{
values.RemoveAt(i);
i--;
}
}
for (int i = 0; i < values.Count; i++)
dataGridView1.Rows.Add(Convert.ToString(List[values[i]].IdBileta), Convert.ToString(List[values[i]].IdReysa), Convert.ToString(List[values[i]].IdZakaza),List[values[i]].PlaceOtpravki,List[values[i]].PlaceNaznachenia, Convert.ToString(List[values[i]].Cena), List[values[i]].SkidkaStudent, List[values[i]].SkidkaPensioner, "");
}
#endregion
private void button4_Click(object sender, EventArgs e)
{
Open_form_changeBilets();
}
#region Report
private void button5_Click(object sender, EventArgs e)
{
List<Bilets> ls3 = new List<Bilets>(); //
for (int i = 0; i < values.Count; i++) ls3.Add(List.ElementAt(values[i]));
ClassSerialiaze.SerialiazeToXml<List<Bilets>>(ref ls3, @"C:\Users\Dell\Documents\Visual Studio 2012\Projects\ \xml\Bilets.xml");
string adres = @"C:\Users\Dell\Documents\Visual Studio 2012\Projects\ \xml\Bilets.frx";
FormReport report_raspizanie = new FormReport(adres);
report_raspizanie.Show();
}
#endregion
private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8 && e.KeyChar!=44)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" : '1-9'");
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8 && e.KeyChar!= 44)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" : '1-9'");
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8 && e.KeyChar!= 44)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" : '1-9'");
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassInsertAvtopark: Form
{
public ClassInsertAvtopark()
{
InitializeComponent();
}
public List<Avtovokzal> List1 = new List<Avtovokzal>();
public List<Avtopark> List = new List<Avtopark>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
private void button2_Click(object sender, EventArgs e)
{
this.Close();
ClassAvtopark f = new ClassAvtopark();
f.Show();
}
int dc;
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
for (int i = 0; i < List1.Count; i++)
{
if (List1[i].GorodAvtovokzala == comboBox1.Text)
dc = List1[i].IdAvtovokzal;
}
}
#region
private void button1_Click(object sender, EventArgs e)
{
if ((comboBox1.Text == "") || (maskedTextBox1.Text == "") || (textBox4.Text == "") || (textBox5.Text == "") || (textBox6.Text == "") || (textBox7.Text == ""))
{
MessageBox.Show(" , !");
}
else
{
string idAvtovokzal = comboBox1.Text;
string numberAvto = maskedTextBox1.Text;
string markaAvto = textBox4.Text;
string modelAvto = textBox5.Text;
string colorAvto = textBox6.Text;
string kolichestvoMestAvto = textBox7.Text;
string QueryString = "INSERT INTO `avtopark`(`idAvtovokz`, `num_avto`, `marka`, `model`, `color`, `kolvo_mest`) VALUES('" + dc + "','" + numberAvto + "','" + markaAvto + "','" + modelAvto + "','" + colorAvto + "','" + kolichestvoMestAvto + "');";
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
int res = DB1.ExecuteNonQuery(ref sqlCon, QueryString);
MessageBox.Show(" " + Convert.ToInt32(res) + " !");
ClassAvtopark f = new ClassAvtopark();
f.Show();
this.Close();
}
}
#endregion
private void ClassInsertAvtopark_Load(object sender, EventArgs e)
{
string sSqlQuery = "SELECT * FROM avtovokzal";
DB1.Execute<Avtovokzal>(ref sqlCon, sSqlQuery, ref List1);
for (int i = 0; i < List1.Count; i++)
comboBox1.Items.Add(List1.ElementAt(i).GorodAvtovokzala);
}
private void textBox7_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" !");
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassInsertAvtovokzal: Form
{
public ClassInsertAvtovokzal()
{
InitializeComponent();
}
public List<Gorod> List2 = new List<Gorod>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
#region
private void button1_Click(object sender, EventArgs e)
{
{
if ((comboBox1.Text == "") || (textBox3.Text == "") || (maskedTextBox1.Text == "") || (textBox5.Text == ""))
{
MessageBox.Show(" , !");
}
else
{
string gorod = comboBox1.Text;
string adress = textBox3.Text;
string telefon = maskedTextBox1.Text;
string fioDirector = textBox5.Text;
string QueryString = "INSERT INTO avtovokzal(gorod, adress, telefon, fioDirector) VALUES('" + gorod + "','" + adress + "','" + telefon + "','" + fioDirector + "');";
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
int res = DB1.ExecuteNonQuery(ref sqlCon, QueryString);
MessageBox.Show(" " + Convert.ToInt32(res) + " !");
ClassAvtovokzal f = new ClassAvtovokzal();
f.Show();
this.Close();
}
}
}
#endregion
private void button2_Click(object sender, EventArgs e)
{
this.Close();
ClassAvtovokzal f = new ClassAvtovokzal();
f.Show();
}
private void ClassInsertAvtovokzal_Load(object sender, EventArgs e)
{
string ssSqlQuery = "SELECT * FROM gorod";
DB1.Execute<Gorod>(ref sqlCon, ssSqlQuery, ref List2);
for (int i = 0; i < List2.Count; ++i)
{
comboBox1.Items.Add(List2.ElementAt(i).NameGoroda);
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassInsertBilet: Form
{
public ClassInsertBilet()
{
InitializeComponent();
}
public List<Gorod> List2 = new List<Gorod>();
public List<Reyses> List1 = new List<Reyses>();
public List<ZakazBileta> List = new List<ZakazBileta>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
#region Insert Bilet
private void button1_Click(object sender, EventArgs e)
{
{
if ((comboBox1.Text == "") || (comboBox2.Text == "") || (comboBox4.Text == "") || (comboBox3.Text == "") || (textBox4.Text == ""))
MessageBox.Show(" , !");
else
{
string num_reysa = comboBox1.Text;
string num_zakaza = comboBox2.Text;
string placeOtpravki = comboBox4.Text;
string placeNaznachenia = comboBox3.Text;
string price = textBox4.Text;
string student = textBox5.Text;
string pensia = textBox6.Text;
string QueryString;
QueryString = "INSERT INTO `bilet`(`num_reysa`, `num_zakaza`, `place_otpr`, `place_nazn`, `price`, `student`, `pensia`) VALUES ('" + num_reysa + "','" + num_zakaza + "','" + placeOtpravki + "', '" + placeNaznachenia + "','" + price + "','" + student + "','" + pensia + "');";
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
int res = DB1.ExecuteNonQuery(ref sqlCon, QueryString);
MessageBox.Show(" " + Convert.ToInt32(res) + " !");
ClassBilets f = new ClassBilets();
f.Show();
this.Close();
}
}
}
#endregion
#region comboBoxes
private void ClassInsertBilet_Load(object sender, EventArgs e)
{
string ssSqlQuery = "SELECT * FROM gorod";
DB1.Execute<Gorod>(ref sqlCon, ssSqlQuery, ref List2);
for (int i = 0; i < List2.Count; ++i)
{
comboBox3.Items.Add(List2.ElementAt(i).NameGoroda);
comboBox4.Items.Add(List2.ElementAt(i).NameGoroda);
}
string sSqlQuery = "SELECT * FROM reysi";
DB1.Execute<Reyses>(ref sqlCon, sSqlQuery, ref List1);
for (int i = 0; i < List1.Count; ++i)
comboBox1.Items.Add(List1.ElementAt(i).IdReysa);
string SqlQuery = "SELECT * FROM zakazi";
DB1.Execute<ZakazBileta>(ref sqlCon, SqlQuery, ref List);
for (int i = 0; i < List.Count; ++i)
comboBox2.Items.Add(List.ElementAt(i).IdZakaza);
}
#endregion
#region
private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" !");
}
#endregion
#region " "
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
int idAvto = 0;
string hs;
if (comboBox2.Text!= "")
{
idAvto = Convert.ToInt32(comboBox2.Text);
string sqlQuery = "SELECT * FROM zakazi WHERE num_zakaza = "+idAvto;
DB1.Execute<ZakazBileta>(ref sqlCon, sqlQuery, ref List);
hs = Convert.ToString(List[List.Count-1].IdReysa);
comboBox1.Text = hs;
}
}
#endregion
#region "" "" . .
private void comboBox1_TextChanged(object sender, EventArgs e)
{
if (comboBox1.Text!= "")
{
int kol;
int numReysa = Convert.ToInt32(comboBox1.Text);
string zapros = "select sum((SELECT `kolvo_mest` FROM `reysi`, `avtopark`, `obsl_reysov` WHERE `reysi`.`num_reysa`='" + numReysa + "' and `obsl_reysov`.`idavtopark`=`avtopark`.`idavtopark` and `obsl_reysov`.`num_reysa`=`reysi`.`num_reysa`) - (SELECT count(`num_bileta`) FROM `bilet` WHERE `bilet`.`num_reysa`='" + numReysa + "')) as kol";
List<ClassRezultat_of_count> ls2 = new List<ClassRezultat_of_count>();
DB1.Execute<ClassRezultat_of_count>(ref sqlCon, zapros, ref ls2);
kol = ls2[0].Rez;
label8.Text = Convert.ToString(kol);
if (kol!= 0)
button1.Enabled = true;
else
button1.Enabled = false;
}
int idAvto = 0;
if (comboBox1.Text!= "")
{
idAvto = Convert.ToInt32(comboBox1.Text);
string ssqlQuary = "SELECT * FROM reysi WHERE num_reysa = " + idAvto;
DB1.Execute<Reyses>(ref sqlCon, ssqlQuary, ref List1);
for (int i = 0; i < List1.Count; ++i)
{
comboBox3.Text = Convert.ToString(List1.ElementAt(i).MestoNasnachenia);
comboBox4.Text = Convert.ToString(List1.ElementAt(i).MestoOtpravki);
}
}
}
#endregion
private void button2_Click(object sender, EventArgs e)
{
ClassBilets f = new ClassBilets();
f.Show();
this.Close();
}
#region ChekBoxes
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (textBox4.Text!= "")
{
if (checkBox1.Checked == true)
{
textBox5.Text = Convert.ToString(Convert.ToInt32(textBox4.Text) * 20 / 100);
textBox6.Text = "";
checkBox2.Checked = false;
}
else textBox5.Text = "";
}
else MessageBox.Show(" ");
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (textBox4.Text!= "")
{
if (checkBox2.Checked == true)
{
textBox6.Text = Convert.ToString(Convert.ToInt32(textBox4.Text) * 20 / 100);
textBox5.Text = "";
checkBox1.Checked = false;
}
else textBox6.Text = "";
}
else MessageBox.Show(" ");
}
#endregion
private void textBox4_TextChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
textBox5.Text = Convert.ToString(Convert.ToInt32(textBox4.Text) * 20 / 100);
if (checkBox2.Checked == true)
textBox6.Text = Convert.ToString(Convert.ToInt32(textBox4.Text) * 20 / 100);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassChangeAvtovokzal: Form
{
public ClassChangeAvtovokzal()
{
InitializeComponent();
}
public ClassChangeAvtovokzal(string kod_reys)
{
InitializeComponent();
textBox1.Text = kod_reys;
}
public List<Gorod> List2 = new List<Gorod>();
public List<Avtovokzal> List = new List<Avtovokzal>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
#region Update
private void button1_Click(object sender, EventArgs e)
{
string idAvtovokz = textBox1.Text;
string gorod = comboBox1.Text;
string adress = textBox2.Text;
string telefon = maskedTextBox1.Text;
string fioDirector = textBox5.Text;
string sSqlQuery = "UPDATE `avtovokzal` SET `gorod`='" + gorod + "',`adress`='" + adress + "',`telefon`='" + telefon + "',`fioDirector`='" + fioDirector + "' WHERE idAvtovokz = '" + idAvtovokz + "';";
int res = this.DB1.ExecuteNonQuery(ref this.sqlCon, sSqlQuery);
if (res <= 0)
MessageBox.Show(" ");
else
MessageBox.Show(" ");
this.Close();
}
#endregion
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
#region toolTip
private void ClassChangeAvtovokzal_Load(object sender, EventArgs e)
{
string ssSqlQuery = "SELECT * FROM gorod";
DB1.Execute<Gorod>(ref sqlCon, ssSqlQuery, ref List2);
for (int i = 0; i < List2.Count; ++i)
{
comboBox1.Items.Add(List2.ElementAt(i).NameGoroda);
}
toolTip1.SetToolTip(pictureBox1, " , . .");
}
#endregion
#region Insert to textBox data
int idAvto;
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
#endregion
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" !");
}
private void textBox1_TextChanged_1(object sender, EventArgs e)
{
if (textBox1.Text == "")
{
comboBox1.Text = "";
textBox2.Text = "";
maskedTextBox1.Text = "";
textBox5.Text = "";
}
if (textBox1.Text!= "")
{
string sSqlQuery = "SELECT * FROM avtovokzal";
DB1.Execute<Avtovokzal>(ref sqlCon, sSqlQuery, ref List);
idAvto = Convert.ToInt32(textBox1.Text);
for (int i = 0; i < List.Count; ++i)
{
if (idAvto == List.ElementAt(i).IdAvtovokzal)
{
comboBox1.Text = List.ElementAt(i).GorodAvtovokzala;
textBox2.Text = List.ElementAt(i).AdresAvtovokzala;
maskedTextBox1.Text = List.ElementAt(i).TelefonAvtovokzala;
textBox5.Text = List.ElementAt(i).FioDerectorAvtovokzala;
}
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassChangeAvtovopark: Form
{
public ClassChangeAvtovopark()
{
InitializeComponent();
}
public ClassChangeAvtovopark(string kod_reys)
{
InitializeComponent();
textBox1.Text = kod_reys;
}
public List<Avtovokzal> List1 = new List<Avtovokzal>();
public List<Avtopark> List = new List<Avtopark>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
private void ClassChangeAvtovopark_Load(object sender, EventArgs e)
{
string sSqlQuery = "SELECT * FROM avtovokzal";
DB1.Execute<Avtovokzal>(ref sqlCon, sSqlQuery, ref List1);
for (int i = 0; i < List1.Count; i++)
comboBox1.Items.Add(List1.ElementAt(i).GorodAvtovokzala);
toolTip1.SetToolTip(pictureBox1, " , . .");
}
#region Update
private void button1_Click(object sender, EventArgs e)
{
string idAvtopark = textBox1.Text;
string idAvtovokzal = comboBox1.Text;
string numberAvto = maskedTextBox1.Text;
string markaAvto = textBox4.Text;
string modelAvto = textBox5.Text;
string colorAvto = textBox6.Text;
string kolichestvoMestAvto = textBox7.Text;
string sSqlQuery = "UPDATE avtopark SET `idavtovokz`='" + dc + "',`num_avto`='" + numberAvto + "',`marka`='" + markaAvto + "',`model`='" + modelAvto + "',`color`='" + colorAvto + "', `kolvo_mest`='" + kolichestvoMestAvto + "' WHERE idavtopark = '" + idAvtopark + "';";
int res = this.DB1.ExecuteNonQuery(ref this.sqlCon, sSqlQuery);
if (res <= 0)
MessageBox.Show(" ");
else
MessageBox.Show(" ");
ClassAvtopark f = new ClassAvtopark();
f.Show();
this.Close();
}
#endregion
private void textBox1_TextChanged(object sender, EventArgs e)
{
int idAvto = 0;
if (textBox1.Text == "")
{
comboBox1.Text = "";
maskedTextBox1.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
}
if (textBox1.Text!= "")
{
string sSqlQuery = "SELECT idavtopark, gorod, num_avto, marka, model, color, kolvo_mest FROM avtopark, avtovokzal WHERE avtopark.idavtovokz = avtovokzal.idavtovokz";
DB1.Execute<Avtopark>(ref sqlCon, sSqlQuery, ref List);
idAvto = Convert.ToInt32(textBox1.Text);
for (int i = 0; i < List.Count; ++i)
{
if (idAvto == List.ElementAt(i).IdAvtopark)
{
comboBox1.Text = List.ElementAt(i).IdAvtovokzal;
maskedTextBox1.Text = List.ElementAt(i).NumberAvto;
textBox4.Text = List.ElementAt(i).MarkaAvto;
textBox5.Text = List.ElementAt(i).ModelAvto;
textBox6.Text = List.ElementAt(i).ColorAvto;
textBox7.Text = List.ElementAt(i).KolichestvoMestAvto;
}
}
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void textBox7_KeyPress(object sender, KeyPressEventArgs e)
{
bool char1 = false;
if ((e.KeyChar <= 47 || e.KeyChar >= 59) && e.KeyChar!= 8)
{
e.Handled = true;
char1 = true;
}
if (char1 == true)
MessageBox.Show(" !");
}
int dc;
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
for (int i = 0; i < List1.Count; i++)
{
if (List1[i].GorodAvtovokzala == comboBox1.Text)
dc = List1[i].IdAvtovokzal;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _
{
public partial class ClassChangeBilet: Form
{
public ClassChangeBilet()
{
InitializeComponent();
}
public ClassChangeBilet(string kod_reys)
{
InitializeComponent();
textBox1.Text = kod_reys;
}
public List<Gorod> List6 = new List<Gorod>();
public List<Reyses> List5 = new List<Reyses>();
public List<ZakazBileta> List4 = new List<ZakazBileta>();
public string sSqlQuery = "SELECT * FROM bilet";
public List<Bilets> List = new List<Bilets>();
ClassSetupProgram sqlCon = new ClassSetupProgram();
ClassDataBase DB1 = new ClassDataBase();
List<int> values = new List<int>();