Exemple #1
0
        //Payment process is finally done here
        protected void Dataentry()
        {
            SqlConnection con2 = new SqlConnection(Strcon);

            con2.Open();
            SqlCommand cmd2 = new SqlCommand("Update rent set rent_amount = @rent_amount, rent_status='Paid', rent_paid_date=@rent_paid_date where emp_id = @emp_id ; ", con2);

            cmd2.Parameters.AddWithValue("@emp_id", EmpID.Text.Trim());
            cmd2.Parameters.AddWithValue("@rent_amount", RentAmount.Text.Trim());
            cmd2.Parameters.AddWithValue("@rent_paid_date", Month.Text.Trim());
            cmd2.ExecuteNonQuery();
            RentGrid.DataBind();
            con2.Close();
            ClearForm();
        }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //This is to redirect the page if the user is not logged in
     if (string.IsNullOrEmpty((string)Session["role"]))
     {
         Response.Redirect("~/");
     }
     if (!IsPostBack)
     {
         SqlConnection connection = new SqlConnection(Strcon);
         connection.Open();
         SqlCommand Command = new SqlCommand("SELECT allocatedquarter.emp_id from allocatedquarter INNER JOIN rent ON allocatedquarter.emp_id=rent.emp_id WHERE rent.rent_status='Due'", connection);
         EmpID.DataSource = Command.ExecuteReader();
         EmpID.DataBind();
         EmpID.Items.Insert(0, new ListItem("Select a employee ID", ""));
         RentGrid.DataBind();
         connection.Close();
     }
 }