Exemplo n.º 1
0
        public static void Update(sy_VariablesDataset.sy_VariablesRow row)
        {
            if (row.RowState == DataRowState.Detached)
            {
                ((sy_VariablesDataset.sy_VariablesDataTable)row.Table).Addsy_VariablesRow(row);
            }

            Update(row.Table);
        }
Exemplo n.º 2
0
        public static void UpdateWithValidation(sy_VariablesDataset.sy_VariablesRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            if (RowIsValid(row))
            {
                Variables.ModifyVariable(row.IdVariable, row.ValorDefault);
                Update(row);
            }
        }
Exemplo n.º 3
0
 public static object GetValue(string IdVariable, string IdTransaction)
 {
     sy_VariablesDataset.sy_VariablesRow row = sy_Variables.GetByPk(IdVariable, IdTransaction);
     if (row != null)
     {
         return(row.ValorDefault);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 4
0
        /*public static object GetValueWithoutCache( string IdVariable, string IdTransaction )
         * {
         *      object value = null;
         *      value = sy_Variables_GetValue(IdVariable,IdTransaction);
         *      return value;
         * }
         *
         * public static object GetValueWithoutCache( string IdVariable)
         * {
         *      object value = null;
         *      value = sy_Variables_GetValue(IdVariable);
         *      return value;
         * }*/


        /*public static string GetValueStringWithoutCache(string IdVariable, string IdTransaction)
         * {
         *      object value = GetValueWithoutCache(IdVariable,IdTransaction);
         *      if (value != null)
         *      {
         *              return (string)value;
         *      }
         *      else
         *      {
         *              return string.Empty;
         *      }
         * }
         * public static string GetValueStringWithoutCache( string IdVariable )
         * {
         *      object value = GetValueWithoutCache(IdVariable);
         *      if (value != null)
         *      {
         *              return (string)value;
         *      }
         *      else
         *      {
         *              return string.Empty;
         *      }
         * }*/

        /*public static bool GetValueBoolWithoutCache( string IdVariable )
         * {
         *      object value = GetValueWithoutCache(IdVariable);
         *      if (value != null)
         *      {
         *              return Convert.ToBoolean( value );
         *      }
         *      else
         *      {
         *              return false;
         *      }
         * }
         *
         * public static bool GetValueBoolWithoutCache( string IdVariable, bool Default)
         * {
         *      object value = GetValueWithoutCache(IdVariable);
         *      if (value != null)
         *      {
         *              return Convert.ToBoolean( value );
         *      }
         *      else
         *      {
         *              return Default;
         *      }
         * }*/


        //sy_variables
        public static object sy_Variables_GetValue(string IdVariable)
        {
            sy_VariablesDataset.sy_VariablesRow row = sy_Variables_GetByPk(IdVariable);
            if (row != null)
            {
                return(row.ValorDefault);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 private string UpdateNumero(DataRow row, string IdTransaction)
 {
     if (!this._numeracionManual)
     {
         string numeracion = Variables.GetValueStringWithoutCache("Comprobantes.Numeracion." + (string)row["IdTipoDeComprobante"], IdTransaction);
         string Numero     = mz.erp.systemframework.Util.StcZero(numeracion, 8);
         row["Numero"] = Numero;
         sy_VariablesDataset.sy_VariablesRow rowVar = mz.erp.businessrules.sy_Variables.GetByPk("Comprobantes.Numeracion." + row["IdTipoDeComprobante"], IdTransaction);
         return(rowVar.IdVariable);
     }
     return(null);
 }
 private static string  UpdateNumero(tfi_MovimientosDeCajaExDataset data)
 {
     if (Variables.GetValueBool("Movimientos.Numeracion.Automatica"))             //si es autonumerico tapo el numero q trae desde la UI
     {
         string numeracion = Variables.GetValueString("Movimientos.Numeracion");
         string Numero     = Util.StcZero(numeracion, 8);
         data.tfi_MovimientosDeCaja.Rows[0]["Numero"] = Numero;
         //actualizo la variable
         sy_VariablesDataset.sy_VariablesRow row = mz.erp.businessrules.sy_Variables.GetByPk("Movimientos.Numeracion");
         mz.erp.dataaccess.sy_Variables.Update(row.IdVariable, (string)data.tfi_MovimientosDeCaja.Rows[0]["Numero"], 1);
         return(row.IdVariable);
     }
     sy_VariablesDataset.sy_VariablesRow row2 = mz.erp.businessrules.sy_Variables.GetByPk("Movimientos.Numeracion");
     return(row2.IdVariable);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Establece los valores por defecto de sy_VariablesRow.
        /// </summary>
        public static sy_VariablesDataset.sy_VariablesRow SetRowDefaultValues(sy_VariablesDataset.sy_VariablesRow row)
        {
            row.IdVariable                   = Util.NewStringId();
            row.Descripcion                  = string.Empty;
            row.ValorDefault                 = string.Empty;
            row.IdTipoVariable               = string.Empty;
            row.Categoria                    = string.Empty;
            row.Comentario                   = 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);
        }
Exemplo n.º 8
0
        private static string  UpdateNumero(tsa_ComprobantesExDataset data)
        {
            foreach (System.Data.DataRow row1 in data.tsa_Comprobantes.Rows)
            {
                if (true)
                {
                    string numeracion = Variables.GetValueStringWithoutCache("Comprobantes.Numeracion." + (string)row1["IdTipoDeComprobante"]);
                    string Numero     = Util.StcZero(numeracion, 8);
                    row1["Numero"] = Numero;
                    sy_VariablesDataset.sy_VariablesRow row = mz.erp.businessrules.sy_Variables.GetByPk("Comprobantes.Numeracion." + row1["IdTipoDeComprobante"]);

                    return(row.IdVariable);
                }
            }

            return(null);
        }
Exemplo n.º 9
0
 public static sy_VariablesDataset.sy_VariablesRow GetByPk(string IdVariable, string IdTransaction)
 {
     sy_VariablesDataset.sy_VariablesRow row = mz.erp.dataaccess.sy_Variables.GetByPk(IdVariable, IdTransaction);
     if (row != null)
     {
         foreach (DataColumn dc in row.Table.Columns)
         {
             if (row[dc] == System.DBNull.Value)
             {
                 if (dc.Caption != "RowId")
                 {
                     row[dc] = Util.DefaultValue(dc.DataType);
                 }
             }
         }
     }
     return(row);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Obtiene un registro de la tabla sy_Variables que luego puede ser persistido en la base de datos.
 /// </summary>
 public static sy_VariablesDataset.sy_VariablesRow GetByPk(string IdVariable)
 {
     sy_VariablesDataset.sy_VariablesRow row = mz.erp.dataaccess.sy_Variables.GetByPk(IdVariable);
     if (row != null)
     {
         foreach (DataColumn dc in row.Table.Columns)
         {
             if (row[dc] == System.DBNull.Value)
             {
                 if (dc.Caption != "RowId" && !dc.Caption.ToUpper().Equals("ULTIMAMODIFICACION"))
                 {
                     row[dc] = Util.DefaultValue(dc.DataType);
                 }
             }
         }
     }
     return(row);
 }
Exemplo n.º 11
0
        public static string NextFileName()
        {
            string Numero = null;

            sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow row = mz.erp.businessrules.sy_VariablesUsuarios.GetByPk("Momentos.Pedir.NumeracionArchivo", Security.IdUsuario);
            if (row != null)
            {
                Numero    = Util.StcZero(row.Valor, 8);
                row.Valor = Numero;
                mz.erp.dataaccess.sy_VariablesUsuarios.Update(row);
            }
            else
            {
                sy_VariablesDataset.sy_VariablesRow rowV = mz.erp.businessrules.sy_Variables.GetByPk("Momentos.Pedir.NumeracionArchivo");
                Numero            = Util.StcZero(rowV.ValorDefault, 8);
                rowV.ValorDefault = Numero;
                mz.erp.dataaccess.sy_Variables.Update(rowV);
            }
            return(Numero);
        }
Exemplo n.º 12
0
        public void Commit(sy_VariablesDataset Data, sy_VariablesUsuariosDataset DataUsuarios, sy_VariablesPerfilesDataset DataPerfiles, sy_VariablesPuestosDataset DataPuestos, string Valor, string Descripcion)
        {
            sy_VariablesDataset.sy_VariablesRow row = sy_Variables.GetByPk(this.IdVariable);
            if (row == null)
            {
                row                    = Data.sy_Variables.Newsy_VariablesRow();
                row.IdVariable         = IdVariable;
                row.IdTipoVariable     = "System.Boolean";
                row.Descripcion        = Descripcion;
                row.ValorDefault       = Valor;
                row.FechaCreacion      = DateTime.Now;
                row.IdConexionCreacion = Security.IdConexion;
                Data.sy_Variables.Addsy_VariablesRow(row);
            }
            else
            {
                row.ValorDefault = Valor;
                Data.sy_Variables.ImportRow(row);
            }

            sy_VariablesUsuariosDataset.sy_VariablesUsuariosDataTable tableVU = sy_VariablesUsuarios.GetList(this.IdVariable).sy_VariablesUsuarios;
            foreach (sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow rowU in tableVU.Rows)
            {
                rowU.Valor = Valor;
                DataUsuarios.sy_VariablesUsuarios.ImportRow(rowU);
            }

            sy_VariablesPerfilesDataset.sy_VariablesPerfilesDataTable tableVP = sy_VariablesPerfiles.GetList(this.IdVariable).sy_VariablesPerfiles;
            foreach (sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow rowP in tableVP.Rows)
            {
                rowP.Valor = Valor;
                DataPerfiles.sy_VariablesPerfiles.ImportRow(rowP);
            }

            sy_VariablesPuestosDataset.sy_VariablesPuestosDataTable tableVPU = sy_VariablesPuestos.GetList(this.IdVariable).sy_VariablesPuestos;
            foreach (sy_VariablesPuestosDataset.sy_VariablesPuestosRow rowPU in tableVPU.Rows)
            {
                rowPU.Valor = Valor;
                DataPuestos.sy_VariablesPuestos.ImportRow(rowPU);
            }
        }
Exemplo n.º 13
0
        public static DataTable GetListByColaCompleto(string IdVariable)
        {
            DataTable  table     = new DataTable("");
            DataColumn columna1  = new DataColumn("IdVariable");
            DataColumn columna2  = new DataColumn("ValorDefault");
            DataColumn columna3  = new DataColumn("Perfil");
            DataColumn columna4  = new DataColumn("Puesto");
            DataColumn columna5  = new DataColumn("Usuario");
            DataColumn columna6  = new DataColumn("Descripcion");
            DataColumn columna7  = new DataColumn("Tipo");
            DataColumn columna8  = new DataColumn("IdUsuario");
            DataColumn columna9  = new DataColumn("IdPerfil");
            DataColumn columna10 = new DataColumn("IdPuesto");

            columna1.DataType  = typeof(string);
            columna2.DataType  = typeof(string);
            columna3.DataType  = typeof(string);
            columna4.DataType  = typeof(string);
            columna5.DataType  = typeof(string);
            columna6.DataType  = typeof(string);
            columna7.DataType  = typeof(string);
            columna8.DataType  = typeof(string);
            columna9.DataType  = typeof(long);
            columna10.DataType = typeof(long);
            table.Columns.Add(columna1);
            table.Columns.Add(columna2);
            table.Columns.Add(columna3);
            table.Columns.Add(columna4);
            table.Columns.Add(columna5);
            table.Columns.Add(columna6);
            table.Columns.Add(columna7);
            table.Columns.Add(columna8);
            table.Columns.Add(columna9);
            table.Columns.Add(columna10);

            DataTable tableVariablesUsuarios = mz.erp.dataaccess.sy_VariablesUsuarios.GetListByCola(IdVariable, string.Empty).sy_VariablesUsuarios;

            foreach (DataRow rowU in tableVariablesUsuarios.Rows)
            {
                string idVar = (string)rowU["IdVariable"];
                sy_VariablesDataset.sy_VariablesRow rowSV = sy_Variables.GetByPk(idVar);
                DataRow rowUC = table.NewRow();
                rowUC["IdVariable"]   = rowU["IdVariable"];
                rowUC["ValorDefault"] = rowU["ValorDefault"];
                rowUC["Perfil"]       = "";
                rowUC["Puesto"]       = "";
                rowUC["Usuario"]      = rowU["Usuario"];
                if (rowSV != null)
                {
                    rowUC["Descripcion"] = rowSV["Descripcion"];
                    rowUC["Tipo"]        = rowSV["IdTipoVariable"];
                }
                else
                {
                    rowUC["Descripcion"] = "";
                    rowUC["Tipo"]        = "";
                }
                rowUC["IdUsuario"] = rowU["IdUsuario"];
                table.Rows.Add(rowUC);
            }
            return(table);
        }
        public void Commit()
        {
            switch (this._processName)
            {
            case "ProcesoJerarquiaConfigurarVariableProductos":
                this._dataTableVariables = mz.erp.dataaccess.sy_Variables.GetListByInicio("Productos.BusquedaJerarquica.Jerarquia").Tables[0];
                foreach (DataRow row in this._dataTableVariables.Rows)
                {
                    string var = Convert.ToString(row["IdVariable"]);
                    switch (var)
                    {
                    case "Productos.BusquedaJerarquica.Jerarquia1":
                        row["ValorDefault"] = _nomenclaturas[0];
                        break;

                    case "Productos.BusquedaJerarquica.Jerarquia2":
                        row["ValorDefault"] = _nomenclaturas[1];
                        break;

                    case "Productos.BusquedaJerarquica.Jerarquia3":
                        row["ValorDefault"] = _nomenclaturas[2];
                        break;

                    case "Productos.BusquedaJerarquica.Jerarquia4":
                        row["ValorDefault"] = _nomenclaturas[3];
                        break;

                    case "Productos.BusquedaJerarquica.Jerarquia5":
                        row["ValorDefault"] = _nomenclaturas[4];
                        break;

                    case "Productos.BusquedaJerarquica.Jerarquia6":
                        row["ValorDefault"] = _nomenclaturas[5];
                        break;

                    case "Productos.BusquedaJerarquica.Jerarquia7":
                        row["ValorDefault"] = _nomenclaturas[6];
                        break;

                    case "Productos.BusquedaJerarquica.Jerarquia8":
                        row["ValorDefault"] = _nomenclaturas[7];
                        break;

                    default:
                        break;
                    }
                }
                /* Silvina 20111104 - Tarea 0000222 */
                sy_VariablesDataset.sy_VariablesRow rowCat = sy_Variables.GetByPk("Productos.Categorias.JerarquiaAsociada");
                rowCat.ValorDefault = _categoria;
                _dataTableVariables.ImportRow(rowCat);
                /* Fin Silvina 20111104 - Tarea 0000222 */
                break;

            case "ProcesoJerarquiaConfigurarVariableCuentas":
                this._dataTableVariables = mz.erp.dataaccess.sy_Variables.GetListByInicio("Cuentas.BusquedaJerarquica.Jerarquia").Tables[0];
                foreach (DataRow row in this._dataTableVariables.Rows)
                {
                    string var = Convert.ToString(row["IdVariable"]);
                    switch (var)
                    {
                    case "Cuentas.BusquedaJerarquica.Jerarquia1":
                        row["ValorDefault"] = _nomenclaturas[0];
                        break;

                    case "Cuentas.BusquedaJerarquica.Jerarquia2":
                        row["ValorDefault"] = _nomenclaturas[1];
                        break;

                    case "Cuentas.BusquedaJerarquica.Jerarquia3":
                        row["ValorDefault"] = _nomenclaturas[2];
                        break;

                    case "Cuentas.BusquedaJerarquica.Jerarquia4":
                        row["ValorDefault"] = _nomenclaturas[3];
                        break;

                    case "Cuentas.BusquedaJerarquica.Jerarquia5":
                        row["ValorDefault"] = _nomenclaturas[4];
                        break;

                    case "Cuentas.BusquedaJerarquica.Jerarquia6":
                        row["ValorDefault"] = _nomenclaturas[5];
                        break;

                    case "Cuentas.BusquedaJerarquica.Jerarquia7":
                        row["ValorDefault"] = _nomenclaturas[6];
                        break;

                    case "Cuentas.BusquedaJerarquica.Jerarquia8":
                        row["ValorDefault"] = _nomenclaturas[7];
                        break;

                    default:
                        break;
                    }
                }
                /* Silvina 20111104 - Tarea 0000222 */
                sy_VariablesDataset.sy_VariablesRow rowC = sy_Variables.GetByPk("Cuentas.Categorias.JerarquiaAsociada");
                rowC.ValorDefault = _categoria;
                _dataTableVariables.ImportRow(rowC);
                /* Fin Silvina 20111104 - Tarea 0000222 */
                break;

            case "ProcesoJerarquiaConfigurarVariableProveedores":
                this._dataTableVariables = mz.erp.dataaccess.sy_Variables.GetListByInicio("Proveedores.BusquedaJerarquica.Jerarquia").Tables[0];
                foreach (DataRow row in this._dataTableVariables.Rows)
                {
                    string var = Convert.ToString(row["IdVariable"]);
                    switch (var)
                    {
                    case "Proveedores.BusquedaJerarquica.Jerarquia1":
                        row["ValorDefault"] = _nomenclaturas[0];
                        break;

                    case "Proveedores.BusquedaJerarquica.Jerarquia2":
                        row["ValorDefault"] = _nomenclaturas[1];
                        break;

                    case "Proveedores.BusquedaJerarquica.Jerarquia3":
                        row["ValorDefault"] = _nomenclaturas[2];
                        break;

                    case "Proveedores.BusquedaJerarquica.Jerarquia4":
                        row["ValorDefault"] = _nomenclaturas[3];
                        break;

                    case "Proveedores.BusquedaJerarquica.Jerarquia5":
                        row["ValorDefault"] = _nomenclaturas[4];
                        break;

                    case "Proveedores.BusquedaJerarquica.Jerarquia6":
                        row["ValorDefault"] = _nomenclaturas[5];
                        break;

                    case "Proveedores.BusquedaJerarquica.Jerarquia7":
                        row["ValorDefault"] = _nomenclaturas[6];
                        break;

                    case "Proveedores.BusquedaJerarquica.Jerarquia8":
                        row["ValorDefault"] = _nomenclaturas[7];
                        break;

                    default:
                        break;
                    }
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 15
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);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Valida un sy_VariablesRow.
        /// </summary>
        public static bool RowIsValid(sy_VariablesDataset.sy_VariablesRow 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 (!DescripcionIsValid(row.Descripcion, out mensaje))
            {
                row.SetColumnError("Descripcion", mensaje);
                isValid = false;
            }

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

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

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

            if (!ComentarioIsValid(row.Comentario, out mensaje))
            {
                row.SetColumnError("Comentario", 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);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Envia los cambios del sy_VariablesRow a la base de datos.
        /// </summary>
        public static void Update(sy_VariablesDataset.sy_VariablesRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            mz.erp.dataaccess.sy_Variables.Update(row);
        }