Exemple #1
0
 public JsonResult DeleteUser(int id)
 {
     AjaxResult result = new AjaxResult();
     try
     {
         UserService service = new UserService();
         if (!service.DeleteUser(id))
         {
             result.ExceptionInfo = "删除失败";
         }
     }
     catch (Exception ex)
     {
         LogService.Log("DeleteUser", ex.ToString());
         result.ExceptionInfo = "删除失败";
     }
     return Json(result);
 }
Exemple #2
0
 public JsonResult CancelUserVip(int id)
 {
     AjaxResult result = new AjaxResult();
     try
     {
         UserService service = new UserService();
         if (!service.CancelUserVip(id))
         {
             result.ExceptionInfo = "取消用户VIP失败";
         }
     }
     catch (Exception ex)
     {
         LogService.Log("CancelUserVip", ex.ToString());
         result.ExceptionInfo = "取消用户VIP失败";
     }
     return Json(result);
 }
Exemple #3
0
 public JsonResult DeleteResult(string ids)
 {
     AjaxResult result=new AjaxResult();
     try
     {
         if (!string.IsNullOrEmpty(ids))
         {
             AdminUserManager adminManager = new AdminUserManager();
             string[] uIds = ids.Split(',').ToArray();
             foreach (var id in uIds)
             {
                 adminManager.deleteAdminUser(id.ToInt32());
             }
         }
     }
     catch (Exception ex)
     {
         LogService.Log("DeleteResult", ex.ToString());
     }
     return Json(result);
 }
Exemple #4
0
        public JsonResult CancelIdentify(int id)
        {
            AjaxResult result = new AjaxResult();
            try
            {
                UserService service = new UserService();
                User user = service.GetUserById(id);

                if (user.Vip.HasValue && user.Vip == (int)VipState.VIP)
                {
                    result.ExceptionInfo = "该用户是VIP会员,不能取消认证。如确实需要,请先取消VIP会员之后重新尝试";
                }
                else if (!service.CancelIdentify(id))
                {
                    result.ExceptionInfo = "取消会员认证失败";
                }
            }
            catch (Exception ex)
            {
                LogService.Log("CancelIdentify", ex.ToString());
                result.ExceptionInfo = "取消会员认证失败";
            }
            return Json(result);
        }
Exemple #5
0
        public JsonResult SetUserVip(int id)
        {
            AjaxResult result = new AjaxResult();
            try
            {
                UserService service = new UserService();
                User user = service.GetUserById(id);

                if (user.Vip.HasValue && user.Vip == (int)VipState.VIP)
                {
                    result.ExceptionInfo = "该用户已经是VIP会员";
                }
                else if (user.Vip.HasValue && (user.Vip == (int)VipState.Normal || user.Vip == (int)VipState.Invalid))
                {
                    result.ExceptionInfo = "只有认证会员才能设置VIP,请先通知会员进行认证,保证信息准确";
                }
                else if (!service.SetUserToVip(id))
                {
                    result.ExceptionInfo = "用户升级1年VIP失败";
                }
            }
            catch (Exception ex)
            {
                LogService.Log("SetUserVip", ex.ToString());
                result.ExceptionInfo = "用户升级1年VIP失败";
            }
            return Json(result);
        }
Exemple #6
0
 public JsonResult ReviewedVipInfo(int vipId, int userId)
 {
     AjaxResult result = new AjaxResult();
     try
     {
         UserService service = new UserService();
         if (!service.ReviewedVipInfo(vipId, userId))
         {
             result.ExceptionInfo = "审核失败";
         }
     }
     catch (Exception ex)
     {
         LogService.Log("ReviewedVipInfo", ex.ToString());
         result.ExceptionInfo = "审核失败";
     }
     return Json(result);
 }
Exemple #7
0
 public JsonResult VerifyUserName(string field, string value)
 {
     AjaxResult result = new AjaxResult();
     try
     {
         userService = new UserService();
         if (!userService.VerifyUserInfo(field, value))
         {
             result.ExceptionInfo = "该用户名已经被注册!";
             result.ErrorCode = 103;
         }
     }
     catch (Exception ex)
     {
         LogService.Log("VerifyUserName", ex.ToString());
         result.ExceptionInfo = "出错了!";
         result.ErrorCode = 102;
     }
     return Json(result);
 }
Exemple #8
0
 public JsonResult VerifyCellphone(string cellphone)
 {
     AjaxResult result = new AjaxResult();
     //try
     //{
     //    var vcode = GetRandom();
     //    ISendShortMessageService smsSerive = SMSServiceFactory.Create();
     //    var message=new ShortMessage {
     //        ToPhoneNumber=cellphone,
     //        Content = vcode,
     //        Parameters = new []{vcode,"300"}
     //    };
     //    var response = smsSerive.SendShortMessage(message);
     //    if (response.IsSuccess)
     //    {
     //        Session["vcode"] = vcode;
     //    }
     //    else
     //    {
     //        result.ExceptionInfo = "发送验证码失败";
     //        result.ErrorCode = 403;
     //    }
     //    InnerSMSService smService = new InnerSMSService();
     //    smService.AddSMSRecordAsync(new Witbird.SHTS.Model.ShortMessage
     //    {
     //        Cellphone = message.ToPhoneNumber,
     //        State = response.IsSuccess? 0:1
     //    });
     //}
     //catch (Exception ex)
     //{
     //    LogService.Log("发送验证码", ex.ToString());
     //    result.ExceptionInfo = "发送验证码失败";
     //    result.ErrorCode = 102;
     //}
     return Json(result);
 }
Exemple #9
0
 public JsonResult VerifyBeforeVcode(string vcode)
 {
     AjaxResult result = new AjaxResult();
     if (!string.Equals(vcode,
         Session["validataCode"].ToString(),
         StringComparison.InvariantCultureIgnoreCase))
     {
         result.ExceptionInfo = "error";
     }
     return Json(result);
 }
Exemple #10
0
 public JsonResult UpdateStatus(int id,int sid)
 {
     AjaxResult result=new AjaxResult();
     try
     {
         ActivityService service = new ActivityService();
         service.UpdateActivityStatu(new Activity
         {
             Id=id,
             State = sid
         });
     }
     catch (Exception e)
     {
         LogService.Log("Update Status Activitys 出错了!", e.ToString());
         result.ExceptionInfo = "出错了";
         result.ErrorCode = 102;
     }
     return Json(result);
 }