public bool InizioAttivita(string Utente, string Lavorazione)
        {
            try
            {
                RilevazioniDS ds = new RilevazioniDS();
                using (RilevazioneBusiness bRilevazione = new RilevazioneBusiness())
                {
                    RilevazioniDS.RW_TEMPIRow tempo = ds.RW_TEMPI.NewRW_TEMPIRow();
                    tempo.APERTO      = 1;
                    tempo.UTENTE      = Utente;
                    tempo.IDDATO      = bRilevazione.GetID();
                    tempo.LAVORAZIONE = (Lavorazione.Length > 100) ? Lavorazione.Substring(0, 100) : Lavorazione;
                    tempo.INIZIO      = DateTime.Now;

                    ds.RW_TEMPI.AddRW_TEMPIRow(tempo);
                    bRilevazione.UpdateRW_TEMPI(ds);

                    return(true);
                }
            }
            catch
            {
                return(false);
            }
        }
        public bool TerminaAttivita(string BarcodeLavoratore, string BarcodeOLD, string Nota, decimal Quantita)
        {
            try
            {
                RilevazioniDS ds = new RilevazioniDS();
                using (RilevazioneBusiness bRilevazione = new RilevazioneBusiness())
                {
                    bRilevazione.FillRW_TEMPI_APERTI(ds, BarcodeLavoratore);
                    RilevazioniDS.RW_TEMPIRow tempo = ds.RW_TEMPI.FirstOrDefault();

                    if (tempo.BARCODE_ODL != BarcodeOLD)
                    {
                        return(false);
                    }

                    tempo.APERTO   = 0;
                    tempo.FINE     = DateTime.Now;
                    tempo.NOTA     = Nota.Length > 100 ? Nota.Substring(0, 100) : Nota;
                    tempo.QUANTITA = Quantita;

                    bRilevazione.UpdateRW_TEMPI(ds);
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
        }
        public void FillRW_TEMPI_REPARTI(RilevazioniDS ds)
        {
            string query = @"SELECT * FROM RW_TEMPI_REPARTI ORDER BY REPARTO, UTENTE";

            using (DbDataAdapter da = BuildDataAdapter(query))
            {
                da.Fill(ds.RW_TEMPI_REPARTI);
            }
        }
        public void FillRW_TEMPI_LAVORAZIONI(RilevazioniDS ds)
        {
            string query = @"SELECT * FROM RW_TEMPI_LAVORAZIONI ORDER BY SEQUENZA";

            using (DbDataAdapter da = BuildDataAdapter(query))
            {
                da.Fill(ds.RW_TEMPI_LAVORAZIONI);
            }
        }
        public List <string> GetUtentiPerReparto(string Reparto)
        {
            RilevazioniDS ds = new RilevazioniDS();

            using (RilevazioneBusiness bRilevazione = new RilevazioneBusiness())
            {
                bRilevazione.FillRW_TEMPI_REPARTI(ds);
                return(ds.RW_TEMPI_REPARTI.Where(x => x.REPARTO == Reparto).Select(x => x.UTENTE).ToList());
            }
        }
        public List <RWListItem> CaricaListaLavorazioni()
        {
            RilevazioniDS ds = new RilevazioniDS();

            using (RilevazioneBusiness bRilevazione = new RilevazioneBusiness())
            {
                bRilevazione.FillRW_TEMPI_LAVORAZIONI(ds);
                return((from tp in ds.RW_TEMPI_LAVORAZIONI select new RWListItem(tp.DESCRIZIONE, tp.SEQUENZA.ToString())).ToList());
            }
        }
        public void FillUSR_PRD_RESOURCESF(RilevazioniDS ds, string BARCODE)
        {
            string query = @"SELECT * FROM gruppo.USR_PRD_RESOURCESF WHERE BARCODE = $P{BARCODE}";

            ParamSet ps = new ParamSet();

            ps.AddParam("BARCODE", DbType.String, BARCODE);

            using (DbDataAdapter da = BuildDataAdapter(query, ps))
            {
                da.Fill(ds.USR_PRD_RESOURCESF);
            }
        }
        public void FillRW_TEMPI_APERTI_PER_UTENTE(RilevazioniDS ds, string UTENTE)
        {
            string query = @"SELECT * FROM RW_TEMPI WHERE APERTO = 1 AND UTENTE = $P{UTENTE}";

            ParamSet ps = new ParamSet();

            ps.AddParam("UTENTE", DbType.String, UTENTE);

            using (DbDataAdapter da = BuildDataAdapter(query, ps))
            {
                da.Fill(ds.RW_TEMPI);
            }
        }
        public void UpdateRegistrazioneDS(string tablename, RilevazioniDS ds)
        {
            string query = string.Format(CultureInfo.InvariantCulture, "SELECT * FROM {0}", tablename);

            using (DbDataAdapter a = BuildDataAdapter(query))
            {
                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);
            }
        }
        public string RilevaUtente(string barcode)
        {
            RilevazioniDS ds = new RilevazioniDS();

            using (RilevazioneBusiness bRilevazione = new RilevazioneBusiness())
            {
                bRilevazione.FillUSR_PRD_RESOURCESF(ds, barcode);

                RilevazioniDS.USR_PRD_RESOURCESFRow risorsa = ds.USR_PRD_RESOURCESF.Where(x => x.BARCODE == barcode).FirstOrDefault();
                if (risorsa == null)
                {
                    return(string.Empty);
                }

                return(risorsa.IsDESRESOURCEFNull() ? string.Empty : risorsa.DESRESOURCEF);
            }
        }
        public string CaricaSchedaAperto(string Utente)
        {
            RilevazioniDS ds = new RilevazioniDS();

            using (RilevazioneBusiness bRilevazione = new RilevazioneBusiness())
            {
                bRilevazione.FillRW_TEMPI_APERTI_PER_UTENTE(ds, Utente);

                RilevazioniDS.RW_TEMPIRow tempoAperto = ds.RW_TEMPI.FirstOrDefault();
                if (tempoAperto == null)
                {
                    return(string.Empty);
                }

                return(tempoAperto.LAVORAZIONE);
            }
        }
        public string CaricaSchedaAperto(string BarcodeLavoratore, out string BarcodeOdl)
        {
            BarcodeOdl = string.Empty;
            RilevazioniDS ds = new RilevazioniDS();

            using (RilevazioneBusiness bRilevazione = new RilevazioneBusiness())
            {
                bRilevazione.FillRW_TEMPI_APERTI(ds, BarcodeLavoratore);

                RilevazioniDS.RW_TEMPIRow tempoAperto = ds.RW_TEMPI.FirstOrDefault();
                if (tempoAperto == null)
                {
                    return(string.Empty);
                }

                BarcodeOdl = tempoAperto.BARCODE_ODL;
                return(tempoAperto.LAVORAZIONE);
            }
        }
        public bool TerminaAttivita(string Utente, string Nota, decimal Quantita)
        {
            try
            {
                RilevazioniDS ds = new RilevazioniDS();
                using (RilevazioneBusiness bRilevazione = new RilevazioneBusiness())
                {
                    bRilevazione.FillRW_TEMPI_APERTI_PER_UTENTE(ds, Utente);
                    RilevazioniDS.RW_TEMPIRow tempo = ds.RW_TEMPI.FirstOrDefault();

                    tempo.APERTO   = 0;
                    tempo.FINE     = DateTime.Now;
                    tempo.NOTA     = Nota.Length > 100 ? Nota.Substring(0, 100) : Nota;
                    tempo.QUANTITA = Quantita;

                    bRilevazione.UpdateRW_TEMPI(ds);
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
        }
Esempio n. 14
0
        public void FillRW_TEMPI_REPARTI(RilevazioniDS ds)
        {
            RilevazioneAdapter a = new RilevazioneAdapter(DbConnection, DbTransaction);

            a.FillRW_TEMPI_REPARTI(ds);
        }
Esempio n. 15
0
        public void UpdateRW_TEMPI(RilevazioniDS ds)
        {
            RilevazioneAdapter a = new RilevazioneAdapter(DbConnection, DbTransaction);

            a.UpdateRegistrazioneDS(ds.RW_TEMPI.TableName, ds);
        }
Esempio n. 16
0
        public void FillRW_TEMPI_APERTI_PER_UTENTE(RilevazioniDS ds, string Utente)
        {
            RilevazioneAdapter a = new RilevazioneAdapter(DbConnection, DbTransaction);

            a.FillRW_TEMPI_APERTI_PER_UTENTE(ds, Utente);
        }
Esempio n. 17
0
        public void FillRW_TEMPI_APERTI(RilevazioniDS ds, string BARCODE)
        {
            RilevazioneAdapter a = new RilevazioneAdapter(DbConnection, DbTransaction);

            a.FillRW_TEMPI_APERTI(ds, BARCODE);
        }
Esempio n. 18
0
        public void FillUSR_PRD_RESOURCESF(RilevazioniDS ds, string BARCODE)
        {
            RilevazioneAdapter a = new RilevazioneAdapter(DbConnection, DbTransaction);

            a.FillUSR_PRD_RESOURCESF(ds, BARCODE);
        }