Пример #1
0
        private void btnExpens_Click(object sender, EventArgs e)
        {
            Expenses exp = new Expenses();

            string Expensess = txtExpensePlusVat.Text;

            if (dateTimePickerExpenss.Checked == true)
            {
                if (cboExpensKind.SelectedIndex != -1)
                {
                    value = cboExpensKind.SelectedIndex;

                    if (double.TryParse(Expensess, out _expensess))
                    {
                        lblMessageExpense.Text = null;

                        exp._dateTimePickerExpenss = dateTimePickerExpenss.Value.ToString("MM/yyyy");
                        exp.expensessAmount        = _expensess;

                        switch (value)
                        {
                        case 0:
                            exp.txtDescripitionExpense = " החזר מלא = " + txtDescripitionExpense.Text;
                            //החזר מס
                            exp.refundExpenses = _expensess;
                            break;

                        case 1:
                            exp.txtDescripitionExpense = "אין החזר  " + txtDescripitionExpense.Text;
                            //החזר מס
                            exp.refundExpenses = 0;
                            break;

                        case 2:
                            exp.txtDescripitionExpense = "החזר 45% = " + txtDescripitionExpense.Text;
                            //החזר מס
                            exp.refundExpenses = _expensess * 0.45;
                            break;

                        case 3:
                            exp.txtDescripitionExpense = "החזר 66% = " + txtDescripitionExpense.Text;
                            //החזר מס
                            exp.refundExpenses = _expensess * 0.66;
                            break;

                        case 4:
                            exp.txtDescripitionExpense = "החזר 20% = " + txtDescripitionExpense.Text;
                            //החזר מס
                            exp.refundExpenses = _expensess * 0.2;
                            break;

                        default:
                            break;
                        }

                        //saving to the list.
                        WriteAndReadExpenseArray.Add(exp);

                        //message saving to the list.
                        lblExpenseMsgResult.Text = ":) ההוצאה נשמרה במערכת";

                        //Refresh expense.
                        txtDescripitionExpense.Clear();
                        txtExpensePlusVat.Clear();
                        cboExpensKind.SelectedIndex   = -1;
                        lblCboExpenssKind.Text        = "";
                        lblDateTimePicker.Text        = "";
                        dateTimePickerExpenss.Checked = false;
                        //Refresh incom.
                        txtIncomePlusVat.Clear();
                        txtDescripitionIncome.Clear();
                        lblIncomMessage.Text       = null;
                        lblIncomeResult.Text       = null;
                        lblIncomeMesseageDate.Text = null;
                    }

                    else
                    {
                        lblExpenseMsgResult.Text = null;
                        lblMessageExpense.Text   = "הכנס רק מספרים *";
                    }
                }

                else
                {
                    lblCboExpenssKind.Text = "בחר סוג הוצאה";
                }
            }

            else
            {
                lblDateTimePicker.Text = "בחר תאריך הוצאה";
            }
        }
Пример #2
0
        private void BMSoftware_Load(object sender, EventArgs e)
        {
            string line;

            MessageBox.Show("All rights reserved © \n to \n ELIYAHU DADIA.", "הודעה חשובה");

            //read expensse.

            if (File.Exists("Report expensess.txt"))
            {
                TextReader _txtReaderExpensess = new StreamReader("Report expensess.txt", Encoding.UTF8);

                while ((line = _txtReaderExpensess.ReadLine()) != null) //0 first line
                {
                    Expenses newExp = new Expenses();
                    newExp._dateTimePickerExpenss = line;

                    line = _txtReaderExpensess.ReadLine(); //1
                    newExp.expensessAmount = Double.Parse(line);

                    line = _txtReaderExpensess.ReadLine(); //2
                    newExp.txtDescripitionExpense = line;

                    line = _txtReaderExpensess.ReadLine(); //3
                    newExp.refundExpenses = Double.Parse(line);

                    // do nothing with line becuase it is just separator ----
                    line = _txtReaderExpensess.ReadLine(); //4

                    WriteAndReadExpenseArray.Add(newExp);
                }

                _txtReaderExpensess.Close();
            }

            //read incomes.

            if (File.Exists("Report incoms.txt"))
            {
                TextReader _txtReaderIncoms = new StreamReader("Report incoms.txt", Encoding.UTF8);

                while ((line = _txtReaderIncoms.ReadLine()) != null) //0 first line
                {
                    Incomes newInc = new Incomes();
                    newInc._dateTimePickerIncomes = line;

                    line = _txtReaderIncoms.ReadLine(); //1
                    newInc.incomesAmount = Double.Parse(line);

                    line = _txtReaderIncoms.ReadLine(); //2
                    newInc.txtDescripitionIcomes = line;

                    // do nothing with line becuase it is just separator ----
                    line = _txtReaderIncoms.ReadLine(); //3

                    WriteAndReadIncomeArray.Add(newInc);
                }

                _txtReaderIncoms.Close();
            }

            writeAfterRead++;
        }