public bool update(SectorDTO oSector) { bool bReturn = false; SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_sector_update"; sqlCmd.Parameters.AddWithValue("@IdSector", oSector.idSector); sqlCmd.Parameters.AddWithValue("@DsSector", oSector.dsSector); sqlCmd.ExecuteNonQuery(); bReturn = true; } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(bReturn); }
public bool update(CategoryDTO pDtoCategory) { bool bReturn = false; SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_category_update"; sqlCmd.Parameters.AddWithValue("@IdCategory", pDtoCategory.idCategory); sqlCmd.Parameters.AddWithValue("@DsCategory", pDtoCategory.dsCategory); sqlCmd.ExecuteNonQuery(); bReturn = true; } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(bReturn); }
public int insert(string pDsCategory) { int iReturn = 0; SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_category_insert"; sqlCmd.Parameters.AddWithValue("@DsCategory", pDsCategory); iReturn = sqlCmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(iReturn); }
public bool delete(int pIdRange) { bool bReturn = false; SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_range_delete"; sqlCmd.Parameters.AddWithValue("@dRange", pIdRange); sqlCmd.ExecuteNonQuery(); bReturn = true; } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(bReturn); }
public bool update(RangeDTO oRange) { bool bReturn = false; SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_range_update"; sqlCmd.Parameters.AddWithValue("@IdRange", oRange.idRange.ToString()); sqlCmd.Parameters.AddWithValue("@FirstValue", oRange.firstValue.ToString()); sqlCmd.Parameters.AddWithValue("@LastValue", oRange.lastValue.ToString()); sqlCmd.ExecuteNonQuery(); bReturn = true; } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(bReturn); }
public int insert(RangeDTO oRange) { int iReturn = 0; SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_range_insert"; sqlCmd.Parameters.AddWithValue("@FirstValue", oRange.firstValue.ToString()); sqlCmd.Parameters.AddWithValue("@LastValue", oRange.lastValue.ToString()); iReturn = sqlCmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(iReturn); }
public List <CategoryDTO> getCategoryByID(int pIdCategory) { List <CategoryDTO> oReturn = new List <CategoryDTO>(); SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_category_consultar"; sqlCmd.Parameters.AddWithValue("@IdCategory", pIdCategory); var oData = sqlCmd.ExecuteReader(); while (oData.Read() == true) { CategoryDTO oCategory = new CategoryDTO(); oCategory.idCategory = int.Parse(oData["idCategory"].ToString()); oCategory.dsCategory = oData["dsCategory"].ToString(); oReturn.Add(oCategory); } } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(oReturn); }
public List <SectorDTO> getSectorByID(int pIdSector) { List <SectorDTO> oReturn = new List <SectorDTO>(); SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_sector_consultar"; sqlCmd.Parameters.AddWithValue("@IdSector", pIdSector); var oData = sqlCmd.ExecuteReader(); while (oData.Read() == true) { SectorDTO oSector = new SectorDTO(); oSector.idSector = int.Parse(oData["idSector"].ToString()); oSector.dsSector = oData["dsSector"].ToString(); oReturn.Add(oSector); } } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(oReturn); }
public List <RangeDTO> getRangeByID(int pIdRange) { List <RangeDTO> oReturn = new List <RangeDTO>(); SqlConnection sqlCon = DBLibrary.OpenConnection(); try { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlCon; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_range_consultar"; sqlCmd.Parameters.AddWithValue("@IdRange", pIdRange); var oData = sqlCmd.ExecuteReader(); while (oData.Read() == true) { RangeDTO oRange = new RangeDTO(); oRange.idRange = pIdRange; oRange.firstValue = decimal.Parse(oData["firstValue"].ToString()); oRange.lastValue = decimal.Parse(oData["lastValue"].ToString()); oReturn.Add(oRange); } } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); } return(oReturn); }