diff --git a/ExpenseTracker.Android/ExpenseTracker.Android.csproj b/ExpenseTracker.Android/ExpenseTracker.Android.csproj
index 5d0dd06..a51f116 100644
--- a/ExpenseTracker.Android/ExpenseTracker.Android.csproj
+++ b/ExpenseTracker.Android/ExpenseTracker.Android.csproj
@@ -103,7 +103,9 @@
-
+
+
+
{801B6533-97C6-486C-9BF4-050D9B494C9B}
@@ -161,5 +163,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ExpenseTracker.Android/Resources/Resource.designer.cs b/ExpenseTracker.Android/Resources/Resource.designer.cs
index 7a0d610..6f353c6 100644
--- a/ExpenseTracker.Android/Resources/Resource.designer.cs
+++ b/ExpenseTracker.Android/Resources/Resource.designer.cs
@@ -10861,130 +10861,139 @@ namespace ExpenseTracker.Droid
public const int avd_show_password = 2131165276;
// aapt resource value: 0x7F07005D
- public const int bg = 2131165277;
+ public const int background = 2131165277;
// aapt resource value: 0x7F07005E
- public const int Capture2 = 2131165278;
+ public const int bg = 2131165278;
// aapt resource value: 0x7F07005F
- public const int cloudiness = 2131165279;
+ public const int Capture2 = 2131165279;
// aapt resource value: 0x7F070060
- public const int dashboard = 2131165280;
+ public const int cloudiness = 2131165280;
// aapt resource value: 0x7F070061
- public const int design_bottom_navigation_item_background = 2131165281;
+ public const int dashboard = 2131165281;
// aapt resource value: 0x7F070062
- public const int design_fab_background = 2131165282;
+ public const int design_bottom_navigation_item_background = 2131165282;
// aapt resource value: 0x7F070063
- public const int design_ic_visibility = 2131165283;
+ public const int design_fab_background = 2131165283;
// aapt resource value: 0x7F070064
- public const int design_ic_visibility_off = 2131165284;
+ public const int design_ic_visibility = 2131165284;
// aapt resource value: 0x7F070065
- public const int design_password_eye = 2131165285;
+ public const int design_ic_visibility_off = 2131165285;
// aapt resource value: 0x7F070066
- public const int design_snackbar_background = 2131165286;
+ public const int design_password_eye = 2131165286;
// aapt resource value: 0x7F070067
- public const int grid = 2131165287;
+ public const int design_snackbar_background = 2131165287;
// aapt resource value: 0x7F070068
- public const int gridColor = 2131165288;
+ public const int grid = 2131165288;
// aapt resource value: 0x7F070069
- public const int humidity = 2131165289;
+ public const int gridColor = 2131165289;
// aapt resource value: 0x7F07006A
- public const int ic_mtrl_chip_checked_black = 2131165290;
+ public const int humidity = 2131165290;
// aapt resource value: 0x7F07006B
- public const int ic_mtrl_chip_checked_circle = 2131165291;
+ public const int ic_mtrl_chip_checked_black = 2131165291;
// aapt resource value: 0x7F07006C
- public const int ic_mtrl_chip_close_circle = 2131165292;
+ public const int ic_mtrl_chip_checked_circle = 2131165292;
// aapt resource value: 0x7F07006D
- public const int list = 2131165293;
+ public const int ic_mtrl_chip_close_circle = 2131165293;
// aapt resource value: 0x7F07006E
- public const int listColor = 2131165294;
+ public const int list = 2131165294;
// aapt resource value: 0x7F07006F
- public const int menu = 2131165295;
+ public const int listColor = 2131165295;
// aapt resource value: 0x7F070070
- public const int mtrl_snackbar_background = 2131165296;
+ public const int logo = 2131165296;
// aapt resource value: 0x7F070071
- public const int mtrl_tabs_default_indicator = 2131165297;
+ public const int menu = 2131165297;
// aapt resource value: 0x7F070072
- public const int navigation_empty_icon = 2131165298;
+ public const int mtrl_snackbar_background = 2131165298;
// aapt resource value: 0x7F070073
- public const int notification_action_background = 2131165299;
+ public const int mtrl_tabs_default_indicator = 2131165299;
// aapt resource value: 0x7F070074
- public const int notification_bg = 2131165300;
+ public const int navigation_empty_icon = 2131165300;
// aapt resource value: 0x7F070075
- public const int notification_bg_low = 2131165301;
+ public const int notification_action_background = 2131165301;
// aapt resource value: 0x7F070076
- public const int notification_bg_low_normal = 2131165302;
+ public const int notification_bg = 2131165302;
// aapt resource value: 0x7F070077
- public const int notification_bg_low_pressed = 2131165303;
+ public const int notification_bg_low = 2131165303;
// aapt resource value: 0x7F070078
- public const int notification_bg_normal = 2131165304;
+ public const int notification_bg_low_normal = 2131165304;
// aapt resource value: 0x7F070079
- public const int notification_bg_normal_pressed = 2131165305;
+ public const int notification_bg_low_pressed = 2131165305;
// aapt resource value: 0x7F07007A
- public const int notification_icon_background = 2131165306;
+ public const int notification_bg_normal = 2131165306;
// aapt resource value: 0x7F07007B
- public const int notification_template_icon_bg = 2131165307;
+ public const int notification_bg_normal_pressed = 2131165307;
// aapt resource value: 0x7F07007C
- public const int notification_template_icon_low_bg = 2131165308;
+ public const int notification_icon_background = 2131165308;
// aapt resource value: 0x7F07007D
- public const int notification_tile_bg = 2131165309;
+ public const int notification_template_icon_bg = 2131165309;
// aapt resource value: 0x7F07007E
- public const int notify_panel_notification_icon_bg = 2131165310;
+ public const int notification_template_icon_low_bg = 2131165310;
// aapt resource value: 0x7F07007F
- public const int overlay = 2131165311;
+ public const int notification_tile_bg = 2131165311;
// aapt resource value: 0x7F070080
- public const int place = 2131165312;
+ public const int notify_panel_notification_icon_bg = 2131165312;
// aapt resource value: 0x7F070081
- public const int pressure = 2131165313;
+ public const int overlay = 2131165313;
// aapt resource value: 0x7F070082
- public const int settings = 2131165314;
+ public const int place = 2131165314;
// aapt resource value: 0x7F070083
- public const int tooltip_frame_dark = 2131165315;
+ public const int pressure = 2131165315;
// aapt resource value: 0x7F070084
- public const int tooltip_frame_light = 2131165316;
+ public const int profile = 2131165316;
// aapt resource value: 0x7F070085
- public const int weather = 2131165317;
+ public const int settings = 2131165317;
// aapt resource value: 0x7F070086
- public const int wind = 2131165318;
+ public const int tooltip_frame_dark = 2131165318;
+
+ // aapt resource value: 0x7F070087
+ public const int tooltip_frame_light = 2131165319;
+
+ // aapt resource value: 0x7F070088
+ public const int weather = 2131165320;
+
+ // aapt resource value: 0x7F070089
+ public const int wind = 2131165321;
static Drawable()
{
diff --git a/ExpenseTracker.Android/Resources/drawable/background.jpg b/ExpenseTracker.Android/Resources/drawable/background.jpg
new file mode 100644
index 0000000..4fde29f
Binary files /dev/null and b/ExpenseTracker.Android/Resources/drawable/background.jpg differ
diff --git a/ExpenseTracker.Android/Resources/drawable/logo.png b/ExpenseTracker.Android/Resources/drawable/logo.png
new file mode 100644
index 0000000..7db8ad0
Binary files /dev/null and b/ExpenseTracker.Android/Resources/drawable/logo.png differ
diff --git a/ExpenseTracker.Android/Resources/drawable/profile.jpg b/ExpenseTracker.Android/Resources/drawable/profile.jpg
new file mode 100644
index 0000000..16881af
Binary files /dev/null and b/ExpenseTracker.Android/Resources/drawable/profile.jpg differ
diff --git a/ExpenseTracker/App.xaml.cs b/ExpenseTracker/App.xaml.cs
index 765b6e8..8990e65 100644
--- a/ExpenseTracker/App.xaml.cs
+++ b/ExpenseTracker/App.xaml.cs
@@ -13,7 +13,7 @@ namespace ExpenseTracker
{
InitializeComponent();
-
+
/*if (!string.IsNullOrEmpty(Preferences.Get("MyFirebaseRefreshToken", "")))
{
MainPage = new NavigationPage(new Home());
@@ -22,9 +22,9 @@ namespace ExpenseTracker
{
MainPage = new NavigationPage(new LoginPage());
}*/
- // MainPage = new NavigationPage(new LoginPage());
-
- MainPage = new HomePage();
+ // MainPage = new NavigationPage(new LoginPage());
+ MainPage = new NavigationPage(new LoginPage());
+ // MainPage = new HomePage();
//MainPage = Navigat new LoginPage();
//MainPage = new MainPage();
}
diff --git a/ExpenseTracker/model/Constants.cs b/ExpenseTracker/model/Constants.cs
index 6b35b30..ff6876f 100644
--- a/ExpenseTracker/model/Constants.cs
+++ b/ExpenseTracker/model/Constants.cs
@@ -4,6 +4,7 @@ using System.Text;
namespace ExpenseTracker.model
{
+ //this class contains constant elements that will be used throughout the app
public class Constants
{
public static string WebAPIkey = "AIzaSyDWd1vZS-n3PIIyP004w9l4DLPNUr5uEBE";
diff --git a/ExpenseTracker/model/ExpenseCategory.cs b/ExpenseTracker/model/ExpenseCategory.cs
index c21ad25..209107a 100644
--- a/ExpenseTracker/model/ExpenseCategory.cs
+++ b/ExpenseTracker/model/ExpenseCategory.cs
@@ -4,9 +4,11 @@ using System.Text;
namespace ExpenseTracker.model
{
+ //this model describes the type of data to be taken for each expense category
public class ExpenseCategory
{
public int id { get; set; }
public string name { get; set; }
+ public string email { get; set; }
}
}
diff --git a/ExpenseTracker/model/expense.cs b/ExpenseTracker/model/expense.cs
index a53f732..12e26f8 100644
--- a/ExpenseTracker/model/expense.cs
+++ b/ExpenseTracker/model/expense.cs
@@ -4,12 +4,14 @@ using System.Text;
namespace ExpenseTracker.model
{
+ //describes the type of data to be taken for expenses per user
class Expense
{
public int expenseCategory { get; set; }
public string id { get; set; }
public double amount { get; set; }
+ public string email { get; set; }
public string narration { get; set; }
-
+
}
}
diff --git a/ExpenseTracker/viewModel/FirebaseHelper.cs b/ExpenseTracker/viewModel/FirebaseHelper.cs
index 4230147..458e27f 100644
--- a/ExpenseTracker/viewModel/FirebaseHelper.cs
+++ b/ExpenseTracker/viewModel/FirebaseHelper.cs
@@ -15,23 +15,24 @@ namespace ExpenseTracker.viewModel
FirebaseClient firebase = new FirebaseClient("https://expensetracker-cdaa4.firebaseio.com");
//get all Expenses
- public async Task> GetAllExpense()
+ public async Task> GetAllExpense(String usermail)
{
return (await firebase
.Child("Expenses")
- .OnceAsync()).Select(item => new Expense
+ .OnceAsync()).Where(a=>a.Object.email==usermail).Select(item => new Expense
{
expenseCategory = item.Object.expenseCategory,
narration = item.Object.narration,
amount=item.Object.amount,
id=item.Object.id,
+ email=item.Object.email,
}).Reverse().ToList();
}
//all New Expense
- public async Task AddExpense(double amount, string narration, int expenseCategory, string id)
+ public async Task AddExpense(double amount, string narration, int expenseCategory, string id, String email)
{
await firebase
@@ -39,22 +40,23 @@ namespace ExpenseTracker.viewModel
.PostAsync(new Expense() {
amount = amount,
expenseCategory= expenseCategory,
- narration = narration,
+ narration= narration,
id= id,
+ email=email,
});
}
//get Details of a particular expense
- public async Task GetExpense(string expenseID)
+ public async Task GetExpense(string expenseID, String email)
{
- var allExpense = await GetAllExpense();
+ var allExpense = await GetAllExpense(email);
await firebase
.Child("Expenses")
.OnceAsync();
return allExpense.Where(a => a.id == expenseID).FirstOrDefault();
}
- //Update and Expense
+ //Update an Expense
public async Task UpdateExpense(double amount, string narration, int expenseCategory, string id)
{
var toUpdatePerson = (await firebase
@@ -88,12 +90,12 @@ namespace ExpenseTracker.viewModel
//get all categories
- public async Task> GetAllCategory()
+ public async Task> GetAllCategory(String useremail)
{
return (await firebase
.Child("Category")
- .OnceAsync()).Select(item => new ExpenseCategory
+ .OnceAsync()).Where(a => a.Object.email == useremail).Select(item => new ExpenseCategory
{
id = item.Object.id,
name= item.Object.name,
@@ -101,7 +103,7 @@ namespace ExpenseTracker.viewModel
}).ToList();
}
//add new category
- public async Task AddCategory(int id, string name)
+ public async Task AddCategory(int id, string name, string email)
{
await firebase
@@ -111,12 +113,13 @@ namespace ExpenseTracker.viewModel
name=name,
id = id,
+ email= email
});
}
//get a new category
- public async Task GetCategory(int categoryID)
+ public async Task GetCategory(int categoryID, string email)
{
- var allExpense = await GetAllCategory();
+ var allExpense = await GetAllCategory(email);
await firebase
.Child("Category")
.OnceAsync();
@@ -153,10 +156,10 @@ namespace ExpenseTracker.viewModel
//getting total amount of expenses
- public async Task GetTotalAmountOfExpense()
+ public async Task GetTotalAmountOfExpense(string email)
{
double totalAmount=0.0;
- var allExpense = await GetAllExpense();
+ var allExpense = await GetAllExpense(email);
for (int i= 0; i< allExpense.Count;i++)
{
totalAmount += allExpense[i].amount;
@@ -168,11 +171,11 @@ namespace ExpenseTracker.viewModel
//get total amount spent on each category
- public async Task> GetTotalAmountOfExpensePerCategory()
+ public async Task> GetTotalAmountOfExpensePerCategory(string email)
{
List categoryAmount = new List();
- var allCategories = await GetAllCategory();
- var allExpense = await GetAllExpense();
+ var allCategories = await GetAllCategory(email);
+ var allExpense = await GetAllExpense(email);
foreach (var category in allCategories) // Outer loop
{
// Code that should run for each collection
diff --git a/ExpenseTracker/views/auth/LoginPage.xaml b/ExpenseTracker/views/auth/LoginPage.xaml
index 170d57a..1bde808 100644
--- a/ExpenseTracker/views/auth/LoginPage.xaml
+++ b/ExpenseTracker/views/auth/LoginPage.xaml
@@ -6,19 +6,29 @@
>
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/ExpenseTracker/views/pages/ExpensePage.xaml.cs b/ExpenseTracker/views/pages/ExpensePage.xaml.cs
index e5c24a9..becdd44 100644
--- a/ExpenseTracker/views/pages/ExpensePage.xaml.cs
+++ b/ExpenseTracker/views/pages/ExpensePage.xaml.cs
@@ -12,24 +12,25 @@ namespace ExpenseTracker.views.pages
public partial class ExpensePage : ContentPage
{
FirebaseHelper firebaseHelper = new FirebaseHelper();
- public ExpensePage()
+ string useremail;
+ public ExpensePage(string email)
{
InitializeComponent();
-
+ useremail = email;
}
protected async override void OnAppearing()
{
base.OnAppearing();
- CategoryEntry.ItemsSource = await firebaseHelper.GetAllCategory();
- AllExpense.ItemsSource = await firebaseHelper.GetAllExpense();
+
+ AllExpense.ItemsSource = await firebaseHelper.GetAllExpense(useremail);
}
//buttong to open the AddExpense popup
private void btnPopupAddExpense(object sender, EventArgs e)
{
- PopupNavigation.Instance.PushAsync(new ExpensePopUp());
+ PopupNavigation.Instance.PushAsync(new ExpensePopUp(useremail));
// PopupNavigation.PushAsync(new PopupExpense());
}
/* private async void BtnAddExpense(object sender, EventArgs e)
diff --git a/ExpenseTracker/views/popUps/CategoryPopUp.xaml b/ExpenseTracker/views/popUps/CategoryPopUp.xaml
index 0ba2991..1bef042 100644
--- a/ExpenseTracker/views/popUps/CategoryPopUp.xaml
+++ b/ExpenseTracker/views/popUps/CategoryPopUp.xaml
@@ -9,7 +9,9 @@
-
+
\ No newline at end of file
diff --git a/ExpenseTracker/views/popUps/CategoryPopUp.xaml.cs b/ExpenseTracker/views/popUps/CategoryPopUp.xaml.cs
index 1758fb2..2773e54 100644
--- a/ExpenseTracker/views/popUps/CategoryPopUp.xaml.cs
+++ b/ExpenseTracker/views/popUps/CategoryPopUp.xaml.cs
@@ -1,4 +1,6 @@
using ExpenseTracker.viewModel;
+using ExpenseTracker.views.home;
+using Rg.Plugins.Popup.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -15,9 +17,11 @@ namespace ExpenseTracker.views.popUps
{
FirebaseHelper firebaseHelper = new FirebaseHelper();
- public CategoryPopUp()
+ string useremail;
+ public CategoryPopUp(string email)
{
InitializeComponent();
+ useremail = email;
}
//button to add a category
private async void BtnAddCategory(object sender, EventArgs e)
@@ -36,9 +40,11 @@ namespace ExpenseTracker.views.popUps
int randomumber = generator.Next(100000, 999999);
//add new category
- await firebaseHelper.AddCategory(randomumber, name.Text);
+ await firebaseHelper.AddCategory(randomumber, name.Text, useremail);
name.Text = string.Empty;
+ await Navigation.PushAsync(new HomePage(useremail));
+ PopupNavigation.Instance.PopAsync(true);
await DisplayAlert("Success", "Category Added Successfully", "OK");
}
diff --git a/ExpenseTracker/views/popUps/ExpensePopUp.xaml b/ExpenseTracker/views/popUps/ExpensePopUp.xaml
index d66ff9d..44f1c50 100644
--- a/ExpenseTracker/views/popUps/ExpensePopUp.xaml
+++ b/ExpenseTracker/views/popUps/ExpensePopUp.xaml
@@ -4,7 +4,7 @@
x:Class="ExpenseTracker.views.popUps.ExpensePopUp"
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup" >
-
+
@@ -14,7 +14,9 @@
x:Name="CategoryEntry" Title="Select Category">
-
+
diff --git a/ExpenseTracker/views/popUps/ExpensePopUp.xaml.cs b/ExpenseTracker/views/popUps/ExpensePopUp.xaml.cs
index b6ac6ef..c6cac83 100644
--- a/ExpenseTracker/views/popUps/ExpensePopUp.xaml.cs
+++ b/ExpenseTracker/views/popUps/ExpensePopUp.xaml.cs
@@ -1,5 +1,6 @@
using ExpenseTracker.model;
using ExpenseTracker.viewModel;
+using ExpenseTracker.views.home;
using Rg.Plugins.Popup.Services;
using System;
using System.Collections.Generic;
@@ -16,9 +17,11 @@ namespace ExpenseTracker.views.popUps
public partial class ExpensePopUp
{
FirebaseHelper firebaseHelper = new FirebaseHelper();
- public ExpensePopUp()
+ string useremail;
+ public ExpensePopUp(string email)
{
InitializeComponent();
+ useremail = email;
}
protected async override void OnAppearing()
{
@@ -27,46 +30,49 @@ namespace ExpenseTracker.views.popUps
var currentTime = DateTime.Now.ToString("dd-MMMM-yyyy");
// when pages loads fresh, get all expenses
- CategoryEntry.ItemsSource = await firebaseHelper.GetAllCategory();
+ CategoryEntry.ItemsSource = await firebaseHelper.GetAllCategory(useremail);
}
// Button to add an expense
private async void BtnAddExpense(object sender, EventArgs e)
{
+
//validation
if (amt.Text==null)
{
- CategoryError.IsVisible = true;
+ AmountError.IsVisible = true;
AmountError.Text = "Please Enter Amount";
}
else if (narration.Text == null)
{
- CategoryError.IsVisible = true;
-
+ AmountError.IsVisible = false;
+ NarationError.IsVisible = true;
NarationError.Text = "Please Enter Naration";
}
- else if (CategoryEntry == null)
+ /* else if (CategoryEntry.SelectedItem==null)
{
+ AmountError.IsVisible = false;
+ NarationError.IsVisible = false;
CategoryError.IsVisible = true;
-
CategoryError.Text = "Please Choose a Category";
- }
+ }*/
else {
//getting id from the selected category
- var categoryId= ((ExpenseCategory)CategoryEntry.SelectedItem).id;
+ var categoryId = ((ExpenseCategory)CategoryEntry.SelectedItem).id;
//generate random ID for each expense
Random generator = new Random();
String randomumber = generator.Next(100000, 999999).ToString();
// call function to add Expense
- await firebaseHelper.AddExpense(Convert.ToDouble(amt.Text), narration.Text, categoryId, randomumber);
+ await firebaseHelper.AddExpense(Convert.ToDouble(amt.Text), narration.Text, categoryId, randomumber, useremail);
amt.Text = string.Empty;
narration.Text = string.Empty;
- var allExpenses = await firebaseHelper.GetAllExpense();
- PopupNavigation.Instance.PopAsync(true);
- await DisplayAlert("Success", "Expense Added Successfully", "OK");
+ var allExpenses = await firebaseHelper.GetAllExpense(useremail);
+ PopupNavigation.Instance.PopAsync(true);
+ await Navigation.PushAsync(new HomePage(useremail));
+ await DisplayAlert("Success", "Expense Added Successfully", "OK");
}
}