/// <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()); }
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()); }