Exemplo n.º 1
0
            public static System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(System.Xml.Schema.XmlSchemaSet xs)
            {
                System.Xml.Schema.XmlSchemaComplexType type     = new System.Xml.Schema.XmlSchemaComplexType();
                System.Xml.Schema.XmlSchemaSequence    sequence = new System.Xml.Schema.XmlSchemaSequence();
                ReportsValidation ds = new ReportsValidation();

                xs.Add(ds.GetSchemaSerializable());
                System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                System.Xml.Schema.XmlSchemaAttribute attribute1 = new System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                System.Xml.Schema.XmlSchemaAttribute attribute2 = new System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "OlapReportsDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                return(type);
            }
Exemplo n.º 2
0
        public override System.Data.DataSet Clone()
        {
            ReportsValidation cln = ((ReportsValidation)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Exemplo n.º 3
0
        public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs)
        {
            ReportsValidation ds = new ReportsValidation();

            System.Xml.Schema.XmlSchemaComplexType type     = new System.Xml.Schema.XmlSchemaComplexType();
            System.Xml.Schema.XmlSchemaSequence    sequence = new System.Xml.Schema.XmlSchemaSequence();
            xs.Add(ds.GetSchemaSerializable());
            System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            return(type);
        }
        public void LoadReports()
        {
            if (_reports != null)
            {
                return;
            }

            SqlConnection reportConn = null;

            try
            {
                // create dataset
                _reports = new ReportsValidation();
                _reports.BeginInit();

                // open connections
                reportConn = new SqlConnection(ConfigurationManager.AppSettings["DBFINFConnection"]);
                reportConn.Open();
                string companyId = ConfigurationManager.AppSettings["DBFINFCompanyId"];

                // commit unsaved reports
                SqlCommand cmd = reportConn.CreateCommand();
                cmd.CommandText = string.Format(
                    @"update t_olap_reports set data=s.data
from t_olap_reports, t_olap_reports_state s, tusers u 
where 
t_olap_reports.user_id=u.id and u.company_id={0}
and t_olap_reports.id=s.rpt_id and s.is_current=1", companyId);
                cmd.ExecuteNonQuery();
                cmd.Dispose();

                // delete report history
                cmd             = reportConn.CreateCommand();
                cmd.CommandText = string.Format(
                    @"delete from t_olap_reports_state 
where rpt_id in (select r.id from t_olap_reports r , tusers u
where r.user_id=u.id and u.company_id={0})", companyId);
                cmd.ExecuteNonQuery();
                cmd.Dispose();

                // load reports data
                cmd             = reportConn.CreateCommand();
                cmd.CommandText = string.Format(
                    @"select r.Id, r.Name, r.Description, u.Name as [User], r.data as ReportXml, 
0 as ObjectsTotal, 0 as ObjectsInvalid, 0 as ObjectsInvalidNew, 0 as InvalidDiff 
from tusers u inner join t_olap_reports r
on u.id=r.user_id
where u.company_id={0}
order by r.Id", companyId);
                SqlDataAdapter ad = new SqlDataAdapter(cmd);
                ad.AcceptChangesDuringFill = true;
                ad.Fill(_reports.OlapReports);
                cmd.Dispose();
            }
            catch (Exception exc)
            {
                _reports = null;
            }
            finally
            {
                if (reportConn != null)
                {
                    reportConn.Close();
                }

                if (_reports != null)
                {
                    _reports.EndInit();
                }
            }
        }
 public static System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(System.Xml.Schema.XmlSchemaSet xs) {
     System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType();
     System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence();
     ReportsValidation ds = new ReportsValidation();
     xs.Add(ds.GetSchemaSerializable());
     System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     System.Xml.Schema.XmlSchemaAttribute attribute1 = new System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     System.Xml.Schema.XmlSchemaAttribute attribute2 = new System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "OlapReportsDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     return type;
 }
 public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs) {
     ReportsValidation ds = new ReportsValidation();
     System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType();
     System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence();
     xs.Add(ds.GetSchemaSerializable());
     System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     return type;
 }