public void GetTreeByMaster() { string Attribute = Request["Attribute"];//1:老师 2:学生 if (Attribute == "1") { string where = " CId='" + CurrentMaster.Company.Id + "'"; string name = (Request["name"] == null ? "" : Request["name"]); //查询过滤条件 if (name != "") { where += " and Nickname like '%" + name + "%'"; } DataTable mytab = new BllSysUser().GetTreeList(where).Tables[0]; //获取所有树 GetTreeNode(mytab); Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); } else { //查询班级 string where = " Type=1 and Status=" + (int)StatusEnum.正常; DataTable mytab = new BllSysGroup().GetTreeList(where).Tables[0]; //获取所有树 string userwhere = " CId='" + CurrentMaster.Company.Id + "'"; DataTable usermytab = new BllSysUser().GetTreeList(userwhere).Tables[0]; //获取所有树 GetClassNode(mytab, usermytab); Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); } }
public void ReSetPwd() { var json = new ModJsonResult(); try { string id = Request["id"]; string pwd = DESEncrypt.Encrypt("666666"); int result = new BllSysUser().ReSetPwd(id, pwd); if (result <= 0) { json.success = false; json.msg = "重置失败!"; } else { json.success = true; json.msg = "重置成功!"; } } catch (Exception ex) { json.success = false; json.msg = "操作失败!"; } Response.Write(new JavaScriptSerializer().Serialize(json).ToString()); Response.End(); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { BllSysUser User = new BllSysUser(); var Model = User.LoadData(id); if (Model != null) { Model.Status = (int)StatusEnum.除; int result = User.Update(Model); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
/// <summary> ///根据用户编号推送用户 /// </summary> /// <param name="UserIdlist"></param> /// <param name="NoticeTitle">标题</param> /// <param name="NoticeContent">内容</param> /// <param name="custom_content">自定义内容</param> /// <returns></returns> public bool SendUserMsg(string UserIdlist, string NoticeTitle, string NoticeContent, string custom_content) { bool flag = false; try { if (!string.IsNullOrEmpty(UserIdlist)) { //获取推送用户列表 string newId = ""; string[] str = UserIdlist.Split(','); if (str.Length > 1) { for (int i = 0; i < str.Length - 1; i++) { newId += "'" + str[i] + "',"; } newId = newId.Substring(0, newId.Length - 1); } else { newId = "'" + str[0] + "'"; } List <ModPushUserView> list = new BllSysUser().GetPushUserList(newId); int sum = 0; if (list != null && list.Count > 0) { foreach (ModPushUserView item in list) { if (!string.IsNullOrEmpty(item.BDUserId) && !string.IsNullOrEmpty(item.BDChannelId)) { string response = BaiduPushExecute.SendPush(ApiKey, SecretKey, sandbox, item.PaltForm, item.BDUserId, item.BDChannelId, NoticeTitle, NoticeContent, custom_content); BaiduRespons bdRespons = js.Deserialize <BaiduRespons>(response); if (bdRespons.response_params.success_amount == 1) { sum += 1; } } } if (sum == list.Count) { return(true); } return(true); } } } catch { flag = false; } return(flag); }
/// <summary> /// 页面列表 /// </summary> public void SearchData() { var search = base.GetSearch(); search.AddCondition("IsCarer=0");//查询普通用户 //查询自己所属公司 //search.AddCondition("CId='" + CurrentMaster.Cid + "'"); if (!CurrentMaster.IsMain) { if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建) { search.AddCondition("CreaterId='" + CurrentMaster.Id + "'"); } } var jsonResult = new BllSysUser().SearchData(search); WriteJsonToPage(jsonResult); }
/// <summary> /// DisableUse /// </summary> public void DisableUse() { var msg = new ModJsonResult(); string key = Request["id"]; int result = new BllSysUser().UpdateStatus(0, key); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } WriteJsonToPage(msg.ToString()); }
public void SaveData(ModSysUser t) { BllSysUser bll = new BllSysUser(); ModJsonResult json = new ModJsonResult(); string TypeId = Request["TypeId"].ToString(); t.Pwd = (string.IsNullOrEmpty(t.Pwd) ? DESEncrypt.Encrypt("666666") : DESEncrypt.Encrypt(t.Pwd.Trim())); t.Name = t.Name.Trim(); t.Nickname = t.Nickname.Trim(); t.OrganizaId = TypeId; if (!string.IsNullOrEmpty(Request["modify"])) //修改 { var model = bll.LoadData(t.Id); model.Pwd = t.Pwd; model.Name = t.Name; model.Nickname = t.Nickname; model.OrganizaId = t.OrganizaId; model.Sex = t.Sex; model.Tel = t.Tel; model.Email = t.Email; int result = bll.Update(model); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } } else { t.Id = Guid.NewGuid().ToString(); t.Status = (int)StatusEnum.正常; t.CId = CurrentMaster.Cid; t.CreaterId = CurrentMaster.Id; t.CreateTime = DateTime.Now; t.CId = CurrentMaster.Cid; t.MobileCode = ""; //机器码 t.Birthday = DateTime.Now; t.BDUserId = ""; t.BDChannelId = ""; t.PaltForm = 0;//登录平台 t.Visible = true; t.IsCarer = false; if (t.Sex == 0) { t.HeadImg = (t.HeadImg == null ? "/Resource/css/icons/head/GTP_hmale_big.jpg" : ""); } else { t.HeadImg = (t.HeadImg == null ? "/Resource/css/icons/head/GTP_hfemale_big.jpg" : ""); } int result = bll.Insert(t); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } } WriteJsonToPage(json.ToString()); }