Esempio n. 1
0
        /// <summary>
        /// 更新学员密码
        /// </summary>
        /// <param name="xueyh">学员号</param>
        /// <param name="oldpassword">旧密码</param>
        /// <param name="newpassword">新密码</param>
        /// <returns></returns>
        public OperateResultModel UpdatePassowrd(string xueyh, string oldpassword, string newpassword, string editer)
        {
            OperateResultModel orm     = new OperateResultModel();
            tbl_xueyuan        xueyuan = QueryXueyuan(xueyh);

            if (xueyuan == null)
            {
                orm.success = false;
                orm.message = "学员号不存在";
            }
            else
            {
                if (xueyuan.password == oldpassword)
                {
                    tbl_xueyuan newmodel = new tbl_xueyuan()
                    {
                        xueyh    = xueyh,
                        password = newpassword,
                        editdate = DateTime.Now,
                        editer   = editer
                    };
                    orm.success = true;
                }
                else
                {
                    orm.success = false;
                    orm.message = "旧密码不正确";
                }
            }
            return(orm);
        }
Esempio n. 2
0
 public JsonResult Valid(string xueyh, string password, string jiaxid = "1")
 {
     try
     {
         xueyh = (xueyh ?? "").ToUpper();
         JiaxInfo bll      = new JiaxInfo();
         bool     bolValid = bll.IsValid(xueyh, password, jiaxid);
         if (bolValid == false)
         {
             throw new Exception("用户名或密码错");
         }
         tbl_xueyuan user = bll.QueryXueyuan(xueyh);
         return(Json(new
         {
             success = true,
             user = user
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             success = false,
             message = ex.Message
         }));
     }
 }
Esempio n. 3
0
        public JsonResult Update(tbl_xueyuan model)
        {
            model.editer   = SessionUser.UserNo;
            model.editdate = DateTime.Now;
            JiaxInfo           jiaxinfo = new JiaxInfo();
            OperateResultModel orm      = jiaxinfo.UpdateXueyuan(model);

            return(JsonResultHelper.ConvertToJsonResult(orm));
        }
Esempio n. 4
0
        public PartialViewResult Edit(string xueyh)
        {
            JiaxInfo    jiaxinfo = new JiaxInfo();
            tbl_xueyuan model    = null;

            if (!string.IsNullOrEmpty(xueyh))
            {
                model = jiaxinfo.QueryXueyuan(xueyh);
            }
            return(PartialView(model));
        }
Esempio n. 5
0
        /// <summary>
        /// 学员是否
        /// </summary>
        /// <param name="xueyh">学员号</param>
        /// <param name="password">密码</param>
        /// <param name="jiaxid">驾校ID</param>
        /// <returns></returns>
        public bool IsValid(string xueyh, string password, string jiaxid)
        {
            tbl_xueyuan xueyuan = QueryXueyuan(xueyh);

            if (xueyuan == null)
            {
                return(false);
            }

            if (jiaxid != xueyuan.jiaxid)
            {
                throw new Exception("你不是当前驾校的学员");
            }

            return(xueyuan.password == password && xueyuan.jiaxid == jiaxid);
        }
Esempio n. 6
0
 public JsonResult User(string xueyh)
 {
     try
     {
         JiaxInfo    bll  = new JiaxInfo();
         tbl_xueyuan user = bll.QueryXueyuan(xueyh);
         return(Json(new
         {
             success = true,
             user = user
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             success = false,
             message = ex.Message
         }));
     }
 }
Esempio n. 7
0
        /// <summary>
        /// 获得练习内容
        /// </summary>
        /// <param name="type">类型</param>
        /// <param name="xueyh">学员号</param>
        /// <param name="xingming">姓名</param>
        /// <param name="source">
        /// 来源
        /// 1:网页
        /// 2:APP
        /// 3:小程序
        /// </param>
        /// <param name="kemu">
        /// 科目
        /// KM1:科目一
        /// KM4:科目四
        /// KMA:客车
        /// KMB:货车
        /// </param>
        /// <returns></returns>
        public JsonResult bank(string type, string xueyh, string xingming, string source, string kemu, string paperid)
        {
            try
            {
                JiaxInfo    jiax    = new JiaxInfo();
                tbl_xueyuan xueyuan = jiax.QueryXueyuan(xueyh);
                if (xueyuan != null)
                {
                    xingming = xueyuan.xingming;
                }


                Bank bll = new Bank();
                OperateResultModel orm       = null;
                string             papername = "";
                type = Server.UrlDecode(type);
                switch (type)
                {
                case "顺序练习":
                case "1-1":    //所有数据-顺序
                    papername = "顺序练习";
                    orm       = bll.QueryBanks(null, null, null, null, true, kemu, null);
                    break;

                case "随机练习":
                case "1-2":    //所有数据-随机
                    papername = "随机练习";
                    orm       = bll.QueryBanks(null, null, null, null, false, kemu, null);
                    break;

                case "判断题":
                case "1-3":    //判断题-顺序
                    papername = "判断题";
                    orm       = bll.QueryBanks(null, "判断题", null, null, true, kemu, null);
                    break;

                case "1-4":    //判断题-随机
                    orm = bll.QueryBanks(null, "判断题", null, null, false, kemu, null);
                    break;

                case "单选题":
                case "1-5":    //单选题-顺序
                    papername = "单选题";
                    orm       = bll.QueryBanks(null, "单选题", null, null, true, kemu, null);
                    break;

                case "1-6":    //单选题-随机
                    orm = bll.QueryBanks(null, "单选题", null, null, false, kemu, null);
                    break;

                case "多选题":
                case "1-7":    //多选题-顺序
                    papername = "多选题";
                    orm       = bll.QueryBanks(null, "多选题", null, null, true, kemu, null);
                    break;

                case "1-8":    //多选题-随机
                    orm = bll.QueryBanks(null, "多选题", null, null, false, kemu, null);
                    break;

                case "图片题":
                case "1-9":    //图片题-顺序
                    papername = "图片题";
                    orm       = bll.QueryBanks(null, null, true, null, true, kemu, null);
                    break;

                case "1-10":    //图片题-随机
                    orm = bll.QueryBanks(null, null, true, null, false, kemu, null);
                    break;

                case "动画题":
                case "1-11":    //动画题-顺序
                    papername = "动画题";
                    orm       = bll.QueryBanks(null, null, null, true, true, kemu, null);
                    break;

                case "1-12":    //动画题-随机
                    orm = bll.QueryBanks(null, null, null, true, false, kemu, null);
                    break;

                case "未做题练习":
                case "1-13":    //未做题练习
                    papername = "未做题练习";
                    orm       = bll.QueryBanksForNotStudy(xueyh);
                    break;

                case "模拟考试":
                case "随机试卷":
                case "2-1":
                    orm       = bll.QueryRandomPaper(kemu);
                    papername = "随机试卷";
                    break;

                case "重点试卷":
                case "2-2":
                    orm = bll.QueryBanksOfPaper(Convert.ToInt32(paperid));
                    tbl_paper papermodel = bll.QueryPaper(Convert.ToInt32(paperid));
                    papername = papermodel == null ? "重点试卷" : papermodel.papername;
                    break;

                default:
                    throw new Exception("题目类型选择错误");
                }

                CommonBll commonbll = new CommonBll();
                string    testno    = commonbll.GetSerialNo("Record", "");
                bool      istest    = type.IndexOf("考试") > 0 || type.IndexOf("试卷") > 0;
                //把查询到的记录插入用户练习记录
                tbl_test_records record = new tbl_test_records()
                {
                    createdate  = DateTime.Now,
                    creater     = xueyh,
                    xingming    = xingming,
                    oknum       = 0,
                    source      = source,
                    kemu        = kemu,
                    testno      = testno,
                    projecttype = papername,
                    testtype    = istest ? "考试" : "练习",
                    totalnum    = orm.total,
                    xueyh       = xueyh
                };
                Study study  = new Study();
                var   tblist = (List <tbl_bank>)orm.rows;
                OperateResultModel ormtest = new OperateResultModel();
                ormtest.success = true;
                if (tblist != null && tblist.Count() != 0)
                {
                    ormtest = study.InsertTestRecord(record);
                }
                if (ormtest.success)
                {
                    orm.message = testno;
                    return(JsonResultHelper.ConvertToJsonResult(orm));
                }
                else
                {
                    return(JsonResultHelper.ConvertToJsonResult(ormtest));
                }
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    success = false,
                    message = ex.Message,
                    total = 0
                }));
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public OperateResultModel UpdateXueyuan(tbl_xueyuan model)
        {
            TblXueyuanDal dal = new TblXueyuanDal();

            return(dal.Update(model));
        }
Esempio n. 9
0
        /// <summary>
        /// 插入信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public OperateResultModel InsertXueyuan(tbl_xueyuan model)
        {
            TblXueyuanDal dal = new TblXueyuanDal();

            return(dal.Insert(model));
        }