Example #1
0
        public static List <Company> LoadCompanyGrid(DataGrid datagrid, List <Company> companies = null)
        {
            if (companies == null)
            {
                companies = GetCompanies();
            }

            DataTable dt = new DataTable();

            CommonViewConfigurations.ConfigDataGrid(datagrid);

            // first add your columns
            dt.Columns.Add("#");
            dt.Columns.Add("Empresa");
            dt.Columns.Add("Web");

            foreach (Company company in companies)
            {
                var row = dt.NewRow();
                // Set values for columns with row[i] = xy
                row[0] = company.id.ToString("D5");
                row[1] = company.name;
                row[2] = company.web;

                dt.Rows.Add(row);
            }

            datagrid.DataContext = dt;
            return(companies);
        }
        public static void LoadAddressGrid(DataGrid datagrid)
        {
            List <Address> brands = GetAddresses();
            DataTable      dt     = new DataTable();

            CommonViewConfigurations.ConfigDataGrid(datagrid);

            // first add your columns
            dt.Columns.Add("Código");
            dt.Columns.Add("Calle");
            dt.Columns.Add("Número");
            dt.Columns.Add("CP");
            //dt.Columns.Add("Coordenadas");

            foreach (Address item in brands)
            {
                var row = dt.NewRow();
                // Set values for columns with row[i] = xy
                row[0] = item.id.ToString("D5");
                row[1] = item.street;
                row[2] = item.number;
                row[3] = item.zipCode;

                dt.Rows.Add(row);
            }

            datagrid.DataContext = dt;
        }
Example #3
0
        /// <summary>
        /// Custom insert of Item List in DataGrid
        /// </summary>
        /// <param name="datagrid">DataGrid Object</param>
        public static void LoadItemsGrid(DataGrid datagrid)
        {
            List <Item> items = GetItems();
            DataTable   dt    = new DataTable();

            CommonViewConfigurations.ConfigDataGrid(datagrid);

            // first add your columns
            dt.Columns.Add("Código");
            dt.Columns.Add("Artículo");
            dt.Columns.Add("Descripción");

            foreach (Item item in items)
            {
                var row = dt.NewRow();
                // Set values for columns with row[i] = xy
                row[0] = item.getId().ToString("D5");
                row[1] = item.getName();
                row[2] = item.getDescription();

                dt.Rows.Add(row);
            }

            datagrid.DataContext = dt;
        }
Example #4
0
        /// <summary>
        /// Custom insert of Brand List in DataGrid
        /// </summary>
        /// <param name="datagrid">DataGrid Object</param>
        public static void LoadBrandsGrid(DataGrid datagrid)
        {
            List <Brand> brands = GetBrands();
            DataTable    dt     = new DataTable();

            CommonViewConfigurations.ConfigDataGrid(datagrid);

            // first add your columns
            dt.Columns.Add("Código");
            dt.Columns.Add("Marca");

            foreach (Brand item in brands)
            {
                var row = dt.NewRow();
                // Set values for columns with row[i] = xy
                row[0] = item.id.ToString("D5");
                row[1] = item.name;

                dt.Rows.Add(row);
            }

            datagrid.DataContext = dt;
        }
Example #5
0
        /// <summary>
        /// Custom insert of Unit List in DataGrid
        /// </summary>
        /// <param name="datagrid">DataGrid Object</param>
        public static void LoadUnitsGrid(DataGrid datagrid)
        {
            List <Unit> units = GetUnits();
            DataTable   dt    = new DataTable();

            CommonViewConfigurations.ConfigDataGrid(datagrid);

            // first add your columns
            dt.Columns.Add("Código");
            dt.Columns.Add("Unidad");

            foreach (Unit item in units)
            {
                var row = dt.NewRow();
                // Set values for columns with row[i] = xy
                row[0] = item.id_unit.ToString("D5");
                row[1] = item.name_unit;

                dt.Rows.Add(row);
            }

            datagrid.DataContext = dt;
        }
Example #6
0
        /// <summary>
        /// Custom insert of Stock List in DataGrid
        /// </summary>
        /// <param name="datagrid">DataGrid Object</param>
        public static void LoadStocksGrid(DataGrid datagrid)
        {
            List <Stock> stocks = GetStocks();
            DataTable    dt     = new DataTable();

            CommonViewConfigurations.ConfigDataGrid(datagrid);

            // first add your columns
            dt.Columns.Add("Código");
            dt.Columns.Add("Marca");

            foreach (Stock item in stocks)
            {
                var row = dt.NewRow();
                // Set values for columns with row[i] = xy
                row[0] = item.item_id.ToString("D5");
                row[1] = item.quantity_stock;

                dt.Rows.Add(row);
            }

            datagrid.DataContext = dt;
        }