Example #1
0
        public void UpdateTable(string tablename, DocumentiDS ds)
        {
            string tablenameDB = tablename;

            string query = string.Format(CultureInfo.InvariantCulture, "SELECT * FROM {0}", tablenameDB);

            using (DbDataAdapter a = BuildDataAdapter(query))
            {
                try
                {
                    a.ContinueUpdateOnError = false;
                    DataTable        dt  = ds.Tables[tablename];
                    DbCommandBuilder cmd = BuildCommandBuilder(a);
                    a.AcceptChangesDuringFill = true;
                    a.UpdateCommand           = cmd.GetUpdateCommand();
                    a.DeleteCommand           = cmd.GetDeleteCommand();
                    a.InsertCommand           = cmd.GetInsertCommand();

                    a.Update(dt);
                }
                catch (DBConcurrencyException ex)
                {
                }
                catch
                {
                    throw;
                }
            }
        }
        public override global::System.Data.DataSet Clone()
        {
            DocumentiDS cln = ((DocumentiDS)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
        public static Documento EstraiDocumentoCompleto(int idDocumento)
        {
            DocumentiDS ds = new DocumentiDS();

            using (DocumentiBusiness bDocumenti = new DocumentiBusiness())
            {
                bDocumenti.EstraiDocumentoCompleto(ds, idDocumento);
            }
            return(CreaDocumento(ds.DOCUMENTI.FirstOrDefault()));
        }
        public void FillDocumenti(decimal IdDocumento, DocumentiDS ds)
        {
            string query = @"SELECT * FROM DOCUMENTI WHERE IDDOCUMENTO = $P<IDDOCUMENTO>";

            ParamSet ps = new ParamSet();

            ps.AddParam("IDDOCUMENTO", DbType.Decimal, IdDocumento);
            using (DbDataAdapter da = BuildDataAdapter(query, ps))
            {
                da.Fill(ds.DOCUMENTI);
            }
        }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            DocumentiDS ds = new DocumentiDS();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Example #6
0
        public void FillBlocchiDocumento(DocumentiDS ds, int idDocumento)
        {
            string select = @"SELECT * FROM BLOCCHIDOCUMENTO WHERE IDDOCUMENTO = $P<IDDOCUMENTO> ";

            ParamSet ps = new ParamSet();

            ps.AddParam("IDDOCUMENTO", DbType.Int32, idDocumento);

            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.BLOCCHIDOCUMENTO);
            }
        }
Example #7
0
        public void EstraiDocumentoCompleto(DocumentiDS ds, int idDocumento)
        {
            string select = @"SELECT * FROM DOCUMENTI WHERE IDDOCUMENTO = $P<IDDOCUMENTO> ";

            ParamSet ps = new ParamSet();

            ps.AddParam("IDDOCUMENTO", DbType.Int32, idDocumento);

            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.DOCUMENTI);
            }
        }
        public void FillDocumenti(decimal IdEsterna, string TabellaEsterna, DocumentiDS ds)
        {
            string query = @"SELECT * FROM DOCUMENTI WHERE IDESTERNA = $P<IDESTERNA> AND TABELLAESTERNA=$P<TABELLAESTERNA>";

            ParamSet ps = new ParamSet();

            ps.AddParam("IDESTERNA", DbType.Decimal, IdEsterna);
            ps.AddParam("TABELLAESTERNA", DbType.String, TabellaEsterna);
            using (DbDataAdapter da = BuildDataAdapter(query, ps))
            {
                da.Fill(ds.DOCUMENTI);
            }
        }
        public void FillDocumentiNoData(DocumentiDS ds, bool soloNonCancellati)
        {
            string query = @"SELECT IDDOCUMENTO,IDTIPODOCUMENTO,FILENAME,IDESTERNA,TABELLAESTERNA, CANCELLATO, DATAMODIFICA,UTENTEMODIFICA FROM DOCUMENTI ";

            if (soloNonCancellati)
            {
                query += "WHERE CANCELLATO = 'N' ";
            }

            using (DbDataAdapter da = BuildDataAdapter(query))
            {
                da.Fill(ds.DOCUMENTI);
            }
        }
        public void UpdateTable(string tablename, DocumentiDS 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);
            }
        }
Example #11
0
        public void FillTipiDocumento(DocumentiDS ds, bool soloNonCancellati)
        {
            string select = @"SELECT * FROM TIPIDOCUMENTO ";

            if (soloNonCancellati)
            {
                select += "WHERE CANCELLATO = 0 ";
            }

            select += " ORDER BY DESCRIZIONE ";

            using (DbDataAdapter da = BuildDataAdapter(select))
            {
                da.Fill(ds.TIPIDOCUMENTO);
            }
        }
        public static List <Documento> EstraiListaDocumenti(int idEsterna, string tabellaEsterna)
        {
            DocumentiDS ds = new DocumentiDS();

            using (DocumentiBusiness bDocumenti = new DocumentiBusiness())
            {
                bDocumenti.FillDocumenti(ds, idEsterna, tabellaEsterna, false);
            }
            List <Documento> documenti = new List <Documento>();

            foreach (DocumentiDS.DOCUMENTIRow riga in ds.DOCUMENTI)
            {
                Documento documento = CreaDocumento(riga);
                documenti.Add(documento);
            }
            return(documenti);
        }
Example #13
0
        public static List <BloccoDocumento> EstraiBlocchiDocumento(int idDocumento)
        {
            DocumentiDS ds = new DocumentiDS();

            using (DocumentiBusiness bDocumenti = new DocumentiBusiness())
            {
                bDocumenti.FillBlocchiDocumento(ds, idDocumento);
            }
            List <BloccoDocumento> blocchi = new List <BloccoDocumento>();

            foreach (DocumentiDS.BLOCCHIDOCUMENTORow riga in ds.BLOCCHIDOCUMENTO)
            {
                BloccoDocumento blocco = CreaBloccoDocumento(riga);
                blocchi.Add(blocco);
            }
            return(blocchi);
        }
Example #14
0
        public static List <TipoDocumento> EstraiListaTipiDocumento(bool soloNonCancellati)
        {
            DocumentiDS ds = new DocumentiDS();

            using (DocumentiBusiness bDocumenti = new DocumentiBusiness())
            {
                bDocumenti.FillTipiDocumento(ds, soloNonCancellati);
            }

            List <TipoDocumento> tipoDocumento = new List <TipoDocumento>();

            foreach (DocumentiDS.TIPIDOCUMENTORow riga in ds.TIPIDOCUMENTO)
            {
                TipoDocumento td = CreaTipoDocumento(riga);
                tipoDocumento.Add(td);
            }
            return(tipoDocumento);
        }
Example #15
0
        public void FillDocumenti(DocumentiDS ds, int idEsterna, string TabellaEsterna, bool soloNonCancellati)
        {
            string select = @"SELECT IDDOCUMENTO,IDTIPODOCUMENTO,FILENAME,ESTENSIONE,IDESTERNA,TABELLAESTERNA,IDBLOCCO,CANCELLATO,DATAMODIFICA,UTENTEMODIFICA 
                                FROM DOCUMENTI WHERE IDESTERNA = $P<IDESTERNA> AND TABELLAESTERNA = $P<TABELLAESTERNA> ";

            if (soloNonCancellati)
            {
                select += " CANCELLATO = 0 ";
            }

            select += " ORDER BY FILENAME ";

            ParamSet ps = new ParamSet();

            ps.AddParam("IDESTERNA", DbType.Int32, idEsterna);
            ps.AddParam("TABELLAESTERNA", DbType.String, TabellaEsterna);

            using (DbDataAdapter da = BuildDataAdapter(select, ps))
            {
                da.Fill(ds.DOCUMENTI);
            }
        }
        public static Documento SalvaDocumento(int idTipoDocumento, string filename, string estensione, int idEsterna, string tabellaEsterna, byte[] dati, string utente)
        {
            DocumentiDS ds = new DocumentiDS();

            using (DocumentiBusiness bDocumenti = new DocumentiBusiness())
            {
                DocumentiDS.DOCUMENTIRow documento = ds.DOCUMENTI.NewDOCUMENTIRow();
                documento.CANCELLATO      = false;
                documento.DATAMODIFICA    = DateTime.Now;
                documento.DATI            = dati;
                documento.ESTENSIONE      = estensione;
                documento.FILENAME        = filename;
                documento.IDESTERNA       = idEsterna;
                documento.IDTIPODOCUMENTO = idTipoDocumento;
                documento.TABELLAESTERNA  = tabellaEsterna;
                documento.UTENTEMODIFICA  = utente;

                ds.DOCUMENTI.AddDOCUMENTIRow(documento);
                bDocumenti.UpdateTable(ds.DOCUMENTI.TableName, ds);
            }
            return(CreaDocumento(ds.DOCUMENTI.FirstOrDefault()));
        }
Example #17
0
        public void FillDocumenti(DocumentiDS ds, int idEsterna, string TabellaEsterna, bool soloNonCancellati)
        {
            DocumentiAdapter a = new DocumentiAdapter(DbConnection, DbTransaction);

            a.FillDocumenti(ds, idEsterna, TabellaEsterna, soloNonCancellati);
        }
        public void UpdateTable(string tablename, DocumentiDS ds)
        {
            DocumentiAdapter a = new DocumentiAdapter(DbConnection, DbTransaction);

            a.UpdateTable(tablename, ds);
        }
        public void FillDocumenti(decimal IdEsterna, string TabellaEsterna, DocumentiDS ds)
        {
            DocumentiAdapter a = new DocumentiAdapter(DbConnection, DbTransaction);

            a.FillDocumenti(IdEsterna, TabellaEsterna, ds);
        }
        public void FillDocumenti(decimal IdDocumento, DocumentiDS ds)
        {
            DocumentiAdapter a = new DocumentiAdapter(DbConnection, DbTransaction);

            a.FillDocumenti(IdDocumento, ds);
        }
        public void FillDocumentiNoData(DocumentiDS ds, bool soloNonCancellati)
        {
            DocumentiAdapter a = new DocumentiAdapter(DbConnection, DbTransaction);

            a.FillDocumentiNoData(ds, soloNonCancellati);
        }
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                DocumentiDS ds = new DocumentiDS();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "DOCUMENTIDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Example #23
0
        public void EstraiDocumentoCompleto(DocumentiDS ds, int idDocumento)
        {
            DocumentiAdapter a = new DocumentiAdapter(DbConnection, DbTransaction);

            a.EstraiDocumentoCompleto(ds, idDocumento);
        }
Example #24
0
        public void FillBlocchiDocumento(DocumentiDS ds, int idDocumento)
        {
            DocumentiAdapter a = new DocumentiAdapter(DbConnection, DbTransaction);

            a.FillBlocchiDocumento(ds, idDocumento);
        }