private void edit() { string title = this.txt_title.Text; if (title == null || title.Length <= 0) { JS.Alert("题目不能为空!"); return; } if (title.Length >= 255) { JS.Alert("题目过长!"); return; } string content = content2.Value; if (content == null || content.Length <= 0) { JS.Alert("内容不能为空!"); return; } string FilePath = ""; FilePath = File1.Value; if (FilePath.Length > 0) { FilePath = FileUp.meUpfile(this.File1, @"~\file\", true); FilePath = FilePath.Substring(FilePath.IndexOf('\\') + 1); } string sqlEdit = "update t_plat set ptitle=@ptitle,pcontent=@pcontent ,purl=@purl where id=" + UID; ArrayList insertValue = new ArrayList(); OleDbParameter ptitle = new OleDbParameter("@ptitle", OleDbType.VarChar); ptitle.Value = title; insertValue.Add(ptitle); OleDbParameter pcontent = new OleDbParameter("@pcontent", OleDbType.LongVarWChar); pcontent.Value = content; insertValue.Add(pcontent); OleDbParameter purl = new OleDbParameter("@purl", OleDbType.LongVarWChar); purl.Value = FilePath; insertValue.Add(purl); int p = AccessDb.ExecuteNon(sqlEdit, ref insertValue); JS.Alert("修改成功!"); }
private void edit() { string Pic1 = ""; Pic1 = File1.Value; if (Pic1.Length > 0) { Pic1 = FileUp.meUpfile(this.File1, @"~\pic\", false); } if (Pic1 == "") { editNoPic(); } else { editPic(Pic1); } }
private void add() { string Pic1 = ""; Pic1 = File1.Value; if (Pic1.Length > 0) { Pic1 = FileUp.meUpfile(this.File1, @"~\pic\", false); } string title = this.txt_title.Text; if (title == null | title.Length <= 0) { JS.Alert("题目不能为空!"); return; } if (title.Length >= 255) { JS.Alert("题目过长!"); return; } string url = this.txt_Url.Text; if (url == null | url.Length <= 0) { JS.Alert("地址不能为空!"); return; } if (url.Length >= 255) { JS.Alert("地址过长!"); return; } string content = content2.Value; string strDateTime = this.txt_DateTime.Value; string sql = "insert into t_sample (ptitle,pcontent,purl,ppic,pdate) values(@ptitle,@pcontent,@url,@ppic,@pdate)"; ArrayList insertValue = new ArrayList(); OleDbParameter ptitle = new OleDbParameter("@ptitle", OleDbType.VarChar); ptitle.Value = title; insertValue.Add(ptitle); OleDbParameter pcontent = new OleDbParameter("@pcontent", OleDbType.LongVarWChar); pcontent.Value = content; insertValue.Add(pcontent); OleDbParameter purl = new OleDbParameter("@purl", OleDbType.VarChar); purl.Value = url; insertValue.Add(purl); OleDbParameter ppic = new OleDbParameter("@ppic", OleDbType.LongVarWChar); ppic.Value = Pic1; insertValue.Add(ppic); OleDbParameter pdate = new OleDbParameter("@pdate", OleDbType.Date); pdate.Value = strDateTime; insertValue.Add(pdate); int p = AccessDb.ExecuteNon(sql, ref insertValue); JS.Alert("添加成功!"); this.txt_title.Text = ""; this.txt_Url.Text = ""; this.content2.Value = ""; }
private void add() { string Pic1 = ""; Pic1 = File1.Value; if (Pic1.Length > 0) { Pic1 = FileUp.meUpfile(this.File1, @"~\pic\", false); } bool _pAnswered = false; string title = this.txt_title.Text; if (title == null || title.Length <= 0) { JS.Alert("问题题目不能为空!"); return; } if (title.Length >= 255) { JS.Alert("问题题目过长!"); return; } string content = content2.Value; if (content != null && content.Length > 0) { _pAnswered = true; } else { _pAnswered = false; } string sql = "insert into t_question (ptitle,pcontent,ppic,pdate,pAnswered) values(@ptitle,@pcontent,@ppic,@pdate,@pAnswered)"; ArrayList insertValue = new ArrayList(); OleDbParameter ptitle = new OleDbParameter("@ptitle", OleDbType.VarChar); ptitle.Value = title; insertValue.Add(ptitle); OleDbParameter pcontent = new OleDbParameter("@pcontent", OleDbType.LongVarWChar); pcontent.Value = content; insertValue.Add(pcontent); OleDbParameter ppic = new OleDbParameter("@ppic", OleDbType.LongVarWChar); ppic.Value = Pic1; insertValue.Add(ppic); OleDbParameter pdate = new OleDbParameter("@pdate", OleDbType.Date); pdate.Value = DateTime.Now; insertValue.Add(pdate); OleDbParameter pAnswered = new OleDbParameter("@pAnswered", OleDbType.Boolean); pAnswered.Value = _pAnswered; insertValue.Add(pAnswered); int p = AccessDb.ExecuteNon(sql, ref insertValue); JS.Alert("添加成功!"); this.txt_title.Text = ""; this.content2.Value = ""; }
protected void Button1_Click(object sender, EventArgs e) { string FilePath = ""; FilePath = File1.Value; if (FilePath.Length > 0) { FilePath = FileUp.meUpfile(this.File1, @"~\file\", true); FilePath = FilePath.Substring(FilePath.IndexOf('\\') + 1); } string title = this.txt_title.Text; if (title == null || title.Length <= 0) { JS.Alert("标题不能为空!"); return; } if (title.Length >= 255) { JS.Alert("标题过长!"); return; } string author = this.txt_author.Text; if (author.Length >= 255) { JS.Alert("作者名称过长!"); return; } string strDateTime = this.txt_DateTime.Value; string content = this.content2.Value; string type = UID == "news" ? "平台动态" : "标准规范"; string sql = "insert into t_news (ptitle,pcontent,puser,pdate,ptype,purl) values(@ptitle,@pcontent,@puser,@pdate,@ptype,@purl)"; ArrayList insertValue = new ArrayList(); OleDbParameter ptitle = new OleDbParameter("@ptitle", OleDbType.VarChar); ptitle.Value = title; insertValue.Add(ptitle); OleDbParameter pcontent = new OleDbParameter("@pcontent", OleDbType.LongVarWChar); pcontent.Value = content; insertValue.Add(pcontent); OleDbParameter puser = new OleDbParameter("@puser", OleDbType.VarChar); puser.Value = author; insertValue.Add(puser); OleDbParameter pdate = new OleDbParameter("@pdate", OleDbType.VarChar); pdate.Value = strDateTime; insertValue.Add(pdate); OleDbParameter ptype = new OleDbParameter("@ptype", OleDbType.VarChar); ptype.Value = type; insertValue.Add(ptype); OleDbParameter purl = new OleDbParameter("@purl", OleDbType.LongVarWChar); purl.Value = FilePath; insertValue.Add(purl); int p = AccessDb.ExecuteNon(sql, ref insertValue); JS.Alert("添加成功!"); this.txt_author.Text = ""; this.txt_title.Text = ""; this.content2.Value = ""; this.txt_DateTime.Value = DateTime.Now.ToUniversalTime().ToString(); }
protected void but_save_Click(object sender, EventArgs e) { string Pic1; Pic1 = this.File1.Value; string title = this.txt_title.Text; string url = this.txt_url.Text; string strSort = txt_sort.Text; int intsort = 0; try { intsort = int.Parse(this.txt_sort.Text); } catch { JS.Alert("序号必须为数字类型!"); return; } string strIsShow = this.drp_isUse.SelectedValue.ToString(); bool IsShow = (this.drp_isUse.SelectedValue == "是" ? true : false); if (UID != null && !UID.Equals(String.Empty)) { if (Pic1.Length > 0) { Pic1 = FileUp.meUpfile(this.File1, @"~\pic\", false); } if (Pic1 == "") { bool flag = updatSqlNoPic(title, url, intsort, IsShow, UID); if (flag) { JS.Alert("更新成功"); //Response.Redirect("b_topnewsList.aspx?id=news", false); } else { JS.Alert("更新失败"); } } else { bool flag = updatSql(Pic1, title, url, intsort, IsShow, UID); if (flag) { JS.Alert("成功"); } else { JS.Alert("失败"); } } } else { if (Pic1.Length > 0) { Pic1 = FileUp.meUpfile(this.File1, @"~\pic\", false); if (Pic1 == "") { JS.Alert("图片选择错误!"); } else { bool flag = AddSqlPic(Pic1, title, url, intsort, IsShow); if (flag) { JS.Alert("添加成功!"); } else { JS.Alert("添加失败!"); } } } else { JS.Alert("图片选择错误!"); } } }