コード例 #1
0
ファイル: Form1.cs プロジェクト: SemikAlexander/Estimation
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(CoursePrise.Text) == false & string.IsNullOrWhiteSpace(SumPrise.Text) == false)
            {
                switch (ChoiseCurrency.SelectedIndex)
                {
                case 0:
                    source.AddData(CoursePrise.Text, SumPrise.Text, 0, act);
                    FillingTable();
                    break;

                case 1:
                    source.AddData(CoursePrise.Text, SumPrise.Text, 1, act);
                    FillingTable();
                    break;

                case 2:
                    source.AddData(CoursePrise.Text, SumPrise.Text, 2, act);
                    FillingTable();
                    break;
                }
                CoursePrise.Text = SumPrise.Text = "";
                SumPrise.Focus();
            }
            else
            {
                MessageBox.Show("Не все поля заполнены!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
コード例 #2
0
        private void AddBoughtCurrency_Click(object sender, EventArgs e)
        {
            if (ChoiseCurrency.SelectedIndex != 3)
            {
                if (string.IsNullOrWhiteSpace(CoursePrise.Text) == false & string.IsNullOrWhiteSpace(SumPrise.Text) == false)
                {
                    switch (ChoiseCurrency.SelectedIndex)
                    {
                    case 0:
                        source.AddData(CoursePrise.Text, SumPrise.Text, 0);
                        FillingTable();
                        break;

                    case 1:
                        source.AddData(CoursePrise.Text, SumPrise.Text, 1);
                        FillingTable();
                        break;

                    case 2:
                        source.AddData(CoursePrise.Text, SumPrise.Text, 2);
                        FillingTable();
                        break;
                    }
                    CoursePrise.Text = SumPrise.Text = "";
                    SumPrise.Focus();
                    toolStripLabel1.Text = $"Начало дня ({ChoiseCurrency.SelectedItem.ToString()} = {source.GetStartSumInCurrency(ChoiseCurrency.SelectedIndex)})";/* ({source.GetStartSum(ChoiseCurrency.SelectedIndex)}руб)*/
                }
                else
                {
                    MessageBox.Show("Не все поля заполнены!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            else
            {
                source.startRub  = Convert.ToInt32(SumPrise.Text);
                CoursePrise.Text = SumPrise.Text = "";
                SumPrise.Focus();
                toolStripLabel1.Text = $"Начало дня ({ChoiseCurrency.SelectedItem.ToString()} = {source.startRub})";
            }
        }