protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "select") { int rowindex = Int32.Parse(e.CommandArgument.ToString()); GridViewRow row = GridView1.Rows[rowindex]; long trainerid = long.Parse(row.Cells[0].Text); long reqId = long.Parse(Request.QueryString["requestId"]); RequestManagementDao calendar = new RequestManagementSql(); List <model.Calender> trainerCal = new List <model.Calender>(); trainerCal = calendar.getDatesRequest(reqId); foreach (var t in trainerCal) { DateTime date1 = t.StartDate; DateTime date2 = t.Enddate; RequestManagementSql request = new RequestManagementSql(); //long trainerid = long.Parse(row.Cells[0].Text); string status = "Busy"; request.addAvailability(trainerid, date1, date2, status); TrainerDao trainerdao = new TrainerDaoSqlImpl(); trainerdao.adminApprovedTrainer(reqId, trainerid); Label2.Visible = true; Label2.Text = "Approved Trainer"; Label1.Visible = true; GridView1.Visible = false; GridView5.Visible = true; } } }
protected void Button1_Click(object sender, EventArgs e) { Details d = new Details(); long det = d.trainerdet(Session["adminlogin"].ToString()); string status; if (available.Checked == true) { status = "Available"; } else { status = "Busy"; } RequestManagementSql request = new RequestManagementSql(); request.addAvailability(det, DateTime.Parse(txtStartDate.Text), DateTime.Parse(txtEndDate.Text), status); Label1.Text = "Availability saved"; }