public void UpdateTable(string tablename, EtichetteDS ds)
        {
            string query = "SELECT * FROM ETICHETTELV";

            using (DbDataAdapter a = BuildDataAdapter(query))
            {
                try
                {
                    a.ContinueUpdateOnError = false;
                    DataTable        dt  = ds.Tables["ETI_ARTICOLI"];
                    DbCommandBuilder cmd = BuildCommandBuilder(a);
                    a.UpdateCommand = cmd.GetUpdateCommand();
                    a.DeleteCommand = cmd.GetDeleteCommand();
                    a.InsertCommand = cmd.GetInsertCommand();
                    a.Update(dt);
                }
                catch (DBConcurrencyException ex)
                {
                }
                catch
                {
                    throw;
                }
            }
        }
        public void FillETI_ARTICOLI(EtichetteDS ds, string IDMAGAZZ)
        {
            string   select = @"SELECT * FROM ETI_ARTICOLI WHERE IDMAGAZZ= $P<IDMAGAZZ>";
            ParamSet ps     = new ParamSet();

            ps.AddParam("IDMAGAZZ", DbType.String, IDMAGAZZ);
            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.ETI_ARTICOLI);
            }
        }
        public void TrovaArticolo(EtichetteDS ds, string Modello)
        {
            string   select  = @"SELECT * FROM GRUPPO.MAGAZZ WHERE MODELLO like $P<MODELLO>";
            ParamSet ps      = new ParamSet();
            string   MODELLO = string.Format("%{0}%", Modello);

            ps.AddParam("MODELLO", DbType.String, MODELLO);
            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.MAGAZZ);
            }
        }
        public void FillMAGAZZSQL(EtichetteDS ds, string IDMAGAZZ)
        {
            string   select = @"SELECT * FROM CROSSREFERENCE 
                            where [Cross-Reference Type]=1
                            and [Cross-Reference Type No_]in('C00197','C00422','C00443','C00463','C00481')
                            AND [Cross-Reference No_] like '$P<IDMAGAZZ>'
                               ";
            ParamSet ps     = new ParamSet();

            ps.AddParam("IDMAGAZZ", DbType.String, IDMAGAZZ);
            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.MAGAZZ);
            }
        }
        public void TrovaArticoloSQL(EtichetteDS ds, string Modello)
        {
            string select = @"SELECT [Item No_] IDMAGAZZ,[Cross-Reference No_] MODELLO,[DESCRIPTION]DESMAGAZZ  FROM CROSSREFERENCE 
                            where [Cross-Reference Type]=1
                            and [Cross-Reference Type No_]in('C00197','C00422','C00443','C00463','C00481') ";
//                            AND [Cross-Reference No_] like '$P<MODELLO>";


            ParamSet ps = new ParamSet();

            AddConditionAndParam(ref select, "[Cross-Reference No_]", "MODELLO", Modello, ps, true);

            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.MAGAZZ);
            }
        }
        public void FillTEMP_COMMESSA(EtichetteDS ds, string IDMAGAZZ)
        {
            string   select = @"SELECT trim(CLI.RAGIONESOC) as RAGIONESOC,trim(DT.RIFERIMENTO) as RIFERIMENTO,trim(DD.NRRIGA) as NRRIGA
                                from DITTA1.USR_VENDITED DD 
                                INNER JOIN DITTA1.USR_VENDITET DT ON DT.IDVENDITET = DD.IDVENDITET
                                INNER JOIN GRUPPO.CLIFO CLI ON DT.CODICECLIFO = CLI.CODICE
                                WHERE DD.IDMAGAZZ= $P<IDMAGAZZ>
                                AND DT.IDTABTIPDOC='0000000022'
                                order by DT.RIFERIMENTO, dd.nrriga ";
            ParamSet ps     = new ParamSet();

            ps.AddParam("IDMAGAZZ", DbType.String, IDMAGAZZ);
            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.TEMP_COMMESSA);
            }
        }
        public void FillUSR_IMPORT_MAGAZZ(EtichetteDS ds, string IDMAGAZZ)
        {
            string   select = @"SELECT * FROM DITTA1.USR_IMPORT_MAGAZZ WHERE IDMAGAZZ= $P<IDMAGAZZ>";
            ParamSet ps     = new ParamSet();

            ps.AddParam("IDMAGAZZ", DbType.String, IDMAGAZZ);
            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.USR_IMPORT_MAGAZZ);
            }

            select = @"SELECT * FROM DITTA2.USR_IMPORT_MAGAZZ WHERE IDMAGAZZ= $P<IDMAGAZZ>";
            ps     = new ParamSet();

            ps.AddParam("IDMAGAZZ", DbType.String, IDMAGAZZ);
            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.USR_IMPORT_MAGAZZ);
            }
        }
Exemplo n.º 8
0
        private void btnTrova_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtModelloRicerca.Text))
            {
                return;
            }

            string modelloDaTrovare = txtModelloRicerca.Text.Trim().ToUpper();

            _ds = new EtichetteDS();
            if (chkBC.Checked)
            {
                using (CreaEtichetteBusinesSQL bEtichetta = new CreaEtichetteBusinesSQL())
                {
                    bEtichetta.TrovaArticolo(_ds, modelloDaTrovare);
                }
            }
            else
            {
                using (CreaEtichetteBusiness bEtichetta = new CreaEtichetteBusiness())
                {
                    bEtichetta.TrovaArticolo(_ds, modelloDaTrovare);
                }
            }
            dgvArticoli.AutoGenerateColumns = true;
            dgvArticoli.DataSource          = _ds;
            dgvArticoli.DataMember          = _ds.MAGAZZ.TableName;
            for (int i = 0; i < dgvArticoli.Columns.Count; i++)
            {
                dgvArticoli.Columns[i].Visible = false;
            }

            dgvArticoli.Columns[1].Visible = true;
            dgvArticoli.Columns[1].Width   = 180;
            dgvArticoli.Columns[2].Visible = true;
            dgvArticoli.Columns[2].Width   = 400;

            System.Drawing.Font font = new System.Drawing.Font(dgvArticoli.Font.FontFamily, 8);

            dgvArticoli.Font = font;
        }
        public void FillTEMP_COMMESSA(EtichetteDS ds, string IDMAGAZZ)
        {
            CreaEtichetteAdapter a = new CreaEtichetteAdapter(DbConnection, DbTransaction);

            a.FillTEMP_COMMESSA(ds, IDMAGAZZ);
        }
        public void UpdateETI_ARTICOLI(EtichetteDS ds)
        {
            CreaEtichetteAdapter a = new CreaEtichetteAdapter(DbConnection, DbTransaction);

            a.UpdateTable(ds.ETI_ARTICOLI.TableName, ds);
        }
        public void FillETI_ARTICOLI(EtichetteDS ds, string IDMAGAZZ)
        {
            CreaEtichetteAdapter a = new CreaEtichetteAdapter(DbConnection, DbTransaction);

            a.FillETI_ARTICOLI(ds, IDMAGAZZ);
        }
        public void FillUSR_IMPORT_MAGAZZ(EtichetteDS ds, string IDMAGAZZ)
        {
            CreaEtichetteAdapter a = new CreaEtichetteAdapter(DbConnection, DbTransaction);

            a.FillUSR_IMPORT_MAGAZZ(ds, IDMAGAZZ);
        }
        public void TrovaArticolo(EtichetteDS ds, string Modello)
        {
            CreaEtichetteAdapter a = new CreaEtichetteAdapter(DbConnection, DbTransaction);

            a.TrovaArticolo(ds, Modello);
        }
        public void UpdateETI_ARTICOLI(EtichetteDS ds)
        {
            CreaEtichetteAdapter a = new CreaEtichetteAdapter(DbConnection, DbTransaction);

            a.UpdateTable("ETICHETTELV", ds);
        }