Beispiel #1
0
        public static void Update(sy_EmpresasDataset.sy_EmpresasRow row)
        {
            if (row.RowState == DataRowState.Detached)
            {
                ((sy_EmpresasDataset.sy_EmpresasDataTable)row.Table).Addsy_EmpresasRow(row);
            }

            Update(row.Table);
        }
Beispiel #2
0
        /// <summary>
        /// Envia los cambios del sy_EmpresasRow a la base de datos realizando una validacin previa.
        /// </summary>
        public static void UpdateWithValidation(sy_EmpresasDataset.sy_EmpresasRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            if (RowIsValid(row))
            {
                Update(row);
            }
        }
Beispiel #3
0
        public virtual DataTable GetList()
        {
            DataSet data = new DataSet();

            SqlCommand     cmd    = new SqlCommand();
            SqlConnection  connec = dbhelper.Connection.GetConnection();
            SqlDataAdapter da     = new SqlDataAdapter();

            cmd.Connection  = connec;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "Exec sp_helpdb";

            da.SelectCommand = cmd;
            da.Fill(data);

            string    metodo = Variables.GetValueString("Sistema.BasesDeDatos.MetodoDeComparacion", "E");
            string    bases  = Variables.GetValueString("Sistema.BasesDeDatos");
            ArrayList arrayBases;

            arrayBases = mz.erp.systemframework.Util.Parse(bases, ",");

            sy_EmpresasDataset.sy_EmpresasDataTable table = new sy_EmpresasDataset.sy_EmpresasDataTable();
            foreach (DataRow row in data.Tables[0].Rows)
            {
                string nombre = row["Name"].ToString();
                if (((metodo.Equals("E")) && (!arrayBases.Contains(nombre))) ||
                    ((metodo.Equals("I")) && (arrayBases.Contains(nombre))))
                {
                    sy_EmpresasDataset.sy_EmpresasRow r = table.Newsy_EmpresasRow();
                    r.Descripcion        = string.Empty;
                    r.Conexion           = string.Empty;
                    r.BaseDeDatos        = nombre;
                    r.Usuario            = string.Empty;
                    r.Password           = string.Empty;
                    r.IdConexionCreacion = 1;
                    r.FechaCreacion      = Sistema.DateTime.Now;
                    r.IdEmpresa          = Convert.ToInt16(row["dbid"]);
                    table.Rows.Add(r);
                }
            }
            return(table);
        }
Beispiel #4
0
        /// <summary>
        /// Envia los cambios del sy_EmpresasRow a la base de datos.
        /// </summary>
        public static void Update(sy_EmpresasDataset.sy_EmpresasRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            mz.erp.dataaccess.sy_Empresas.Update(row);
        }
Beispiel #5
0
        /// <summary>
        /// Valida un sy_EmpresasRow.
        /// </summary>
        public static bool RowIsValid(sy_EmpresasDataset.sy_EmpresasRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);


            if (!IdEmpresaIsValid(row.IdEmpresa))
            {
                return(false);
            }

            if (!DescripcionIsValid(row.Descripcion))
            {
                row.RowError = "Debe ingresar el nombre de la empresa.";
                return(false);
            }

            if (!ConexionIsValid(row.Conexion))
            {
                return(false);
            }

            if (!BaseDeDatosIsValid(row.BaseDeDatos))
            {
                return(false);
            }

            if (!UsuarioIsValid(row.Usuario))
            {
                return(false);
            }

            if (!PasswordIsValid(row.Password))
            {
                return(false);
            }

            if (!ActivoIsValid(row.Activo))
            {
                return(false);
            }

            /*
             * if ( !FechaCreacionIsValid( row.FechaCreacion ) )
             * {
             * return false;
             * }
             *
             * if ( !IdConexionCreacionIsValid( row.IdConexionCreacion ) )
             * {
             * return false;
             * }
             *
             * if ( !UltimaModificacionIsValid( row.UltimaModificacion ) )
             * {
             * return false;
             * }
             *
             * if ( !IdConexionUltimaModificacionIsValid( row.IdConexionUltimaModificacion ) )
             * {
             * return false;
             * }
             *
             * if ( !RowIdIsValid( row.RowId ) )
             * {
             * return false;
             * }
             * ;
             */

            return(true);
        }