/// <summary> ///</summary> /// <param name="CIUDAD"> Object CIUDAD added to List</param> public override int AddCIUDAD(CIUDADEntity entity_CIUDAD) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.CIUDAD.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_CIUDADAdd", connection); AssingParameter(comandoSql, "@Clv_Ciudad", null, pd: ParameterDirection.Output, IsKey: true); AssingParameter(comandoSql, "@Nombre", entity_CIUDAD.Nombre); AssingParameter(comandoSql, "@CobroEspecial", entity_CIUDAD.CobroEspecial); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = ExecuteNonQuery(comandoSql); } catch (Exception ex) { throw new Exception("Error adding CIUDAD " + ex.Message, ex); } finally { connection.Close(); } result = (int)comandoSql.Parameters["@Clv_Ciudad"].Value; } return(result); }
public static CIUDADEntity GetOne(int?Clv_Ciudad) { CIUDADEntity result = ProviderSoftv.CIUDAD.GetCIUDADById(Clv_Ciudad); if (result.Clv_Ciudad != null) { result.CVECOLCIU = ProviderSoftv.CVECOLCIU.GetCVECOLCIUByCiudad(result.Clv_Ciudad); } return(result); }
/// <summary> /// Converts data from reader to entity /// </summary> protected virtual CIUDADEntity GetCIUDADFromReader(IDataReader reader) { CIUDADEntity entity_CIUDAD = null; try { entity_CIUDAD = new CIUDADEntity(); entity_CIUDAD.Clv_Ciudad = (int?)(GetFromReader(reader, "Clv_Ciudad")); entity_CIUDAD.Nombre = (String)(GetFromReader(reader, "Nombre", IsString: true)); entity_CIUDAD.CobroEspecial = (int?)(GetFromReader(reader, "CobroEspecial")); } catch (Exception ex) { throw new Exception("Error converting CIUDAD data to entity", ex); } return(entity_CIUDAD); }
/// <summary> /// Gets CIUDAD by ///</summary> public override CIUDADEntity GetCIUDADById(int?Clv_Ciudad) { using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.CIUDAD.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_CIUDADGetById", connection); CIUDADEntity entity_CIUDAD = null; AssingParameter(comandoSql, "@Clv_Ciudad", Clv_Ciudad); IDataReader rd = null; try { if (connection.State == ConnectionState.Closed) { connection.Open(); } rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow); if (rd.Read()) { entity_CIUDAD = GetCIUDADFromReader(rd); } } catch (Exception ex) { throw new Exception("Error getting data CIUDAD " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } if (rd != null) { rd.Close(); } } return(entity_CIUDAD); } }
/// <summary> /// Edits a CIUDAD ///</summary> /// <param name="CIUDAD"> Objeto CIUDAD a editar </param> public override int EditCIUDAD(CIUDADEntity entity_CIUDAD) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.CIUDAD.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_CIUDADEdit", connection); AssingParameter(comandoSql, "@Clv_Ciudad", entity_CIUDAD.Clv_Ciudad); AssingParameter(comandoSql, "@Nombre", entity_CIUDAD.Nombre); AssingParameter(comandoSql, "@CobroEspecial", entity_CIUDAD.CobroEspecial); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = int.Parse(ExecuteNonQuery(comandoSql).ToString()); } catch (Exception ex) { throw new Exception("Error updating CIUDAD " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } } } return(result); }
public static int Edit(CIUDADEntity objCIUDAD) { int result = ProviderSoftv.CIUDAD.EditCIUDAD(objCIUDAD); return(result); }
public static int Add(CIUDADEntity objCIUDAD) { int result = ProviderSoftv.CIUDAD.AddCIUDAD(objCIUDAD); return(result); }
/// <summary> /// Abstract method to update CIUDAD /// </summary> public abstract int EditCIUDAD(CIUDADEntity entity_CIUDAD);
/// <summary> /// Abstract method to add CIUDAD /// /summary> /// <param name="CIUDAD"></param> /// <returns></returns> public abstract int AddCIUDAD(CIUDADEntity entity_CIUDAD);
public int UpdateCIUDAD(CIUDADEntity objCIUDAD) { return(CIUDAD.Edit(objCIUDAD)); }
public int AddCIUDAD(CIUDADEntity objCIUDAD) { return(CIUDAD.Add(objCIUDAD)); }