public void set_list_source() { items = new List <Magazzino>(); try { // deve scaricare le tipologie di Scarto da AS400 DBHandler _dbh400 = new DBHandler(); String _query400 = "SELECT USUSET, USPIAN, USPOST, USCDAR, USDMOD, USLEDS, USQTUB FROM ZBAUS00f WHERE USQTUB <> 0 AND USCDAR = '" + App.Current.Properties["id_articolo"].ToString() + "'"; // App.Current.Properties["id_terminale"] + "' AND PTLOTO = '" + App.Current.Properties["Articolo"] DataTable _dt = _dbh400.ExecuteShot(_query400); foreach (DataRow _dr in _dt.Rows) { String _DS = _dr[5].ToString(); if (_DS.Length == 1) { _DS += "X"; } items.Add(new Magazzino() { Sett = _dr[0].ToString(), Piano = _dr[1].ToString(), Post = _dr[2].ToString(), Article = _dr[3].ToString(), Modello = _dr[4].ToString(), DS = _DS, Qty_ubicato = _dr[6].ToString() }); } } catch (Exception ex) { throw new Exception(ex.Message); } ListaMagazzini.ItemsSource = items; }
private bool login() { App.Current.Properties["operatore_nome"] = "Paolo Rossi"; App.Current.Properties["operatore_id"] = txt_operatore.Text; DBHandler _dbh = new DBHandler(); DataTable _dt = new DataTable(); try { _dt = _dbh.ExecuteShot("SELECT [ID_lot] ,[lot_description] ,[lot_unit] ,[lot_qty] , [lot_status], [lot_product] FROM [dbo].[lot] WHERE [ID_lot] = '" + txt_lotto.Text.Replace("'", "''") + "'"); if (_dt.Rows.Count == 1) { App.Current.Properties["lotto"] = txt_lotto.Text; App.Current.Properties["lotto_description"] = _dt.Rows[0]["lot_description"].ToString(); App.Current.Properties["lotto_qty"] = _dt.Rows[0]["lot_qty"].ToString(); App.Current.Properties.Add("lotto_status", _dt.Rows[0]["lot_status"].ToString());// Blank , C -> Closed, A -> Open App.Current.Properties.Add("lotto_unit", _dt.Rows[0]["lot_unit"].ToString()); App.Current.Properties.Add("id_articolo", _dt.Rows[0]["lot_product"].ToString()); return(true); } } catch (Exception ep) { throw new Exception("login():" + ep.Message); } return(false); }
public void set_questionario() { domande = new List <Domanda>(); try { //String _sql = "SELECT [ID_domanda],[ID_lotto],[TestoDomanda],[Risposta] FROM [Domande] WHERE [ID_lotto]= '" + App.Current.Properties["lotto"].ToString() + "'"; String _sql = "SELECT [ID_question] ,[_question] ,[_answer] FROM [dbo].[Audit] where _lot = '" + App.Current.Properties["lotto"].ToString() + "'"; DBHandler _dbh = new DBHandler(); DataTable _dt = _dbh.ExecuteShot(_sql); foreach (DataRow _dr in _dt.Rows) { domande.Add(new Domanda() { ID_Domanda = _dr[0].ToString(), Testo = _dr[1].ToString(), Risposta = _dr[2].ToString() }); if (_dr[2].ToString() == "") { is_questionario_completed = false; } } } catch (Exception ex) { throw new Exception(ex.Message); } ListaDomande.ItemsSource = domande; }
public Lotto(String _gruppo_select, String screen_height) // l'ID del LOTTO scelto nella login gli viene passato tramite il parametro di configurazione: ID_lotto { _screen_height = screen_height; try { Gruppo_colore_select = _gruppo_select; Items = new List <Lotto_box>(); set_tipologie_di_scarto(); DBHandler _dbh = new DBHandler(); DataTable _dt = new DataTable(); try { _dt = _dbh.ExecuteShot("SELECT [ID_lot],[ID_terminal],[ID_color],[ID_waste_type],[date_reg],[waste_qty] FROM [dbo].[lot_waste] WHERE [ID_lot] = '" + ID_lotto + "' AND [ID_terminal] = " + App.Current.Properties["id_terminale"].ToString()); if (_dt.Rows.Count > 0) { Int32 _count_row = 0; Int32 _index_gruppo = 0; foreach (DataRow _dr in _dt.Rows) { _count_row += 1; add_box(_dr["ID_waste_type"].ToString(), _dr["waste_qty"].ToString(), _gruppi[_index_gruppo]); if (_count_row == TipologieScartoList.Count) { _count_row = 0; _index_gruppo += 1; } } return; } } catch (Exception ep) { } // se il flusso d'esecuzione arriva quì vuol dire che non ci sono sessioni aperte per questo lotto // per sessioni aperte intendiamo una situazione intemedia salvata su un file. // quindi andiamo a pescare i dati da AS400 load_boxes_initial(); } catch (Exception ex) { throw new Exception("Lotto(): " + ex.Message); } }
public void load_boxes_from_as400() { try { // deve scaricare le tipologie di Scarto da AS400 DBHandler _dbh400 = new DBHandler(); String _query400 = "SELECT PTCODS, PTQTAS , PTLOTO,PTGRUP, PTDESA FROM STOPTS0F WHERE PTTERM = '" + App.Current.Properties["id_terminale"] + "' AND PTLOTO = '" + App.Current.Properties["lotto"] + "'";// order by PTGRUP DESC,PTCODS"; DataTable _dt = _dbh400.ExecuteShot(_query400); foreach (DataRow _dr in _dt.Rows) { add_box(_dr[0].ToString(), _dr[1].ToString(), _dr[3].ToString()); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void set_tipologie_di_scarto() { TipologieScartoList = new List <tipo_scarto>(); DBHandler _dbh = new DBHandler(); DataTable _dt = new DataTable(); try { _dt = _dbh.ExecuteShot("SELECT [ID_waste_type],[waste_type] FROM [dbo].[waste_type] "); // let's read the waste types foreach (DataRow _dr in _dt.Rows) { TipologieScartoList.Add(new tipo_scarto(_dr[0].ToString(), _dr[1].ToString())); } } catch (Exception ex) { //MessageBox.Show("ERRORE:" + ex.Message); } }