Exemplo n.º 1
0
        private void CacheDbs()
        {
            try
            {
                IsLoading = true;

                /* this.toolStripStatusLabel1.Text = "Cargando Articulo en cache";
                 * CacheArticulo = await Task.Run(() =>  db.articuloes.ToList());
                 * this.toolStripStatusLabel1.Text = "Listo";
                 *
                 * this.toolStripStatusLabel1.Text = "Cargando Caracteristica en cache";
                 * CacheCaracteristicas = await Task.Run(() => db.caracteristicas.ToList());
                 * this.toolStripStatusLabel1.Text = "Listo";
                 *
                 * this.toolStripStatusLabel1.Text = "Cargando Color en cache";
                 * CacheCaracteristicas = await Task.Run(() => db.caracteristicas.ToList());
                 * this.toolStripStatusLabel1.Text = "Listo";*/

                this.toolStripStatusLabel1.Text = "Cargando la base de datos";
                Task.WaitAll(
                    Task.Run(() => { using (var c = new pikitikosdbEntities()) { CacheArticulo = new pikitikosdbEntities().articuloes.ToList(); } }),
                    Task.Run(() => { using (var c = new pikitikosdbEntities()) { CacheCaracteristicas = new pikitikosdbEntities().caracteristicas.ToList(); } }),
                    Task.Run(() => { using (var c = new pikitikosdbEntities()) { CacheColor = new pikitikosdbEntities().colors.ToList(); } }),
                    Task.Run(() => { using (var c = new pikitikosdbEntities()) { Cachetalla = new pikitikosdbEntities().tallas.ToList(); } }),
                    Task.Run(() => { using (var c = new pikitikosdbEntities()) { CacheTipoArticulo = new pikitikosdbEntities().tipoarticuloes.ToList(); } }),
                    Task.Run(() => { using (var c = new pikitikosdbEntities()) { CacheTipoTela = new pikitikosdbEntities().tipotelas.ToList(); } }),
                    Task.Run(() => { using (var c = new pikitikosdbEntities()) { CacheInventario = new pikitikosdbEntities().inventarios.ToList(); } })
                    );
                this.toolStripStatusLabel1.Text = "Listo";

                BuildDdisplay();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                IsLoading = false;
                db.Database.Connection.Close();
            }
        }
Exemplo n.º 2
0
        private async void frmInventario_Load(object sender, EventArgs e)
        {
            db = new pikitikosdbEntities();
            CacheDbs();
            //  rbArticulo_CheckedChanged(this, new EventArgs());


            dgInventario.AutoGenerateColumns = true;
            dgInventario.DataSource          = DisplayInventario;

            dgInventario.Columns[0].ReadOnly = true;
            dgInventario.Columns[0].Visible  = false;
            dgInventario.Columns[1].ReadOnly = true;
            dgInventario.Columns[11].Visible = false;
            dgInventario.Columns[12].Visible = false;
            dgInventario.Columns[13].Visible = false;
            dgInventario.Columns[14].Visible = false;
            dgInventario.Columns[15].Visible = false;
            dgInventario.Columns[16].Visible = false;


            await InsertNullDummies();
        }