示例#1
0
        /// <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);
        }
示例#2
0
        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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
            }
        }
示例#5
0
        /// <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);
        }
示例#6
0
        public static int Edit(CIUDADEntity objCIUDAD)
        {
            int result = ProviderSoftv.CIUDAD.EditCIUDAD(objCIUDAD);

            return(result);
        }
示例#7
0
        public static int Add(CIUDADEntity objCIUDAD)
        {
            int result = ProviderSoftv.CIUDAD.AddCIUDAD(objCIUDAD);

            return(result);
        }
示例#8
0
 /// <summary>
 /// Abstract method to update CIUDAD
 /// </summary>
 public abstract int EditCIUDAD(CIUDADEntity entity_CIUDAD);
示例#9
0
 /// <summary>
 /// Abstract method to add CIUDAD
 ///  /summary>
 /// <param name="CIUDAD"></param>
 /// <returns></returns>
 public abstract int AddCIUDAD(CIUDADEntity entity_CIUDAD);
示例#10
0
 public int UpdateCIUDAD(CIUDADEntity objCIUDAD)
 {
     return(CIUDAD.Edit(objCIUDAD));
 }
示例#11
0
 public int AddCIUDAD(CIUDADEntity objCIUDAD)
 {
     return(CIUDAD.Add(objCIUDAD));
 }