Example #1
0
        public List <clsrecprp> find_rec()
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("findrec", con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader    dr  = cmd.ExecuteReader();
            List <clsrecprp> obj = new List <clsrecprp>();

            while (dr.HasRows)
            {
                dr.Read();
                clsrecprp k = new clsrecprp();
                k.reccode = Convert.ToInt32(dr[0]);
                //k.recdate =Convert.ToInt32(dr[1]);
                k.reccatcode = Convert.ToInt32(dr[2]);
                k.recscore   = Convert.ToInt32(dr[3]);
                k.recusreml  = dr[4].ToString();
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Example #2
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     nsquiz.clsrec    obj    = new nsquiz.clsrec();
     nsquiz.clsrecprp objprp = new nsquiz.clsrecprp();
     objprp.reccatcode = Convert.ToInt32(Session["ccod"]);
     objprp.recdate    = DateTime.Now;
     objprp.recscore   = Convert.ToInt32(Label4.Text);
     objprp.recusreml  = Session["eml"].ToString();
     obj.save_rec(objprp);
     Session["ccod"] = null;
     Session["lvl"]  = null;
     Response.Redirect("frmhis.aspx");
 }
Example #3
0
        public void delete_rec(clsrecprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("delrec", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@reccode", SqlDbType.Int).Value = p.reccode;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
Example #4
0
        public void update_rec(clsrecprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("updaterec", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@reccode", SqlDbType.Int).Value           = p.reccode;
            cmd.Parameters.Add("@recdate", SqlDbType.DateTime).Value      = p.recdate;
            cmd.Parameters.Add("@reccatcode", SqlDbType.Int).Value        = p.reccatcode;
            cmd.Parameters.Add("@recscore", SqlDbType.Int).Value          = p.recscore;
            cmd.Parameters.Add("@recusreml", SqlDbType.VarChar, 50).Value = p.recusreml;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }