Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     String[] dane = new String[3];
     maxLabel.Text = Application["Max_pozyczka"].ToString() + " $";
     if (Session["User_id"] != null)
     {
         dane           = tools.pobierzKredyt(Int32.Parse(Session["User_id"].ToString()));
         sumaLabel.Text = dane[0].ToString() + " $";
         allSqlDataSource.SelectParameters.Add("id_uzytkownika", Session["User_id"].ToString());
     }
 }
Exemplo n.º 2
0
 protected void zatwierdzLinkButton_Click(object sender, EventArgs e)
 {
     String[] dane = new String[3];
     if (numerDropDownList.SelectedItem.Value != "-1")
     {
         if (Int32.Parse(iloscTextBox.Text) > 0 && Int32.Parse(iloscTextBox.Text) < (int)Application["Max_pozyczka"])
         {
             dane = tools.pobierzKredyt(Int32.Parse(Session["User_id"].ToString()));
             int suma = Int32.Parse(dane[0]) + Int32.Parse(iloscTextBox.Text);
             if (suma < (int)Application["Max_pozyczka"])
             {
                 int    kwota    = Int32.Parse(iloscTextBox.Text);
                 int    a        = kredyt[(Int32.Parse(numerDropDownList.SelectedItem.Value) - 1), 0];
                 int    b        = kredyt[(Int32.Parse(numerDropDownList.SelectedItem.Value) - 1), 1];
                 int    czas     = kredyt[Int32.Parse(numerDropDownList.SelectedItem.Value) - 1, 0];
                 double odsetkiD = Math.Ceiling((double)kwota / (double)czas * (100 + (double)(kredyt[(Int32.Parse(numerDropDownList.SelectedItem.Value) - 1), 1])) / 100);
                 int    odsetki  = Convert.ToInt32(odsetkiD);
                 tools.wezKredyt(kwota, odsetki, czas, Session["User_id"].ToString());
                 Response.Redirect(Request.RawUrl);
                 komunikatLabel.Visible = true;
                 komunikatLabel.Text    = "Poprawnie wzięto kredyt.";
             }
             else
             {
                 komunikatLabel.Visible = true;
                 komunikatLabel.Text    = "Suma Twoich pożyczek przekracza dozwoloną ilość.";
             }
         }
         else
         {
             komunikatLabel.Visible = true;
             komunikatLabel.Text    = "Możliwy przedział kredytu 0-" + (int)Application["Max_pozyczka"] + " $";
         }
     }
     else
     {
         komunikatLabel.Visible = true;
         komunikatLabel.Text    = "Wybierz numer pożyczki";
     }
 }