Exemple #1
0
 public bool Edit(Info_Admin model)
 {
     //修改
     if (model != null)
     {
         Dao.Update <Info_Admin>(model);
     }
     if (Dao.Save())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
 public bool Add(Info_Admin model)
 {
     //添加
     if (model != null)
     {
         model.AdminID = Guid.NewGuid();
         Dao.Create <Info_Admin>(model);
     }
     if (Dao.Save())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #3
0
 public bool Delete(Guid ID)
 {
     //物理删除
     if (ID != Guid.Empty)
     {
         Info_Admin model = Dao.GetEntities <Info_Admin>(x => x.AdminID == ID).FirstOrDefault();
         Dao.Delete <Info_Admin>(model);
     }
     if (Dao.Save())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #4
0
        public JsonResult GetLoginByPhone(Info_Admin model)
        {
            InfoAdmin_bll     infoAdminbll = new InfoAdmin_bll();
            JsonResult        jr           = new JsonResult();
            List <Info_Admin> admin        = infoAdminbll.GetPhoneList(model.Account, model.AdminPwd).ToList();
            //var RandomNum = Guid.NewGuid().ToString().Substring(0, 6);
            var Adminpwd = MD5Helper.GetMd5Hash(model.AdminPwd + Random);

            if (admin.Count != 0)
            {
                foreach (var item in admin)
                {
                    CookieHelper.SetCookie("ID", item.AdminID.ToString(), DateTime.Now.AddMinutes(10));
                    CookieHelper.SetCookie("Name", item.AdminName.ToString(), DateTime.Now.AddMinutes(10));
                    CookieHelper.SetCookie("Password", Adminpwd, DateTime.Now.AddMinutes(10));
                }
                jr.Data = new { code = 10000, result = true, message = "登录成功!", returnUrl = Url.Content("~/GetTrackLocationByList") };
            }
            else
            {
                jr.Data = new { code = 10001, result = false, message = "账号或密码错误!" };
            }
            return(jr);
        }