/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Save_Click(object sender, EventArgs e) { try { Hashtable ht = new Hashtable(); // 状态 ht["State"] = selState.Value; // 审核描述 ht["ReviewNote"] = txtRemark.Value; if (!string.IsNullOrEmpty(_key)) { ht["ID"] = _key; } VehicleCommentsLogManager vehicleCommentsManager = new VehicleCommentsLogManager(); bool returnValue = vehicleCommentsManager.AddOrEditVehicleCommentsLogInfo(ht, _key); if (returnValue) { ShowMsgHelper.AlertMsg("操作成功!"); } else { ShowMsgHelper.Alert_Error("操作失败!"); } } catch (Exception ex) { throw ex; } }
public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["UID"] == null || res["VehicleID"] == null || res["UID"].ToString().Trim().Length <= 0 || res["VehicleID"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整")); } else { if (res["UserNickName"] == null || res["UserNickName"].ToString().Trim().Length <= 0) { usernickname = "匿名用户"; } else { usernickname = res["UserNickName"].ToString().Trim(); } if (res["Content"] != null && res["Content"].ToString().Trim().Length > 0) { content = res["Content"].ToString().Trim(); } uid = res["UID"].ToString().Trim(); vehicleid = res["VehicleID"].ToString().Trim(); Hashtable comment = new Hashtable(); comment["ID"] = CommonHelper.GetGuid; comment["VehicleID"] = vehicleid; comment["UserID"] = uid; comment["UserNickName"] = usernickname; comment["CommentsContent"] = content; comment["CommentsTime"] = SiteHelper.GetWebServerCurrentTime(); comment["State"] = VehicleCommentsState.NewSubmit.GetHashCode(); if (res["Client"] != null && "iOS" == res["Client"].ToString()) { comment["ClientType"] = "iOS"; } else { comment["ClientType"] = "Android"; } VehicleCommentsLogManager vclm = new VehicleCommentsLogManager(); bool isSuccess = vclm.AddOrEditVehicleCommentsLogInfo(comment, null); if (isSuccess) { return(SiteHelper.GetJsonFromHashTable(null, "success", "评论保存成功,感谢您的参与。")); } else { return(SiteHelper.GetJsonFromHashTable(null, "faild", "评论保存失败")); } } }
/// <summary> /// 绑定数据源 /// </summary> private void DataBindGrid(bool isQuery = false) { VehicleCommentsLogManager vehicleCommentsLogManager = new VehicleCommentsLogManager(); int count = 0; int pageIndex = isQuery ? 1 : PageControl1.PageIndex; KeyValuePair <StringBuilder, IList <SqlParam> > keyValue = InitCondition(); DataTable dt = vehicleCommentsLogManager.GetVehicleCommentsLogInfoPage(keyValue.Key, keyValue.Value, pageIndex, PageControl1.PageSize, ref count); ControlBindHelper.BindRepeaterList(dt, rp_Item); this.PageControl1.PageIndex = pageIndex; this.PageControl1.RecordCount = Convert.ToInt32(count); this.PageControl1.PageChecking(); }
protected void lbtExport_Click(object sender, EventArgs e) { VehicleCommentsLogManager vehicleCommentsLogManager = new VehicleCommentsLogManager(); int count = 0; int pageIndex = 1; KeyValuePair <StringBuilder, IList <SqlParam> > keyValue = InitCondition(); DataTable dt = vehicleCommentsLogManager.GetVehicleCommentsLogInfoPage(keyValue.Key, keyValue.Value, pageIndex, 1000000000, ref count); StringBuilder s = new StringBuilder(); s.AppendLine("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"); s.AppendLine("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">"); //写出列名 s.AppendLine("<tr style=\"background-color: #FFE88C;font-weight: bold; white-space: nowrap;\">"); s.AppendLine("<td>车辆名称</td><td>会员手机号</td><td>会员姓名</td><td>会员昵称</td><td>评论内容</td><td>评论时间</td><td>评论状态</td><td>客户端</td>"); s.AppendLine("</tr>"); //写数据 foreach (DataRow row in dt.Rows) { s.Append("<tr>"); s.Append("<td>'").Append(row["LicenseNumber"].ToString()).Append("</td>"); s.Append("<td>'").Append(row["BindPhone"].ToString()).Append("</td>"); s.Append("<td>").Append(row["RealName"].ToString()).Append("</td>"); s.Append("<td>").Append(row["UserNickName"].ToString()).Append("</td>"); s.Append("<td>").Append(row["CommentsContent"].ToString()).Append("</td>"); s.Append("<td>'").Append(row["CommentsTime"].ToString()).Append("</td>"); s.Append("<td>'").Append(EnumHelper.GetEnumShowName(typeof(UserRaiseReplyState), Convert.ToInt32(row["State"].ToString()))).Append("</td>"); s.Append("<td>").Append(row["ClientType"].ToString()).Append("</td>"); s.AppendLine("</tr>"); } s.AppendLine("</table>"); this.Page.Response.ContentType = "application/vnd.ms-excel"; this.Page.Response.ContentEncoding = System.Text.Encoding.UTF8; this.Page.Response.Charset = "Utf-8"; this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=评价列表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"); this.Page.Response.Write(s.ToString()); this.Page.Response.End(); }