protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     int id = (int)GridView1.DataKeys[e.RowIndex].Value;
     workStation = dataWorkStation.readWorkStationEDIT(id);
     dataWorkStation.deleteWorkStation(id, workStation.IdLab);
     Response.Redirect("/CRUDWorkStation.aspx");
 }
 protected void gvResults_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Edit")
     {
         int index = Convert.ToInt32(e.CommandArgument);
         int i = (int)GridView1.DataKeys[index].Value;
         workStation = dataWorkStation.readWorkStationEDIT(i);
         Session["workStationSession"] = workStation;
         Response.Redirect("/EditWorkStation.aspx");
     }
 }
Example #3
0
 public DataTable readWorkStation()
 {
     DataTable dt = new DataTable();
     WorkStation workStation = new WorkStation();
     Lab lab = new Lab();
     SqlConnection con = DatabaseConnection("open");
     SqlCommand cmd = new SqlCommand("readWorkStation", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     SqlDataAdapter da = new SqlDataAdapter(cmd);
     da.Fill(dt);
     cmd.Dispose();
     DatabaseConnection("close");
     return dt;
 }
        public List<WorkStation> selectBusy(int idlab, string startTime, string date)
        {
            int pos = 1;
            List<WorkStation> ws = new List<WorkStation>();
            WorkStation wsD = new WorkStation();
            idLab = dataLab.changeNameToId(ddlLab.SelectedValue);
            int contCode = dataReservation.SelectLabCode(idLab);
            int cont = 30 * (contCode - 1) + 1;
            for (int i = cont; i < 30 * contCode; i++)
            {

                ws.Add(dataWS.readWorkStationBusy(i, startTime, date));

                pos++;
            }
            ws.Add(wsD);
            return ws;
        }
Example #5
0
        public WorkStation readWorkStationBusy(int id, string startTime, string date)
        {
            DataReservation dataReservation = new DataReservation();

            WorkStation workStation = new WorkStation();
            SqlConnection con = DatabaseConnection("open");
            SqlCommand cmd = new SqlCommand("readWorkStationEDIT", con);
            cmd.Parameters.AddWithValue("@id", id);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.ExecuteNonQuery();
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.Read())
            {
                workStation.Id = reader.GetInt32(reader.GetOrdinal("id"));
                workStation.Description = reader.GetString(reader.GetOrdinal("description"));
                workStation.IdLab = reader.GetInt32(reader.GetOrdinal("idLab"));
                workStation.Busy = dataReservation.SelectAvailabilityStation(id, startTime, date);
            }
            cmd.Dispose();
            DatabaseConnection("close");
            return workStation;
        }
 public void updateWorkStation(WorkStation workStation) { }