Example #1
0
        private void buttonPay_Click(object sender, EventArgs e)
        {
            BaseDataLite bd     = new BaseDataLite();
            DataTable    loantb = bd.GetLoanbyID(bd, textBox1.Text);

            if (loantb != null)
            {
                BClaim claim = new BClaim();
                claim = BaseDataLite.FillClaim(Convert.ToInt32(textBox1.Text), bd);
                NotificationWindow window = new NotificationWindow($"{claim.Id}", claim.SumLoan, claim.Days, $"{claim.SumPaid}", "Оплатить");
                DialogResult       result = window.ShowDialog();
                if (result == DialogResult.Yes)
                {
                    try
                    {
                        if ((Convert.ToInt32(NotificationWindow.text) + claim.PaidOut) > claim.SumPaid)
                        {
                            MessageBox.Show("Сумма оплаты приведет к переплате по займу.\nВведите меньшую сумму", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            BaseDataLite.SendPayment(claim.Id, Convert.ToInt32(NotificationWindow.text));
                            MessageBox.Show($"Ваша оплата принята в обработку\nP.s здесь должна быть оплата счета.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            BaseDataLite.AutoCloseClaim(claim.Id);
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Ой, что-то пошло не так ;(", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #2
0
        private void buttonFindClaim_Click(object sender, EventArgs e)
        {
            BaseDataLite bd    = new BaseDataLite();
            BClaim       claim = new BClaim();

            if (!String.IsNullOrEmpty(textBox1.Text))
            {
                DataTable loantb = bd.GetLoanbyID(bd, textBox1.Text);
                if (loantb != null)
                {
                    claim = BaseDataLite.FillClaim(Convert.ToInt32(textBox1.Text), bd);
                    labelClaimSumLoan.Text = $"{claim.SumLoan} руб.";
                    double proc = 1.0;
                    if (claim.SumLoan > 35000)
                    {
                        proc = 2.0;
                    }
                    double sumfine = (double)claim.SumLoan * (proc / 100.0) * (double)claim.Fine;
                    labelClaimSumPaid.Text   = $"{claim.SumPaid} руб.\nвключая штраф:{sumfine}руб.({(sumfine / claim.SumLoan) * 100}%)";
                    labelClaimFineDays.Text  = $"{claim.Fine} дня";
                    labelClaimPiadout.Text   = $"{claim.PaidOut} руб.";
                    labelClaimStatus.Text    = $"{claim.status}";
                    labelClaimDays.Text      = $"{claim.Days} дней до {claim.LastDate.ToString("d")}";
                    labelClaimFirstDate.Text = $"{claim.FirstDate.ToString("d")}";
                    switch (labelClaimStatus.Text.ToLower())
                    {
                    case "открыто":
                        labelClaimStatus.ForeColor = Color.FromArgb(236, 214, 22);
                        buttonPay.Enabled          = false;
                        break;

                    case "принято":
                        labelClaimStatus.ForeColor = Color.FromArgb(44, 218, 65);
                        buttonPay.Enabled          = true;
                        break;

                    case "закрыто":
                        labelClaimStatus.ForeColor = Color.FromArgb(140, 140, 140);
                        buttonPay.Enabled          = false;
                        break;

                    case "отклонено":
                        labelClaimStatus.ForeColor = Color.FromArgb(180, 37, 23);
                        buttonPay.Enabled          = false;
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    MessageBox.Show("Займ не найден!", "Займ не найден", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Строка пуста!", "Пустая строка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #3
0
 private void buttonCloseClaim_Click(object sender, EventArgs e)
 {
     if (labelStatus.Text == "принято")
     {
         buttonCloseClaim.Enabled = true;
         DialogResult dialogResult = MessageBox.Show("Вы уверены что хотитие закрыть заявку ?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         if (dialogResult == DialogResult.OK)
         {
             BaseDataLite.SetNewStatus(Convert.ToInt32(labelLoanID.Text.Substring(1)), "закрыто");
             MessageBox.Show("Заявка закрыта", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
             labelStatus.ForeColor = Color.FromArgb(140, 140, 140);
             labelStatus.Text      = "закрыто";
             DataBase.GeneralMessages.SendEmailNewStatus(labelEmail.Text, "закрыто", labelName.Text, BaseDataLite.FillClaim(Convert.ToInt32(labelLoanID.Text.Substring(1)), bd));
         }
     }
 }
Example #4
0
        private void buttonSendDecision_Click(object sender, EventArgs e)
        {
            DecideForm   f      = new DecideForm();
            DialogResult result = f.ShowDialog();

            try
            {
                if (result == DialogResult.Yes)
                {
                    BaseDataLite.SetNewStatus(Convert.ToInt32(labelLoanID.Text.Substring(1)), "принято");
                    buttonSendDecision.Enabled = false;
                    MessageBox.Show("Заявка принята", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    labelStatus.ForeColor = Color.FromArgb(44, 218, 65);
                    labelStatus.Text      = "принято";
                    DataBase.GeneralMessages.SendEmailNewStatus(labelEmail.Text, "принято", labelName.Text, BaseDataLite.FillClaim(Convert.ToInt32(labelLoanID.Text.Substring(1)), bd));
                }
                else if (result == DialogResult.No)
                {
                    BaseDataLite.SetNewStatus(Convert.ToInt32(labelLoanID.Text.Substring(1)), "отклонено");
                    buttonSendDecision.Enabled = false;
                    MessageBox.Show("Заявка отклонена", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    labelStatus.ForeColor = Color.FromArgb(180, 37, 23);
                    labelStatus.Text      = "отклонено";
                    DataBase.GeneralMessages.SendEmailNewStatus(labelEmail.Text, "отклонено", labelName.Text, BaseDataLite.FillClaim(Convert.ToInt32(labelLoanID.Text.Substring(1)), bd));
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ой, что-то пошло не так ;(", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        private void buttonOpenClaim_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(textBoxIDClaim.Text))
            {
                DataTable loantb = bd.GetLoanbyID(bd, $"{textBoxIDClaim.Text}");
                if (loantb != null)
                {
                    try
                    {
                        DataTable usertb = bd.GetUserbyID(bd, $"{Convert.ToInt32(loantb.Rows[0][5])}");
                        groupBox1.Enabled = true;
                        #region claimdata
                        //GetDataFromBD
                        claim = BaseDataLite.FillClaim(Convert.ToInt32(textBoxIDClaim.Text), bd);
                        //Write data to claim interface
                        labelLoanID.Text     = $"№{claim.Id}";
                        lableLoanSum.Text    = $"{claim.SumLoan}";
                        labelDays.Text       = $"{claim.Days}";
                        lableFineDays.Text   = $"{claim.Fine}";
                        labelCardNumber.Text = $"{claim.CardNumber}";
                        labelType.Text       = claim.type.ToLower();;
                        labelStatus.Text     = claim.status.ToLower();
                        double proc = 1.0;
                        if (claim.SumLoan > 35000)
                        {
                            proc = 2.0;
                        }
                        double sumfine = (double)claim.SumLoan * (proc / 100.0) * (double)claim.Fine;
                        labelPaidOUT.Text = $"{claim.PaidOut}/{claim.SumPaid} \nвключая штраф:{sumfine}руб.({(sumfine/claim.SumLoan)*100}%)";
                        #endregion
                        #region userdata
                        //GetDataFromBD
                        user.Id          = Convert.ToInt32(loantb.Rows[0][5]);
                        user.Name        = Convert.ToString(usertb.Rows[0][1]);
                        user.SecoundName = Convert.ToString(usertb.Rows[0][2]);
                        user.MiddleName  = Convert.ToString(usertb.Rows[0][3]);
                        user.Passport    = Convert.ToString(usertb.Rows[0][7]);
                        user.BirthDay    = Convert.ToDateTime(usertb.Rows[0][4]);
                        user.Phone       = Convert.ToString(usertb.Rows[0][5]);
                        user.Email       = Convert.ToString(usertb.Rows[0][6]);
                        //Write data to claim interface
                        labelClientId.Text = $"{user.Id}";
                        labelName.Text     = $"{user.SecoundName} {user.Name} {user.MiddleName}";
                        labelPass.Text     = user.Passport;
                        labelBirthday.Text = user.BirthDay.ToString("d");
                        labelPhone.Text    = user.Phone.ToString();
                        labelEmail.Text    = user.Email;
                        #endregion
                    }
                    catch (Exception)
                    {
                        groupBox1.Enabled = false;
                        MessageBox.Show("Ой, что-то пошло не так ;(", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    if (Convert.ToInt32(lableFineDays.Text) > 0)
                    {
                        lableFineDays.ForeColor = Color.FromArgb(180, 37, 23);
                        label12.ForeColor       = Color.FromArgb(180, 37, 23);
                    }
                    switch (labelStatus.Text.ToLower())
                    {
                    case "открыто":
                        labelStatus.ForeColor      = Color.FromArgb(236, 214, 22);
                        buttonSendDecision.Enabled = true;
                        buttonAddFine.Enabled      = false;
                        buttonCloseClaim.Enabled   = false;
                        break;

                    case "принято":
                        labelStatus.ForeColor      = Color.FromArgb(44, 218, 65);
                        buttonSendDecision.Enabled = false;
                        buttonAddFine.Enabled      = true;
                        buttonCloseClaim.Enabled   = true;
                        break;

                    case "закрыто":
                        labelStatus.ForeColor      = Color.FromArgb(140, 140, 140);
                        buttonSendDecision.Enabled = false;
                        buttonAddFine.Enabled      = false;
                        buttonCloseClaim.Enabled   = false;
                        break;

                    case "отклонено":
                        labelStatus.ForeColor      = Color.FromArgb(180, 37, 23);
                        buttonSendDecision.Enabled = false;
                        buttonAddFine.Enabled      = true;
                        buttonCloseClaim.Enabled   = false;
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    MessageBox.Show("Займ не найден!", "Займ не найден", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Строка пуста!", "Пустая строка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        } // Отрисовка заявки