protected void btnUpdate_Click(object sender, EventArgs e) { string sql = "update T_STUDENT SET STUDENT_NAME='" + txtName.Text + "','...";//没写完 if (sh.excuteNonQuery(sql)) { Tool.Alert("修改成功", Page); //没写完 } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["UserInfo"] == null || Session["UserInfo"].ToString().ToUpper().Contains("ADMIN")) { Tool.Alert("您未登录或您不是管理者,不能使用此功能"); Response.Redirect("Login.aspx"); } } }
protected void btnAdd_Click(object sender, EventArgs e) { sqlHelper sh = new sqlHelper(); string sno = Labelno.Text.Trim(); string sname = Labelsname.Text.Trim(); string teacher = Labeltname.Text.Trim(); string stuRea = txtRea.Text.Trim(); string stuPhone = txtPhone.Text.Trim(); string Length = txtLength.Text.Trim(); //string stuSex if (stuRea.Equals("")) { Tool.Alert("理由不能为空", Page); } else if (stuPhone.Equals("")) { Tool.Alert("电话号码不能为空", Page); } else if (Length.Equals("")) { Tool.Alert("请假天数不能为空", Page); } else { string sqlAddAPPLY = "insert into STUDENTAPPLY(STUDENT_NO,STUDENT_NAME,TEACHER,STUDENT_REA,STUDENT_PHONE,CREATETIME,LENGTH,FLAG) values('" + sno + "','" + sname + "','" + teacher + "','" + stuRea + "','" + stuPhone + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Length + "','" + 1 + "')"; if (sh.excuteNonQuery(sqlAddAPPLY)) { Tool.Alert("申请成功,请等待回复!", Page); Labelno.Text = ""; Labelsname.Text = ""; Labeltname.Text = ""; txtRea.Text = ""; txtPhone.Text = ""; txtLength.Text = ""; } else { Tool.Alert("申请失败,请重试!", Page); } } }
protected void btnAdd_Click(object sender, ImageClickEventArgs e) { try { string Url = txtUrl.Text.Trim(); if (Url.Contains("https://") || Url.Contains("www.") || Url.Contains("http://")) { DataTable dt = DBHelper.GetDataTable("select NAME,URL,REMARK from Link"); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["URL"].ToString().Contains(Url)) { Tool.Alert("此地址【" + Url + "】已经存在,不能添加"); return; } } string sql = "INSERT INTO Link(NAME,URL,REMARK)values('{0}','{1}','{2}')"; string remark = txtRemark.Text.Trim(); remark = remark.Length > 1 ? remark : "爱生活 爱分享,全在我爱分享网"; sql = string.Format(sql, txtName.Text.Trim(), Url, remark); if (DBHelper.ExecuteCommand(sql) > 0) { txtName.Text = ""; txtUrl.Text = ""; txtRemark.Text = ""; Tool.Alert("添加成功"); } else { Tool.Alert("添加失败"); } } else { Tool.Alert("Url不合法"); } } catch (Exception es) { Tool.Alert("添加失败:【" + es.Message + "】"); } }
protected void LinkButton1_Click(object sender, EventArgs e) { LinkButton lbt = (LinkButton)sender; object[] arg = lbt.CommandArgument.ToString().Split(','); string arg0 = arg[0].ToString(); string arg1 = arg[1].ToString(); string sql = "UPDATE STUDENTAPPLY SET FLAG=0 WHERE STUDENT_NO='" + arg0 + "' and CREATETIME='" + arg1 + "'and FLAG=1"; if (sh.excuteNonQuery(sql)) { Tool.Alert("不批准成功", Page); BindRepList(); } else { Tool.Alert("不批准成功", Page); } }
protected void btnRelease_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(HidContent.Value.Trim())) { Tool.Alert("发布内容不可为空!"); return; } if (string.IsNullOrEmpty(lblName.Text.Trim())) { Tool.Alert("请选择发布栏目!"); return; } if (string.IsNullOrEmpty(txtTitle.Text.Trim())) { Tool.Alert("请选择发布标题!"); return; } CustomerModel customer = Session["UserInfo"] as CustomerModel; shareModel model = new shareModel(); //创建文字对象 model.CustomerID = customer.CustomerID; //文字发布人设置为当前登录用户 model.ArticleContent = HidContent.Value.Trim(); model.ArticleType = lblName.Text.Trim(); model.Title = txtTitle.Text.Trim(); bool bl = service.CreateArea(model, lblName.Text); //提交至数据库 if (bl) { //var CloseWebPage = "<script language='javascript' type='text/javascript'> CloseWebPage()</script>"; //Page.ClientScript.RegisterStartupScript(ClientScript.GetType(), "CloseWebPage", CloseWebPage); Tool.Alert("发布成功"); txtTitle.Text = null; } else { Tool.Alert("发布失败,请重试"); } } catch (Exception r) { Tool.WritrErro(r); Tool.Alert("发布失败,错误讯息【" + r.Message + "】"); } }