示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         String qry = "select * from tbClass";
         tbl = obj.Srch(qry);
         for (int y = 0; y < tbl.Rows.Count; y++)
         {
             TxtClass.Items.Add(tbl.Rows[y]["Sclass"].ToString());
         }
     }
     catch (Exception ex)
     {
         rslt.InnerHtml = "Classes are not loaded from the Table";
     }
 }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            dbClass obj = new dbClass();

            try
            {
                if (TxtName.Text.ToString().Equals("") && TxtPassword.Text.ToString().Equals(""))
                {
                    rslt.InnerHtml = "Fill  user Name or password ";
                }
                else
                {
                    String    qry = "select * from tbRegister where SuserName='******' and Spassword='******'";
                    DataTable tbl = new DataTable();
                    tbl = obj.Srch(qry);
                    if (tbl.Rows.Count > 0)
                    {
                        Response.Redirect("AdminZone.aspx");
                    }
                    else
                    {
                        rslt.InnerHtml = "invalid user Name or password";
                    }
                }
            }
            catch (Exception es) {
                rslt.InnerHtml = "Fill Proper Details for Login";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    DataTable tbl = new DataTable();
                    String    qry = "select * from tbClass";
                    tbl = obj.Srch(qry);
                    for (int y = 0; y < tbl.Rows.Count; y++)
                    {
                        TxtClass1.Items.Add(tbl.Rows[y]["Sclass"].ToString());
                    }

                    qry = "";
                    tbl = new DataTable();

                    if (Request.QueryString["ID"] != null)
                    {
                        qry = "select * from tbStudent where ID=" + Convert.ToInt32(Request.QueryString["ID"].ToString()) + "";
                        tbl = obj.Srch(qry);
                        if (tbl.Rows.Count > 0)
                        {
                            name    = tbl.Rows[0]["SName"].ToString();
                            address = tbl.Rows[0]["SAddress"].ToString();
                            sfather = tbl.Rows[0]["SFatherName"].ToString();
                            sdob    = tbl.Rows[0]["SDob"].ToString();
                            mob     = tbl.Rows[0]["SMobile"].ToString();
                            sclass  = tbl.Rows[0]["Sclass"].ToString();
                            id      = tbl.Rows[0]["id"].ToString();

                            TxtId1.Text         = id;
                            txtName1.Text       = name;
                            txtAddress1.Text    = address;
                            TxtClass1.Text      = sclass;
                            TxtDob1.Text        = sdob;
                            TxtFatherName1.Text = sfather;
                            TxtmobileNo1.Text   = mob;
                        }
                    }
                }
                catch (Exception rs)
                {
                    rslt.InnerHtml = "Here  is Some error in the Code";
                }
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                String    recrd = "<table><tr><td>Unique ID</td><td>Name</td><td>Father Name</td><td>Class</td><td>Address</td><td>Mobile No</td><td>Dob</td><td>delete</td><td>Update</td></tr>";
                DataTable tbl   = new DataTable();
                String    qry   = "select * from tbStudent";
                tbl = obj.Srch(qry);
                if (tbl.Rows.Count > 0)
                {
                    for (int x = 0; x < tbl.Rows.Count; x++)
                    {
                        recrd = recrd + "<tr><td>" + tbl.Rows[x]["id"] + "</td><td>" + tbl.Rows[x]["SName"] + "</td>";
                        recrd = recrd + "<td>" + tbl.Rows[x]["SFatherName"] + "</td>";
                        recrd = recrd + "<td>" + tbl.Rows[x]["Sclass"] + "</td>";
                        recrd = recrd + "<td>" + tbl.Rows[x]["SAddress"] + "</td>";
                        recrd = recrd + "<td>" + tbl.Rows[x]["SMobile"] + "</td>";
                        recrd = recrd + "<td>" + tbl.Rows[x]["SDob"] + "</td>";
                        recrd = recrd + "<td><a href='ViewStudent.aspx?id=" + tbl.Rows[x]["id"] + "' class='btn-primary' style='border:5px ridge green;height:10px;padding:10px;'>Delete</td>";
                        recrd = recrd + "<td><a href='UpdateStudent.aspx?id=" + tbl.Rows[x]["id"] + "#Record' class='btn-primary' style='border:5px ridge green;height:10px;padding:10px;'>Update</td></tr>";
                    }
                    rslt.InnerHtml = recrd + "</table>";
                }
                else
                {
                    rslt.InnerHtml = "record is empty";
                }

                if (Request.QueryString["id"] != null)
                {
                    qry = "";
                    qry = "delete from tbStudent where id=" + Convert.ToInt32(Request.QueryString["id"].ToString()) + "";
                    obj.InsDelUpdt(qry);
                    Response.Redirect("ViewStudent.aspx?#Record");
                }
            }
            catch (Exception es) {
                rslt.InnerHtml = "error in the code";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                String    recrd = "<table><tr><td>Unique ID </td><td>Fee</td><td>Date</td><td>delete</td></tr>";
                DataTable tbl   = new DataTable();
                String    qry   = "select * from tbFee";
                tbl = obj.Srch(qry);
                if (tbl.Rows.Count > 0)
                {
                    for (int x = 0; x < tbl.Rows.Count; x++)
                    {
                        recrd = recrd + "<tr><td>" + tbl.Rows[x]["UniqID"] + "</td>";
                        recrd = recrd + "<td>" + tbl.Rows[x]["Fee"] + "</td>";
                        recrd = recrd + "<td>" + tbl.Rows[x]["Sdate"] + "</td>";
                        recrd = recrd + "<td><a href='ViewFee.aspx?id=" + tbl.Rows[x]["id"] + "' class='btn-primary' style='border:5px ridge green;height:10px;padding:10px;'>Delete</td></tr>";
                    }
                    rslt.InnerHtml = recrd + "</table>";
                }
                else
                {
                    rslt.InnerHtml = "record is empty";
                }

                if (Request.QueryString["id"] != null)
                {
                    qry = "";
                    qry = "delete from tbFee where id=" + Convert.ToInt32(Request.QueryString["id"].ToString()) + "";
                    obj.InsDelUpdt(qry);
                    Response.Redirect("ViewFee.aspx");
                }
            }
            catch (Exception rs) {
                rslt.InnerHtml = "check the Code ";
            }
        }