Exemplo n.º 1
0
        /// <summary>
        ///</summary>
        /// <param name="COLONIA"> Object COLONIA added to List</param>
        public override int AddCOLONIA(COLONIAEntity entity_COLONIA)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.COLONIA.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("Softv_COLONIAAdd", connection);

                AssingParameter(comandoSql, "@Clv_Colonia", null, pd: ParameterDirection.Output, IsKey: true);

                AssingParameter(comandoSql, "@Nombre", entity_COLONIA.Nombre);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    result = ExecuteNonQuery(comandoSql);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error adding COLONIA " + ex.Message, ex);
                }
                finally
                {
                    connection.Close();
                }
                result = (int)comandoSql.Parameters["@Clv_Colonia"].Value;
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Edits a COLONIA
        ///</summary>
        /// <param name="COLONIA"> Objeto COLONIA a editar </param>
        public override int EditCOLONIA(COLONIAEntity entity_COLONIA)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.COLONIA.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("Softv_COLONIAEdit", connection);

                AssingParameter(comandoSql, "@Clv_Colonia", entity_COLONIA.Clv_Colonia);

                AssingParameter(comandoSql, "@Nombre", entity_COLONIA.Nombre);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }

                    result = int.Parse(ExecuteNonQuery(comandoSql).ToString());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error updating COLONIA " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public static COLONIAEntity GetOneDeep(int?Clv_Colonia)
        {
            COLONIAEntity result = ProviderSoftv.COLONIA.GetCOLONIAById(Clv_Colonia);

            if (result.Clv_Colonia != null)
            {
                result.CLIENTE = ProviderSoftv.CLIENTE.GetCLIENTEById(result.Clv_Colonia);
            }


            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Converts data from reader to entity
        /// </summary>
        protected virtual COLONIAEntity GetCOLONIAFromReader(IDataReader reader)
        {
            COLONIAEntity entity_COLONIA = null;

            try
            {
                entity_COLONIA             = new COLONIAEntity();
                entity_COLONIA.Clv_Colonia = (int?)(GetFromReader(reader, "Clv_Colonia"));
                entity_COLONIA.Nombre      = (String)(GetFromReader(reader, "Nombre", IsString: true));
            }
            catch (Exception ex)
            {
                throw new Exception("Error converting COLONIA data to entity", ex);
            }
            return(entity_COLONIA);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets COLONIA by
        ///</summary>
        public override COLONIAEntity GetCOLONIAById(int?Clv_Colonia)
        {
            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.COLONIA.ConnectionString))
            {
                SqlCommand    comandoSql     = CreateCommand("Softv_COLONIAGetById", connection);
                COLONIAEntity entity_COLONIA = null;


                AssingParameter(comandoSql, "@Clv_Colonia", Clv_Colonia);

                IDataReader rd = null;
                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow);
                    if (rd.Read())
                    {
                        entity_COLONIA = GetCOLONIAFromReader(rd);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error getting data COLONIA " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (rd != null)
                    {
                        rd.Close();
                    }
                }
                return(entity_COLONIA);
            }
        }
Exemplo n.º 6
0
        public static int Edit(COLONIAEntity objCOLONIA)
        {
            int result = ProviderSoftv.COLONIA.EditCOLONIA(objCOLONIA);

            return(result);
        }
Exemplo n.º 7
0
        public static int Add(COLONIAEntity objCOLONIA)
        {
            int result = ProviderSoftv.COLONIA.AddCOLONIA(objCOLONIA);

            return(result);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Abstract method to update COLONIA
 /// </summary>
 public abstract int EditCOLONIA(COLONIAEntity entity_COLONIA);
Exemplo n.º 9
0
 /// <summary>
 /// Abstract method to add COLONIA
 ///  /summary>
 /// <param name="COLONIA"></param>
 /// <returns></returns>
 public abstract int AddCOLONIA(COLONIAEntity entity_COLONIA);
Exemplo n.º 10
0
 public int UpdateCOLONIA(COLONIAEntity objCOLONIA)
 {
     return(COLONIA.Edit(objCOLONIA));
 }
Exemplo n.º 11
0
 public int AddCOLONIA(COLONIAEntity objCOLONIA)
 {
     return(COLONIA.Add(objCOLONIA));
 }