public List <clsappreqprp> Find_Rec(Int32 appreqcod) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("fndappreq", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@appreqcod", appreqcod); SqlDataReader dr = cmd.ExecuteReader(); List <clsappreqprp> obj = new List <clsappreqprp>(); if (dr.HasRows) { dr.Read(); clsappreqprp k = new clsappreqprp(); k.appreqcod = Convert.ToInt32(dr[0]); k.appreqtim = dr[2].ToString(); k.apprequsrcod = Convert.ToInt32(dr[3]); k.appreqdsc = dr[4].ToString(); k.appreqsts = Convert.ToChar(dr[5]); k.appreqdoccod = Convert.ToInt32(dr[6]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public List <clsappreqprp> Disp_Rec() { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dspappreq", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List <clsappreqprp> obj = new List <clsappreqprp>(); while (dr.Read()) { clsappreqprp k = new clsappreqprp(); k.appreqcod = Convert.ToInt32(dr[0]); k.appreqtim = dr[2].ToString(); k.apprequsrcod = Convert.ToInt32(dr[3]); k.appreqdsc = dr[4].ToString(); k.appreqsts = Convert.ToChar(dr[5]); k.appreqdoccod = Convert.ToInt32(dr[6]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { nsgetwell.clsappreq obj = new nsgetwell.clsappreq(); nsgetwell.clsappreqprp objprp = new nsgetwell.clsappreqprp(); objprp.appreqcod = Convert.ToInt32(GridView1.DataKeys [e.RowIndex][0]); objprp.appreqsts = 'R'; obj.Update_Rec(objprp); GridView1.DataBind(); e.Cancel = true; }
public void Delete_Rec(clsappreqprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delappreq", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@appreqcod", p.appreqcod); cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
protected void Button1_Click(object sender, EventArgs e) { nsgetwell.clsappreq obj = new nsgetwell.clsappreq(); nsgetwell.clsappreqprp objprp = new nsgetwell.clsappreqprp(); objprp.appreqdat = Convert.ToDateTime(TextBox1.Text); objprp.appreqdoccod = Convert.ToInt32(Session["dcod"]); objprp.appreqdsc = TextBox2.Text; objprp.appreqtim = DropDownList1.SelectedValue + ":" + DropDownList2.SelectedValue; objprp.apprequsrcod = Convert.ToInt32(Session["cod"]); objprp.appreqsts = 'N'; obj.Save_Rec(objprp); TextBox1.Text = String.Empty; TextBox2.Text = String.Empty; DropDownList1.SelectedIndex = -1; DropDownList2.SelectedIndex = -1; lblmsg.Text = "Appointment Requested Successfully.Our representative will contact you soon."; }
public void Save_Rec(clsappreqprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insappreq", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@appreqdat", p.appreqdat); cmd.Parameters.AddWithValue("@appreqtim", p.appreqtim); cmd.Parameters.AddWithValue("@apprequsrcod", p.apprequsrcod); cmd.Parameters.AddWithValue("@appreqdsc", p.appreqdsc); cmd.Parameters.AddWithValue("@appreqsts", p.appreqsts); cmd.Parameters.AddWithValue("@appreqdoccod", p.appreqdoccod); cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }