protected void Page_Load(object sender, EventArgs e) { Details det = new Details(); model.TrainersmeDetails trainersmefirstname = new model.TrainersmeDetails(); trainersmefirstname = det.trainersmedetails(long.Parse(Session["requestid"].ToString())); Label2.Text = trainersmefirstname.RequestId.ToString(); Label3.Text = trainersmefirstname.TrainerId.ToString(); Label4.Text = trainersmefirstname.SmeId.ToString(); //if (trainersmefirstname.SmeId == null) //{ // GridView2.Visible = true; // GridView2.DataSource = trainersmefirstname; // GridView2.DataBind(); //} //else if(trainersmefirstname.TrainerId==null) // { // GridView3.Visible = true; // GridView3.DataSource = trainersmefirstname; // GridView3.DataBind(); //} //else //{ // GridView1.Visible = true; // GridView1.DataSource = trainersmefirstname; // GridView1.DataBind(); //} }
public TrainersmeDetails trainersmedetails(long requestid) { model.TrainersmeDetails trainesmedet = null; SqlConnection connect = ConnectionHandler.getConnection(); connect.Open(); SqlCommand cmd = new SqlCommand("select r.requestId,at.trainer_Id,saa.smeid from request r left join adminApprovedTrainer at on r.requestId=at.requestId left join adminApprovedSme saa on r.requestId=saa.requestId where r.requestId=@requestId", connect); cmd.Parameters.AddWithValue("@requestId", requestid); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); connect.Close(); DataTable dt = ds.Tables[0]; string smeid, trainerid; foreach (DataRow dr in dt.Rows) { smeid = (dr["smeid"].ToString() == "") ? "0" : dr["smeid"].ToString(); trainerid = (dr["trainer_Id"].ToString() == "") ? "0" : dr["trainer_Id"].ToString(); trainesmedet = new TrainersmeDetails(long.Parse(dr["requestId"].ToString()), long.Parse(trainerid), long.Parse(smeid)); //trainesmedet.RequestId = long.Parse(dr["requestId"].ToString()); //trainesmedet.TrainerId = long.Parse(dr["trainer_Id"].ToString()); //trainesmedet.SmeId = long.Parse(dr["sme_Id"].ToString()); } return(trainesmedet); }
protected void Page_Load(object sender, EventArgs e) { Details det = new Details(); model.TrainersmeDetails trainersmefirstname = new model.TrainersmeDetails(); long reqId = long.Parse(Request.QueryString["requestId"]); trainersmefirstname = det.trainersmedetails(reqId); Label2.Text = trainersmefirstname.RequestId.ToString(); Label3.Text = trainersmefirstname.TrainerId.ToString(); Label4.Text = trainersmefirstname.SmeId.ToString(); }