Ejemplo n.º 1
0
            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();
                PackagesRevenue ds = new PackagesRevenue();

                xs.Add(ds.GetSchemaSerializable());
                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 = "PackageRevenueDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                return(type);
            }
Ejemplo n.º 2
0
        public override global::System.Data.DataSet Clone()
        {
            PackagesRevenue cln = ((PackagesRevenue)(base.Clone()));

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

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            xs.Add(ds.GetSchemaSerializable());
            global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            return(type);
        }
Ejemplo n.º 4
0
        private void buttonRevenueForecast_Click(object sender, RibbonControlEventArgs e)
        {
            SelectYearForm selectYearForm = new SelectYearForm();

            selectYearForm.ShowDialog();
            int year = selectYearForm.SelectedYear;

            selectYearForm.Dispose();

            if (year == 0)
            {
                return;
            }

            PseudoProgressForm progress = new PseudoProgressForm();

            progress.ProgressLabel = "Querying SAP...";
            BackgroundWorker backgroundWorker = new BackgroundWorker();
            PackagesRevenue  revenueDataset   = new PackagesRevenue();

            backgroundWorker.DoWork +=
                delegate(object workSender, DoWorkEventArgs eventArg)
            {
                PackagesRevenue.PackageRevenueDataTable revenueTable =
                    revenueDataset.PackageRevenue;

                Dictionary <string, ArrayList> allSales =
                    new Dictionary <string, ArrayList>();

                allSales.Add("Gold", new ArrayList());
                allSales.Add("Silver", new ArrayList());
                allSales.Add("Bronze", new ArrayList());

                allSales["Gold"].Add("Gold");
                allSales["Silver"].Add("Silver");
                allSales["Bronze"].Add("Bronze");

                Sales[] aSales = new Sales[12];
                for (int month = 0; month < aSales.Length; month++)
                {
                    aSales[month] = DataHelper.GetSalesData(month + 1, year);

                    allSales["Gold"].Add(0);
                    allSales["Silver"].Add(0);
                    allSales["Bronze"].Add(0);

                    foreach (Sales.EventSaleRow eventSaleRow in aSales[month].EventSale.Rows)
                    {
                        allSales[eventSaleRow.PackageType][month + 1] =
                            Convert.ToDecimal(allSales[eventSaleRow.PackageType][month + 1]) +
                            (eventSaleRow.Price - eventSaleRow.Cost);
                    }
                }

                allSales["Gold"].Add(year);
                allSales["Silver"].Add(year);
                allSales["Bronze"].Add(year);

                revenueTable.LoadDataRow(allSales["Gold"].ToArray(), true);
                revenueTable.LoadDataRow(allSales["Silver"].ToArray(), true);
                revenueTable.LoadDataRow(allSales["Bronze"].ToArray(), true);
            };

            backgroundWorker.RunWorkerCompleted +=
                delegate(object workSender, RunWorkerCompletedEventArgs eventArg)
            {
                progress.Close();
                progress.Dispose();

                ExcelHelper.LoadExcelSheet(
                    "RevenueForecast",
                    Resources.RevenueForecast,
                    revenueDataset);
            };

            backgroundWorker.RunWorkerAsync();
            progress.ShowDialog();
        }