public Hours Insert(Hours id) { string ConnectionString = IDManager.connection(); SqlConnection con = new SqlConnection(ConnectionString); try { con.Open(); SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_HOURS", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Hours_Worked", id.Hours_Worked); cmd.ExecuteReader(); con.Close(); con.Open(); cmd = new SqlCommand("SP_DMCS_GET_HOURS", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Hours_Worked", id.Hours_Worked); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { rdr.Read(); id.Hours_ID = rdr.GetInt32(0); } } catch (Exception ex) { id.SetColumnDefaults(); } finally { con.Close(); } return id; }
public Hours Delete_Hours_select(int ID) { Hours = Hours.Select(ID); Delete_Hours_ID_txt_lbl.Text = Convert.ToString(Hours.Hours_ID); Delete_Hours_Worked_txt_lbl.Text = Convert.ToString(Hours.Hours_Worked); return Hours; }
public Hours Update_Hours_select(int ID) { Hours = Hours.Select(ID); Update_Hours_ID_txt.Text = Convert.ToString(Hours.Hours_ID); Update_Hours_Worked_txt.Text = Convert.ToString(Hours.Hours_Worked); return(Hours); }
public Hours Insert(Hours id) { string ConnectionString = IDManager.connection(); SqlConnection con = new SqlConnection(ConnectionString); try { con.Open(); SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_HOURS", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Hours_Worked", id.Hours_Worked); cmd.ExecuteReader(); con.Close(); con.Open(); cmd = new SqlCommand("SP_DMCS_GET_HOURS", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Hours_Worked", id.Hours_Worked); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { rdr.Read(); id.Hours_ID = rdr.GetInt32(0); } } catch (Exception ex) { id.SetColumnDefaults(); } finally { con.Close(); } return(id); }
public Boolean Update(Hours id) { string ConnectionString = IDManager.connection(); SqlConnection con = new SqlConnection(ConnectionString); try { con.Open(); SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_HOURS", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Hours_ID", id.Hours_ID); cmd.Parameters.AddWithValue("@Hours_Worked", id.Hours_Worked); cmd.ExecuteReader(); con.Close(); return(true); } catch (Exception ex) { return(false); } finally { con.Close(); } }
public Hours Hours_insert() { Hours.Hours_Worked = Convert.ToInt32(Insert_Hours_Worked_txt.Text); Hours = Hours.Insert(Hours); Insert_Hours_GridView.DataBind(); Update_Hours_GridView.DataBind(); Delete_Hours_GridView.DataBind(); return(Hours); }
public Hours Hours_insert() { Hours.Hours_Worked = Convert.ToInt32(Insert_Hours_Worked_txt.Text); Hours = Hours.Insert(Hours); Insert_Hours_GridView.DataBind(); Update_Hours_GridView.DataBind(); Delete_Hours_GridView.DataBind(); return Hours; }
public Hours Hours_update(int ID) { Hours = Hours.Select(ID); Hours.Hours_ID = Convert.ToInt32(Update_Hours_ID_txt.Text); Hours.Hours_Worked = Convert.ToInt32(Update_Hours_Worked_txt.Text); Hours.Update(Hours); Insert_Hours_GridView.DataBind(); Update_Hours_GridView.DataBind(); Delete_Hours_GridView.DataBind(); return Hours; }
public Hours Hours_update(int ID) { Hours = Hours.Select(ID); Hours.Hours_ID = Convert.ToInt32(Update_Hours_ID_txt.Text); Hours.Hours_Worked = Convert.ToInt32(Update_Hours_Worked_txt.Text); Hours.Update(Hours); Insert_Hours_GridView.DataBind(); Update_Hours_GridView.DataBind(); Delete_Hours_GridView.DataBind(); return(Hours); }
public Hours Select(int id) { Hours Hours = new Hours(); string ConnectionString = IDManager.connection(); SqlConnection con = new SqlConnection(ConnectionString); try { con.Open(); SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_HOURS", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Hours_ID", id); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { rdr.Read(); if (!rdr.IsDBNull(0)) { Hours.Hours_ID = rdr.GetInt32(0); } else { Hours.Hours_ID = 0; } if (!rdr.IsDBNull(1)) { Hours.Hours_Worked = rdr.GetInt32(1); } else { Hours.Hours_Worked = 0; } } else { Hours.SetColumnDefaults(); } } catch (Exception ex) { Hours.SetColumnDefaults(); return(Hours); } finally { con.Close(); } return(Hours); }
public Hours Insert_Hours_select(int ID) { Hours = Hours.Select(ID); Insert_Hours_Worked_txt.Text = Convert.ToString(Hours.Hours_Worked); return Hours; }
public Boolean Update(Hours id) { string ConnectionString = IDManager.connection(); SqlConnection con = new SqlConnection(ConnectionString); try { con.Open(); SqlCommand cmd = new SqlCommand("SP_DMCS_UPDATE_HOURS", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Hours_ID", id.Hours_ID); cmd.Parameters.AddWithValue("@Hours_Worked", id.Hours_Worked); cmd.ExecuteReader(); con.Close(); return true; } catch (Exception ex) { return false; } finally { con.Close(); } }
///////////////////////// //////////////////////// /////////////////////// ////////////////////// ///////////////////// //Update Tab Methods protected void Update_Select_Record(object sender, EventArgs e) { Hours = Update_Hours_select(Convert.ToInt32(Update_Hours_GridView.SelectedValue)); }
protected void UPDATE(object sender, EventArgs e) { Hours = Hours_update(Convert.ToInt32(Update_Hours_GridView.SelectedValue)); }
///////////////////////// //////////////////////// /////////////////////// ////////////////////// ///////////////////// //Insert Tab Methods protected void Insert_Select_Record(object sender, EventArgs e) { Hours = Insert_Hours_select(Convert.ToInt32(Insert_Hours_GridView.SelectedValue)); }
protected void INSERT(object sender, EventArgs e) { Hours = Hours_insert(); }
public Hours Select(int id) { Hours Hours = new Hours(); string ConnectionString = IDManager.connection(); SqlConnection con = new SqlConnection(ConnectionString); try { con.Open(); SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_HOURS", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Hours_ID", id); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { rdr.Read(); if (!rdr.IsDBNull(0)) { Hours.Hours_ID = rdr.GetInt32(0); } else { Hours.Hours_ID = 0; } if (!rdr.IsDBNull(1)) { Hours.Hours_Worked = rdr.GetInt32(1); } else { Hours.Hours_Worked = 0; } } else { Hours.SetColumnDefaults(); } } catch (Exception ex) { Hours.SetColumnDefaults(); return Hours; } finally { con.Close(); } return Hours; }
public Hours Insert_Hours_select(int ID) { Hours = Hours.Select(ID); Insert_Hours_Worked_txt.Text = Convert.ToString(Hours.Hours_Worked); return(Hours); }