コード例 #1
0
        public static void UpdateWithValidation(sy_VariablesPuestosDataset.sy_VariablesPuestosRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            if (RowIsValid(row))
            {
                Update(row);
            }
        }
コード例 #2
0
        public static void Update(sy_VariablesPuestosDataset.sy_VariablesPuestosRow row)
        {
            if (row.RowState == DataRowState.Detached)
            {
                ((sy_VariablesPuestosDataset.sy_VariablesPuestosDataTable)row.Table).Addsy_VariablesPuestosRow(row);
            }

            Update(row.Table);
        }
コード例 #3
0
 public static object GetValuePK(string IdVariable, long IdEmpresa, long IdSucursal, long IdPuesto)
 {
     sy_VariablesPuestosDataset.sy_VariablesPuestosRow row = dataaccess.sy_VariablesPuestos.GetByPk(IdVariable, IdEmpresa, IdSucursal, IdPuesto);
     if (row != null)
     {
         return(row.Valor);
     }
     else
     {
         return(null);
     }
 }
コード例 #4
0
 /// <summary>
 /// Obtiene un registro de la tabla sy_VariablesPuestos que luego puede ser persistido en la base de datos.
 /// </summary>
 public static sy_VariablesPuestosDataset.sy_VariablesPuestosRow GetByPk(string IdVariable, long IdEmpresa, long IdSucursal, long IdPuesto)
 {
     sy_VariablesPuestosDataset.sy_VariablesPuestosRow row = mz.erp.dataaccess.sy_VariablesPuestos.GetByPk(IdVariable, IdEmpresa, IdSucursal, IdPuesto);
     if (row != null)
     {
         foreach (DataColumn dc in row.Table.Columns)
         {
             if (!dc.Caption.ToUpper().Equals("ROWID"))
             {
                 if (row[dc] == System.DBNull.Value)
                 {
                     row[dc] = Util.DefaultValue(dc.DataType);
                 }
             }
         }
     }
     return(row);
 }
コード例 #5
0
 public static object GetValue(string IdVariable, int IdEmpresa, int IdSucursal, int IdPuesto)
 {
     /*sy_VariablesPuestosDataset data = sy_VariablesPuestos.GetList( IdVariable, IdEmpresa, IdSucursal, IdPuesto );
      * if ( data != null && data.sy_VariablesPuestos.Rows.Count == 1 )
      * {
      *      return ( ( sy_VariablesPuestosDataset.sy_VariablesPuestosRow ) data.sy_VariablesPuestos.Rows[ 0 ] ).Valor;
      * }
      * else
      * {
      *      //throw new ArgumentException( "No se ha encontrado el parámetro indicado" );
      *      return null;
      * }*/
     sy_VariablesPuestosDataset.sy_VariablesPuestosRow row = dataaccess.sy_VariablesPuestos.GetByPk(IdVariable, IdEmpresa, IdSucursal, IdPuesto);
     if (row != null)
     {
         return(row.Valor);
     }
     else
     {
         return(null);
     }
 }
コード例 #6
0
        public void Commit()
        {
            foreach (DataRow row in _result.Rows)
            {
                if (row.RowState.Equals(DataRowState.Modified))
                {                //Es una modificacion
                    string idVariable     = (string)row["IdVariable"];
                    string idTipoVariable = (string)row["Tipo"];
                    string valor          = string.Empty;
                    if (row["ValorDefault"] != System.DBNull.Value)
                    {
                        valor = (string)row["ValorDefault"];
                    }
                    string usuario = (string)row["Usuario"];
                    string perfil  = (string)row["Perfil"];
                    string puesto  = (string)row["Puesto"];
                    if (!usuario.Equals(string.Empty))                    //Es una variable de sy_VariablesUsuarios
                    {
                        string idUsuario = (string)row["IdUsuario"];
                        sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow rowU = sy_VariablesUsuarios.GetByPk(idVariable, idUsuario);
                        if (rowU != null)
                        {
                            rowU.Valor = valor;
                            _dataUsuarios.sy_VariablesUsuarios.ImportRow(rowU);
                        }
                    }
                    else if (!perfil.Equals(string.Empty))                   //Es una variable de sy_VariablesPerfiles
                    {
                        long idPerfil = Convert.ToInt64(row["IdPerfil"]);
                        sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow rowP = sy_VariablesPerfiles.GetByPk(idVariable, idPerfil);
                        if (rowP != null)
                        {
                            rowP.Valor = valor;
                            _dataPerfiles.sy_VariablesPerfiles.ImportRow(rowP);
                        }
                    }
                    else if (!puesto.Equals(string.Empty))                   //Es una variable de sy_VariablesPuestos
                    {
                        long idPuesto = Convert.ToInt64(row["IdPuesto"]);
                        sy_VariablesPuestosDataset.sy_VariablesPuestosRow rowPU = sy_VariablesPuestos.GetByPk(idVariable, Security.IdEmpresa, Security.IdSucursal, idPuesto);
                        if (rowPU != null)
                        {
                            rowPU.Valor = valor;
                            _dataPuestos.sy_VariablesPuestos.ImportRow(rowPU);
                        }
                    }
                    else                     //Es una variable de sy_Variables
                    {
                        sy_VariablesDataset.sy_VariablesRow rowG = sy_Variables.GetByPk(idVariable);
                        if (rowG != null)
                        {
                            rowG.ValorDefault   = valor;
                            rowG.IdTipoVariable = idTipoVariable;
                            _dataGenericas.sy_Variables.ImportRow(rowG);
                        }
                    }
                }
            }

            //Borro las variables eliminadas
            foreach (Variable var in _variablesBorradas)
            {
                var.Commit(_dataGenericas, _dataUsuarios, _dataPerfiles, _dataPuestos);
            }
        }
コード例 #7
0
        /// <summary>
        /// Valida un sy_VariablesPuestosRow.
        /// </summary>
        public static bool RowIsValid(sy_VariablesPuestosDataset.sy_VariablesPuestosRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);
            bool   isValid = true;
            string mensaje;


            if (!IdVariableIsValid(row.IdVariable, out mensaje))
            {
                row.SetColumnError("IdVariable", 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 (!IdPuestoIsValid(row.IdPuesto, out mensaje))
            {
                row.SetColumnError("IdPuesto", mensaje);
                isValid = false;
            }

            if (!ValorIsValid(row.Valor, out mensaje))
            {
                row.SetColumnError("Valor", 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;
            }
            ;

            return(isValid);
        }
コード例 #8
0
        /// <summary>
        /// Envia los cambios del sy_VariablesPuestosRow a la base de datos.
        /// </summary>
        public static void Update(sy_VariablesPuestosDataset.sy_VariablesPuestosRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            mz.erp.dataaccess.sy_VariablesPuestos.Update(row);
        }
コード例 #9
0
        /// <summary>
        /// Establece los valores por defecto de sy_VariablesPuestosRow.
        /// </summary>
        public static sy_VariablesPuestosDataset.sy_VariablesPuestosRow SetRowDefaultValues(sy_VariablesPuestosDataset.sy_VariablesPuestosRow row)
        {
            row.IdVariable                   = Util.NewStringId();
            row.IdEmpresa                    = Security.IdEmpresa;
            row.IdSucursal                   = Security.IdSucursal;
            row.IdPuesto                     = 0;
            row.Valor                        = 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;

            return(row);
        }
コード例 #10
0
        public void Commit()
        {
            foreach (ConfiguracionNueva cn in _configuracionesNuevas)
            {
                switch (cn.TipoHabilitado)
                {
                case "Usuario":
                {
                    ArrayList keys = new ArrayList();
                    keys.Add(cn.IdVariable);
                    keys.Add(cn.IdHabilitado);
                    sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow rowU1 = (sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow)_dataUsuarios.sy_VariablesUsuarios.Rows.Find(keys.ToArray());
                    if (rowU1 == null)
                    {
                        sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow rowU = mz.erp.businessrules.sy_VariablesUsuarios.GetByPk(cn.IdVariable, cn.IdHabilitado);
                        if (rowU == null)
                        {
                            rowU                    = _dataUsuarios.sy_VariablesUsuarios.Newsy_VariablesUsuariosRow();
                            rowU.IdVariable         = cn.IdVariable;
                            rowU.IdUsuario          = cn.IdHabilitado;
                            rowU.Valor              = "@" + cn.DescripcionDatoNuevo;
                            rowU.FechaCreacion      = DateTime.Now;
                            rowU.IdConexionCreacion = Security.IdConexion;
                            _dataUsuarios.sy_VariablesUsuarios.Addsy_VariablesUsuariosRow(rowU);
                        }
                        else
                        {
                            rowU.Valor = rowU.Valor + "@" + cn.DescripcionDatoNuevo;
                            _dataUsuarios.sy_VariablesUsuarios.ImportRow(rowU);
                        }
                    }
                    else
                    {
                        rowU1.Valor = rowU1.Valor + "@" + cn.DescripcionDatoNuevo;
                    }
                    break;
                }

                case "Perfil":
                {
                    ArrayList keys = new ArrayList();
                    keys.Add(cn.IdVariable);
                    keys.Add(cn.IdHabilitadoL);
                    sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow rowP1 = (sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow)_dataPerfiles.sy_VariablesPerfiles.Rows.Find(keys.ToArray());
                    if (rowP1 == null)
                    {
                        sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow rowP = mz.erp.businessrules.sy_VariablesPerfiles.GetByPk(cn.IdVariable, cn.IdHabilitadoL);
                        if (rowP == null)
                        {
                            rowP                    = _dataPerfiles.sy_VariablesPerfiles.Newsy_VariablesPerfilesRow();
                            rowP.IdVariable         = cn.IdVariable;
                            rowP.IdPerfil           = cn.IdHabilitadoL;
                            rowP.Valor              = "@" + cn.DescripcionDatoNuevo;
                            rowP.FechaCreacion      = DateTime.Now;
                            rowP.IdConexionCreacion = Security.IdConexion;
                            _dataPerfiles.sy_VariablesPerfiles.Addsy_VariablesPerfilesRow(rowP);
                        }
                        else
                        {
                            rowP.Valor = rowP.Valor + "@" + cn.DescripcionDatoNuevo;
                            _dataPerfiles.sy_VariablesPerfiles.ImportRow(rowP);
                        }
                    }
                    else
                    {
                        rowP1.Valor = rowP1.Valor + "@" + cn.DescripcionDatoNuevo;
                    }

                    break;
                }

                case "Puesto":
                {
                    ArrayList keys = new ArrayList();
                    keys.Add(cn.IdVariable);
                    keys.Add(Security.IdEmpresa);
                    keys.Add(Security.IdSucursal);
                    keys.Add(cn.IdHabilitadoL);
                    sy_VariablesPuestosDataset.sy_VariablesPuestosRow rowP1 = (sy_VariablesPuestosDataset.sy_VariablesPuestosRow)_dataPuestos.sy_VariablesPuestos.Rows.Find(keys.ToArray());
                    if (rowP1 == null)
                    {
                        sy_VariablesPuestosDataset.sy_VariablesPuestosRow rowP = mz.erp.businessrules.sy_VariablesPuestos.GetByPk(cn.IdVariable, Security.IdEmpresa, Security.IdSucursal, cn.IdHabilitadoL);
                        if (rowP == null)
                        {
                            rowP                    = _dataPuestos.sy_VariablesPuestos.Newsy_VariablesPuestosRow();
                            rowP.IdVariable         = cn.IdVariable;
                            rowP.IdPuesto           = cn.IdHabilitadoL;
                            rowP.IdEmpresa          = Security.IdEmpresa;
                            rowP.IdSucursal         = Security.IdSucursal;
                            rowP.Valor              = "@" + cn.DescripcionDatoNuevo;
                            rowP.FechaCreacion      = DateTime.Now;
                            rowP.IdConexionCreacion = Security.IdConexion;
                            _dataPuestos.sy_VariablesPuestos.Addsy_VariablesPuestosRow(rowP);
                        }
                        else
                        {
                            rowP.Valor = rowP.Valor + "@" + cn.DescripcionDatoNuevo;
                            _dataPuestos.sy_VariablesPuestos.ImportRow(rowP);
                        }
                    }
                    else
                    {
                        rowP1.Valor = rowP1.Valor + "@" + cn.DescripcionDatoNuevo;
                    }
                    break;
                }

                case "Empresa":
                {
                    ArrayList keys = new ArrayList();
                    keys.Add(cn.IdVariable);
                    keys.Add(cn.IdHabilitadoL);
                    sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow rowE1 = (sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow)_dataEmpresas.sy_VariablesEmpresas.Rows.Find(keys.ToArray());
                    if (rowE1 == null)
                    {
                        sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow rowE = mz.erp.businessrules.sy_VariablesEmpresas.GetByPk(cn.IdVariable, cn.IdHabilitadoL);
                        if (rowE == null)
                        {
                            rowE                    = _dataEmpresas.sy_VariablesEmpresas.Newsy_VariablesEmpresasRow();
                            rowE.IdVariable         = cn.IdVariable;
                            rowE.IdEmpresa          = cn.IdHabilitadoL;
                            rowE.Valor              = "@" + cn.DescripcionDatoNuevo;
                            rowE.FechaCreacion      = DateTime.Now;
                            rowE.IdConexionCreacion = Security.IdConexion;
                            _dataEmpresas.sy_VariablesEmpresas.Addsy_VariablesEmpresasRow(rowE);
                        }
                        else
                        {
                            rowE.Valor = rowE.Valor + "@" + cn.DescripcionDatoNuevo;
                            _dataEmpresas.sy_VariablesEmpresas.ImportRow(rowE);
                        }
                    }
                    else
                    {
                        rowE1.Valor = rowE1.Valor + "@" + cn.DescripcionDatoNuevo;
                    }
                    break;
                }

                case "Sucursal":
                {
                    ArrayList keys = new ArrayList();
                    keys.Add(cn.IdVariable);
                    keys.Add(cn.IdHabilitadoLAux);
                    keys.Add(cn.IdHabilitadoL);
                    sy_VariablesSucursalesDataset.sy_VariablesSucursalesRow rowS1 = (sy_VariablesSucursalesDataset.sy_VariablesSucursalesRow)_dataSucursales.sy_VariablesSucursales.Rows.Find(keys.ToArray());
                    if (rowS1 == null)
                    {
                        sy_VariablesSucursalesDataset.sy_VariablesSucursalesRow rowS = mz.erp.businessrules.sy_VariablesSucursales.GetByPk(cn.IdVariable, cn.IdHabilitadoLAux, cn.IdHabilitadoL);
                        if (rowS == null)
                        {
                            rowS                     = _dataSucursales.sy_VariablesSucursales.Newsy_VariablesSucursalesRow();
                            rowS.IdVariable          = cn.IdVariable;
                            rowS.IdEmpresa           = cn.IdHabilitadoLAux;
                            rowS.IdSucursal          = cn.IdHabilitadoL;
                            rowS.Valor               = "@" + cn.DescripcionDatoNuevo;
                            rowS.FechaCreacion       = DateTime.Now;
                            rowS.IdConecxionCreacion = Security.IdConexion;
                            _dataSucursales.sy_VariablesSucursales.Addsy_VariablesSucursalesRow(rowS);
                        }
                        else
                        {
                            rowS.Valor = rowS.Valor + "@" + cn.DescripcionDatoNuevo;
                            _dataSucursales.sy_VariablesSucursales.ImportRow(rowS);
                        }
                    }
                    else
                    {
                        rowS1.Valor = rowS1.Valor + "@" + cn.DescripcionDatoNuevo;
                    }
                    break;
                }
                }
            }
        }