/// <summary> /// To fetch details from database /// </summary> /// <param name="ProjectID"></param> /// <returns></returns> public object GetAllExpenseData(int ProjectID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_TRN_GET_PROJ_EXPENSE"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("PROJECTID_", ProjectID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ExpenseBO ExpenseBOobj = null; ExpenseList ExpenseListobj = new ExpenseList(); ExpenseBOobj = new ExpenseBO(); while (dr.Read()) { ExpenseBOobj = new ExpenseBO(); if (!dr.IsDBNull(dr.GetOrdinal("PROJECTEXPENSEID"))) { ExpenseBOobj.PROJECTEXPENSEID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("PROJECTEXPENSEID"))); } if (!dr.IsDBNull(dr.GetOrdinal("PROJECTID"))) { ExpenseBOobj.PROJECTID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("PROJECTID"))); } if (!dr.IsDBNull(dr.GetOrdinal("EXPENSETYPE"))) { ExpenseBOobj.EXPENSETYPE = dr.GetString(dr.GetOrdinal("EXPENSETYPE")); } if (!dr.IsDBNull(dr.GetOrdinal("ACCOUNTCODE"))) { ExpenseBOobj.ACCOUNTCODE = dr.GetString(dr.GetOrdinal("ACCOUNTCODE")); } if (!dr.IsDBNull(dr.GetOrdinal("EXPENSEAMOUNT"))) { ExpenseBOobj.EXPENSEAMOUNT = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("EXPENSEAMOUNT"))); } if (!dr.IsDBNull(dr.GetOrdinal("DATEOFEXPENSE"))) { ExpenseBOobj.DATEOFEXPENSE = dr.GetDateTime(dr.GetOrdinal("DATEOFEXPENSE")); } ExpenseBOobj.ISDELETED = dr.GetString(dr.GetOrdinal("ISDELETED")); ExpenseListobj.Add(ExpenseBOobj); } dr.Close(); return(ExpenseListobj); }
static void Main(string[] args) { Person Ramkumar = new Person(){Name = "Ramkumar"}; Person Kumar = new Person(){Name = "Kumar"}; Person Jim = new Person(){Name = "Jim"}; Person Cook = new Person(){Name = "Cook"}; Expense<Person> CarExpense = new Expense<Person>(Ramkumar,1000,Kumar,Jim,Cook); ExpenseList _expenseList = new ExpenseList(); _expenseList.Add(CarExpense); Expense<Person> DinnerExpense = new Expense<Person>(Jim,500,Cook,Kumar); Expense<Person> TripExpense = new Expense<Person>(Cook,6000,Kumar,Ramkumar); _expenseList.Add(DinnerExpense); _expenseList.Add(TripExpense); OweCalculator.CalculateOwing(_expenseList); // foreach(var owe in Ramkumar.Owing.Keys) // { // Console.WriteLine("****"); // Console.WriteLine(owe.Name + "Owes Rs." +Ramkumar.Owing[owe] + "to" + Ramkumar.Name); // Console.WriteLine("*****"); // } // foreach(var owe in Cook.Owing.Keys) // { // Console.WriteLine("****"); // Console.WriteLine(owe.Name + "Owes Rs." +Cook.Owing[owe] + "to" + Cook.Name); // Console.WriteLine("*****"); // } // foreach(var owe in Jim.Owing.Keys) // { // Console.WriteLine("****"); // Console.WriteLine(owe.Name + "Owes Rs." +Jim.Owing[owe] + "to" + Jim.Name); // Console.WriteLine("*****"); // } // foreach(var owe in Kumar.Owing.Keys) // { // Console.WriteLine("****"); // Console.WriteLine(owe.Name + "Owes Rs." +Kumar.Owing[owe] + "to" + Kumar.Name); // Console.WriteLine("*****"); // } // } }
private void button2_Click(object sender, EventArgs e) { //var str = tableLayoutPanel1.GetControlFromPosition(1, 1); ExpenseList newExpenses = new ExpenseList(); for (int i = 0; i < numEntries; i++) { string str = tableLayoutPanel1.GetControlFromPosition(0, i).Text; Decimal num = ((NumericUpDown)(tableLayoutPanel1.GetControlFromPosition(1, i))).Value; Console.WriteLine(str + ", " + num.ToString()); newExpenses.Add(new Expense(str, num)); } expenseState = newExpenses; }
private void ExecuteSaveExpense() { if (ValidateExpense()) { using (var unitOfWork = new UnitOfWork(new MahalluDBContext())) { MahalluManager.Model.Expense expense = GetExpense(); unitOfWork.Expenses.Add(expense); unitOfWork.Complete(); ExpenseList.Add(expense); CurrentExpense = expense; ExpenseType totatExpenseType = new ExpenseType() { Expense = CurrentExpense }; eventAggregator.GetEvent <PubSubEvent <ExpenseType> >().Publish(totatExpenseType); } } }
internal static ExpenseList getExpenseHistory(HttpResponseMessage responce) { var expenseList = new ExpenseList(); var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("expensehistory")) { var expenseArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["expensehistory"].ToString()); foreach(var expObj in expenseArray) { var expense = new Expense(); expense = JsonConvert.DeserializeObject<Expense>(expObj.ToString()); expenseList.Add(expense); } } if (jsonObj.ContainsKey("page_context")) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString()); expenseList.page_context = pageContext; } return expenseList; }
internal static ExpenseList getExpenseList(HttpResponseMessage responce) { var expenseList = new ExpenseList(); var jsonObj = JsonConvert.DeserializeObject <Dictionary <string, object> >(responce.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("expenses")) { var expensesArray = JsonConvert.DeserializeObject <List <object> >(jsonObj["expenses"].ToString()); foreach (var expenseObj in expensesArray) { var expense = new Expense(); expense = JsonConvert.DeserializeObject <Expense>(expenseObj.ToString()); expenseList.Add(expense); } } if (jsonObj.ContainsKey("page_context")) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject <PageContext>(jsonObj["page_context"].ToString()); expenseList.page_context = pageContext; } return(expenseList); }
private async Task ExecuteLoadExpensesAsync() { IsBusy = true; try { ExpenseList.Clear(); IList <Expense> list = await _expenseTrackerService.GetExpenseListAsync(); foreach (Expense e in list) { ExpenseList.Add(e); } } catch (Exception ex) { _telemetry.LogError("ExecuteLoadExpensesAsync error", ex); } finally { IsBusy = false; } }
public SummaryViewModel() { eventAggregator.GetEvent <PubSubEvent <SelectedYearType> >().Subscribe((e) => { Selected = ((SelectedYearType)e).SelectedYear; }); eventAggregator.GetEvent <PubSubEvent <IncomeType> >().Subscribe((e) => { IncomeType incomeType = (IncomeType)e; bool isPresent = false; Contribution temp = null; foreach (var item in ContributionList) { if (item.Id == incomeType.Contribution.Id) { item.ToatalAmount = incomeType.Contribution.ToatalAmount; isPresent = true; if (incomeType.Operation == MahalluManager.Model.Common.Operation.Delete) { temp = item; break; } } } if (temp != null) { contributionList.Remove(temp); } if (!isPresent) { ContributionList.Add(incomeType.Contribution); } TotalIncome = CalcuateTotalIncome(); }); eventAggregator.GetEvent <PubSubEvent <ExpenseType> >().Subscribe((e) => { ExpenseType expenseType = (ExpenseType)e; bool isPresent = false; Expense temp = null; foreach (var item in ExpenseList) { if (item.Id == expenseType.Expense.Id) { item.ToatalAmount = expenseType.Expense.ToatalAmount; isPresent = true; if (expenseType.Operation == MahalluManager.Model.Common.Operation.Delete) { temp = item; break; } } } if (temp != null) { ExpenseList.Remove(temp); } if (!isPresent) { ExpenseList.Add(expenseType.Expense); } TotalExpense = CalcuateTotalExpense(); }); Refresh(); Years = new ObservableCollection <string>(); SetYears(); }