protected void Page_Load(object sender, EventArgs e) { Label1.Text = "Mr:" + " " + Login_page.getParentNameFromDatabase(); Label_QChild.Text = "Quantity Of Children : " + " " + GetChildQuantity().ToString(); Label2.Text = "Total Amount :" + " " + GetTotalAmount().ToString() + " " + "£"; date = DateTime.Now.ToString("dd.MM.yyy"); LabelDate.Text = date; TextBox3.Text = CurrencyConvertor().ToString(); }
protected void Page_Load(object sender, EventArgs e) { test_date = DateTime.Now.ToString("dd.MM.yyy"); DateTime dt = DateTime.Now; test_time = dt.ToShortTimeString(); Label19.Text = "Welcome" + " " + Login_page.getChildNameFromDatabase(); lblUsername.Text = " " + totalPonits.ToString(); lbltime.Text = "Time :" + " " + test_time; lbldate.Text = "Date :" + " " + test_date; }
protected void Page_Load(object sender, EventArgs e) { Label19.Text = "Welcome " + " " + Login_page.getParentNameFromDatabase(); if (GetDataFromGridView().Rows.Count == 0) { Label20.Text = "No Child Record Found!!"; } else { GetDataFromGridView(); } }
protected void Button1_payment(object sender, EventArgs e) { try { Parent_ID = Login_page.getParentIDFromDatabase(); Parent_name = Label1.Text; ChildrenQ = GetChildQuantity().ToString(); Total_Amount = GetTotalAmount().ToString(); payment_date = LabelDate.Text; inserted_amount = TextBox3.Text; SqlConnection conn = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\tumi\source\repos\LearnOnlineSystem\LearnOnlineSystem\App_Data\Learn_Online_System.mdf; Integrated Security = True"); conn.Open(); SqlCommand cmd = new SqlCommand("INSERT into payment (Parent_ID,Parent_name,ChildrenQ,Total_Amount,payment_date,inserted_amount)values (@Parent_ID,@Parent_name,@ChildrenQ,@Total_Amount,@payment_date,@inserted_amount)"); cmd.Parameters.AddWithValue("@Parent_ID", Parent_ID); cmd.Parameters.AddWithValue("@Parent_name", Parent_name); cmd.Parameters.AddWithValue("@ChildrenQ", ChildrenQ); cmd.Parameters.AddWithValue("@Total_Amount", Total_Amount); cmd.Parameters.AddWithValue("@payment_date", payment_date); cmd.Parameters.AddWithValue("@inserted_amount", inserted_amount); cmd.Connection = conn; cmd.ExecuteNonQuery(); conn.Close(); Response.Redirect("ConfirmationPayment.aspx"); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Thank you payment completed" + "'); ", true); //alert shown. } catch (FormatException) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "you already Paid " + "'); ", true); //alert shown. } }
public int GetPaymentIDFromDatabaseTable() { SqlConnection conn = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\tumi\source\repos\LearnOnlineSystem\LearnOnlineSystem\App_Data\Learn_Online_System.mdf; Integrated Security = True"); conn.Open(); string selectQuery = "SELECT * FROM payment WHERE Parent_ID =" + Login_page.getParentIDFromDatabase(); SqlCommand comm = new SqlCommand(selectQuery, conn); SqlDataReader mdr = comm.ExecuteReader(); if (mdr.Read()) { paymentId = (mdr["payment_id"].ToString()); } conn.Close(); return(int.Parse(paymentId)); }
protected void Button2_Click(object sender, EventArgs e) { if (TextBox1.Text == "5") { txt6.Text = ".10"; } else { txt6.Text = "0"; txt6.ForeColor = System.Drawing.Color.Red; } if (TextBox2.Text == "14") { txt7.Text = ".10"; } else { txt7.Text = "0"; txt7.ForeColor = System.Drawing.Color.Red; } if (TextBox3.Text == "9") { txt8.Text = ".10"; } else { txt8.Text = "0"; txt8.ForeColor = System.Drawing.Color.Red; } if (TextBox4.Text == "11") { txt9.Text = ".10"; } else { txt9.Text = "0"; txt9.ForeColor = System.Drawing.Color.Red; } if (TextBox5.Text == "7") { txt10.Text = ".10"; } else { txt10.Text = "0"; txt10.ForeColor = System.Drawing.Color.Red; } point6 = Convert.ToDouble(txt6.Text); point7 = Convert.ToDouble(txt7.Text); point8 = Convert.ToDouble(txt8.Text); point9 = Convert.ToDouble(txt9.Text); point10 = Convert.ToDouble(txt10.Text); totalResult2 = point6 + point7 + point8 + point9 + point10; total2.Text = totalResult2.ToString(); totalPonits = Convert.ToDouble(total1.Text) + Convert.ToDouble(total2.Text); lblUsername.Text = " " + totalPonits.ToString(); PointsColor(); try { child_id = int.Parse(Login_page.child_username); total_points = totalPonits.ToString("P", CultureInfo.InvariantCulture); parent_id = GetParentIDFromChildTable(); child_Name = Login_page.getChildNameFromDatabase(); Parent_Name = GetParentNameFromPointsTable(); SqlConnection conn = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\tumi\source\repos\LearnOnlineSystem\LearnOnlineSystem\App_Data\Learn_Online_System.mdf; Integrated Security = True"); conn.Open(); SqlCommand cmd = new SqlCommand("INSERT into points (child_id,child_Name,test_date,test_time,total_points,parent_id,Parent_Name)values (@child_id,@child_Name,@test_date,@test_time,@total_points,@parent_id,@Parent_Name)"); cmd.Parameters.AddWithValue("@child_id", child_id); cmd.Parameters.AddWithValue("@child_Name", child_Name); cmd.Parameters.AddWithValue("@test_date", test_date); cmd.Parameters.AddWithValue("@test_time", test_time); cmd.Parameters.AddWithValue("@total_points", total_points); cmd.Parameters.AddWithValue("@parent_id", parent_id); cmd.Parameters.AddWithValue("@Parent_Name", Parent_Name); cmd.Connection = conn; cmd.ExecuteNonQuery(); conn.Close(); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + " Test is Completed Thank you " + Login_page.getChildNameFromDatabase() + "'); ", true); TextBox1.Enabled = false; TextBox2.Enabled = false; TextBox3.Enabled = false; TextBox4.Enabled = false; TextBox5.Enabled = false; } catch (FormatException) { ClientScript.RegisterStartupScript(this.GetType(), "Alert1", "alert('" + "Please Key in all details " + "'); ", true); //alert shown. } }
public GridView GetDataFromGridView() { SqlConnection conn = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\tumi\source\repos\LearnOnlineSystem\LearnOnlineSystem\App_Data\Learn_Online_System.mdf; Integrated Security = True"); conn.Open(); SqlCommand cmd = new SqlCommand("select * from points where parent_id ='" + Login_page.boxid + "' AND Parent_Name = '" + Login_page.getParentNameFromDatabase() + "'", conn); GridView1.DataSource = cmd.ExecuteReader(); GridView1.DataBind(); return(GridView1); }
public static int GetChildQuantity() { SqlConnection conn = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\tumi\source\repos\LearnOnlineSystem\LearnOnlineSystem\App_Data\Learn_Online_System.mdf; Integrated Security = True"); conn.Open(); string selectQuery = "SELECT COUNT(parentID) FROM child WHERE parentID='" + Login_page.getParentIDFromDatabase() + "';"; SqlCommand comm = new SqlCommand(selectQuery, conn); Int32 count = Convert.ToInt32(comm.ExecuteScalar()); if (count > 0) { AVG = count.ToString(); } else { AVG = "0"; } conn.Close(); return(int.Parse(AVG)); }
protected void Page_Load(object sender, EventArgs e) { Child_Name.Text = Login_page.getChildNameFromDatabase(); Parent_Name.Text = AssignParentNameIntoChildProfile(); Image1.ImageUrl = SetImageProfile(); }