public static void MoneyTransfer(UserData userFrom, UserData userTo, decimal budget)
        {
            var infoRepo    = new InformationRepository(withPlan: false);
            var historyRepo = new HistoryCashRepository();

            var nameFirst = string.Format("{0} {1}({2})", userFrom.FirstName, userFrom.LastName, userFrom.NickName);
            var nameLast  = string.Format("{0} {1}({2})", userTo.FirstName, userTo.LastName, userTo.NickName);

            var information = new Information()
            {
                UserData   = userFrom.Code,
                DateAction = Constants.TotalMilliseconds,
                Info       = string.Format(Constants.Transfer, budget, nameFirst, nameLast)
            };

            infoRepo.InsertData(information);
            information.UserData = userTo.Code;
            infoRepo.InsertData(information);

            var historyCash = new HistoryCash();

            historyCash.Name       = string.Format(Constants.Transfer, budget, nameFirst, nameLast);
            historyCash.DateAction = Constants.TotalMilliseconds;

            historyCash.Cash     = budget;
            historyCash.UserCode = userTo.Code;
            historyRepo.InsertData(historyCash);

            historyCash.Cash     = -budget;
            historyCash.UserCode = userFrom.Code;
            historyRepo.InsertData(historyCash);
        }
        private static void InformationUserCash(Plan plan, Flight flight)
        {
            var historyRepo = new HistoryCashRepository(true);
            var historyCash = new HistoryCash();

            historyCash.Name         = string.Format(Constants.ApproveFlight, plan.Name, flight.Comment);
            historyCash.DateAction   = Constants.TotalMilliseconds;
            historyCash.Cash         = -flight.ActualBudget;
            historyCash.UserCode     = plan.ExecutorCode;
            historyCash.PlanCode     = plan.Code;
            historyCash.CategoryCode = plan.CategoryCode;
            historyRepo.InsertData(historyCash);
        }
示例#3
0
        public static List <HistoryCash> GetHistoryCash(FilterData filter)
        {
            var user = UserSession.Current.User;

            if (user != null)
            {
                HistoryCashRepository repo = new HistoryCashRepository(filter);
                if (repo != null)
                {
                    return(repo.List);
                }
            }
            return(new List <HistoryCash>());
        }
        public static void BudgetReplenishment(UserData user, decimal budget)
        {
            var infoRepo    = new InformationRepository(withPlan: false);
            var historyRepo = new HistoryCashRepository();

            var information = new Information()
            {
                UserData   = user.Code,
                DateAction = Constants.TotalMilliseconds,
                Info       = string.Format(Constants.BudgetReplenishment, budget)
            };

            infoRepo.InsertData(information);

            var historyCash = new HistoryCash();

            historyCash.Cash       = budget;
            historyCash.Name       = string.Format(Constants.BudgetReplenishment, budget);
            historyCash.DateAction = Constants.TotalMilliseconds;
            historyCash.UserCode   = user.Code;
            historyRepo.InsertData(historyCash);
        }