Esempio n. 1
0
        public static MailingLabelDS Format(DataTable customerTable, string nameFormat, string streetUnitNumberFormat)
        {
            var ds = new MailingLabelDS();
            var dsHelper = new MailingLableDSHelper(ds);

            //Create the list of selected users and build the labels.
            //DateTime now = DateTime.Now;

            var data = new DataSet("PrintList");
            data.Tables.Add(customerTable);

            foreach (DataRowView row in data.Tables[0].DefaultView)
            {
                var name = string.Format(nameFormat, row[FirstName], row[LastName]);
                var streetUnitNumber = string.Format(streetUnitNumberFormat, row[AddressStreet], row[AddressUnitNumber]).Trim();
                var city = GetValue(AddressCity, row);
                var state = GetValue(AddressState, row);
                var zip = GetValue(AddressZipCode, row);
                var country = GetValue(AddressCountry, row);

                var address = AddressFormatter.Format(city, state, zip);

                //Add the address to the dataset
                dsHelper.AddAddress(name, streetUnitNumber, address, country);

            }

            return ds;
        }
Esempio n. 2
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();
     MailingLabelDS ds = new MailingLabelDS();
     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 = "LabelDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     return type;
 }
Esempio n. 3
0
 public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs) {
     MailingLabelDS ds = new MailingLabelDS();
     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;
 }
Esempio n. 4
0
		public void Teardown() 
		{
			_data = null;
			_obj = null;
		}
Esempio n. 5
0
		public void Setup() 
		{
			_data = new MailingLabelDS();
			_obj = new MailingLableDSHelper(_data);
		}
Esempio n. 6
0
		public MailingLableDSHelper(MailingLabelDS data)
		{
			_ds = data;
		}