protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
    {
        nsgaanamania.tbsgsdwnlds       obj    = new nsgaanamania.tbsgsdwnlds();
        nsgaanamania.clstbsgsdwnldsprp objprp = new nsgaanamania.clstbsgsdwnldsprp();
        if (e.CommandName == "abck")
        {
            List <nsgaanamania.clstbsgsdwnldsprp> k = obj.find_rec_sgs(Convert.ToInt32(Request.QueryString["sgsid"]));
            if (k.Count == 0)
            {
                objprp.sgsdwnldsno    = 1;
                objprp.sgsdwnldssgsid = Convert.ToInt32(Request.QueryString["sgsid"]);
                obj.save_rec(objprp);

                // insert query
            }
            else
            {
                //update query
                objprp.sgsdwnldssgsid = Convert.ToInt32(Request.QueryString["sgsid"]);
                objprp.sgsdwnldsno    = k[0].sgsdwnldsno + 1;
                obj.upd_rec(objprp);
            }
            Response.Redirect(e.CommandArgument.ToString());
        }
    }
Esempio n. 2
0
        public List <clstbsgsdwnldsprp> disp_rec()
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("disp_tbsgsdwnlds", con);

            cmd.CommandType = CommandType.StoredProcedure;

            SqlDataReader            dr  = cmd.ExecuteReader();
            List <clstbsgsdwnldsprp> obj = new List <clstbsgsdwnldsprp>();

            while (dr.Read())
            {
                clstbsgsdwnldsprp k = new clstbsgsdwnldsprp();
                k.sgsdwnldsid    = Convert.ToInt32(dr[0]);
                k.sgsdwnldssgsid = Convert.ToInt32(dr[1]);
                k.sgsdwnldsno    = Convert.ToInt32(dr[2]);


                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Esempio n. 3
0
        public List <clstbsgsdwnldsprp> find_rec_sgs(Int32 sgsdwnldssgsid)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("find_tbsgsdwnlds_sgsdwnldssgsid", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@sgsdwnldssgsid", SqlDbType.Int).Value = sgsdwnldssgsid;
            SqlDataReader            dr  = cmd.ExecuteReader();
            List <clstbsgsdwnldsprp> obj = new List <clstbsgsdwnldsprp>();

            if (dr.HasRows)
            {
                dr.Read();
                clstbsgsdwnldsprp k = new clstbsgsdwnldsprp();
                k.sgsdwnldsid    = Convert.ToInt32(dr[0]);
                k.sgsdwnldssgsid = Convert.ToInt32(dr[1]);
                k.sgsdwnldsno    = Convert.ToInt32(dr[2]);


                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Esempio n. 4
0
        public void del_rec(clstbsgsdwnldsprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("del_tbsgsdwnlds", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@sgsdwnldsid", SqlDbType.Int).Value = p.sgsdwnldsid;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }