public static void UpdateWithValidation(tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            if (RowIsValid(row))
            {
                Update(row);
            }
        }
        public static void Update(tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow row)
        {
            if (row.RowState == DataRowState.Detached)
            {
                ((tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasDataTable)row.Table).Addtsh_ProductosListasDePreciosCategoriasCuentasRow(row);
            }

            Update(row.Table);
        }
        /// <summary>
        /// Establece los valores por defecto de tsh_ProductosListasDePreciosCategoriasCuentasRow.
        /// </summary>
        public static tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow SetRowDefaultValues(tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow row)
        {
            row.IdNomenclaturaCuenta         = string.Empty;
            row.IdNomenclaturaProducto       = string.Empty;
            row.IdListaDePrecio              = string.Empty;
            row.FechaCreacion                = mz.erp.businessrules.Sistema.DateTime.Now;
            row.IdConexionCreacion           = Security.IdConexion;
            row.UltimaModificacion           = null;
            row.IdConexionUltimaModificacion = Security.IdConexion;
            row.RowId       = Guid.Empty;
            row.IdEmpresa   = 1;
            row.IdSucursal  = 1;
            row.IdReservado = 0;

            return(row);
        }
 /// <summary>
 /// Obtiene un registro de la tabla tsh_ProductosListasDePreciosCategoriasCuentas que luego puede ser persistido en la base de datos.
 /// </summary>
 public static tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow GetByPk(string IdNomenclaturaCuenta, string IdNomenclaturaProducto)
 {
     tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow row = mz.erp.dataaccess.tsh_ProductosListasDePreciosCategoriasCuentas.GetByPk(IdNomenclaturaCuenta, IdNomenclaturaProducto);
     foreach (DataColumn dc in row.Table.Columns)
     {
         if (row[dc] == System.DBNull.Value)
         {
             row[dc] = Util.DefaultValue(dc.DataType);
         }
     }
     return(row);
 }
        /// <summary>
        /// Valida un tsh_ProductosListasDePreciosCategoriasCuentasRow.
        /// </summary>
        public static bool RowIsValid(tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);
            bool   isValid = true;
            string mensaje;


            if (!IdNomenclaturaCuentaIsValid(row.IdNomenclaturaCuenta, out mensaje))
            {
                row.SetColumnError("IdNomenclaturaCuenta", mensaje);
                isValid = false;
            }

            if (!IdNomenclaturaProductoIsValid(row.IdNomenclaturaProducto, out mensaje))
            {
                row.SetColumnError("IdNomenclaturaProducto", mensaje);
                isValid = false;
            }

            if (!IdListaDePrecioIsValid(row.IdListaDePrecio, out mensaje))
            {
                row.SetColumnError("IdListaDePrecio", mensaje);
                isValid = false;
            }

            if (!FechaCreacionIsValid(row.FechaCreacion, out mensaje))
            {
                row.SetColumnError("FechaCreacion", mensaje);
                isValid = false;
            }

            if (!IdConexionCreacionIsValid(row.IdConexionCreacion, out mensaje))
            {
                row.SetColumnError("IdConexionCreacion", mensaje);
                isValid = false;
            }

            if (!UltimaModificacionIsValid(row.UltimaModificacion, out mensaje))
            {
                row.SetColumnError("UltimaModificacion", mensaje);
                isValid = false;
            }

            if (!IdConexionUltimaModificacionIsValid(row.IdConexionUltimaModificacion, out mensaje))
            {
                row.SetColumnError("IdConexionUltimaModificacion", mensaje);
                isValid = false;
            }

            if (!RowIdIsValid(row.RowId, out mensaje))
            {
                row.SetColumnError("RowId", mensaje);
                isValid = false;
            }

            if (!IdEmpresaIsValid(row.IdEmpresa, out mensaje))
            {
                row.SetColumnError("IdEmpresa", mensaje);
                isValid = false;
            }

            if (!IdSucursalIsValid(row.IdSucursal, out mensaje))
            {
                row.SetColumnError("IdSucursal", mensaje);
                isValid = false;
            }

            if (!IdReservadoIsValid(row.IdReservado, out mensaje))
            {
                row.SetColumnError("IdReservado", mensaje);
                isValid = false;
            }
            ;

            return(isValid);
        }
        /// <summary>
        /// Envia los cambios del tsh_ProductosListasDePreciosCategoriasCuentasRow a la base de datos.
        /// </summary>
        public static void Update(tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            mz.erp.dataaccess.tsh_ProductosListasDePreciosCategoriasCuentas.Update(row);
        }
Пример #7
0
        public tsh_ProductosListasDePreciosCategoriasCuentasDataset Commit(tsh_ProductosListasDePreciosCategoriasCuentasDataset data)
        {
            switch (_estado)
            {
            case "NEW":
            {
                tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow rowPC = data.tsh_ProductosListasDePreciosCategoriasCuentas.Newtsh_ProductosListasDePreciosCategoriasCuentasRow();
                tsh_ProductosListasDePreciosCategoriasCuentas.SetRowDefaultValues(rowPC);

                rowPC.IdNomenclaturaCuenta   = _idNomenclaturaCuenta;
                rowPC.IdNomenclaturaProducto = _idNomenclaturaProducto;
                rowPC.IdListaDePrecio        = _idListaDePrecios;

                data.tsh_ProductosListasDePreciosCategoriasCuentas.Rows.Add(rowPC);
                break;
            }

            case "DEL":
            {
                tsh_ProductosListasDePreciosCategoriasCuentasDataset.tsh_ProductosListasDePreciosCategoriasCuentasRow rowPC = data.tsh_ProductosListasDePreciosCategoriasCuentas.FindByIdNomenclaturaCuentaIdNomenclaturaProducto(_idNomenclaturaCuenta, _idNomenclaturaProducto);
                if (rowPC == null)
                {
                    rowPC = mz.erp.businessrules.tsh_ProductosListasDePreciosCategoriasCuentas.GetByPk(_idNomenclaturaCuenta, _idNomenclaturaProducto);
                    rowPC.Delete();
                    data.tsh_ProductosListasDePreciosCategoriasCuentas.ImportRow(rowPC);
                }
                else
                {
                    rowPC.Delete();
                }
                break;
            }

            default:
                break;
            }
            return(data);
        }