コード例 #1
0
ファイル: Program.cs プロジェクト: DeepakkSHAW/MEMCore
        public static void EditExpenses()
        {
            var oExpenses = new MEMCore.Domain.Expense();

            oExpenses.ExpenseTitle      = "--Update this expenses";
            oExpenses.ExpensesAmount    = 7200.20;
            oExpenses.ExpenseDate       = new DateTime(2018, 5, 5, 5, 5, 5);
            oExpenses.CurrencyId        = 5;
            oExpenses.ExpenseCategoryId = 5;
            oExpenses.ExpenseDetail     = new MEMCore.Domain.ExpenseDetail {
                Detail = "-- just an update++"
            };
            oExpenses.Signature = "JS";

            MEMCore.Services.IExpenseRepository srv = new MEMCore.Services.ExpenseRepository();
            var asynCallGetExpenses = Task.Run(() => srv.EditExpensesAsync(oExpenses, 1));

            asynCallGetExpenses.Wait();

            var asynExp = asynCallGetExpenses.Result;

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine($"Number of row affected after upate: {asynExp}");
            Console.ResetColor();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: DeepakkSHAW/MEMCore
        public static void NewExpenses()
        {
            var oExpenses = new MEMCore.Domain.Expense();

            oExpenses.ExpenseTitle      = "++++ Added new expense async";
            oExpenses.ExpensesAmount    = 100.20;
            oExpenses.ExpenseDate       = new DateTime(2019, 7, 5, 10, 10, 10);
            oExpenses.CurrencyId        = 1;
            oExpenses.ExpenseCategoryId = 5;
            oExpenses.PaymentMethod     = PaymentMethod.DirectDeposit;
            oExpenses.PaymentType       = PaymentType.Refunded;
            oExpenses.ExpenseDetail     = new MEMCore.Domain.ExpenseDetail {
                Detail = "after enum testing & fixing"
            };
            oExpenses.Signature = "DK";

            MEMCore.Services.IExpenseRepository srv = new MEMCore.Services.ExpenseRepository();
            var asynCallGetExpenses = Task.Run(() => srv.NewExpensesAsync(oExpenses));

            asynCallGetExpenses.Wait();

            var asynExp = asynCallGetExpenses.Result;

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine($"Number of row affected: {asynExp}");
            Console.ResetColor();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: DeepakkSHAW/MEMCore
        public static void DeleteExpenses()
        {
            MEMCore.Services.IExpenseRepository srv = new MEMCore.Services.ExpenseRepository();
            var asynCallGetExpenses = Task.Run(() => srv.DeleteExpensesAsync(4));

            asynCallGetExpenses.Wait();

            var asynExp = asynCallGetExpenses.Result;

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine($"Total number of expenses deleted: {asynExp}");
            Console.ResetColor();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: DeepakkSHAW/MEMCore
        public static void ListAExpenses()
        {
            MEMCore.Services.IExpenseRepository srv = new MEMCore.Services.ExpenseRepository();
            Task <MEMCore.Domain.Expense>       asynCallGetExpenses = Task.Run(() => srv.GetExpensesAsync(3));

            asynCallGetExpenses.Wait();

            var asynExp = asynCallGetExpenses.Result;

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine($"Expense Id: {asynExp.Id}");
            Console.WriteLine($"Expense Title: {asynExp.ExpenseTitle}");
            // Console.WriteLine($"Expense Details: {asynExp.ExpenseDetail.Detail}");
            Console.WriteLine($"Expense Amount: {asynExp.ExpensesAmount}");
            Console.WriteLine($"Expense Date: {asynExp.ExpenseDate}");
            Console.WriteLine($"Expense Currency: {asynExp.Currency.CurrencyName}");
            Console.WriteLine($"Expense Category: {asynExp.Category.Category}");
            Console.WriteLine($"Expense Signature: {asynExp.Signature}");
            Console.ResetColor();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: DeepakkSHAW/MEMCore
        public static void ListAllExpenses()
        {
            MEMCore.Services.IExpenseRepository          srv = new MEMCore.Services.ExpenseRepository();
            Task <IEnumerable <MEMCore.Domain.Expense> > asynCallGetExpenses = Task.Run(() => srv.GetExpensesWithIdAsync());

            asynCallGetExpenses.Wait();

            var asynExp = asynCallGetExpenses.Result;

            Console.ForegroundColor = ConsoleColor.Blue;
            foreach (var item in asynExp)
            {
                Console.WriteLine($"Expense Id: {item.Id}");
                Console.WriteLine($"Expense Title: {item.ExpenseTitle}");
                Console.WriteLine($"Expense Details: {(item.ExpenseDetail == null ? null : item.ExpenseDetail.Detail)}");
                Console.WriteLine($"Expense Amount: {item.ExpensesAmount}");
                Console.WriteLine($"Expense Date: {item.ExpenseDate}");
                Console.WriteLine($"Expense Currency: {item.Currency.CurrencyName}");
                Console.WriteLine($"Expense Category: {item.Category.Category}");
                Console.WriteLine($"Expense Signature: {item.Signature}");
            }
            Console.ResetColor();
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: DeepakkSHAW/MEMCore
        public static void ListExpensesFromToDates()
        {
            MEMCore.Services.IExpenseRepository srv = new MEMCore.Services.ExpenseRepository();
            var asynCallGetExpenses = Task.Run(() => srv.GetExpensesAsync(DateTime.Now.AddMonths(-1), DateTime.Now));

            asynCallGetExpenses.Wait();

            var asynExp = asynCallGetExpenses.Result;

            Console.ForegroundColor = ConsoleColor.Blue;
            foreach (var item in asynExp)
            {
                Console.WriteLine($"Expense Id: {item.Id}");
                Console.WriteLine($"Expense Title: {item.ExpenseTitle}");
                // Console.WriteLine($"Expense Details: {item.ExpenseDetail.Detail}");
                Console.WriteLine($"Expense Amount: {item.ExpensesAmount}");
                Console.WriteLine($"Expense Date: {item.ExpenseDate}");
                Console.WriteLine($"Expense Currency: {item.Currency.CurrencyName}");
                Console.WriteLine($"Expense Category: {item.Category.Category}");
                Console.WriteLine($"Expense Signature: {item.Signature}");
            }
            Console.ResetColor();
        }