private void DelUserHouseOwner(HttpContext context) { if (string.IsNullOrWhiteSpace(context.Request.Form["houseOwnerId"])) { context.Response.Write("{\"success\": false, \"message\": \"参数houseOwnerId值不能为空,请检查\"}"); return; } Guid houseOwnerId = Guid.Empty; Guid.TryParse(context.Request.Form["houseOwnerId"], out houseOwnerId); if (houseOwnerId.Equals(Guid.Empty)) { context.Response.Write("{\"success\": false, \"message\": \"参数houseOwnerId值无效,请检查\"}"); return; } if (string.IsNullOrWhiteSpace(context.Request.Form["userName"])) { context.Response.Write("{\"success\": false, \"message\": \"参数userName值不能为空,请检查\"}"); return; } MembershipUser user = Membership.GetUser(context.Request.Form["userName"]); if (user == null) { context.Response.Write("{\"success\": false, \"message\": \"参数userName值无效,请检查\"}"); return; } UserHouseOwner bll = new UserHouseOwner(); bll.Delete(user.ProviderUserKey, houseOwnerId); context.Response.Write("{\"success\": true, \"message\": \"操作成功!\"}"); return; }
private void AddUserHouseOwner(HttpContext context) { if (string.IsNullOrWhiteSpace(context.Request.Form["houseOwnerId"])) { context.Response.Write("{\"success\": false, \"message\": \"参数houseOwnerId值不能为空,请检查\"}"); return; } Guid houseOwnerId = Guid.Empty; Guid.TryParse(context.Request.Form["houseOwnerId"], out houseOwnerId); if (houseOwnerId.Equals(Guid.Empty)) { context.Response.Write("{\"success\": false, \"message\": \"参数houseOwnerId值无效,请检查\"}"); return; } if (string.IsNullOrWhiteSpace(context.Request.Form["userName"])) { context.Response.Write("{\"success\": false, \"message\": \"参数userName值不能为空,请检查\"}"); return; } MembershipUser user = Membership.GetUser(context.Request.Form["userName"]); if (user == null) { context.Response.Write("{\"success\": false, \"message\": \"参数userName值无效,请检查\"}"); return; } UserHouseOwnerInfo model = new UserHouseOwnerInfo(); model.UserId = user.ProviderUserKey; model.HouseOwnerId = houseOwnerId; model.Password = ""; UserHouseOwner bll = new UserHouseOwner(); string message = "操作成功"; if (bll.Insert(model) == 110) { message = "已存在相同记录"; } context.Response.Write("{\"success\": true, \"message\": \"" + message + "!\"}"); return; }
private void Bind() { //查询条件 GetSearchItem(); List <HouseOwnerInfo> list = null; int totalRecords = 0; UserHouseOwner bll = new UserHouseOwner(); if (parms != null && parms.Count() > 0) { list = bll.GetListByJoin(pageIndex, pageSize, out totalRecords, sqlWhere, parms == null ? null : parms.ToArray()); } else { list = bll.GetListByJoin(pageIndex, pageSize, out totalRecords, "", null); } rpData.DataSource = list; rpData.DataBind(); myDataAppend += "<div id=\"myDataForPage\" style=\"display:none;\">[{\"PageIndex\":\"" + pageIndex + "\",\"PageSize\":\"" + pageSize + "\",\"TotalRecord\":\"" + totalRecords + "\",\"QueryStr\":\"" + queryStr + "\"}]</div>"; }