public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 || res["PushID"] == null || res["PushID"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整")); } else { uid = res["UID"].ToString().Trim(); pushid = res["PushID"].ToString().Trim(); OPUserManager userManager = new OPUserManager(); Hashtable user = userManager.GetUserInfoByUserID(uid); if (user == null || user.Keys.Count <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户不存在")); } else { Hashtable modifyUser = new Hashtable(); modifyUser["PushID"] = pushid; bool issuccess = userManager.AddOrEditUserInfo(modifyUser, uid); if (!issuccess) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "保存失败")); } } return(SiteHelper.GetJsonFromHashTable(null, "success", "保存成功", "SetPushInfo")); } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Save_Click(object sender, EventArgs e) { try { Hashtable ht = new Hashtable(); ht["UserName"] = UserName.Value; ht["NickName"] = NickName.Value; ht["UserSex"] = UserSex.Value; ht["ReceiveSMS"] = ReceiveSMS.Value; ht["Tel"] = Tel.Value; ht["Email"] = Email.Value; ht["IDCardNum"] = IDCardNum.Value; ht["UserState"] = 1; if (!string.IsNullOrEmpty(_key)) { ht["UserID"] = _key; } else { ht["UserID"] = CommonHelper.GetGuid; ht["DeleteMark"] = "1"; ht["Createtime"] = DateTime.Now; } bool returnValue = userManager.AddOrEditUserInfo(ht, _key); List <string> list = new List <string>(); foreach (ListItem item in ParkingList.Items) { if (item.Selected) { list.Add(item.Value); } } returnValue = userManager.SaveUserParkingList(ht["UserID"].ToString(), list); if (returnValue) { ShowMsgHelper.AlertMsgNoFresh("操作成功!"); } else { ShowMsgHelper.Alert_Error("操作失败!"); } } catch (Exception ex) { throw ex; } }
public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["Mobile"] == null || res["VerificationCode"] == null || res["Client"] == null || res["Mobile"].ToString().Trim().Length <= 0 || res["VerificationCode"].ToString().Trim().Length <= 0 || res["Client"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "登录数据不完整")); } else { OPUserManager userManager = new OPUserManager(); SmsInfoManager sim = new SmsInfoManager(); bool isAllowLogin = false; //获取参数 mobile = res["Mobile"].ToString().Trim(); verificationCode = res["VerificationCode"].ToString().Trim(); client = res["Client"].ToString().Trim(); DataTable user = userManager.GetUserInfoByMobile(mobile); //判断用户是否在系统中进行过注册 if (user == null || user.Rows.Count == 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户未在系统注册,登录失败")); } if (user != null && user.Rows.Count > 0) { string vcode = sim.GetVerCodeByMobile(mobile); if (vcode != null && verificationCode.Trim() == vcode.Trim()) { isAllowLogin = true; } else { return(SiteHelper.GetJsonFromHashTable(null, "faild", "验证码不正确")); } } if (isAllowLogin) { //更新最后登录时间 Hashtable userh = new Hashtable(); userh["LastloginTime"] = SiteHelper.GetWebServerCurrentTime(); userManager.AddOrEditUserInfo(userh, user.Rows[0]["UserID"].ToString()); //响应数据到客户端 Hashtable huser = DataTableHelper.DataTableToHashtable(user); DataTable dt_parking = userManager.GetUserParkingList(huser["USERID"].ToString()); DataRow dr = dt_parking.NewRow(); dr["ID"] = System.Guid.Empty.ToString(); dr["ThisName"] = "停车点外"; dt_parking.Rows.InsertAt(dr, 0); huser["PARKLIST"] = dt_parking; //huser["PARKLIST"] = userManager.GetUserParkingList(huser["USERID"].ToString()); return(SiteHelper.GetJsonFromHashTable2(huser, "success", "登录成功", "UserInfo")); } else { return(SiteHelper.GetJsonFromHashTable(null, "faild", "登录失败,请稍后重试")); } } }
public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["SetType"] == null || res["Content"] == null || res["UID"] == null || res["SetType"].ToString().Trim().Length <= 0 || res["Content"].ToString().Trim().Length <= 0 || res["UID"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整")); } else { OPUserManager userManager = new OPUserManager(); //1:头像,2:昵称,3:性别,4:电子邮箱 uid = res["UID"].ToString().Trim(); setType = res["SetType"].ToString().Trim(); content = res["Content"].ToString().Trim(); Hashtable user = userManager.GetUserInfoByUserID(uid); if (user == null || user.Keys.Count <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户不存在")); } else { if (setType == "1") { //修改头像 try { string imgPath = BitmapHelper.toUpload(content); Hashtable modifyUser = new Hashtable(); modifyUser["HeadPortrait"] = imgPath; bool issuccess = userManager.AddOrEditUserInfo(modifyUser, uid); if (!issuccess) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户头像保存失败")); } else { user["HeadPortrait"] = imgPath; } } catch (Exception e1) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户头像保存失败")); } } else if (setType == "2") { //修改姓名 Hashtable modifyUser = new Hashtable(); modifyUser["NickName"] = content; bool issuccess = userManager.AddOrEditUserInfo(modifyUser, uid); if (!issuccess) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "昵称保存失败")); } else { user["NickName"] = content; } } else if (setType == "3") { //修改昵称 Hashtable modifyUser = new Hashtable(); modifyUser["UserSex"] = content; bool issuccess = userManager.AddOrEditUserInfo(modifyUser, uid); if (!issuccess) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "性别保存失败")); } else { user["UserSex"] = content; } } else if (setType == "4") { //修改邮箱 Hashtable modifyUser = new Hashtable(); modifyUser["Email"] = content; bool issuccess = userManager.AddOrEditUserInfo(modifyUser, uid); if (!issuccess) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "电子邮箱保存失败")); } else { user["Email"] = content; } } else { return(SiteHelper.GetJsonFromHashTable(null, "faild", "修改项不合法")); } } DataTable dt = userManager.GetUserInfoByMobile(SiteHelper.GetHashTableValueByKey(user, "Tel")); if (dt == null || dt.Rows.Count <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "网络异常")); } else { Hashtable huser = DataTableHelper.DataRowToHashTable(dt.Rows[0]); return(SiteHelper.GetJsonFromHashTable(huser, "success", "操作成功", "UserInfo")); } } }