public void RegistraMisure(int IdMeasure, List <UploadMeasuresElementRequest> UploadMeasuresElements, bool IsTest) { if (IsTest) { if (IdMeasure < 0) { string messaggio = string.Format("IdMeasure: {0} non valido", IdMeasure); throw new ArgumentException(messaggio); } return; } CertixDS ds = new CertixDS(); if (!VerificaIdMeasure(IdMeasure, ds)) { string messaggio = string.Format("IdMeasure: {0} non censito a sistema", IdMeasure); throw new ArgumentException(messaggio); } if (VerificaDuplicati(IdMeasure, ds)) { string messaggio = string.Format("IdMeasure: {0} misure già acquisite", IdMeasure); throw new ArgumentException(messaggio); } VerificaMuasures(IdMeasure, UploadMeasuresElements, ds); SalvaMuasures(IdMeasure, UploadMeasuresElements, ds); }
public void UpdateTable(string tablename, CertixDS ds) { string query = string.Format(CultureInfo.InvariantCulture, "SELECT * FROM {0}", tablename); using (DbDataAdapter a = BuildDataAdapter(query)) { try { a.ContinueUpdateOnError = false; DataTable dt = ds.Tables[tablename]; 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 CertixDS.USR_PRD_MOVFASIRow VerificaBarcodeODL(string barcode, CertixDS ds) { using (CertixWSBusiness bCertix = new CertixWSBusiness()) { bCertix.FillUSR_PRD_MOVFASIByBarcode(ds, barcode); } return(ds.USR_PRD_MOVFASI.Where(x => x.BARCODE == barcode).FirstOrDefault()); }
private bool VerificaDuplicati(int IdMeasure, CertixDS ds) { using (CertixWSBusiness bCertix = new CertixWSBusiness()) { bCertix.FillAP_CERTIX_DETTAGLIO(ds, IdMeasure); return(ds.AP_CERTIX_DETTAGLIO.Any(x => x.IDMISURECERTIX == IdMeasure)); } }
public void FillMAGAZZ(CertixDS ds, List <string> IDMAGAZZ) { string inCOndition = ConvertToStringForInCondition(IDMAGAZZ); string select = @"SELECT DISTINCT * FROM GRUPPO.MAGAZZ WHERE IDMAGAZZ in ( {0} )"; select = string.Format(select, inCOndition); using (DbDataAdapter da = BuildDataAdapter(select)) { da.Fill(ds.MAGAZZ); } }
public void FillUSR_PRD_MOVFASIByBarcode(CertixDS ds, string Barcode) { string select = @"SELECT * FROM USR_PRD_MOVFASI WHERE BARCODE = $P{Barcode}"; ParamSet ps = new ParamSet(); ps.AddParam("Barcode", DbType.String, Barcode); using (DbDataAdapter da = BuildDataAdapter(select, ps)) { da.Fill(ds.USR_PRD_MOVFASI); } }
public void FillUSR_PRD_FASI(CertixDS ds, List <string> IDPRDFASE) { string inCOndition = ConvertToStringForInCondition(IDPRDFASE); string select = @"SELECT DISTINCT * FROM USR_PRD_FASI WHERE IDPRDFASE in ( {0} )"; select = string.Format(select, inCOndition); using (DbDataAdapter da = BuildDataAdapter(select)) { da.Fill(ds.USR_PRD_FASI); } }
public void FillAP_CERTIX_DETTAGLIO(CertixDS ds, Decimal IDMISURECERTIX) { string select = @"select * from AP_CERTIX_DETTAGLIO where IDMISURECERTIX = $P{IDMISURECERTIX}"; ParamSet ps = new ParamSet(); ps.AddParam("IDMISURECERTIX", DbType.Decimal, IDMISURECERTIX); using (DbDataAdapter da = BuildDataAdapter(select, ps)) { da.Fill(ds.AP_CERTIX_DETTAGLIO); } }
public void FillAP_GALVANICA_MODELLO(CertixDS ds, string IDMAGAZZ, string IDMAGAZZ_WIP) { string select = @"select mo.* from ap_galvanica_modello mo where mo.idmagazz = $P{IDMAGAZZ} and mo.idmagazz_wip = $P{IDMAGAZZ_WIP}"; ParamSet ps = new ParamSet(); ps.AddParam("IDMAGAZZ", DbType.String, IDMAGAZZ); ps.AddParam("IDMAGAZZ_WIP", DbType.String, IDMAGAZZ_WIP); using (DbDataAdapter da = BuildDataAdapter(select, ps)) { da.Fill(ds.AP_GALVANICA_MODELLO); } }
public void FillAP_GALVANICA_SPESSORI(string Brand, string Finitura, CertixDS ds) { string select = @"select sp.* from ap_galvanica_spessori sp where sp.brand = $P{BRAND} and sp.finitura = $P{FINITURA}"; ParamSet ps = new ParamSet(); ps.AddParam("BRAND", DbType.String, Brand); ps.AddParam("FINITURA", DbType.String, Finitura); using (DbDataAdapter da = BuildDataAdapter(select, ps)) { da.Fill(ds.AP_GALVANICA_SPESSORI); } }
public void FillAP_GALVANICA_SPESSORI(CertixDS ds, string IDMAGAZZ, string IDMAGAZZ_WIP) { string select = @"select sp.* from ap_galvanica_spessori sp inner join ap_galvanica_modello mo on mo.brand = sp.brand and mo.finitura = sp.finitura where mo.idmagazz = $P{IDMAGAZZ} and mo.idmagazz_wip = $P{IDMAGAZZ_WIP}"; ParamSet ps = new ParamSet(); ps.AddParam("IDMAGAZZ", DbType.String, IDMAGAZZ); ps.AddParam("IDMAGAZZ_WIP", DbType.String, IDMAGAZZ_WIP); using (DbDataAdapter da = BuildDataAdapter(select, ps)) { da.Fill(ds.AP_GALVANICA_SPESSORI); } }
public void FillUSR_PRD_FASI(CertixDS ds, List <string> IDPRDFASE) { List <string> Presenti = ds.USR_PRD_FASI.Select(x => x.IDPRDFASE).Distinct().ToList(); List <string> Mancanti = IDPRDFASE.Except(Presenti).ToList(); CertixWSAdapter a = new CertixWSAdapter(DbConnection, DbTransaction); while (Mancanti.Count > 0) { List <string> daCaricare; if (Mancanti.Count > 999) { daCaricare = Mancanti.GetRange(0, 999); Mancanti.RemoveRange(0, 999); } else { daCaricare = Mancanti.GetRange(0, Mancanti.Count); Mancanti.RemoveRange(0, Mancanti.Count); } a.FillUSR_PRD_FASI(ds, daCaricare); } }
private void VerificaMuasures(int IdMeasure, List <UploadMeasuresElementRequest> UploadMeasuresElements, CertixDS ds) { bool esito = true; StringBuilder sb = new StringBuilder(); CertixDS.AP_CERTIXRow misura = ds.AP_CERTIX.Where(x => x.IDMISURECERTIX == IdMeasure).FirstOrDefault(); using (CertixWSBusiness bCertix = new CertixWSBusiness()) { bCertix.FillAP_GALVANICA_SPESSORI(ds, misura.IDMAGAZZ, misura.IDMAGAZZ_WIP); } decimal aux; foreach (UploadMeasuresElementRequest m in UploadMeasuresElements) { if (m.Material.Length > 10) { esito = false; sb.AppendLine(string.Format("Materiale: {0} lunghezza etichetta non valida", m.Material)); } if (!ds.AP_GALVANICA_SPESSORI.Select(x => x.ETICHETTA).ToList().Contains(m.Material)) { esito = false; sb.AppendLine(string.Format("Materiale: {0} inatteso.", m.Material)); } } if (!esito) { throw new ArgumentException(sb.ToString()); } }
private void SalvaMuasures(int IdMeasure, List <UploadMeasuresElementRequest> UploadMeasuresElements, CertixDS ds) { int sequenza = 0; using (CertixWSBusiness bCertix = new CertixWSBusiness()) { foreach (UploadMeasuresElementRequest m in UploadMeasuresElements) { CertixDS.AP_CERTIX_DETTAGLIORow dettaglio = ds.AP_CERTIX_DETTAGLIO.NewAP_CERTIX_DETTAGLIORow(); dettaglio.DATAINSERIMENTO = DateTime.Now; dettaglio.ETICHETTA = m.Material; dettaglio.IDMISURECERTIX = IdMeasure; dettaglio.IDMISURECERTIXDET = bCertix.GetID(); dettaglio.SEQUENZA = sequenza; sequenza++; dettaglio.VALORE = m.Measure; ds.AP_CERTIX_DETTAGLIO.AddAP_CERTIX_DETTAGLIORow(dettaglio); } bCertix.UpdateTable(ds.AP_CERTIX_DETTAGLIO.TableName, ds); } }
public int CreateIdMeasureFromCodeAndIdLine(int IdLine, string Code, bool IsTest, out List <string> Measures) { Measures = new List <string>(); if (IsTest) { if (IdLine < 0) { string m = string.Format("Codice IdLine: {0} non valido", IdLine); throw new ArgumentException(m); } if (Code == "12345678912345") { Measures = new List <string>(new string[] { "Au", "Ni", "Pd" }); } if (Code == "12345678912345") { return(DateTime.Now.Minute); } string messaggio = string.Format("Codice Code: {0} non valido", Code); throw new ArgumentException(messaggio); } //********* PRODUZIONE ****** CertixDS ds = new CertixDS(); CertixDS.USR_PRD_MOVFASIRow movFase = VerificaBarcodeODL(Code, ds); if (movFase == null) { string messaggio = string.Format("Codice Code: {0} non valido", Code); throw new ArgumentException(messaggio); } CertixDS.USR_PRD_FASIRow faseGalvanica = EstraiFaseGalvanicaDaODL(movFase, ds); if (faseGalvanica == null) { string messaggio = string.Format("Codice Code: {0} fase galvanica non trovata", Code); throw new ArgumentException(messaggio); } if (faseGalvanica.IsIDMAGAZZNull()) { string messaggio = string.Format("Codice Code: {0} articolo galvanica non trovato", Code); throw new ArgumentException(messaggio); } int idMeasure = -1; using (CertixWSBusiness bCertix = new CertixWSBusiness()) { bCertix.FillAP_GALVANICA_SPESSORI(ds, movFase.IDMAGAZZ, faseGalvanica.IDMAGAZZ); if (ds.AP_GALVANICA_SPESSORI.Count == 0) { string messaggio = string.Format("Codice Code: {0} articolo galvanica dati incompleti", Code); throw new ArgumentException(messaggio); } CertixDS.AP_CERTIXRow certixRow = ds.AP_CERTIX.NewAP_CERTIXRow(); certixRow.IDMISURECERTIX = bCertix.GetID(); idMeasure = (int)certixRow.IDMISURECERTIX; certixRow.IDLINE = IdLine; certixRow.BARCODE = Code; certixRow.IDMAGAZZ = movFase.IDMAGAZZ; certixRow.IDMAGAZZ_WIP = faseGalvanica.IDMAGAZZ; certixRow.DATAMISURA = DateTime.Now; ds.AP_CERTIX.AddAP_CERTIXRow(certixRow); bCertix.UpdateTable(ds.AP_CERTIX.TableName, ds); } Measures = ds.AP_GALVANICA_SPESSORI.OrderBy(x => x.SEQUENZA).Select(x => x.ETICHETTA).ToList(); return(idMeasure); }
public void UpdateTable(string tablename, CertixDS ds) { CertixWSAdapter a = new CertixWSAdapter(DbConnection, DbTransaction); a.UpdateTable(tablename, ds); }
public void FillAP_GALVANICA_SPESSORI(string Brand, string Finitura, CertixDS ds) { CertixWSAdapter a = new CertixWSAdapter(DbConnection, DbTransaction); a.FillAP_GALVANICA_SPESSORI(Brand, Finitura, ds); }
public void FillAP_GALVANICA_SPESSORI(CertixDS ds, string IDMAGAZZ, string IDMAGAZZ_WIP) { CertixWSAdapter a = new CertixWSAdapter(DbConnection, DbTransaction); a.FillAP_GALVANICA_SPESSORI(ds, IDMAGAZZ, IDMAGAZZ_WIP); }
public void FillAP_CERTIX(CertixDS ds, decimal IDMISURECERTIX) { CertixWSAdapter a = new CertixWSAdapter(DbConnection, DbTransaction); a.FillAP_CERTIX(ds, IDMISURECERTIX); }
public void FillMAGAZZ(CertixDS ds, string IDMAGAZZ) { FillMAGAZZ(ds, new List <string>(new string[] { IDMAGAZZ })); }
public void FillMAGAZZ(CertixDS ds, List <string> IDMAGAZZ) { CertixWSAdapter a = new CertixWSAdapter(DbConnection, DbTransaction); a.FillMAGAZZ(ds, IDMAGAZZ); }
public CertixDS.USR_PRD_FASIRow EstraiFaseGalvanicaDaODL(CertixDS.USR_PRD_MOVFASIRow movFase, CertixDS ds) { using (CertixWSBusiness bCertix = new CertixWSBusiness()) { bCertix.FillUSR_PRD_FASI(ds, new List <string>(new string[] { movFase.IDPRDFASE })); CertixDS.USR_PRD_FASIRow fase = ds.USR_PRD_FASI.Where(x => x.IDPRDFASE == movFase.IDPRDFASE).FirstOrDefault(); if (fase == null) { string messaggio = string.Format("Nessuna fase trovata per IDPRDFASE: {0} ", movFase.IDPRDFASE); throw new ArgumentException(messaggio); } if (fase.IsIDPRDFASEPADRENull()) { string messaggio = "Impossibile risalire alla fase di galvanica"; throw new ArgumentException(messaggio); } bCertix.FillUSR_PRD_FASI(ds, new List <string>(new string[] { fase.IDPRDFASEPADRE })); CertixDS.USR_PRD_FASIRow faseGalvanica = ds.USR_PRD_FASI.Where(x => x.IDPRDFASE == fase.IDPRDFASEPADRE).FirstOrDefault(); if (faseGalvanica == null) { string messaggio = "Nessuna fase galvanica non trovata per IDPRDFASE: " + fase.IDPRDFASEPADRE; throw new ArgumentException(messaggio); } return(faseGalvanica); } }
public void FillUSR_PRD_MOVFASIByBarcode(CertixDS ds, string Barcode) { CertixWSAdapter a = new CertixWSAdapter(DbConnection, DbTransaction); a.FillUSR_PRD_MOVFASIByBarcode(ds, Barcode); }