Add files via upload

This commit is contained in:
Андрей 2020-01-27 15:33:31 +03:00 committed by GitHub
parent af04b8bc7d
commit b40f5743a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 122 additions and 84 deletions

View file

@ -33,6 +33,7 @@
this.тарифToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.тарифToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.обновитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.обновитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.фильтрToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.фильтрToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.фильтрацияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.выходToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.выходToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.параметрыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.параметрыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.регионToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.регионToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -87,7 +88,6 @@
this.numericUpDown6 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
this.checkedListBox1 = new System.Windows.Forms.CheckedListBox(); this.checkedListBox1 = new System.Windows.Forms.CheckedListBox();
this.button7 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button();
this.фильтрацияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
@ -129,7 +129,7 @@
// обновитьToolStripMenuItem // обновитьToolStripMenuItem
// //
this.обновитьToolStripMenuItem.Name = "обновитьToolStripMenuItem"; this.обновитьToolStripMenuItem.Name = "обновитьToolStripMenuItem";
this.обновитьToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.обновитьToolStripMenuItem.Size = new System.Drawing.Size(128, 22);
this.обновитьToolStripMenuItem.Text = "Обновить"; this.обновитьToolStripMenuItem.Text = "Обновить";
this.обновитьToolStripMenuItem.Click += new System.EventHandler(this.обновитьToolStripMenuItem_Click); this.обновитьToolStripMenuItem.Click += new System.EventHandler(this.обновитьToolStripMenuItem_Click);
// //
@ -138,13 +138,19 @@
this.фильтрToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.фильтрToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.фильтрацияToolStripMenuItem}); this.фильтрацияToolStripMenuItem});
this.фильтрToolStripMenuItem.Name = "фильтрToolStripMenuItem"; this.фильтрToolStripMenuItem.Name = "фильтрToolStripMenuItem";
this.фильтрToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.фильтрToolStripMenuItem.Size = new System.Drawing.Size(128, 22);
this.фильтрToolStripMenuItem.Text = "Фильтр"; this.фильтрToolStripMenuItem.Text = "Фильтр";
// //
// фильтрацияToolStripMenuItem
//
this.фильтрацияToolStripMenuItem.Name = "фильтрацияToolStripMenuItem";
this.фильтрацияToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
this.фильтрацияToolStripMenuItem.Text = "Фильтрация";
//
// выходToolStripMenuItem // выходToolStripMenuItem
// //
this.выходToolStripMenuItem.Name = "выходToolStripMenuItem"; this.выходToolStripMenuItem.Name = "выходToolStripMenuItem";
this.выходToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.выходToolStripMenuItem.Size = new System.Drawing.Size(128, 22);
this.выходToolStripMenuItem.Text = "Выход"; this.выходToolStripMenuItem.Text = "Выход";
this.выходToolStripMenuItem.Click += new System.EventHandler(this.CloseProgram); this.выходToolStripMenuItem.Click += new System.EventHandler(this.CloseProgram);
// //
@ -308,7 +314,7 @@
this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(775, 287); this.tabPage2.Size = new System.Drawing.Size(760, 287);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Сравнение"; this.tabPage2.Text = "Сравнение";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
@ -318,7 +324,7 @@
this.tabPage3.Controls.Add(this.tableLayoutPanel1); this.tabPage3.Controls.Add(this.tableLayoutPanel1);
this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(775, 287); this.tabPage3.Size = new System.Drawing.Size(760, 287);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Панель сайтов"; this.tabPage3.Text = "Панель сайтов";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
@ -328,7 +334,7 @@
this.tableLayoutPanel1.ColumnCount = 3; this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 47.62886F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 47.62886F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 52.37114F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 52.37114F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 238F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 239F));
this.tableLayoutPanel1.Controls.Add(this.button1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.button1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.button2, 1, 0); this.tableLayoutPanel1.Controls.Add(this.button2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.button3, 2, 0); this.tableLayoutPanel1.Controls.Add(this.button3, 2, 0);
@ -351,7 +357,7 @@
this.button1.ImageAlign = System.Drawing.ContentAlignment.TopCenter; this.button1.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.button1.Location = new System.Drawing.Point(3, 3); this.button1.Location = new System.Drawing.Point(3, 3);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(228, 139); this.button1.Size = new System.Drawing.Size(227, 139);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "MegaFon"; this.button1.Text = "MegaFon";
this.button1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.button1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
@ -363,7 +369,7 @@
this.button2.BackgroundImage = global::Tariffs.Properties.Resources.logotip_mts; this.button2.BackgroundImage = global::Tariffs.Properties.Resources.logotip_mts;
this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.button2.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.button2.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button2.Location = new System.Drawing.Point(237, 3); this.button2.Location = new System.Drawing.Point(236, 3);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(251, 139); this.button2.Size = new System.Drawing.Size(251, 139);
this.button2.TabIndex = 1; this.button2.TabIndex = 1;
@ -378,7 +384,7 @@
this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.button3.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.button3.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); this.button3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.button3.Location = new System.Drawing.Point(494, 3); this.button3.Location = new System.Drawing.Point(493, 3);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(233, 139); this.button3.Size = new System.Drawing.Size(233, 139);
this.button3.TabIndex = 2; this.button3.TabIndex = 2;
@ -394,7 +400,7 @@
this.button4.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.button4.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button4.Location = new System.Drawing.Point(3, 148); this.button4.Location = new System.Drawing.Point(3, 148);
this.button4.Name = "button4"; this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(228, 136); this.button4.Size = new System.Drawing.Size(227, 136);
this.button4.TabIndex = 3; this.button4.TabIndex = 3;
this.button4.Text = "Tele2"; this.button4.Text = "Tele2";
this.button4.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.button4.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
@ -406,7 +412,7 @@
this.button5.BackgroundImage = global::Tariffs.Properties.Resources.logotip_tinkoff_mobile; this.button5.BackgroundImage = global::Tariffs.Properties.Resources.logotip_tinkoff_mobile;
this.button5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.button5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.button5.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.button5.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button5.Location = new System.Drawing.Point(237, 148); this.button5.Location = new System.Drawing.Point(236, 148);
this.button5.Name = "button5"; this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(251, 136); this.button5.Size = new System.Drawing.Size(251, 136);
this.button5.TabIndex = 4; this.button5.TabIndex = 4;
@ -418,7 +424,7 @@
// button6 // button6
// //
this.button6.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.button6.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button6.Location = new System.Drawing.Point(494, 148); this.button6.Location = new System.Drawing.Point(493, 148);
this.button6.Name = "button6"; this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(233, 136); this.button6.Size = new System.Drawing.Size(233, 136);
this.button6.TabIndex = 5; this.button6.TabIndex = 5;
@ -740,12 +746,7 @@
this.button7.TabIndex = 56; this.button7.TabIndex = 56;
this.button7.Text = "Фильтрация"; this.button7.Text = "Фильтрация";
this.button7.UseVisualStyleBackColor = true; this.button7.UseVisualStyleBackColor = true;
// this.button7.Click += new System.EventHandler(this.button7_Click);
// фильтрацияToolStripMenuItem
//
this.фильтрацияToolStripMenuItem.Name = "фильтрацияToolStripMenuItem";
this.фильтрацияToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.фильтрацияToolStripMenuItem.Text = "Фильтрация";
// //
// Form1 // Form1
// //

View file

@ -9,18 +9,21 @@ namespace Tariffs
{ {
private int arrlenght = 50; private int arrlenght = 50;
private struct Filter public struct Filter
{ {
String[] operators; public String[] operators;
int min_minutes; public int min_minutes;
int max_minutes; public int max_minutes;
int min_sms; public int min_sms;
int max_sms; public int max_sms;
int min_pay; public int min_inet;
int max_pay; public int max_inet;
public int min_pay;
public int max_pay;
} }
public Form1() public Form1()
@ -139,63 +142,13 @@ namespace Tariffs
private void ReadListFile() private void ReadListFile()
{ {
StreamReader listfile = new StreamReader("list.txt"); ReadListFile(new Filter());
String firststr = listfile.ReadLine();
String[,] tariffsArr = new String[arrlenght, 8];
String line;
int i = 0;
if (!(firststr == "Tariffs"))
{
MessageBox.Show("Неверный тип файла!\n\n" +
"Так как невозможно загрузить тарифы,\n" +
"приложение будет закрыто.",
"Ошибка",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
listfile.Close();
Close();
}
line = listfile.ReadLine();
while (line != "End")
{
if (!(line.StartsWith("#")) && line != "" && line != null)
{
for (int ind = 1; ind < 7; ind++)
{
tariffsArr[i, ind] = line.Split(new char[] { ',' })[ind - 1];
}
}
line = listfile.ReadLine();
i++;
}
for (int rowind = 0; rowind < 50; rowind++)
{
tariffsArr[rowind, 0] = "false";
}
listfile.Close();
String[] rowsArray = new String[8];
dataGridView1.Rows.Clear();
for (int elind = 0; elind < 50; elind++)
{
for (int propind = 0; propind < 8; propind++)
{
rowsArray[propind] = tariffsArr[elind, propind];
}
_ = dataGridView1.Rows.Add(rowsArray);
}
} }
private void ReadListFile(Filter filt_params) private void ReadListFile(Filter filt_params)
{ {
dataGridView1.Rows.Clear();
dataGridView1.RowCount = 1;
StreamReader listfile = new StreamReader("list.txt"); StreamReader listfile = new StreamReader("list.txt");
String firststr = listfile.ReadLine(); String firststr = listfile.ReadLine();
String[,] tariffsArr = new String[arrlenght, 8]; String[,] tariffsArr = new String[arrlenght, 8];
@ -221,7 +174,7 @@ namespace Tariffs
{ {
if (!(line.StartsWith("#")) && line != "" && line != null) if (!(line.StartsWith("#")) && line != "" && line != null)
{ {
for (int ind = 1; ind < 7; ind++) for (int ind = 1; ind < 8; ind++)
{ {
tariffsArr[i, ind] = line.Split(new char[] { ',' })[ind - 1]; tariffsArr[i, ind] = line.Split(new char[] { ',' })[ind - 1];
} }
@ -231,7 +184,7 @@ namespace Tariffs
i++; i++;
} }
for (int rowind = 0; rowind < 50; rowind++) for (int rowind = 0; rowind < i; rowind++)
{ {
tariffsArr[rowind, 0] = "false"; tariffsArr[rowind, 0] = "false";
} }
@ -240,14 +193,91 @@ namespace Tariffs
String[] rowsArray = new String[8]; String[] rowsArray = new String[8];
for (int elind = 0; elind < 50; elind++) for (int elind = 0; elind < i; elind++)
{ {
propind = 0;
while (propind < 8) while (propind < 8)
{ {
rowsArray[propind] = tariffsArr[elind, propind]; rowsArray[propind] = tariffsArr[elind, propind];
propind++; propind++;
} }
_ = dataGridView1.Rows.Add(rowsArray);
bool needToAdd = true;
int x;
//mins
if (filt_params.min_minutes > 0 &&
rowsArray[3] != null &&
Int32.TryParse(rowsArray[3], out x) &&
Convert.ToInt32(rowsArray[3]) > filt_params.min_minutes)
{
needToAdd = false;
}
if (filt_params.max_minutes > 0 &&
rowsArray[3] != null &&
Int32.TryParse(rowsArray[3], out x) &&
Convert.ToInt32(rowsArray[3]) > filt_params.max_minutes)
{
needToAdd = false;
}
//sms
if (filt_params.min_sms > 0 &&
rowsArray[4] != null &&
Int32.TryParse(rowsArray[4], out x) &&
Convert.ToInt32(rowsArray[4]) > filt_params.min_sms)
{
needToAdd = false;
}
if (filt_params.max_sms > 0 &&
rowsArray[4] != null &&
Int32.TryParse(rowsArray[4], out x) &&
Convert.ToInt32(rowsArray[4]) > filt_params.max_sms)
{
needToAdd = false;
}
//internet
if (filt_params.min_inet > 0 &&
rowsArray[6] != null &&
Int32.TryParse(rowsArray[6], out x) &&
Convert.ToInt32(rowsArray[6]) > filt_params.min_inet)
{
needToAdd = false;
}
if (filt_params.max_inet > 0 &&
rowsArray[6] != null &&
Int32.TryParse(rowsArray[6], out x) &&
Convert.ToInt32(rowsArray[6]) > filt_params.max_inet)
{
needToAdd = false;
}
//pay
if (filt_params.min_pay > 0 &&
rowsArray[7] != null &&
Int32.TryParse(rowsArray[7], out x) &&
Convert.ToInt32(rowsArray[7]) > filt_params.min_pay)
{
needToAdd = false;
}
if (filt_params.max_pay > 0 &&
rowsArray[7] != null &&
Int32.TryParse(rowsArray[7], out x) &&
Convert.ToInt32(rowsArray[7]) > filt_params.max_pay)
{
needToAdd = false;
}
//adding
if (needToAdd)
{
_ = dataGridView1.Rows.Add(rowsArray);
}
} }
} }
@ -286,5 +316,12 @@ namespace Tariffs
{ {
ReadListFile(); ReadListFile();
} }
private void button7_Click(object sender, EventArgs e)
{
Filter filt = new Filter();
filt.max_minutes = Convert.ToInt32(numericUpDown1.Value);
ReadListFile(filt);
}
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.