protected void Del_Btn(object obj, EventArgs e) { LinkButton linkButton = obj as LinkButton; RepeaterItem repeaterItem = linkButton.Parent as RepeaterItem; HtmlInputCheckBox htmlInputCheckBox = repeaterItem.FindControl("chk") as HtmlInputCheckBox; int num = Convert.ToInt32(htmlInputCheckBox.Value); try { IList all = Docs_Doc.Init().GetAll("doctypeid=" + num, null); if (all != null && all.Count > 0) { foreach (object current in all) { Docs_DocInfo docs_DocInfo = current as Docs_DocInfo; Help.DeleteFiles(docs_DocInfo.FilePath); } } } catch { } string cmdText = "delete from Docs_Doc where doctypeid=" + num; MsSqlOperate.ExecuteNonQuery(CommandType.Text, cmdText, new SqlParameter[0]); Docs_DocType.Init().Delete(num); this.Show(); }
protected string GetDocType(object DocTypeID) { string result; try { int num = Convert.ToInt32(DocTypeID); if (num == 0) { result = "默认分类"; } else { IList all = Docs_DocType.Init().GetAll("id=" + num, null); if (all != null) { Docs_DocTypeInfo docs_DocTypeInfo = all[0] as Docs_DocTypeInfo; result = docs_DocTypeInfo.TypeName; } else { result = ""; } } } catch { result = "默认分类"; } return(result); }
private void Show() { IList all = Docs_DocType.Init().GetAll("uid=" + this.Uid, null); this.rpt.DataSource = all; this.rpt.DataBind(); this.num.InnerHtml = "当前 总计 - <span style='color:#ff0000; font-weight:bold;'>" + all.Count + "</span> 个 记录数据"; }
private void Show(string id) { Docs_DocTypeInfo byId = Docs_DocType.Init().GetById(Convert.ToInt32(id)); this.ViewState["ni"] = byId; this.TypeName.Value = byId.TypeName; this.Notes.Value = byId.Notes; }
//protected Repeater rpt; //protected Button bt5; protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { IList all = Docs_DocType.Init().GetAll("uid=" + this.Uid, null); this.doctype.Items.Add(new ListItem("默认分类", "0")); foreach (object current in all) { Docs_DocTypeInfo docs_DocTypeInfo = current as Docs_DocTypeInfo; this.doctype.Items.Add(new ListItem(docs_DocTypeInfo.TypeName, string.Concat(docs_DocTypeInfo.id))); } } if (!base.IsPostBack && !string.IsNullOrEmpty(base.Request.QueryString["did"])) { this.Show(base.Request.QueryString["did"]); } }
protected void Save_Btn(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request.QueryString["tid"])) { Docs_DocTypeInfo docs_DocTypeInfo = this.ViewState["ni"] as Docs_DocTypeInfo; docs_DocTypeInfo.Notes = this.Notes.Value; docs_DocTypeInfo.TypeName = this.TypeName.Value; docs_DocTypeInfo.Uid = Convert.ToInt32(this.Uid); Docs_DocType.Init().Update(docs_DocTypeInfo); } else { Docs_DocTypeInfo docs_DocTypeInfo = new Docs_DocTypeInfo(); docs_DocTypeInfo.TypeName = this.TypeName.Value; docs_DocTypeInfo.Notes = this.Notes.Value; docs_DocTypeInfo.Uid = Convert.ToInt32(this.Uid); Docs_DocType.Init().Add(docs_DocTypeInfo); } string str = HttpContext.Current.Server.HtmlEncode("您好!文档分类保存成功!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=../Manage/doc/DocType_List.aspx&tip=" + str); }