Beispiel #1
0
        /// <summary>
        ///存款
        /// </summary>
        public override void Diposit(string genType, double money, int year)
        {
            BankEntities context = new BankEntities();

            base.Diposit("存款", money, year);
            if (year == 1)
            {
                //定期类型
                type = RateType.定期1年;
                base.Diposit("结息", DataOperation.GetRate(RateType.定期1年) * money, year);
                //到期利息
                preRate = DataOperation.GetRate(RateType.定期1年) * money;
            }
            if (year == 2)
            {
                base.Diposit("结息", DataOperation.GetRate(RateType.定期3年) * money, year);
                type    = RateType.定期3年;
                preRate = DataOperation.GetRate(RateType.定期3年) * money;
            }
            if (year == 3)
            {
                base.Diposit("结息", DataOperation.GetRate(RateType.定期5年) * money, year);
                type    = RateType.定期5年;
                preRate = DataOperation.GetRate(RateType.定期5年) * money;
            }
        }
Beispiel #2
0
 public static string GetAdminName(string id)
 {
     using (BankEntities c = new BankEntities())
     {
         var q = from t in c.Admin
                 where t.Id == id
                 select t;
         if (q != null && q.Count() >= 1)
         {
             return q.First().dminName;
         }
         else
         {
             return "";
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// 获取操作员姓名
 /// </summary>
 /// <param name="id">操作员编号</param>
 /// <returns></returns>
 public static string GetOperateName(string id)
 {
     using (BankEntities c = new BankEntities())
     {
         var q = from t in c.EmployeeInfo
                  where t.EmployeeNo == id
                  select t;
         if (q != null && q.Count()>=1)
         {
             return q.First().EmployeeName;
         }
         else
         {
             return "";
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// 获取存款用户信息,并初始化余额
 /// </summary>
 /// <param name="accountNumber"></param>
 /// <returns></returns>
 public static Custom GetCustom(string accountNumber)
 {
     Custom custom = null;
     BankEntities c = new BankEntities();
     try
     {
         var q = (from t in c.AccountInfo
                  where t.accountNo == accountNumber
                  select t).Single();
         custom = CreateCustom(q.accountType);
         custom.AccountInfo.accountNo = accountNumber;
         custom.AccountInfo.accountName = q.accountName;
         custom.AccountInfo.accountPass = q.accountPass;
         custom.AccountInfo.IdCard = q.IdCard;
     }
     catch
     {
         return null;
     }
     var q1 = (from t in c.MoneyInfo
               where t.accountNo == accountNumber
               select t).Sum(x => x.dealMoney);
     custom.AccountBalance = q1;
     return custom;
 }
Beispiel #5
0
 /// <summary>
 /// 获取指定类别的利率
 /// </summary>
 /// <param name="rateType">利率类别</param>
 /// <returns>对应类别的利率值</returns>
 public static double GetRate(RateType rateType)
 {
     string type = rateType.ToString();
     BankEntities c = new BankEntities();
     var q = (from t in c.RateInfo
              where t.rationType == type
              select t.rationValue).Single();
     return q.Value;
 }
Beispiel #6
0
        public override void Withdraw(double money)
        {
            BankEntities context = new BankEntities();
            var          qq      = from t in context.MoneyInfo
                                   where t.dealType == "存款" && t.accountNo == account1
                                   select t;
            var q = qq.FirstOrDefault();

            if (!ValidBeforeWithdraw(money))
            {
                return;
            }
            //存款时间
            date1 = Convert.ToDateTime(q.dealDate);
            //计算利息

            //取款时间
            DateTime date2 = DateTime.Now;

            if (type == RateType.定期1年)
            {
                DYear = 1;
            }
            if (type == RateType.定期3年)
            {
                DYear = 3;
            }
            if (type == RateType.定期5年)
            {
                DYear = 5;
            }
            //1年
            if (DYear == 1 && (date2 - date1).TotalDays >= 365)
            {
                if ((date2 - date1).TotalDays > 365)
                {
                    //超期利息
                    double rate = DataOperation.GetRate(RateType.定期超期部分) * AccountBalance;
                    //添加利息
                    AccountBalance += rate;
                    //取款
                    base.Withdraw(money);
                }
                else
                {
                    base.Withdraw(money);
                }
            }
            else if (DYear == 1 && (date2 - date1).TotalDays < 365)
            {
                AccountBalance -= preRate;
                //不足日期
                double rate = DataOperation.GetRate(RateType.定期提前支取) * AccountBalance;
                //添加利息
                AccountBalance += rate;
                AccountBalance -= preRate;
                //取款
                base.Withdraw(money);
            }



            //3年
            if (DYear == 3 && (date2 - date1).TotalDays >= 365 * 3)
            {
                if ((date2 - date1).TotalDays > 365 * 3)
                {
                    //超期利息
                    double rate = DataOperation.GetRate(RateType.定期超期部分) * AccountBalance;
                    //添加利息
                    AccountBalance += rate;
                    //取款
                    base.Withdraw(money);
                }
                else
                {
                    base.Withdraw(money);
                }
            }
            else if (DYear == 3 && (date2 - date1).TotalDays < 365 * 3)
            {
                AccountBalance -= preRate;
                //不足日期
                double rate = DataOperation.GetRate(RateType.定期提前支取) * AccountBalance;
                //添加利息
                AccountBalance += rate;
                AccountBalance -= preRate;
                //取款
                base.Withdraw(money);
            }


            //5年
            if (DYear == 5 && (date2 - date1).TotalDays >= 365 * 5)
            {
                if ((date2 - date1).TotalDays > 365 * 5)
                {
                    //超期利息
                    double rate = DataOperation.GetRate(RateType.定期超期部分) * AccountBalance;
                    //添加利息
                    AccountBalance += rate;
                    //取款
                    base.Withdraw(money);
                }
                else
                {
                    base.Withdraw(money);
                }
            }
            else if (DYear == 5 && (date2 - date1).TotalDays < 365 * 5)
            {
                AccountBalance -= preRate;
                //不足日期
                double rate = DataOperation.GetRate(RateType.定期提前支取) * AccountBalance;
                //添加利息
                AccountBalance += rate;
                AccountBalance -= preRate;
                //取款
                base.Withdraw(money);
            }
        }