Пример #1
0
		public TransactionSearch(string curDB)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//string dbSource = "DataSource="+curDB;
			DBConnection = new db(curDB);
			
			commandValue = "Select Category from BudgetInfo;";
            DBConnection.ExecuteQuery(commandValue);
            
            while (DBConnection.QueryStep())
            {
            	CategoryList.Add(DBConnection.QueryReturnString(0));
            }
            SearchSelectCombo.Items.AddRange(CategoryList.ToArray());
            SearchSelectCombo.SelectedIndex = 0;
            
            MonthSelectCombo.SelectedIndex = 0;
            
            commandValue = "Select Month,Date,Description,Amount from Transactions where category=";
            commandValue += SearchSelectCombo.SelectedIndex.ToString();
			DBConnection.ExecuteQuery(commandValue);

             while (DBConnection.QueryStep())
            {
             	float SpentAmount = DBConnection.QueryReturnFloat(3) * -1.0f;
             	float Month = DBConnection.QueryReturnInt(0) + 1;
             	string Info = Month.ToString() + "/" + DBConnection.QueryReturnInt(1).ToString();
             	Info += " - $" + SpentAmount.ToString() + " for " + DBConnection.QueryReturnString(2);
             	listBox1.Items.Add(Info);
            }   
            commandValue = "Select Month,Description,Amount from AmazonTransactions where category=";
            commandValue += SearchSelectCombo.SelectedIndex.ToString();
			DBConnection.ExecuteQuery(commandValue);

             while (DBConnection.QueryStep())
            {
             	float SpentAmount = DBConnection.QueryReturnFloat(2);
             	float Month = DBConnection.QueryReturnInt(0) + 1;
             	string Info = Month.ToString();
             	Info += " - $" + SpentAmount.ToString() + " for " + DBConnection.QueryReturnString(1);
             	listBox2.Items.Add(Info);
            }              
		}
Пример #2
0
		public void SetTransactions(db DBConnection, string commandValue)
		{
            DBConnection.ExecuteQuery(commandValue);
            
            while (DBConnection.QueryStep())
            {
                addedTrans = new Transaction();
                addedTrans.date = DBConnection.QueryReturnInt(0);
                addedTrans.type = DBConnection.QueryReturnInt(2);
                addedTrans.amount = DBConnection.QueryReturnFloat(3);
                addedTrans.verified = DBConnection.QueryReturnBool(4);
                addedTrans.description = DBConnection.QueryReturnString(1);
                //dbListNum = System.Convert.ToInt32(reader[5]);
                dbTransList.Add(DBConnection.QueryReturnInt(5),addedTrans);
                dbListNum++;
            }
		}
Пример #3
0
        public Graphs(List<string> items, Budget BudgetVals, int curMonth,string curDB)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			// 
			InitializeComponent();
			
			//string dbSource = "DataSource="+curDB;
			DBConnection = new db(curDB);
			
			commandValue = "Select Category,ShowChart from BudgetInfo;";
            DBConnection.ExecuteQuery(commandValue);
            
            while (DBConnection.QueryStep())
            {
            	if (System.Convert.ToBoolean(DBConnection.QueryReturnInt(1)))
            	{
            		budgetItemList.Add(DBConnection.QueryReturnString(0));
            	}
            }
						
			dbSelectCombo.Items.AddRange(budgetItemList.ToArray());
			dbSelectCombo.SelectedIndex = 8;
					
			BudgetInfo = BudgetVals;
			//budgetItemList = items;
			month = curMonth+1;
			
			//
        	for (int i = 0; i < 12; i++)
        	{
        		Months.Add(monthValsAbbr[i]);
        	}
        	
        	commandValue = "select Amount from BudgetInfo where DatabaseIndex=0";
        	//commandValue += category.ToString();
        	targetValue = DBConnection.ReturnTotals(commandValue);
        	
        	UpdateChart(8);
		}
Пример #4
0
	    public void InitializeBudgetInfo(db database)
	    {
	    	string queryString = "select * from budgetInfo order by DatabaseIndex";
	    	database.ExecuteQuery(queryString);
	    	
	    	while (database.QueryStep())
	    	{
	    		budgetCategories.Add(database.QueryReturnString(1));
	    		budgetedAmount.Add(database.QueryReturnFloat(2));
	    		if (database.QueryReturnBool(3))
	    		{
	    			budgetVerIndex.Add(database.QueryReturnInt(0)-1);
		    		verificationString.Add(database.QueryReturnString(1));
		    		verificationPerYear.Add(database.QueryReturnInt(4));
		    		verificationDate.Add(database.QueryReturnInt(5));
		    		monthStart.Add(database.QueryReturnInt(6));
		    		transactionVerificationIndex.Add(totalVerifications);
		    		totalVerifications++;
	    		}
	    		else
	    		{
	    			budgetVerIndex.Add(-1);
		    		verificationString.Add("");
		    		verificationPerYear.Add(-1);
		    		verificationDate.Add(-1);
		    		monthStart.Add(-1);
		    		transactionVerificationIndex.Add(-1);	    			
	    		}
	    		budgetIndexer.Add(database.QueryReturnInt(7));
	    		layoutIndexer.Add(database.QueryReturnInt(8));
	    		yearlyColumn.Add(database.QueryReturnBool(9));
	    		showBudget.Add(database.QueryReturnBool(10));
	    		inputColumn.Add(database.QueryReturnBool(11));
	    		numBudget++;
	    	}
	    }
Пример #5
0
        public MainForm()
        {
            //Startup tester = new Startup();
            
            StartPath = Application.StartupPath + System.IO.Path.DirectorySeparatorChar;
            FindCurrentMonth(); 
            
            dbPath = currentYear.ToString() + "Tomo.d";
            string path = StartPath + currentYear.ToString() + System.IO.Path.DirectorySeparatorChar + monthVals[currentMonth] + ".csv";
            dbPath = "Data Source=" + dbPath;// StartPath + currentYear.ToString() + "Tomo.d";
            DBConnection = new db(dbPath);
            
            
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //      
            
            InitializeComponent();
            
			this.tabControl1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.Panel1_MouseWheel);

			AddToBudgetLayout();
     
			AddBillVerifyCheckboxes();
            
			ReadInitFiles(currentMonth,true);
			foreach (string value in BudgetInfo.budgetCategories)
			{
				budgetItemList.Add(value);
			}
			budgetItemList.Sort();
            FillLayout();
            AddMenusYears(StartPath);
            
          
        }