public List <clsrevprp> Find_Rec(Int32 revcod) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("fndrev", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@revcod", revcod); SqlDataReader dr = cmd.ExecuteReader(); List <clsrevprp> obj = new List <clsrevprp>(); if (dr.HasRows) { dr.Read(); clsrevprp k = new clsrevprp(); k.revcod = Convert.ToInt32(dr[0]); k.revappreqcod = Convert.ToInt32(dr[1]); k.revdsc = dr[3].ToString(); k.revscr = Convert.ToSingle(dr[4]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public List <clsrevprp> Disp_Rec() { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dsprev", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List <clsrevprp> obj = new List <clsrevprp>(); while (dr.Read()) { clsrevprp k = new clsrevprp(); k.revcod = Convert.ToInt32(dr[0]); k.revappreqcod = Convert.ToInt32(dr[1]); k.revdsc = dr[3].ToString(); k.revscr = Convert.ToSingle(dr[4]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
protected void btn1_Click(object sender, EventArgs e) { nsgetwell.clsrev obj = new nsgetwell.clsrev(); nsgetwell.clsrevprp objprp = new nsgetwell.clsrevprp(); objprp.revappreqcod = Convert.ToInt32(drpapp.SelectedValue); objprp.revdat = DateTime.Now; objprp.revdsc = txtdsc.Text; objprp.revscr = Convert.ToInt32(Rating1.CurrentRating); obj.Save_Rec(objprp); txtdsc.Text = String.Empty; lblusr.Text = "Review stored successfully."; }
public void Delete_Rec(clsrevprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delrev", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@revcod", p.revcod); cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
public void Save_Rec(clsrevprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insrev", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@revappreqcod", p.revappreqcod); cmd.Parameters.AddWithValue("@revdat", p.revdat); cmd.Parameters.AddWithValue("@revdsc", p.revdsc); cmd.Parameters.AddWithValue("@revscr", p.revscr); cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }