Exemple #1
0
        public override DataSet Clone()
        {
            SiteCodeSchema cln = ((SiteCodeSchema)(base.Clone()));

            cln.InitVars();
            return(cln);
        }
            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();
                SiteCodeSchema ds = new SiteCodeSchema();

                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 = "CoxSitesDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                return(type);
            }
        public override System.Data.DataSet Clone()
        {
            SiteCodeSchema cln = ((SiteCodeSchema)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
        public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs)
        {
            SiteCodeSchema ds = new SiteCodeSchema();

            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);
        }
Exemple #5
0
        /// <summary>
        /// retrieves the list of siteid's to respective division/sites
        /// use the CompanyDivisionAtt enumeration for a list of columnNames
        /// within returned DataTable
        /// </summary>
        /// <returns></returns>
        /// <exception cref="LogonException">Thrown when a problem occurred
        /// trying to connect to the underlying datasource.</exception>
        /// <exception cref="DataSourceException">Thrown when a problem occurred
        /// trying to interact with the underlying datasource after a connection
        /// has been established. Check the inner exception for further meaning
        /// as to why the problem occurred.</exception>
        private SiteCodeSchema.CompanyDivisionSitesDataTable GetCompanyDivisionSites()
        {
            // here, we are wrapping all exceptions with a datasource exception.
            // the inner exception will contain the actual stack trace and the
            // corresponding base exception (and rdbms specific error).
            try
            {
                // connect to the profile database to get this information.
                // do this with a using statement in order to make sure the
                // connection gets closed.
                using (SqlConnection sqlConn = new SqlConnection(_connectionString))
                {
                    // build the command object
                    using (SqlCommand cmd = new SqlCommand("spGetCompanyDivisionSites", sqlConn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        // build the dataadapter
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            // create the dataset to fill
                            SiteCodeSchema ds = new SiteCodeSchema();

                            // now fill it
                            da.Fill(ds.CompanyDivisionSites);

                            // return the single table
                            return(ds.CompanyDivisionSites);
                        }
                    }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                // Opening a connection will throw either a
                //		System.InvalidOperationException: Connection is already open
                //		System.Data.SqlClient.SqlException: Connection level exception
                //
                //		Since we know that the connection is not already open, we don't
                //		need to specialize the catch block for InvalidOperationException
                //		(plus this is an error also thrown by other SqlXXX objects
                throw new LogonException(sqlEx);
            }
            catch (Exception ex)
            {
                throw new DataSourceException(ex);
            }
        }