コード例 #1
0
 public void Salva(CDCDS ds)
 {
     using (CDCMetalBusiness bCDCMetal = new CDCMetalBusiness())
     {
         bCDCMetal.UpdateCDC_EXCEL(ds);
         bCDCMetal.UpdateCDC_DETTAGLIO(ds);
     }
 }
コード例 #2
0
        public bool LeggiExcelCDC(CDCDS ds, string filePath, string utente, string brand, out string messaggioErrore)
        {
            messaggioErrore = string.Empty;
            using (FileStream fs = new FileStream(filePath, FileMode.Open))
            {
                ds.CDC_DETTAGLIO.Clear();
                ds.CDC_EXCEL.Clear();

                decimal IDEXCEL;
                using (CDCMetalBusiness bCDCMetal = new CDCMetalBusiness())
                {
                    long ID = bCDCMetal.GetID();
                    IDEXCEL = (decimal)ID;
                }

                CDCDS.CDC_EXCELRow excelRow = ds.CDC_EXCEL.NewCDC_EXCELRow();
                excelRow.IDEXCEL          = IDEXCEL;
                excelRow.NOMEFILE         = filePath.Length > 200 ? filePath.Substring(0, 200) : filePath;
                excelRow.DATAACQUISIZIONE = DateTime.Today;
                excelRow.UTENTE           = utente.Length > 50 ? utente.Substring(0, 50) : utente;
                excelRow.AZIENDA          = brand;

                MemoryStream ms   = new MemoryStream();
                byte[]       dati = new byte[fs.Length];
                fs.Read(dati, 0, (int)fs.Length);
                excelRow.DATI = dati;

                ExcelHelper excel = new ExcelHelper();
                if (!excel.ReadCDC(fs, ds, IDEXCEL, utente, out messaggioErrore))
                {
                    ds.CDC_DETTAGLIO.Clear();
                    ds.CDC_EXCEL.Clear();
                    return(false);
                }

                if (ds.CDC_DETTAGLIO.Count > 0)
                {
                    string   data = ds.CDC_DETTAGLIO.FirstOrDefault().DATACOLLAUDO;
                    DateTime dt   = DateTime.ParseExact(data, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    excelRow.DATARIFERIMENTO = dt;
                    ds.CDC_EXCEL.AddCDC_EXCELRow(excelRow);
                    return(true);
                }
                else
                {
                    messaggioErrore = "Il file excel risulta essere vuoto";
                    return(false);
                }

                fs.Close();
            }
            return(false);
        }
コード例 #3
0
        public void Salva(CDCDS ds)
        {
            using (CDCMetalBusiness bCDCMetal = new CDCMetalBusiness())
            {
                bCDCMetal.UpdateCDC_EXCEL(ds);



                //long lastid = bCDCMetal.GetLastIdentity();

                //foreach (System.Data.DataRow dr in ds.CDC_DETTAGLIO.Rows)
                //{
                //    dr["IDEXCEL"] = lastid;
                //}

                bCDCMetal.UpdateCDC_DETTAGLIO_rel(ds);
            }
        }
コード例 #4
0
        public List <decimal> VerificaExcelCaricato(CDCDS ds)
        {
            List <decimal> IDPRENOTAZIONE = ds.CDC_DETTAGLIO_rel.Select(x => x.IDPRENOTAZIONE).Distinct().ToList();

            CDCDS dsDB = new CDCDS();

            using (CDCMetalBusiness bCDCMetal = new CDCMetalBusiness())
            {
                bCDCMetal.FillCDC_DETTAGLIO(IDPRENOTAZIONE, dsDB);
            }

            List <decimal> IDPRENOTAZIONEDUPLICATI = dsDB.CDC_DETTAGLIO.Select(x => x.IDPRENOTAZIONE).Distinct().ToList();

            foreach (CDCDS.CDC_DETTAGLIO_relRow riga in ds.CDC_DETTAGLIO_rel)
            {
                if (riga.IsENTENull() || string.IsNullOrEmpty(riga.ENTE))
                {
                    riga.ENTE = "-";
                }
            }

            return(IDPRENOTAZIONEDUPLICATI);
        }
コード例 #5
0
        public bool VerificaPassword(string user, string password, out CDCDS.USR_USERRow userRow)
        {
            userRow  = null;
            user     = user.ToUpper();
            password = password.ToUpper();

            using (CDCMetalBusiness bCDC = new CDCMetalBusiness())
            {
                CDCDS ds = new CDCDS();
                bCDC.LeggiUtente(ds, user);

                userRow = ds.USR_USER.Where(x => x.UIDUSER.Trim() == user).FirstOrDefault();
                if (userRow == null)
                {
                    return(false);
                }

                if (userRow.PWDUSER.ToUpper() == password)
                {
                    return(true);
                }
                return(false);
            }
        }