public string UploadMeasures(int IdMeasure, string JSON)
        {
            ScriviMessaggioInLog("*************  UploadMeasures Richiamato");
            bool IsTest = Properties.Settings.Default.IsTest;

            try
            {
                List <UploadMeasuresElementRequest> UploadMeasuresElements = JSonSerializer.Deserialize <List <UploadMeasuresElementRequest> >(JSON);

                CertixBLL bll = new CertixBLL();
                bll.RegistraMisure(IdMeasure, UploadMeasuresElements, Properties.Settings.Default.IsTest);
            }
            catch (ArgumentException ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("********** ERRORE IN UPLOADCODE");
                ScriviErroreGestitoInLog(ex, sb.ToString());
                return(CreaUploadMeasuresResponse(Status.ERRORE, ex.Message));
            }
            catch (Exception ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("********** ERRORE IN UPLOADCODE");
                sb.AppendLine(string.Format(" IdMeasure: {0}  ", IdMeasure));
                sb.AppendLine(string.Format("JSON: {0}  ", JSON));
                ScriviEccezioneInLog(ex, sb.ToString());
                return(CreaUploadMeasuresResponse(Status.ERRORE, "Errore non recuperabile."));
            }
            return(CreaUploadMeasuresResponse(Status.OK, string.Empty));
        }
        public string UploadCode(int IdLine, string Code)
        {
            ScriviMessaggioInLog("*************  UploadCode Richiamato");

            try
            {
                CertixBLL bll = new CertixBLL();

                List <string> Measures;
                int           IdMeasure = bll.CreateIdMeasureFromCodeAndIdLine(IdLine, Code, Properties.Settings.Default.IsTest, out Measures);

                UploadCodeResponse response = new UploadCodeResponse();
                response.Status    = Status.OK;
                response.Error     = string.Empty;
                response.IdMeasure = IdMeasure;
                response.Materials = Measures;

                return(JSonSerializer.Serialize <UploadCodeResponse>(response));
            }
            catch (ArgumentException ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("********** ERRORE IN UPLOADCODE");
                ScriviErroreGestitoInLog(ex, sb.ToString());
                return(CreaUploadCodeResponsePerErrore(ex.Message));
            }
            catch (Exception ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("********** ERRORE IN UPLOADCODE");
                sb.AppendLine(string.Format(" IdLine: {0}  ", IdLine));
                sb.AppendLine(string.Format("Code: {0}  ", Code));
                ScriviEccezioneInLog(ex, sb.ToString());
                return(CreaUploadCodeResponsePerErrore("Errore non recuperabile."));
            }
        }
Example #3
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string barcode = textBox1.Text;
                using (CertixWSBusiness bCertix = new CertixWSBusiness())
                {
                    CertixBLL bll = new CertixBLL();
                    CertixDS.USR_PRD_MOVFASIRow movFase = bll.VerificaBarcodeODL(barcode, _ds);
                    if (movFase == null)
                    {
                        string messaggio = string.Format("Codice Code: {0} non valido", barcode);
                        throw new ArgumentException(messaggio);
                    }
                    txtIdmagazz.Text = movFase.IsIDMAGAZZNull() ? string.Empty : movFase.IDMAGAZZ;
                    if (!movFase.IsIDMAGAZZNull())
                    {
                        bCertix.FillMAGAZZ(_ds, movFase.IDMAGAZZ);
                        CertixDS.MAGAZZRow magazz = _ds.MAGAZZ.Where(x => x.IDMAGAZZ == movFase.IDMAGAZZ).FirstOrDefault();
                        if (magazz != null)
                        {
                            txtModelloMagazz.Text = magazz.MODELLO;
                        }
                    }

                    CertixDS.USR_PRD_FASIRow faseGalvanica = bll.EstraiFaseGalvanicaDaODL(movFase, _ds);
                    if (faseGalvanica == null)
                    {
                        string messaggio = string.Format("Codice Code: {0} fase galvanica non trovata", barcode);
                        throw new ArgumentException(messaggio);
                    }
                    if (faseGalvanica.IsIDMAGAZZNull())
                    {
                        string messaggio = string.Format("Codice Code: {0} articolo galvanica non trovato", barcode);
                        throw new ArgumentException(messaggio);
                    }
                    else
                    {
                        bCertix.FillMAGAZZ(_ds, faseGalvanica.IDMAGAZZ);
                        CertixDS.MAGAZZRow magazz = _ds.MAGAZZ.Where(x => x.IDMAGAZZ == faseGalvanica.IDMAGAZZ).FirstOrDefault();
                        if (magazz != null)
                        {
                            txtModelloMagazzWip.Text = magazz.MODELLO;
                        }
                    }
                    txtIdmagazzWip.Text = faseGalvanica.IsIDMAGAZZNull() ? string.Empty : faseGalvanica.IDMAGAZZ;


                    bCertix.FillAP_GALVANICA_MODELLO(_ds, movFase.IDMAGAZZ, faseGalvanica.IDMAGAZZ);


                    if (_ds.AP_GALVANICA_MODELLO.Count != 0)
                    {
                        CertixDS.AP_GALVANICA_MODELLORow modello = _ds.AP_GALVANICA_MODELLO.Where(x => x.IDMAGAZZ == txtIdmagazz.Text && x.IDMAGAZZ_WIP == txtIdmagazzWip.Text).FirstOrDefault();
                        if (modello != null)
                        {
                            ddlBrand.Text    = modello.IsBRANDNull() ? string.Empty : modello.BRAND;
                            txtFinitura.Text = modello.IsFINITURANull() ? string.Empty : modello.FINITURA;
                            bCertix.FillAP_GALVANICA_SPESSORI(ddlBrand.Text, txtFinitura.Text, _ds);
                            List <string> etichette = _ds.AP_GALVANICA_SPESSORI.OrderBy(x => x.SEQUENZA).Select(x => x.ETICHETTA).ToList();
                            foreach (string etichetta in _ds.AP_GALVANICA_SPESSORI.OrderBy(x => x.SEQUENZA).Select(x => x.ETICHETTA).ToList())
                            {
                                dgvEtichette.Rows.Add(etichetta);
                            }
                        }
                    }
                }
            }
        }