97 lines
2.9 KiB
C#
97 lines
2.9 KiB
C#
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 Cukraszda
|
|
{
|
|
public partial class Rendelo : Form
|
|
{
|
|
|
|
bool nincsjelolve;
|
|
String[,] sutiktomb;
|
|
public Rendelo()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void setSuti(String[,] tomb)
|
|
{
|
|
sutiktomb = tomb;
|
|
for (int i = 0; i < tomb.GetLength(0); i++)
|
|
{
|
|
CheckBox cb = new CheckBox();
|
|
cb.Size = new Size(300,25);
|
|
cb.Text = tomb[i,0]+" ("+tomb[i,1]+" Ft)";
|
|
tableLayoutPanel1.Controls.Add(cb, 0, i);
|
|
|
|
TextBox tb = new TextBox();
|
|
tb.Size = new Size(30, 25);
|
|
tableLayoutPanel1.Controls.Add(tb, 1, i);
|
|
tb.Tag = tomb[i, 1];
|
|
cb.Tag = tb;
|
|
|
|
Label label = new Label();
|
|
label.Text = " adag";
|
|
tableLayoutPanel1.Controls.Add(label, 2, i);
|
|
}
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
nincsjelolve = true;
|
|
foreach (var item in tableLayoutPanel1.Controls)
|
|
{
|
|
if ( item is CheckBox)
|
|
{
|
|
if( (item as CheckBox).Checked) nincsjelolve=false;
|
|
|
|
}
|
|
}
|
|
if (nincsjelolve) MessageBox.Show("Nincs jelölt süti!", "Hiba!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
|
|
private void sToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
button1_Click(sender, e);
|
|
if(!nincsjelolve)
|
|
{
|
|
string[] sorok = new string[tableLayoutPanel1.RowCount+10];
|
|
sorok[0] = "SZÁMLA";
|
|
sorok[1] = "";
|
|
int sox = 2;
|
|
foreach (var item in tableLayoutPanel1.Controls)
|
|
{
|
|
|
|
if (item is CheckBox)
|
|
{
|
|
CheckBox cb = (CheckBox)item;
|
|
if (cb.Checked)
|
|
{
|
|
TextBox tb = (TextBox)cb.Tag;
|
|
if (tb.Text.Length>0)
|
|
{
|
|
int darab = int.Parse(tb.Text);
|
|
int ear = int.Parse((String)tb.Tag);
|
|
sorok[sox] = $"{cb.Text,-50} {ear,4} {darab,2} db {darab*ear,6}";
|
|
sox++;
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
richTextBox1.Lines = sorok;
|
|
richTextBox1.Visible = true;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|