예제 #1
0
        public void ClientPart(ref Client.Client cl, ref Credit.Credit[] credits, ref Bank.Bank bank, ref Worker.Worker w)
        {
            Console.Clear();
            Console.WriteLine("1) For look your credit(s)");
            Console.WriteLine("2) For add new credit");
            Console.WriteLine("3) For convert money to dollar");
            bool IsInt = int.TryParse(Console.ReadLine(), out int choose);

            if (IsInt)
            {
                if (choose == 1)
                {
                    Console.Clear();
                    foreach (var item in credits)
                    {
                        if (item.TheClient.Name == cl.Name)
                        {
                            item.Print();
                        }
                    }
                    Thread.Sleep(3000);
                    Console.Clear();
                }
                else if (choose == 2)
                {
                    Console.Clear();
                    Console.Write("Enter amonut: ");
                    decimal amount = Convert.ToDecimal(Console.ReadLine());
                    Console.WriteLine("Enter month: ");
                    int month = Convert.ToInt32(Console.ReadLine());

                    w.addOperation(new Operation.Operation(Guid.NewGuid(), $"New credit was added in {cl.Name} account", DateTime.Now));
                    Credit.Credit[] cre = new Credit.Credit[credits.Length + 1];
                    for (int i = 0; i < credits.Length; i++)
                    {
                        cre[i] = credits[i];
                    }
                    cre[cre.Length - 1] = new Credit.Credit(Guid.NewGuid(), cl, amount, month);
                    credits             = cre;
                }
                else if (choose == 3)
                {
                    Console.Clear();
                    Console.Write("Write amount: ");
                    bool isD = decimal.TryParse(Console.ReadLine(), out decimal res);
                    if (isD)
                    {
                        decimal dess = res * (17 / 10);
                        cl.Salary   += res;
                        cl.Salary   -= dess;
                        bank.Budget += dess * (17 / 10) - dess * (171 / 10);
                        bank.ProfitCalculating();
                    }
                }
            }
            else
            {
                throw new Exception("Invalid type!");
            }
        }
예제 #2
0
 public void addClient(Credit.Credit resource)
 {
     Credit.Credit[] temp = new Credit.Credit[++ClientCount];
     if (Credits != null)
     {
         Credits.CopyTo(temp, 0);
     }
     temp[temp.Length - 1] = resource;
     Credits = temp;
 }
예제 #3
0
        /// <summary>
        /// 产品筛选
        /// </summary>
        /// yangj   16.08.02
        /// <param name="produceName">产品名</param>
        /// <param name="repaymentMethod">还款方式</param>
        /// <param name="financingPeriods">融资期限</param>
        /// <returns></returns>
        public List <ComboInfo> GetProduct(string produceName, string repaymentMethod, string financingPeriods)
        {
            Credit.Credit  _credit        = new Credit.Credit();
            Credit.Account _creditAccount = new Credit.Account();

            //获取当前登录用户并借此查询授信主体标识
            int userId        = User.User.CurrentUserId;
            var creditAccount = _creditAccount.Get(userId);

            if (creditAccount == null || creditAccount.CreditId == 0)
            {
                return(null);
            }

            return(produceMapper.FindProduct(produceName, repaymentMethod, financingPeriods, creditAccount.CreditId));
        }
예제 #4
0
        /// <summary>
        /// 获取产品列表(融资期限)
        /// </summary>
        /// yangj   16.08.02
        /// <returns></returns>
        public List <ComboInfo> GetByFinancingPeriods()
        {
            Credit.Credit  _credit        = new Credit.Credit();
            Credit.Account _creditAccount = new Credit.Account();

            //获取当前登录用户并借此查询授信主体标识
            int userId        = User.User.CurrentUserId;
            var creditAccount = _creditAccount.Get(userId);

            if (creditAccount == null || creditAccount.CreditId == 0)
            {
                return(null);
            }

            return(produceMapper.FindByFinancingPeriods(creditAccount.CreditId));
        }
예제 #5
0
        public int?FindUser(object value)
        {
            var data = (FlowData)value;

            var transfer = new Action().Get(data.ActionId).Transfer;
            var roldId   = new Node().Get(transfer.Value).RoleId;

            var financeId   = new Instance().GetData(data.InstanceId.Value, new { FinanceId = 0 }).FinanceId;
            var creditId    = new Finance.Finance().Get(financeId).CreateOf;
            var processUser = new Credit.Credit().Get(creditId).ProcessUser;

            int?userId;

            switch (roldId)
            {
            case 3:
                userId = processUser.User1;
                break;

            case 4:
                userId = processUser.User2;
                break;

            case 5:
                userId = processUser.User3;
                break;

            case 10:
                userId = processUser.User4;
                break;

            case 6:
                userId = processUser.User5;
                break;

            default:
                userId = null;
                break;
            }

            return(userId);
        }
예제 #6
0
        /// <summary>
        /// 获取当前授信主体所拥有的产品选项
        /// </summary>
        /// qiy     16.04.07
        /// <returns></returns>
        public List <ComboInfo> ProducesOptionByCredit()
        {
            Credit.Credit  _credit        = new Credit.Credit();
            Credit.Account _creditAccount = new Credit.Account();

            //获取当前登录用户并借此查询授信主体标识
            int userId        = User.User.CurrentUserId;
            var creditAccount = _creditAccount.Get(userId);

            if (creditAccount == null || creditAccount.CreditId == 0)
            {
                return(null);
            }

            //获取授信主体所拥有的产品
            List <Models.Produce.ProduceInfo> produces = _credit.GetProduces(creditAccount.CreditId);

            //转换为选项
            List <ComboInfo> options = Produce.Produce.ProducesToOption(produces);

            return(options);
        }
예제 #7
0
        public void Starter()
        {
            Worker.Worker w1 = new Worker.Worker(Guid.NewGuid(), "Hakuna", "", 35, "Cart operations", 2123);
            Worker.Worker w2 = new Worker.Worker(Guid.NewGuid(), "Sun", "", 26, "Cart operations", 221);
            Worker.Worker w3 = new Worker.Worker(Guid.NewGuid(), "Moon", "", 37, "Cart operations", 1233);
            Worker.Worker w4 = new Worker.Worker(Guid.NewGuid(), "Sky", "", 40, "Cart operations", 223);
            w1.addOperation(new Operation.Operation(Guid.NewGuid(), "Cart Added", DateTime.Now));
            Worker.Worker[] workers = new Worker.Worker[4] {
                w1, w2, w3, w4
            };

            Manager.Manager m1 = new Manager.Manager(Guid.NewGuid(), "Matata", "", 46, "Main Manager", 98123);
            m1.addWorker(w1);
            m1.addWorker(w2);
            m1.addWorker(w3);
            m1.addWorker(w4);
            Manager.Manager m2 = new Manager.Manager(Guid.NewGuid(), "Glass", "", 19, "Manager", 2721);
            m2.addWorker(w1);
            m2.addWorker(w2);
            Manager.Manager m3 = new Manager.Manager(Guid.NewGuid(), "Light", "", 29, "Manager", 12671);
            m3.addWorker(w3);
            m3.addWorker(w4);
            Manager.Manager m4 = new Manager.Manager(Guid.NewGuid(), "Blue", "", 41, "Manager", 82342);
            m4.addWorker(w1);
            m4.addWorker(w3);
            Manager.Manager[] managers = new Manager.Manager[4] {
                m1, m2, m3, m4
            };

            Client.Client   c1      = new Client.Client(Guid.NewGuid(), "Matatata", "Nana", 22, 34324, "X street,New York", "Y street, New Jersey");
            Client.Client   c2      = new Client.Client(Guid.NewGuid(), "Last", "Glass", 56, 1434, "I don't work", "Y street, Vegas");
            Client.Client[] clients = new Client.Client[2] {
                c1, c2
            };

            Ceo.Ceo ceo = new Ceo.Ceo(Guid.NewGuid(), "Hakuna", "", 35, "Ceo", 100000);
            ceo.addWorker(w1);
            ceo.addWorker(w2);
            ceo.addWorker(w3);
            ceo.addWorker(w4);
            ceo.addManager(m1);
            ceo.addManager(m2);
            ceo.addManager(m3);
            ceo.addManager(m4);

            Credit.Credit cr1 = new Credit.Credit(Guid.NewGuid(), c1, 20013, 6);
            Credit.Credit cr3 = new Credit.Credit(Guid.NewGuid(), c1, 142, 2);
            Credit.Credit cr2 = new Credit.Credit(Guid.NewGuid(), c2, 41500, 3);

            m1.Ceo = ceo;
            m2.Ceo = ceo;
            m3.Ceo = ceo;
            m4.Ceo = ceo;

            Bank.Bank bank = new Bank.Bank("Time bank", 10000000, ceo);

            Credit.Credit[] credits = new Credit.Credit[3] {
                cr1, cr2, cr3
            };


            while (true)
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("1) Ceo");
                    Console.WriteLine("2) Worker");
                    Console.WriteLine("3) Manager");
                    Console.WriteLine("4) Client");
                    Console.WriteLine("5) Bank");
                    Choose(Console.ReadLine(), ref ceo, ref workers, ref managers, ref clients, ref credits, bank);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }