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;
 }
Exemple #2
0
 public int changeNameToId(string name)
 {
     Lab lab = new Lab();
     SqlConnection con = DatabaseConnection("open");
     SqlCommand cmd = new SqlCommand("changeNameToId", con);
     cmd.Parameters.AddWithValue("@name", name);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.ExecuteNonQuery();
     SqlDataReader reader = cmd.ExecuteReader();
     if (reader.Read())
     {
         lab.Id = reader.GetInt32(reader.GetOrdinal("id"));
     }
     cmd.Dispose();
     DatabaseConnection("close");
     return lab.Id;
 }
Exemple #3
0
 public string changeIdToName(int idLab)
 {
     Lab lab = new Lab();
     SqlConnection con = DatabaseConnection("open");
     SqlCommand cmd = new SqlCommand("changeIdToName", con);
     cmd.Parameters.AddWithValue("@idLab", idLab);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.ExecuteNonQuery();
     SqlDataReader reader = cmd.ExecuteReader();
     if (reader.Read())
     {
         lab.Name = reader.GetString(reader.GetOrdinal("name"));
     }
     cmd.Dispose();
     DatabaseConnection("close");
     return lab.Name;
 }
Exemple #4
0
 public Date readDate(int id, int idLab, string startTime, string endTime, string date)
 {
     Date date1 = new Date();
     Lab lab = new Lab();
     Shift shift = new Shift();
     SqlConnection con = DatabaseConnection("open");
     SqlCommand cmd = new SqlCommand("readDate", con);
     cmd.Parameters.AddWithValue("@id", id);
     cmd.Parameters.AddWithValue("@idLab", idLab);
     cmd.Parameters.AddWithValue("@start time", startTime);
     cmd.Parameters.AddWithValue("@end time", endTime);
     cmd.Parameters.AddWithValue("@date", startTime);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.ExecuteNonQuery();
     SqlDataReader reader = cmd.ExecuteReader();
     if (reader.Read())
     {
         date1.Id = reader.GetInt32(reader.GetOrdinal("id"));
     }
     cmd.Dispose();
     DatabaseConnection("close");
     return date1;
 }
        protected void gvResults_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                // Retrieve the row index stored in the
                // CommandArgument property.
                int index = Convert.ToInt32(e.CommandArgument);

                int i = (int)GridView1.DataKeys[index].Value;
                 lab = dataLab.getLabEdit(i);
                 Session["labEdit"] = lab;
                Response.Redirect("/UpdateLab.aspx");

            }
        }
Exemple #6
0
 public Lab getLabEdit(int id)
 {
     Lab lab = new Lab();
     //open database connection
     SqlConnection con = DatabaseConnection("open");
     SqlCommand sqlCommand;
     sqlCommand = new SqlCommand("SelectLabID", con);
     sqlCommand.Parameters.AddWithValue("@id", id);
     sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
     SqlDataReader reader = sqlCommand.ExecuteReader();
     if (reader.Read())
     {
         lab.Id = reader.GetInt32(reader.GetOrdinal("id"));
         lab.Name = reader.GetString(reader.GetOrdinal("name"));
         lab.Description = reader.GetString(reader.GetOrdinal("description"));
     }
     sqlCommand.Dispose();
     DatabaseConnection("close");
     return lab;
 }
Exemple #7
0
 public DropDownList readLabName()
 {
     DropDownList ddl = new DropDownList();
     Lab lab = new Lab();
     DataTable dt = new DataTable();
     SqlConnection con = DatabaseConnection("open");
     SqlCommand cmd = new SqlCommand("SelectLab", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     SqlDataAdapter da = new SqlDataAdapter(cmd);
     da.Fill(dt);
     ddl.DataSource = dt;
     ddl.DataTextField = "name";
     ddl.DataValueField = "name";
     ddl.DataBind();
     cmd.Dispose();
     DatabaseConnection("close");
     return ddl;
 }
Exemple #8
0
        public List<Lab> readLab()
        {
            List<Lab> LabList = new List<Lab>();
            Lab Lab = new Lab();
            //open database connection
            SqlConnection con = DatabaseConnection("open");
            SqlCommand sqlCommand;
            try
            {
                sqlCommand = new SqlCommand("readLab", con);
                SqlDataReader reader = sqlCommand.ExecuteReader();
                while (reader.Read())
                {
                    Lab.Id = reader.GetInt32(reader.GetOrdinal("id"));
                    Lab.Name = reader.GetString(reader.GetOrdinal("name"));
                    Lab.Description = reader.GetString(reader.GetOrdinal("description"));
                    LabList.Add(Lab);
                }
                sqlCommand.Dispose();

            }
            catch (SqlException sqlException)
            {
                Console.WriteLine("Database error: " + sqlException.ToString());
            }
            finally
            {
                DatabaseConnection("close");
            }
            return LabList;
        }
Exemple #9
0
 public void updateLab(Lab lab) { }
Exemple #10
0
        public void readLab() 
        {
            Lab lab = new Lab();

        }