protected void btnSet_Click(object sender, EventArgs e) { string MsgCount = tboxMsgCount.Text.Trim(); decimal MsgPrice = 0M; try { Convert.ToInt32(MsgCount); MsgPrice = Convert.ToDecimal(tboxMsgPrice.Text.Trim()); } catch { Response.Write("<script language='javascript'>alert('请正确填写短信条数和金额!');</script>"); return; } try { bool result = AdminChongZhiMsgBLL.AddAdminChongZhiMsg(MsgCount, MsgPrice); MsgDataBind(); } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } }
protected void grdCus_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { int i = Convert.ToInt32(e.CommandArgument); dt = AdminChongZhiMsgBLL.GetAdminChongZhiMsg(txt_StartTime.Value, txt_EndTime.Value); string id = dt.Rows[i]["id"].ToString(); AdminChongZhiMsgBLL.DeleteAdminChongZhiMsg(id); MsgDataBind(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script type='text/javascript' defer=defer>alert('删除成功!');</script>"); } }
private void MsgDataBind() { try { dt = AdminChongZhiMsgBLL.GetAdminChongZhiMsg(txt_StartTime.Value, txt_EndTime.Value); grdCus.DataSource = dt; grdCus.DataBind(); } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } }