Example #1
0
        /// <summary>
        /// Envia los cambios del tsh_PaisesDataset a la base de datos.
        /// </summary>
        public static void Update(tsh_PaisesDataset dataSet)
        {
            ApplicationAssert.Check(dataSet != null, "El argumento dataSet no debe ser nulo.", ApplicationAssert.LineNumber);
            ApplicationAssert.Check(dataSet.tsh_Paises.Rows.Count > 0, "La tabla dataSet.tsh_PaisesDataTable debe poseer alguna fila.", ApplicationAssert.LineNumber);

            mz.erp.dataaccess.tsh_Paises.Update(dataSet);
        }
Example #2
0
        public static tsh_PaisesDataset.tsh_PaisesRow GetByPk(long IdPais)
        {
            tsh_PaisesDataset data = new tsh_PaisesDataset();

            SqlCommand cmd = new SqlCommand("Pr_tsh_Paises_GetByPk", dbhelper.Connection.GetConnection());

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add(new SqlParameter("@IdPais", SqlDbType.BigInt));
            cmd.Parameters["@IdPais"].Value = IdPais;

            SqlDataAdapter adapter = new SqlDataAdapter(cmd);

            adapter.TableMappings.Add("Table", "tsh_Paises");

            adapter.Fill(data);

            if (data.tsh_Paises.Rows.Count == 1)
            {
                return((tsh_PaisesDataset.tsh_PaisesRow)data.tsh_Paises.Rows[0]);
            }


            return(null);
        }
Example #3
0
        public static tsh_PaisesDataset GetList(long IdPais, string Nombre, string Descripcion, long IdEmpresa, long IdSucursal)
        {
            tsh_PaisesDataset data = new tsh_PaisesDataset();

            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.TableMappings.Add("Table", "tsh_Paises");

            SqlCommand cmd = new SqlCommand("Pr_tsh_Paises_Search", dbhelper.Connection.GetConnection());

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add(new SqlParameter("@IdPais", SqlDbType.BigInt));
            if (IdPais == long.MinValue)
            {
                cmd.Parameters["@IdPais"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@IdPais"].Value = IdPais;
            }
            cmd.Parameters.Add(new SqlParameter("@Nombre", SqlDbType.VarChar));
            if (Nombre.Equals(string.Empty))
            {
                cmd.Parameters["@Nombre"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@Nombre"].Value = Nombre;
            }
            cmd.Parameters.Add(new SqlParameter("@Descripcion", SqlDbType.VarChar));
            if (Descripcion.Equals(string.Empty))
            {
                cmd.Parameters["@Descripcion"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@Descripcion"].Value = Descripcion;
            }
            cmd.Parameters.Add(new SqlParameter("@IdEmpresa", SqlDbType.BigInt));
            if (IdEmpresa == long.MinValue)
            {
                cmd.Parameters["@IdEmpresa"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@IdEmpresa"].Value = IdEmpresa;
            }
            cmd.Parameters.Add(new SqlParameter("@IdSucursal", SqlDbType.BigInt));
            if (IdSucursal == long.MinValue)
            {
                cmd.Parameters["@IdSucursal"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@IdSucursal"].Value = IdSucursal;
            }
            adapter.SelectCommand = cmd;

            adapter.Fill(data);

            return(data);
        }
Example #4
0
        public static tsh_PaisesDataset GetList()
        {
            tsh_PaisesDataset data = new tsh_PaisesDataset();

            return(( tsh_PaisesDataset )GetList(data));
        }
Example #5
0
 public static void Update(tsh_PaisesDataset dataSet)
 {
     Update(dataSet.tsh_Paises);
 }