private void Bind() { int totalRecords = 0; if (!string.IsNullOrEmpty(asId.Value)) { //查询条件 GetSearchItem(); ActivityPlayer bll = new ActivityPlayer(); rpData.DataSource = bll.GetListOW(pageIndex, pageSize, out totalRecords, sqlWhere, parms == null ? null : parms.ToArray()); rpData.DataBind(); } myDataAppend.Append("<div id=\"myDataForPage\" style=\"display:none;\">[{\"PageIndex\":\"" + pageIndex + "\",\"PageSize\":\"" + pageSize + "\",\"TotalRecord\":\"" + totalRecords + "\",\"QueryStr\":\"" + queryStr + "\"}]</div>"); }
private void Bind() { if (!Id.Equals(Guid.Empty)) { Page.Title = "编辑选手"; ActivityPlayer bll = new ActivityPlayer(); DataSet ds = bll.GetModelOW(Id); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; txtName.Value = dt.Rows[0]["Named"].ToString(); txtContent.Value = dt.Rows[0]["DetailInformation"].ToString(); imgSinglePicture.Src = dt.Rows[0]["PictureId"] is DBNull ? "../../Images/nopic.gif" : string.Format("{0}{1}/PC/{1}_1{2}", dt.Rows[0]["FileDirectory"], dt.Rows[0]["RandomFolder"], dt.Rows[0]["FileExtension"]); hImgSinglePictureId.Value = dt.Rows[0]["PictureId"].ToString(); txtActualVoteCount.Value = dt.Rows[0]["ActualVoteCount"].ToString(); txtUpdateVoteCount.Value = dt.Rows[0]["UpdateVoteCount"].ToString(); hId.Value = Id.ToString(); asId.Value = dt.Rows[0]["ActivityId"].ToString(); if (Convert.ToBoolean(dt.Rows[0]["IsDisable"])) { rdFalse.Checked = false; rdTrue.Checked = true; } else { rdFalse.Checked = true; rdTrue.Checked = false; } } } else { asId.Value = Request["asId"]; } }
public void SaveActivityPlayer(HttpContext context) { try { string id = context.Request.Form["ctl00$cphMain$hId"].Trim(); string sActivityId = context.Request.Form["ctl00$cphMain$asId"].Trim(); string sName = context.Request.Form["ctl00$cphMain$txtName"].Trim(); string sPictureId = context.Request.Form["pictureId"].Trim(); string sDetailInfo = context.Request.Form["detailInfo"].Trim(); string sActualVoteCount = context.Request.Form["ctl00$cphMain$txtActualVoteCount"].Trim(); sActualVoteCount = sActualVoteCount == "" ? "0" : sActualVoteCount; string sUpdateVoteCount = context.Request.Form["ctl00$cphMain$txtUpdateVoteCount"].Trim(); sUpdateVoteCount = sUpdateVoteCount == "" ? "0" : sUpdateVoteCount; string sIsDisable = context.Request.Form["isDisable"].Trim(); sDetailInfo = HttpUtility.HtmlDecode(sDetailInfo); Guid gId = Guid.Empty; if (id != "") { Guid.TryParse(id, out gId); } Guid pictureId = Guid.Empty; Guid.TryParse(sPictureId, out pictureId); Guid activityId = Guid.Empty; Guid.TryParse(sActivityId, out activityId); ActivityPlayerInfo model = new ActivityPlayerInfo(); model.LastUpdatedDate = DateTime.Now; model.Remark = ""; model.HeadPicture = ""; model.Id = gId; model.ActivityId = activityId; model.Named = sName; model.DetailInformation = sDetailInfo; model.ActualVoteCount = int.Parse(sActualVoteCount); model.UpdateVoteCount = int.Parse(sUpdateVoteCount); model.IsDisable = bool.Parse(sIsDisable); if (string.IsNullOrWhiteSpace(model.DetailInformation)) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Params_InvalidError + "\"}"); return; } ActivityPlayer bll = new ActivityPlayer(); PlayerPicture bllPP = new PlayerPicture(); PlayerPictureInfo infoPP = new PlayerPictureInfo(); int effect = -1; if (!gId.Equals(Guid.Empty)) { effect = bll.Update(model); if (effect > 0) { infoPP.PlayerId = model.Id; infoPP.PictureId = pictureId; bllPP.Delete(model.Id); bllPP.Insert(infoPP); } } else { Guid playerId = bll.InsertByOutput(model); if (!playerId.Equals(Guid.Empty)) { effect = 1; if (!pictureId.Equals(Guid.Empty)) { infoPP.PlayerId = playerId; infoPP.PictureId = pictureId; bllPP.Insert(infoPP); } } } if (effect == 110) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Exist + "\"}"); return; } if (effect < 1) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Error + "\"}"); return; } context.Response.Write("{\"success\": true,\"message\": \"" + MessageContent.Submit_Success + "\"}"); } catch (Exception ex) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.AlertTitle_Ex_Error + ":" + ex.Message + "\"}"); } }