public ActionResult ExpenseDetailReport(int clientNo, int ProjectNo) { IEnumerable <ExpenseDetail> expenseDetailList = null; try { ExpenseManager expenseManager = new ExpenseManager(); expenseDetailList = expenseManager.ExpenseDetailReport(clientNo, ProjectNo); if (expenseDetailList.Count() > 0) { var jsonResultS = this.Json(expenseDetailList, JsonRequestBehavior.AllowGet); jsonResultS.MaxJsonLength = int.MaxValue; return(jsonResultS); } else { var result = new { Success = "True", Message = "No Data Found" }; return(Json(result, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { string sMessage = ex.Message; var result = new { Success = "False", Message = "Exception: " + sMessage }; return(Json(result, JsonRequestBehavior.AllowGet)); } }
public GenerateBillController() { mealManager = new MealManager(); expenseManager = new ExpenseManager(); studentManager = new StudentManager(); paymentManager = new PaymentManager(); }
public ActionResult Create(ExpenseSummary expenseSummary) { try { try { ExpenseManager expenseManager = new ExpenseManager(); expenseSummary.EmpID = Convert.ToInt32(Session["UserID"]); int value = expenseManager.CreateExpense(expenseSummary); if (value == 1) { TempData["Message"] = "Expense Created Successfully"; } else if (value == 0) { TempData["Message"] = "Error Occured"; } return(Redirect("~/Expense/Index")); } catch (Exception ex) { return(View()); } } catch { return(View()); } }
public HttpResponseMessage CreateExpense(Expenses expense_requests) { ExpenseManager expenseManager = new ExpenseManager(); cls_common_responses clsCommonResponses = new cls_common_responses(); if (expense_requests == null) { clsCommonResponses.ResponseCode = 400; clsCommonResponses.ResponseMessage = ""; return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses)); } HttpResponseMessage response; try { expense_requests.CreatedBy = new int?(1); expense_requests.CreatedDate = new DateTime?(DateTime.Now); cls_common_responses expenses = expenseManager.CreateExpenses("Proc_Expense_Save", expense_requests); int responseCode = expenses.ResponseCode; response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, expenses); } catch (Exception ex) { clsCommonResponses.ResponseCode = 400; clsCommonResponses.ResponseMessage = "Something went wrong, please try again later."; response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses); } return(response); }
public ExpenseDetailsController() { mealManager = new MealManager(); expenseManager = new ExpenseManager(); studentManager = new StudentManager(); paymentManager = new PaymentManager(); }
private void LoadData() { using (var db = new ExpenseManager()) { expenses = db.GetSomeItems(startDate, endDate, selectedCatName); } }
private object PurgeAll(DateTime deleteDate, BackgroundWorker worker, DoWorkEventArgs e) { (new CommonManager()).BeginBatchOperation(); TransactionManager tm = new TransactionManager(); //get a list of all customers List <Customer> customers = (new CustomerManager()).GetAllCustomers(); foreach (Customer customer in customers) { if (worker.CancellationPending) { e.Cancel = true; } else { worker.ReportProgress((int)((double)customers.IndexOf(customer) / (double)customers.Count * 100.0), "Deleting Sale/Purchase data of " + customer.Name); tm.DeleteAllTransactionsBefore(customer.ID, deleteDate, true); } } //now delete expenses till the date.. ExpenseManager em = new ExpenseManager(); List <Expense> expenses = em.GetExpenses(new DateTime(1900, 1, 1), deleteDate); foreach (Expense expense in expenses) { em.DeleteExpenseById(expense.ID); worker.ReportProgress((int)((double)expenses.IndexOf(expense) / (double)expenses.Count * 100.0), "Deleting Expense Data of " + expense.TimeStamp.ToShortDateString()); } (new CommonManager()).ConfirmBatchOperation(); return(null); }
public ActionResult Report(int?year, int?month) { int status = 0; #region MonthList ViewBag.Months ViewBag.Months = new SelectList(Enumerable.Range(1, 12).Select(x => new SelectListItem() { Text = CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedMonthNames[x - 1], Value = x.ToString() }), "Value", "Text"); #endregion #region YearList ViewBag.Years List <int> years = new List <int>(); for (int i = DateTime.Today.Year; i >= 2000; i--) { years.Add(i); } ViewBag.Years = years; #endregion if (year != null && month != null) { status = 1; List <ExpenseMonthlyViewModel> expenses = ExpenseManager.LoadExpenseMonthly((int)year, (int)month); if (expenses.Count > 0) { ViewBag.ExpenseMonthlyList = expenses; ViewBag.Records = expenses.Count(); status = 2; } } ViewBag.Status = status; return(View()); }
public BaseInfoApplicationService(string connectionString) { _tableGatewayFactory = new SqlTableGatewayFactory(connectionString); _buildingManager = new BuildingManager(_tableGatewayFactory); _expenseManager = new ExpenseManager(_tableGatewayFactory); _personManager = new PersonManager(_tableGatewayFactory); }
public List <Transaction> MakeTransactionListByTotalMealOrderAndMonth(List <Order> listOfOrder, int operatedByUserId, int month, int year) { List <Transaction> listOfTransaction = new List <Transaction>(); DateTime currentTime = BdTime.GetCurrentDate(); ExpenseManager expenseManager = new ExpenseManager(); double currentMealPrice = expenseManager.GetAverageMealPriceOfMonth(month, year); foreach (Order order in listOfOrder) { Transaction newTransaction = new Transaction(); newTransaction.OperatedByUserId = operatedByUserId; newTransaction.OperatedToUserId = order.UserId; newTransaction.Amount = currentMealPrice * (order.Meal1 + order.Meal2 + order.Meal3); newTransaction.Date = currentTime.ToString("yyyy-MM-dd"); newTransaction.Time = currentTime.ToString("mm:hh ttt"); newTransaction.TransactionType = Transaction.remove; listOfTransaction.Add(newTransaction); } return(listOfTransaction); }
private async void SaveButton_Clicked(object sender, EventArgs e) { float amount; int month; try { amount = float.Parse(BudgetAmount.Text); var m = MonthPicker.Date; month = m.Month; } catch { amount = 0; month = DateTime.Now.Month; } var fileName = ""; Month updatedMonth = (Month)month; if (budget != null && budget.MonthInYear == updatedMonth) { fileName = budget.FileName; } //converting the enum value to enum Budget b = new Budget(amount, (Month)month) { FileName = fileName }; ExpenseManager.SaveBudget(b); await Navigation.PushModalAsync(new MainPage { BindingContext = null }); }
//The event handler for the Save Button currently writes the values of the page to Output private async void SaveButtonClicked(object sender, EventArgs e) { var expenseName = Description.Text; var expenseDate = ExpenseDate.Date; var expenseAmount = float.Parse(ExpenseAmount.Text); var category = (string)picker.SelectedItem; Enum.TryParse(category, out ExpenseCategory myCategory); //here we did binding context, to edit the values of the expense if (BindingContext != null) { var expense = (Expense)BindingContext; expense.ExpenseName = expenseName; expense.Date = File.GetCreationTime(expense.FileName); expense.Category = myCategory; expense.Amount = expenseAmount; ExpenseManager.SaveExpense(expense); } //if binding context is null then, //Creating a new instance of currentExpense else { Expense currentExpense = new Expense(expenseName, expenseAmount, expenseDate, myCategory); ExpenseManager.SaveExpense(currentExpense); } await Navigation.PopModalAsync(); }
public ActionResult Entry(ExpenseViewModel expense) { ExpenseModel data = new ExpenseModel(); #region Income Model data maping data.Amount = expense.Amount; data.BankId = expense.BankId; data.Date = expense.Date; data.Particular = expense.Particular; data.ChequeNo = expense.ChequeNo; if (expense.isCash == 1) { data.Cash = true; } else { data.Cheque = true; } #endregion bool isSaved = ExpenseManager.SaveExpense(data); if (isSaved) { ViewBag.Message = "Expense Saved"; } ViewBag.BankList = BankManager.LoadBank(); return(View()); }
public ActionResult AllExpenseOfMonth() { ExpenseManager expenseManager = new ExpenseManager(); DateTime currentTime = BdTime.GetCurrentDate(); ViewBag.AllExpenseOfMonth = expenseManager.GetListOfAllExpenseOfMonth(currentTime.Month, currentTime.Year); return(View()); }
public ActionResult Upload(int id) { ExpenseManager expenseManager = new ExpenseManager(); ViewBag.ExpenseSummaryName = expenseManager.GetExpenseSummaryName(id); ViewBag.ExpenseSummaryID = id; ViewBag.Category = new SelectList(expenseManager.GetExpenseCategory(), "ID", "Name"); return(View()); }
public ActionResult Info() { ExpenseManager expenseManager = new ExpenseManager(); DateTime currentTime = BdTime.GetCurrentDate(); double averageMealPriceOfMonth = expenseManager.GetAverageMealPriceOfMonth(currentTime.Month, currentTime.Year); ViewBag.averageMealPriceOfMonth = Math.Round(averageMealPriceOfMonth, 3, MidpointRounding.ToEven); return(View()); }
// POST: api/Expense public bool Post([FromBody] Expense value) { if (value.Amount > 0) { ExpenseManager.CreateExpense(value); return(true); } else { return(false); } }
public ActionResult Detail(int id) { TempData["Message"] = null; ExpenseDetail obj = new ExpenseDetail(); obj.HasBill = true; ExpenseManager expenseManager = new ExpenseManager(); ViewBag.ExpenseSummaryName = expenseManager.GetExpenseSummaryName(id); ViewBag.ExpenseSummaryID = id; ViewBag.Category = new SelectList(expenseManager.GetExpenseCategory(), "ID", "Name"); return(View(obj)); }
public ActionResult Index(double amount) { ExpenseManager expenseManager = new ExpenseManager(); User currentUser = SetSession.GetCurrentUser(); Expense currentExpense = new Expense(); currentExpense.UserId = currentUser.Id; currentExpense.Amount = amount; ViewBag.msg = expenseManager.AddDailyExpenses(currentExpense); return(View()); }
private void Spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { var mySpinner = (Spinner)sender; string selectedCatName = string.Format("{0}", mySpinner.GetItemAtPosition(e.Position)); using (var db = new ExpenseManager()) { catSum = db.GetSomeItems(startDate, endDate, selectedCatName) .Sum(a => a.Amount); } catTV.Text = catSum.ToString(); }
//The event handler for the Save Button currently writes the values of the page to Output private async void SaveButtonClicked(object sender, EventArgs e) { var expenseName = Description.Text; var expenseDate = ExpenseDate.Date; var expenseAmount = float.Parse(ExpenseAmount.Text); var category = (string)picker.SelectedItem; Enum.TryParse(category, out ExpenseCategory myCategory); //Creating a new instance of currentExpense Expense currentExpense = new Expense(expenseName, expenseAmount, expenseDate, myCategory); ExpenseManager.SaveExpense(currentExpense); await Navigation.PopModalAsync(); }
public ActionResult Approve(FormCollection Id) { #region Getting Selected Id List <int> approvedIds = new List <int>(); var arr = Id["Id"].ToString().Split(','); foreach (string id in arr) { approvedIds.Add(Convert.ToInt32(id)); } #endregion bool isUpdated = ExpenseManager.UpdateApprovedExpense(approvedIds); return(RedirectToAction("Approve", "Expense")); }
// GET: Expense/Delete/5 public ActionResult Delete(int id) { try { TempData["Message"] = null; // TODO: Add update logic here ExpenseManager clientManager = new ExpenseManager(); clientManager.DeleteExpenseDetail(id); return(RedirectToAction("/Index")); } catch { return(View()); } }
static void Main(string[] args) { UserManager userManager = new UserManager(); userManager.GenerateData(); ExpenseManager expenseManager = new ExpenseManager(); expenseManager.GenerateTestData(); RaportManager raportManager = new RaportManager(); raportManager.Execute(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var builder = new AlertDialog.Builder(Activity); var inflater = Activity.LayoutInflater; var dialogView = inflater.Inflate(Resource.Layout.ExpenseDetailsView, null); if (dialogView != null) { editDate = dialogView.FindViewById <EditText>(Resource.Id.editExpenseDateDialog); editAmount = dialogView.FindViewById <EditText>(Resource.Id.editExpenseAmountDialog); editDetails = dialogView.FindViewById <EditText>(Resource.Id.editExpenseDetailsDialog); catText = dialogView.FindViewById <TextView>(Resource.Id.textView145); spinner = dialogView.FindViewById <Spinner>(Resource.Id.spinnerExpenseEdit); changeCatBtn = dialogView.FindViewById <Button>(Resource.Id.btnExpenseEdit); using (var db = new ExpenseManager()) { expense = db.GetItemWithChildren(id); } editDate.Text = expense.Date.ToShortDateString(); editAmount.Text = expense.Amount.ToString(); editDetails.Text = expense.Details; catText.Text = expense.Category.Name; editDate.KeyPress += EditDate_KeyPress; editAmount.KeyPress += EditAmount_KeyPress; editDetails.KeyPress += EditDetails_KeyPress; changeCatBtn.Click += ChangeCatBtn_Click; LoadSpinnerData(); spinner.ItemSelected += Spinner_ItemSelected; builder.SetView(dialogView); builder.SetPositiveButton("Zapisz zmiany", HandlePositiveButtonClick); builder.SetNeutralButton("Wróć", HandleNeutralButtonClick); builder.SetNegativeButton("Usuń", HandleNegativeButtonClick); } var dialog = builder.Create(); return(dialog); }
private void ExpenseMenu(MenuActionService actionService) { ExpenseRepository expenseRepository = new ExpenseRepository(); ExpenseService expenseService = new ExpenseService(expenseRepository); ExpenseManager expenseManager = new ExpenseManager(actionService, expenseService); bool isExpenseMenuActive = true; while (isExpenseMenuActive) { int operation = expenseManager.ShowExpenseMenu(); switch (operation) { case 1: var createdId = expenseManager.ShowAddNewExpense(); break; case 2: System.Console.WriteLine(); System.Console.WriteLine("Wpisz id wydatku, który chcesz zobaczyć."); System.Console.WriteLine(); int idToView; string readedIdToView = Console.ReadLine(); Int32.TryParse(readedIdToView, out idToView); expenseManager.ShowGetExpenseById(idToView); break; case 3: expenseManager.ShowAllExpenses(); break; case 4: System.Console.WriteLine(); System.Console.WriteLine("Wpisz id wydatku, który chcesz usunąć."); System.Console.WriteLine(); int idToRemove; string readedIdToRemove = Console.ReadLine(); Int32.TryParse(readedIdToRemove, out idToRemove); var removedId = expenseManager.ShowRemoveExpenseById(idToRemove); break; default: isExpenseMenuActive = false; break; } } }
public HttpResponseMessage GetExpenses() { ExpenseManager expenseManager = new ExpenseManager(); cls_user_responses clsUserResponses = new cls_user_responses(); HttpResponseMessage response; try { response = this.Request.CreateResponse <List <Expenses> >(HttpStatusCode.OK, expenseManager.GetExpenses()); } catch (Exception ex) { response = this.Request.CreateResponse <cls_user_responses>(HttpStatusCode.OK, clsUserResponses); } return(response); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate( Resource.Layout.ShowReportView, container, false); var context = this.Activity; monthsSpinner = view.FindViewById <Spinner>(Resource.Id.spinnerRep1); yearsSpinner = view.FindViewById <Spinner>(Resource.Id.spinnerRep2); editStartAmount = view.FindViewById <EditText>(Resource.Id.editRepStart); editEndAmount = view.FindViewById <EditText>(Resource.Id.editRepEnd); btnShowReport = view.FindViewById <Button>(Resource.Id.btnRepShow); bool databaseEmpty = true; using (var db = new ExpenseManager()) { if (db.GetAllItems().FirstOrDefault() != null) { databaseEmpty = false; } } if (!databaseEmpty) { editStartAmount.KeyPress += EditStartAmount_KeyPress; editEndAmount.KeyPress += EditEndAmount_KeyPress; btnShowReport.Click += BtnShowReport_Click; LoadMonthsSpinnerData(); LoadYearsSpinnerData(); int monthNow = today.Month - 1; int yearNow = today.Year; monthsSpinner.SetSelection(monthNow); yearsSpinner.SetSelection(years.FindIndex(y => y == yearNow)); monthsSpinner.ItemSelected += MonthsSpinner_ItemSelected; yearsSpinner.ItemSelected += YearsSpinner_ItemSelected; selectedMonth = today.Month; selectedYear = today.Year; SetAmounts(); } return(view); }
public ActionResult Detail(int id, ExpenseDetail expenseDetail) { try { ExpenseManager expenseManager = new ExpenseManager(); expenseDetail.ExpenseSummaryID = id; int value = expenseManager.CreateExpenseDetail(expenseDetail); ////create path to store in database //// expenseDetail.user_image = "~/image/" + expenseDetail.expenseAttachment.FileName; //var t = Server.MapPath("Images") + "/" + expenseDetail.expenseAttachment.FileName; ////store image in folder //expenseDetail.expenseAttachment.SaveAs(Server.MapPath("~/Images") + "/" + expenseDetail.expenseAttachment.FileName); byte[] bytes; if (expenseDetail.expenseAttachment != null) { using (BinaryReader br = new BinaryReader(expenseDetail.expenseAttachment.InputStream)) { bytes = br.ReadBytes(expenseDetail.expenseAttachment.ContentLength); } string constr = ConfigurationManager.AppSettings["PayMe-Connectionstring"]; using (SqlConnection con = new SqlConnection(constr)) { string query = "INSERT INTO ExpenseDetailDocument VALUES (@ExpenseDetailID,@Name, @ContentType, @Data)"; using (SqlCommand cmd = new SqlCommand(query)) { cmd.Connection = con; cmd.Parameters.AddWithValue("@ExpenseDetailID", value); cmd.Parameters.AddWithValue("@Name", Path.GetFileName(expenseDetail.expenseAttachment.FileName)); cmd.Parameters.AddWithValue("@ContentType", expenseDetail.expenseAttachment.ContentType); cmd.Parameters.AddWithValue("@Data", bytes); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } } } TempData["Message"] = "Expense Detail Created Successfully"; return(RedirectToAction("Detail/" + id)); } catch (Exception ex) { TempData["Message"] = "Error Occured"; return(View()); } }
protected override void OnAppearing() { var Expenses = ExpenseManager.GetExpenses(); ExpenseManager.SaveBudget(500); Budget.Text = budget.ToString(); RemainingAmount.Text = ExpenseManager.RemainingBudget().ToString(); if (budget > 0) { AddNewExpense.IsEnabled = true; } foreach (var expense in Expenses) { expenses.Add(expense); } ExpenseRecords.ItemsSource = expenses.OrderBy(n => n.Date).ToList(); }