示例#1
0
        public AccountMsg deposit(dwacc value)
        {
            string              data     = JsonConvert.SerializeObject(value);
            StringContent       content  = new StringContent(data, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Transaction/deposit/", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string data1 = response.Content.ReadAsStringAsync().Result;
                Ts     s1    = JsonConvert.DeserializeObject <Ts>(data1);
                if (s1.Message == "Success")
                {
                    if (value.AccountId % 2 == 0)
                    {
                        var sa = savingsAccounts.Find(a => a.savingsAccountId == value.AccountId);
                        sa.savingsAccountbalance = sa.savingsAccountbalance + value.Balance;
                        AccountMsg sob = new AccountMsg
                        {
                            accountId = value.AccountId,
                            AccType   = "Deposited Correctly",
                            AccBal    = sa.savingsAccountbalance
                        };
                        return(sob);
                    }
                    var ca = currentAccounts.Find(a => a.CAId == value.AccountId);
                    ca.CBal = ca.CBal + value.Balance;
                    AccountMsg cob = new AccountMsg
                    {
                        accountId = value.AccountId,
                        AccType   = "Deposited Correctly",
                        AccBal    = ca.CBal
                    };
                    return(cob);
                }

                /* if (value.AccountId % 2 == 0)
                 * {
                 *   var sad = savingsAccounts.Find(a => a.savingsAccountId == value.AccountId);
                 *   sad.savingsAccountbalance = sad.savingsAccountbalance + value.Balance;
                 *   AccountMsg sobd = new AccountMsg
                 *   {
                 *       accountId = value.AccountId,
                 *       AccType = "Deposited Correctly",
                 *       AccBal = sad.savingsAccountbalance
                 *   };
                 *   return sobd;
                 * }
                 * var cad = currentAccounts.Find(a => a.CAId == value.AccountId);
                 * cad.CBal = cad.CBal + value.Balance;
                 * AccountMsg cobd = new AccountMsg
                 * {
                 *   accountId = value.AccountId,
                 *   AccType = "Deposited Correctly",
                 *   AccBal = cad.CBal
                 * };
                 * return cobd;*/
            }
            return(null);
        }
示例#2
0
        /// <summary>
        /// 获取卡号
        /// </summary>
        /// <returns>读者编号</returns>
        public string strGetCardNo()
        {
            AccountMsg am = new AccountMsg();
            int        s  = TA_ReadCardSimple(ref am);

            _cardNo = s.ToString() + "," + am.StudentCode;
            return(_cardNo); //am.StudentCode.ToString() ;
        }
        public ruleStatus evaluateMinBal(dwacc value)
        {
            AccountMsg          ob       = new AccountMsg();
            ruleStatus          ob1      = new ruleStatus();
            HttpResponseMessage response = client.GetAsync(client.BaseAddress + "/Account/getAccount/" + value.AccountId).Result;

            if (response.IsSuccessStatusCode)
            {
                string data = response.Content.ReadAsStringAsync().Result;
                ob        = JsonConvert.DeserializeObject <AccountMsg>(data);
                ob.AccBal = ob.AccBal - value.Balance;
                if (ob.AccBal < 500)
                {
                    ob1.message = "Warning";
                }

                else
                {
                    ob1.message = "No Warning";
                }
            }
            return(ob1);
        }
示例#4
0
        public AccountMsg getAccount(int id)
        {
            if (id % 2 != 0)
            {
                var ca  = currentAccounts.Find(a => a.CAId == id);
                var ac1 = new AccountMsg
                {
                    accountId = ca.CAId,
                    AccType   = "Current Account",
                    AccBal    = ca.CBal
                };
                return(ac1);
            }
            var sa = savingsAccounts.Find(a => a.savingsAccountId == id);
            var ac = new AccountMsg
            {
                accountId = sa.savingsAccountId,
                AccType   = "Savings Account",
                AccBal    = sa.savingsAccountbalance
            };

            return(ac);
        }
 public static extern int TA_InqAcc(ref AccountMsg pAccMsg, short TimeOut);
 public static extern int TA_HazyInqAcc(ref AccountMsg pAccMsg, int *RecNum, string FileName, short TimeOut);
示例#7
0
 public void Setup()
 {
     am = new AccountMsg {
         AccId = 1, AccBal = 1000, AccType = "Savings"
     };
 }
示例#8
0
        public AccountMsg withdraw(dwacc value)
        {
            string              data     = JsonConvert.SerializeObject(value);
            StringContent       content  = new StringContent(data, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/Transaction/withdraw/", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string     data1 = response.Content.ReadAsStringAsync().Result;
                Ts         s1    = JsonConvert.DeserializeObject <Ts>(data1);
                AccountMsg amsg  = new AccountMsg();
                if (s1.Message == "No Warning")
                {
                    if (value.AccountId % 2 == 0)
                    {
                        var sa = savingsAccounts.Find(a => a.savingsAccountId == value.AccountId);
                        sa.savingsAccountbalance = sa.savingsAccountbalance - value.Balance;
                        if (sa.savingsAccountbalance >= 0)
                        {
                            amsg.accountId = value.AccountId;
                            amsg.AccType   = "Withdrawn Successfully";
                            amsg.AccBal    = sa.savingsAccountbalance;
                            return(amsg);
                        }
                        else
                        {
                            sa.savingsAccountbalance = sa.savingsAccountbalance + value.Balance;
                            amsg.accountId           = value.AccountId;
                            amsg.AccType             = "Insufficient Fund";
                            amsg.AccBal = sa.savingsAccountbalance;
                            return(amsg);
                        }
                    }
                    var car = currentAccounts.Find(a => a.CAId == value.AccountId);
                    car.CBal = car.CBal - value.Balance;
                    if (car.CBal >= 0)
                    {
                        amsg.accountId = value.AccountId;
                        amsg.AccType   = "Withdrawn Successfully";
                        amsg.AccBal    = car.CBal;
                        return(amsg);
                    }
                    else
                    {
                        car.CBal       = car.CBal + value.Balance;
                        amsg.accountId = value.AccountId;
                        amsg.AccType   = "Insufficient Fund";
                        amsg.AccBal    = car.CBal;
                        return(amsg);
                    }
                }
                if (value.AccountId % 2 == 0)
                {
                    var sa = savingsAccounts.Find(a => a.savingsAccountId == value.AccountId);
                    sa.savingsAccountbalance = sa.savingsAccountbalance - value.Balance;
                    if (sa.savingsAccountbalance >= 0)
                    {
                        amsg.accountId = value.AccountId;
                        amsg.AccType   = "Withdrawn Successfully.Service charge applicable at the end of month";
                        amsg.AccBal    = sa.savingsAccountbalance;
                        return(amsg);
                    }
                    else
                    {
                        sa.savingsAccountbalance = sa.savingsAccountbalance + value.Balance;
                        amsg.accountId           = value.AccountId;
                        amsg.AccType             = "Insufficient Fund";
                        amsg.AccBal = sa.savingsAccountbalance;
                        return(amsg);
                    }
                }
                var ca = currentAccounts.Find(a => a.CAId == value.AccountId);
                ca.CBal = ca.CBal - value.Balance;
                if (ca.CBal >= 0)
                {
                    amsg.accountId = value.AccountId;
                    amsg.AccType   = "Withdrawn Successfully.Service Charge Applicable at the end of month";
                    amsg.AccBal    = ca.CBal;
                    return(amsg);
                }
                else
                {
                    ca.CBal        = ca.CBal + value.Balance;
                    amsg.accountId = value.AccountId;
                    amsg.AccType   = "Insufficient Fund";
                    amsg.AccBal    = ca.CBal;
                    return(amsg);
                }
            }
            return(null);
        }
示例#9
0
 private static extern int TA_ReadCardSimple(ref AccountMsg pAccMsg);