예제 #1
0
        /// <summary>
        ///  主页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Mainview()
        {
            try
            {
                string         strUserId = Session["AccountID"].ToString();
                int            intUserId = Convert.ToInt32(strUserId);
                B_AccountTable accouunt  = (from tbAccountTable in myDYXTEntities.B_AccountTable
                                            where tbAccountTable.AccountID == intUserId
                                            select tbAccountTable).Single();
                ViewBag.User = accouunt.User;

                SpVoice speech     = new SpVoice();                             //new一个
                int     speechRate = -1;                                        //语音朗读速度
                int     volume     = 100;                                       //音量
                bool    paused     = false;                                     //是否暂停
                string  testspeech = "You are welcome to use," + accouunt.User; //测试朗读内容
                if (paused)
                {
                    speech.Resume();
                    paused = false;
                }
                else
                {
                    speech.Rate   = speechRate;
                    speech.Volume = volume;
                    speech.Speak(testspeech, SpeechVoiceSpeakFlags.SVSFlagsAsync);//开始语音朗读
                }

                return(View());
            }
            catch (Exception e)
            {
                return(Redirect("/LoginMain/Login"));
            }
        }
예제 #2
0
        //添加新用户、也就是注册
        public ActionResult InsertYongHu(B_AccountTable Account)
        {
            string str = "";

            try
            {
                int user = (from tbuser in myModels.B_AccountTable
                            where tbuser.User == Account.User
                            select tbuser).Count();
                if (user > 0)
                {
                    str = "Exist";
                }
                else
                {
                    string pw = AESEncryptHelper.AESEncrypt(Account.Password);
                    Account.Password = pw;
                    Account.Cancel   = false;
                    myModels.B_AccountTable.Add(Account);
                    myModels.SaveChanges();
                    str = "success";
                }
            }
            catch (Exception e)
            {
            }

            return(Json(str, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ActionResult insertUserPwP(B_AccountTable Account, B_UserTable User)
        {
            string strMed      = "fail";
            string password    = AESEncryptHelper.AESEncrypt(Account.Password);
            string Paypassword = AESEncryptHelper.AESEncrypt(User.PayPassword);
            int    intaccon    = (from tbaccounnt in myDYXTEntities.B_AccountTable
                                  where tbaccounnt.User == User.UserName
                                  select tbaccounnt).Count();

            if (intaccon == 0)
            {
                Account.User     = User.UserName;
                Account.Password = password;
                Account.Cancel   = false;
                myDYXTEntities.B_AccountTable.Add(Account);
                myDYXTEntities.SaveChanges();

                int varuser = (from tbUSer in myDYXTEntities.B_UserTable
                               where tbUSer.UserName == User.UserName
                               select tbUSer).Count();
                if (varuser == 0)
                {
                    var varaccon = (from tbaccounnt in myDYXTEntities.B_AccountTable
                                    where tbaccounnt.User == User.UserName
                                    select tbaccounnt).Single();

                    User.AccountID         = varaccon.AccountID;
                    User.PayPassword       = Paypassword;
                    User.UserTypeID        = 2;
                    User.Time              = DateTime.Now;
                    User.PropertyAmounts   = 0;
                    User.UsableMoney       = 0;
                    User.FreezeMoney       = 0;
                    User.WaitMoney         = 0;
                    User.CompensatoryMoney = 0;
                    myDYXTEntities.B_UserTable.Add(User);
                    myDYXTEntities.SaveChanges();
                    strMed = "success";
                }
                else
                {
                    strMed = "UserNamefail";//用户名已存在
                }
            }
            else
            {
                strMed = "AccountUserfail";//账号名已存在
            }

            return(Json(strMed, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
 // 计算器
 public ActionResult CounterIndex()
 {
     try
     {
         string         strUserId = Session["AccountID"].ToString();
         int            intUserId = Convert.ToInt32(strUserId);
         B_AccountTable accouunt  = (from tbAccountTable in myModels.B_AccountTable
                                     where tbAccountTable.AccountID == intUserId
                                     select tbAccountTable).Single();
         ViewBag.User = accouunt.User;
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     return(View());
 }
예제 #5
0
        public ActionResult UserLogin(B_AccountTable Account)
        {
            string str          = "";                   //
            string strUser      = Request["username"];  //用户名
            string strPassword  = Request["password"];  //密码
            string strvalidCode = Request["validCode"]; //验证码
            string strSession   = "";

            if (Session["vildeCode"] != null)
            {
                strSession = Session["vildeCode"].ToString();
                if (strSession.Equals(strvalidCode, StringComparison.CurrentCultureIgnoreCase))
                {
                    try
                    {
                        var list = (from tbUser in myModels.B_AccountTable
                                    where tbUser.User == strUser.Trim()
                                    select new
                        {
                            tbUser.User,
                            tbUser.Password,
                            tbUser.AccountID
                        }).Single();
                        string strpassword = AESEncryptHelper.AESEncrypt(strPassword);
                        if (strpassword == list.Password.Trim())
                        {
                            Session["AccountID"] = list.AccountID; // 传递 UserID
                            Session["Password"]  = list.Password;


                            var BLoginDetai = (from tblo in myModels.B_UserLoginDetailTable
                                               select new
                            {
                                tblo.AccountID,
                            }).ToList();
                            for (int i = 0; i < BLoginDetai.Count; i++)
                            {
                                if (BLoginDetai[i].AccountID == list.AccountID)
                                {
                                    B_UserLoginDetailTable BLoginss = (from tblogin in myModels.B_UserLoginDetailTable
                                                                       where tblogin.AccountID == list.AccountID
                                                                       select tblogin).Single();
                                    if (BLoginss.lastLoginTime == null || BLoginss.LoginFrequency == null)
                                    {
                                        BLoginss.RegisterTime          = DateTime.Now;
                                        BLoginss.lastLoginTime         = DateTime.Now;
                                        BLoginss.LoginFrequency        = 1;
                                        BLoginss.EndLoginTime          = DateTime.Now;
                                        myModels.Entry(BLoginss).State = System.Data.Entity.EntityState.Modified;
                                        myModels.SaveChanges();
                                    }
                                    else
                                    {
                                        BLoginss.lastLoginTime         = BLoginss.EndLoginTime;
                                        BLoginss.LoginFrequency        = BLoginss.LoginFrequency + 1;
                                        BLoginss.EndLoginTime          = DateTime.Now;
                                        myModels.Entry(BLoginss).State = System.Data.Entity.EntityState.Modified;
                                        myModels.SaveChanges();
                                    }
                                    break;
                                }
                            }

                            str = "success";
                        }
                        else
                        {
                            str = "fail";
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    str = "validCodeFail";
                }
            }
            else
            {
                str = "writevalidCode";
            }
            return(Json(str, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public ActionResult UserLogin(B_AccountTable B_Account)
        {
            string strMed              = "fail";
            string struser             = Request["User"];;     //用户
            string strPassword         = Request["password"];
            string strvalidCode        = Request["validCode"]; //验证码
            string strSessionValidCode = "";                   //获取 session中的验证码

            try
            {
                strSessionValidCode = Session["ValidCode"].ToString();
            }
            catch (Exception)
            {
                return(Json("loginerror", JsonRequestBehavior.AllowGet));
            }
            //判断验证码
            if (strSessionValidCode.Equals(strvalidCode.Trim(), StringComparison.InvariantCultureIgnoreCase))
            {
                try
                {
                    //根据 UserNuber 查询用户
                    var dbUser = (from tbUser in myDYXTEntities.B_AccountTable
                                  where tbUser.User == struser.Trim()
                                  select new
                    {
                        tbUser.AccountID,
                        tbUser.User,
                        tbUser.Password
                    }).Single();
                    //将用户输入的密码进行AES265后与数据库中的密码对比
                    string password = AESEncryptHelper.AESEncrypt(strPassword);
                    if (dbUser.Password.Trim().Equals(password))
                    {
                        B_UserTable dbuser = (from tbuser in myDYXTEntities.B_UserTable
                                              where tbuser.AccountID == dbUser.AccountID
                                              select tbuser).Single();
                        if (dbuser.UserTypeID == 1 || dbuser.UserTypeID == 4 || dbuser.UserTypeID == 12)
                        {
                            Session["AccountID"] = dbUser.AccountID;

                            B_UserTable varFundCost = (from tbuser in myDYXTEntities.B_UserTable
                                                       where tbuser.AccountID == dbUser.AccountID
                                                       select tbuser).Single();
                            B_ManagerRecord ManagerRecord = new B_ManagerRecord();
                            ManagerRecord.UserID    = varFundCost.UserID;
                            ManagerRecord.BearFruit = "成功".Trim();
                            ManagerRecord.Content   = "用户" + varFundCost.UserName.Trim() + "在“" + DateTime.Now + "”登录后台";
                            ManagerRecord.LoginTime = DateTime.Now;
                            string IP = "";
                            try
                            {
                                string pHostName = Dns.GetHostName();//Dns类


                                IPHostEntry myAddress = Dns.GetHostEntry(pHostName);
                                //myAddress.Aliases
                                IPAddress[] myIPAddress = myAddress.AddressList;

                                foreach (IPAddress add in myIPAddress)
                                {
                                    if (add.AddressFamily == AddressFamily.InterNetwork)
                                    {
                                        IP = add.ToString();
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                            }
                            ManagerRecord.LoginIP = IP;
                            myDYXTEntities.B_ManagerRecord.Add(ManagerRecord);
                            myDYXTEntities.SaveChanges();

                            strMed = "strsuccess";//登录成功
                        }
                        else
                        {
                            strMed = "strfail";//登录成功
                        }
                    }
                    else
                    {
                        strMed = "strpassword";//密码错误
                    }
                }
                catch (Exception e)
                {
                    strMed = "usernoexsit";//没有此用户
                }
            }
            else
            {
                strMed = "ValidCodeErro";//验证码错误
            }
            return(Json(strMed, JsonRequestBehavior.AllowGet));
        }
예제 #7
0
        //认购页面
        public ActionResult SubscribeIndex(int LoanID, BsgridPage bsgridPage)
        {
            try
            {
                string         strUserId = Session["AccountID"].ToString();
                int            intUserId = Convert.ToInt32(strUserId);
                B_AccountTable accouunt  = (from tbAccountTable in myModels.B_AccountTable
                                            where tbAccountTable.AccountID == intUserId
                                            select tbAccountTable).Single();
                ViewBag.User = accouunt.User;

                B_LoanTable notice = (from tbloan in myModels.B_LoanTable
                                      join tbuser in myModels.B_UserTable on tbloan.UserID equals tbuser.UserID
                                      join tbLoanDeadline in myModels.S_LoanDeadlineTable on tbloan.LoanDeadlineID equals tbLoanDeadline.LoanDeadlineID
                                      join tbtree in myModels.S_Treetoptypetalbe on tbloan.TreetoptypeID equals tbtree.TreetoptypeID
                                      join tbRepaymentWayTable in myModels.S_RepaymentWayTable on tbloan.RepaymentWayID equals tbRepaymentWayTable.RepaymentWayID
                                      where tbloan.LoanID == LoanID
                                      select new LoanVo
                {
                    LoanID = tbloan.LoanID,
                    UserID = tbloan.UserID,
                    UserName = tbuser.UserName,
                    Loantitle = tbloan.Loantitle,
                    PaymentNumber = tbloan.PaymentNumber,
                    LoanMoney = tbloan.LoanMoney,
                    Rate = tbloan.Rate,
                    LoanDeadlineName = tbLoanDeadline.LoanDeadlineName,
                    RepaymentWayName = tbRepaymentWayTable.RepaymentWayName,
                    LowestTenderMoney = tbloan.LowestTenderMoney,
                    AlreadyLoan = tbloan.AlreadyLoan,
                    SurplusLoan = tbloan.SurplusLoan,
                    Scheduleinvestment = tbloan.Scheduleinvestment
                }).Single();
                ViewBag.notice = notice;

                B_LoanTable Loanxinix = (from tbloan in myModels.B_LoanTable
                                         where tbloan.LoanID == LoanID
                                         select tbloan).Single();
                int         userid    = Convert.ToInt32(Loanxinix.UserID);
                B_UserTable userxinxi = (from tbuser in myModels.B_UserTable
                                         where tbuser.UserID == userid
                                         select new UserVo
                {
                    UserName = tbuser.UserName,
                    Sex = tbuser.Sex,
                    MonthIncome = tbuser.MonthIncome,
                    ReleaseTimeStr = tbuser.BornDate.ToString(),
                    MarriageState = tbuser.MarriageState,
                    EducationalBackground = tbuser.EducationalBackground,
                    WhetherBuyCar = tbuser.WhetherBuyCar,
                    housingCondition = tbuser.housingCondition,
                    Issue = tbuser.Issue,
                    PropertyAmounts = tbuser.PropertyAmounts,
                    CompensatoryMoney = tbuser.CompensatoryMoney,
                }).Single();
                ViewBag.userxinxi = userxinxi;
                var vraloan = (from tbloan in myModels.B_LoanTable
                               where tbloan.UserID == userid
                               select tbloan).ToList();
                decimal rowloan = vraloan.Count;
                ViewBag.rowloan = rowloan;//发布借款
                var vraloanStatusID = (from tbloan in myModels.B_LoanTable
                                       where tbloan.UserID == userid && tbloan.StatusID == 10
                                       select tbloan).ToList();
                decimal varvraloanStatusID = vraloanStatusID.Count;
                ViewBag.varvraloanStatusID = varvraloanStatusID;//成功借款

                var vrastrloan = (from tbloanid in myModels.B_LoanTable
                                  where tbloanid.UserID == userid && (tbloanid.StatusID == 12 || tbloanid.StatusID == 13)
                                  select tbloanid).ToList();
                decimal rowvrastrloan = vrastrloan.Count;
                ViewBag.rowvrastrloan = rowvrastrloan;//还请笔数
            }
            catch (Exception e)
            {
            }

            return(View());
        }