public override global::System.Data.DataSet Clone()
        {
            ExpensesData cln = ((ExpensesData)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Exemple #2
0
        //  [Fact]
        public void CreateExpenses()
        {
            var ATbase = new AirtableExpenses();

            var expensesEntry = new ExpensesData("test data");

            expensesEntry.Date        = DateTime.Now;
            expensesEntry.DeliveredTo = "Al";
            expensesEntry.Value       = 10.34;

            ATbase.CreateExpensesRecord(expensesEntry);
        }
Exemple #3
0
        public void CreateAndUpdateExpense()
        {
            var ATbase = new AirtableExpenses();
            var data   = new ExpensesData("DUMMY EXPENSE")
            {
                Value   = 1.2,
                Date    = DateTime.Now,
                OrderId = "1234",
            };

            ATbase.CreateExpensesRecord(data);
        }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            ExpensesData ds = new ExpensesData();

            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);
        }
        private void IEReportPrint_Load(object sender, EventArgs e)
        {
            ExpensesData ExData = new ExpensesData();
            IncomeData   InData = new IncomeData();
            string       cs     = @"Data Source=DAVE\DAVE;Initial Catalog=SchoolManagementSystem;Integrated Security=True";

            SqlConnection  cn   = new SqlConnection(cs);
            SqlDataAdapter sql1 = new SqlDataAdapter("SELECT expensesUnitName, expensesType, expensesAmount FROM expensesPayment WHERE YEAR (expensesDate) =" + IEReportYear + "and MONTH (expensesDate) =" + IEReportMonth, cn);
            SqlDataAdapter sql2 = new SqlDataAdapter("SELECT incomeUnitName, incomeType, incomeAmount FROM incomePayment WHERE YEAR (incomeDate) =" + IEReportYear + "and MONTH (incomeDate) =" + IEReportMonth, cn);

            sql1.Fill(ExData, ExData.Tables[0].TableName);
            sql2.Fill(InData, InData.Tables[0].TableName);

            ReportDataSource rds1 = new ReportDataSource("Expenses", ExData.Tables[0]);
            ReportDataSource rds2 = new ReportDataSource("Income", InData.Tables[0]);

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(rds1);
            this.reportViewer1.LocalReport.Refresh();


            this.reportViewer1.LocalReport.DataSources.Add(rds2);
            this.reportViewer1.LocalReport.Refresh();


            this.reportViewer1.RefreshReport();

            IEReportTitle = "Income Expenses Overview Report";

            if (IEReportMonth == 1 || IEReportMonth == 3 || IEReportMonth == 5 || IEReportMonth == 7 || IEReportMonth == 8 || IEReportMonth == 10 || IEReportMonth == 12)
            {
                IEReportDate = IEReportYear + "/0" + (IEReportMonth - 1) + "/01 to " + IEReportYear + "/" + IEReportMonth + "/31";
            }
            else if (IEReportMonth == 2)
            {
                IEReportDate = IEReportYear + "/0" + (IEReportMonth - 1) + "/01 to " + IEReportYear + "/" + IEReportMonth + "/28";
            }
            else
            {
                IEReportDate = IEReportYear + "/0" + (IEReportMonth - 1) + "/01 to " + IEReportYear + "/" + IEReportMonth + "/30";
            }

            Microsoft.Reporting.WinForms.ReportParameter[] para = new Microsoft.Reporting.WinForms.ReportParameter[]
            {
                new Microsoft.Reporting.WinForms.ReportParameter("ReportTotalExpenses", Convert.ToString(IEReportExpensesTotal)),
                new Microsoft.Reporting.WinForms.ReportParameter("ReportTotalIncome", Convert.ToString(IEReportIncomeTotal)),
                new Microsoft.Reporting.WinForms.ReportParameter("ReportDate", IEReportDate),
                new Microsoft.Reporting.WinForms.ReportParameter("ReportTitle", IEReportTitle)
            };
            this.reportViewer1.LocalReport.SetParameters(para);
            this.reportViewer1.RefreshReport();
        }
    public static void RemoveExpense(ExpenseType type, Departments dept)
    {
        if (GameManager.isInDemoMode)
        {
            return;
        }
        ExpensesData foundData = instance.expenses.Find(x => x.type == type && x.department == dept);

        if (foundData != null)
        {
            instance.expenses.Remove(foundData);
        }
    }
    void PopulateExpense()
    {
        expenseString = new List <System.Tuple <string, string> >();
        float total = 0;

        foreach (var rev in expenses)
        {
            total += rev.amount + rev.amountMod;
        }

        //Group expenses by type
        List <System.Tuple <string, float> > expenseGroup = new List <System.Tuple <string, float> >();
        ExpensesData maintenanceExpense = expenses.Find(x => x.type == ExpenseType.Maintenance);
        ExpensesData loanExpense        = expenses.Find(x => x.type == ExpenseType.Loan);

        if (maintenanceExpense != null)
        {
            expenseGroup.Add(System.Tuple.Create("Maintenance", maintenanceExpense.amount + maintenanceExpense.amountMod));
        }
        if (loanExpense != null)
        {
            expenseGroup.Add(System.Tuple.Create("Loans", loanExpense.amount + loanExpense.amountMod));
        }

        expenseString.Add(System.Tuple.Create("Total Expenses", string.Format("${0:N0}", total)));
        for (int i = 1; i < financeReportRows.Length; i++)
        {
            if (i <= expenseGroup.Count)
            {
                expenseString.Add(
                    System.Tuple.Create(string.Format("- {0}", expenseGroup[i - 1].Item1),
                                        string.Format("${0:N0}", expenseGroup[i - 1].Item2)
                                        ));
            }
            else
            {
                expenseString.Add(System.Tuple.Create("", ""));
                financeReportRows[i].label.text = "";
                financeReportRows[i].value.text = "";
            }
        }

        expenseByDeptString = new List <System.Tuple <string, string> >();

        InitializeExpense();
    }
    public static void AddExpense(ExpenseType type, Departments dept, float amt, float amtMod = 0)
    {
        if (GameManager.isInDemoMode)
        {
            return;
        }
        RemoveExpense(type, dept);

        ExpensesData data = new ExpensesData()
        {
            type       = type,
            department = dept,
            amount     = amt,
            amountMod  = amtMod
        };

        instance.expenses.Add(data);
    }
    public static void ModifyExpense(ExpenseType type, Departments dept, float amtMod)
    {
        if (GameManager.isInDemoMode)
        {
            return;
        }
        ExpensesData foundData = instance.expenses.Find(x => x.type == type && x.department == dept);

        if (foundData != null)
        {
            instance.expenses.Remove(foundData);
            instance.expenses.Add(new ExpensesData()
            {
                type       = type,
                department = dept,
                amount     = foundData.amount + amtMod,
                amountMod  = foundData.amountMod
            });
        }
    }
            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();
                ExpensesData ds = new ExpensesData();

                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 = "ExpensesDataTable";
                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);
            }