Exemplo n.º 1
0
        public List <clsareprp> Disp_Rec(Int32 ctycod)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("dspare", con);

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

            while (dr.Read())
            {
                clsareprp k = new clsareprp();
                k.arecod    = Convert.ToInt32(dr[0]);
                k.arenam    = dr[1].ToString();
                k.arectycod = Convert.ToInt32(dr[2]);
                k.arelatlng = dr[3].ToString();
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Exemplo n.º 2
0
        public List <clsareprp> Find_Rec(Int32 arecod)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("fndare", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@arecod", arecod);
            SqlDataReader    dr  = cmd.ExecuteReader();
            List <clsareprp> obj = new List <clsareprp>();

            if (dr.HasRows)
            {
                dr.Read();
                clsareprp k = new clsareprp();
                k.arecod    = Convert.ToInt32(dr[0]);
                k.arenam    = dr[1].ToString();
                k.arectycod = Convert.ToInt32(dr[2]);
                k.arelatlng = dr[3].ToString();
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Exemplo n.º 3
0
        public void Delete_Rec(clsareprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("delare", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@arecod", p.arecod);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
Exemplo n.º 4
0
 protected void btnsub_Click(object sender, EventArgs e)
 {
     nsgetwell.clsare    obj    = new nsgetwell.clsare();
     nsgetwell.clsareprp objprp = new nsgetwell.clsareprp();
     objprp.arectycod = Convert.ToInt32(drpcty.SelectedValue);
     objprp.arenam    = txtare.Text;
     objprp.arelatlng = Hidden1.Value;
     if (btnsub.Text == "Submit")
     {
         obj.Save_Rec(objprp);
     }
     else
     {
         objprp.arecod = Convert.ToInt32(ViewState["cod"]);
         obj.Update_Rec(objprp);
         btnsub.Text = "Submit";
     }
     txtare.Text = String.Empty;
     lblcrd.Text = String.Empty;
     GridView1.DataBind();
 }