//绑定页面控件的值 private void SetControlData() { if (Request.QueryString["id"] != null) { string fileID = Request["id"]; DA_FilesBU file1 = new DA_FilesBU(); DataSet ds1 = file1.GetFileDetailByID(fileID); file1.Close(); if (ds1.Tables[0].Rows.Count > 0) { for (int i = 0; i < arr0.Length; i++) { Util.SetControlValue(this.ajnum.Parent.FindControl(arr0[i]), ds1.Tables[0].Rows[0][arr0[i]]); } if (ds1.Tables[0].Rows[0]["jyuetime"] != DBNull.Value && ds1.Tables[0].Rows[0]["jyuetime"].ToString().Trim() != "") { this.jyuetime.Text = DateTime.Parse(ds1.Tables[0].Rows[0]["jyuetime"].ToString()).ToString("yyyy-MM-dd"); this.djtime.Text = DateTime.Parse(ds1.Tables[0].Rows[0]["djtime"].ToString()).ToString("yyyy-MM-dd"); } } ds1.Dispose(); } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.Item.FindControl("seldoc") != null) { string id = ((Label)e.Item.FindControl("seldoc")).Text; //string id=Request.QueryString[""] if (e.CommandName == "delete") { try { DA_FilesBU file2 = new DA_FilesBU(); file2.DelteFile(id); this.BindFiles(file2); file2.Close(); } catch (Exception err1) { Util.alert(this.Page, err1.Message); } } else { Context.Items["id"] = id; Server.Transfer("AnJuanDetailEdit.aspx?id=" + id, false); } } }
//添加案卷文件 protected void Button1_Click(object sender, EventArgs e) { object[] obj0 = new object[] { title, filecount, filefs }; object[] obj1 = new object[] { title }; string[] info = new string[] { "文件名称" }; bool check = true; for (int i = 0; i < info.Length; i++) { if (Util.GetControlValue((Control)obj1[i]) == null || Util.GetControlValue((Control)obj1[i]) == "") { check = false; Util.alert(this.Page, "错误提示:【" + info[i] + "】栏目不能为空!"); break; } } if (check) { Hashtable ht = new Hashtable(); Util.getPageData(obj0, ht); ht.Add("ajnum", this.ajnum.Text); if (ht["filecount"].ToString() == "") { ht.Remove("filecount"); } if (ht["filefs"].ToString() == "") { ht.Remove("filefs"); } DA_FilesBU file1 = new DA_FilesBU(); bool result = file1.InsertFileData(ht); file1.Close(); if (result) { string url = Application["root"] + "/DangAn/AddFile.aspx?ajid=" + Request.QueryString["ajid"]; PubComm.ShowInfo("提示:添加文件成功!", url); } else { Util.alert(this.Page, "错误提示:增加数据失败,请检查数据类型!"); } } }
//设置页面控件的值 private void SetControlData() { if (Request.QueryString["fileID"] != null) { string id = Request["fileID"]; DA_FilesBU file1 = new DA_FilesBU(); DataSet ds1 = file1.GetFileDetailByID(id); file1.Close(); if (ds1.Tables[0].Rows.Count > 0) { for (int i = 0; i < arr1.Length; i++) { Util.SetControlValue(this.ajnum.Parent.FindControl(arr1[i]), ds1.Tables[0].Rows[0][arr1[i]]); } } ds1.Dispose(); } }
//更新文件资料 protected void Button1_Click(object sender, EventArgs e) { Hashtable ht = new Hashtable(); foreach (string item in arr1) { ht[item] = Util.GetControlValue(this.ajnum.Parent.FindControl(item)); } ht.Remove("ajnum"); DA_FilesBU file2 = new DA_FilesBU(); file2.UpdateFileData(Request["fileID"], ht); file2.Close(); DA_AnJuanBU anjuan1 = new DA_AnJuanBU(); string id = anjuan1.GetIdByAjnum(this.ajnum.Text); anjuan1.Close(); string url = Application["root"] + "/DangAn/AnJuanDetailEdit.aspx?id=" + id; Comm.ShowInfo("操作提示:更新文件成功!", url); }