protected override void Initialize() { if (Request["del"] != null) { DeleteFile(Request["del"].ToString()); } FileGridView.DataSource = GetContentConfigFiles(null); FileGridView.DataBind(); }
void BindImg() { string sql = "SELECT * FROM tbl_claim_img where claim_deteil_id = '" + Session["CodePK"].ToString() + "' and claim_img_type = '0'"; MySqlDataAdapter da = function.MySqlSelectDataSet(sql); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds); FileGridView.DataSource = ds.Tables[0]; FileGridView.DataBind(); LabelImg.Text = "รูปภาพแนบ " + ds.Tables[0].Rows.Count + " ภาพ"; }
//监听gridview按钮事件 打开添加弹窗 #region protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e) { //点击修改议题 if (e.CommandName == "openModifyBigTitleModal") { SuperviseMxBLL superviseMxBLL = new SuperviseMxBLL(); SuperviseAssignBLL superviseAssignBLL = new SuperviseAssignBLL(); string[] commandArgument = e.CommandArgument.ToString().Split(','); int RID = int.Parse(commandArgument[0]); int MxID = int.Parse(commandArgument[2]); ModiyRID.Text = RID.ToString(); ModifyMxID2.Text = MxID.ToString(); SuperviseBLL superviseBLL = new SuperviseBLL(); R_Supervise supervise = superviseBLL.FindSupervise(RID); SqlDataReader read = superviseAssignBLL.FindSuperviseAssignByRID(RID); string AssignNoStr = ""; string DeptNameStr = ""; while (read.Read()) { if (read["AssignNo"].ToString() != "") { AssignNoStr += read["AssignNo"].ToString() + ","; Session["OldAssignNo"] = AssignNoStr; } Session["OldAssignNo"] = AssignNoStr; DeptNameStr += read["DeptName"].ToString() + ","; } SetDepartment2.Text = DeptNameStr; SetDeptCharge2.Text = AssignNoStr; ModifyBigTitle2.Text = supervise.Title; RegisterJS(@" $('#ModifyBigTitleModal').modal({ show: true, backdrop: 'static' });", this); } //删除议题 else if (e.CommandName == "DeleteBigTitle_Click") { string RID = e.CommandArgument.ToString(); SuperviseBLL superviseBLL = new SuperviseBLL(); SuperviseAssignBLL superviseAssignBLL = new SuperviseAssignBLL(); int num = superviseAssignBLL.DeleteSuperviseAssignByRID(RID); if (num != 0) { Response.Write("<script language='javascript'>alert('删除成功!')</script>"); Page_Load(sender, e); } else { Response.Write("<script language='javascript'>alert('删除失败!')</script>"); } } //点击添加步骤 if (e.CommandName == "openModifySuperviseMxModal") { SuperviseMxBLL superviseMxBLL = new SuperviseMxBLL(); string[] commandArgument = e.CommandArgument.ToString().Split(','); string AssignID = commandArgument[0]; string RID = commandArgument[1]; string bigTitle = commandArgument[2]; ModifyAssignID.Text = AssignID.ToString(); ModifyRID.Text = RID.ToString(); ModifyBigTitle.Text = bigTitle; RegisterJS(@" $('#ModifyTitle').val(''); $('#ModifyFinishDate').val(''); $('#ModifySetStaff').val(''); $('#ModifySuperviseMxModal').modal({ show: true, backdrop: 'static' });", this); } //点击修改步骤 else if (e.CommandName == "openModifySmallTitleModal") { string[] commandArgument = e.CommandArgument.ToString().Split(','); int MxID = int.Parse(commandArgument[0]); string bigTitle = commandArgument[1]; string smallTitle = commandArgument[2]; string AssignID = commandArgument[4]; string RID = commandArgument[3]; ModifyBigTitle3.Text = bigTitle; ModifySmallTitle.Text = smallTitle; ModifyMxID.Text = MxID.ToString(); ModifyRID3.Text = RID; ModifySuperiseAssignID.Text = AssignID; SuperviseAssignBLL superviseAssignBLL = new SuperviseAssignBLL(); SqlDataReader read = superviseAssignBLL.FindSuperviseAssignByMxID(MxID); string AssignNoStr = ""; while (read.Read()) { if (read["AssignNo"].ToString() != "") { AssignNoStr += read["AssignNo"].ToString() + ","; Session["OldStaff"] = AssignNoStr; } } ModifySetStaff2.Text = AssignNoStr; SuperviseMxBLL superviseMxBLL = new SuperviseMxBLL(); RegisterJS(@" $('#ModifySmallTitleModal').modal({ show: true, backdrop: 'static' });", this); }//删除任务 else if (e.CommandName == "DeleteSmallTitle_Click") { string[] commandArgument = e.CommandArgument.ToString().Split(','); string MxID = commandArgument[0]; string AssignD = commandArgument[1]; SuperviseMxBLL superviseMxBLL = new SuperviseMxBLL(); SuperviseAssignBLL superviseAssignBLL = new SuperviseAssignBLL(); int num = superviseAssignBLL.DeleteSuperviseAssignByMxIDAndAssign(MxID, AssignD); if (num != 0) { Response.Write("<script language='javascript'>alert('删除成功!')</script>"); Page_Load(sender, e); } else { Response.Write("<script language='javascript'>alert('删除失败!')</script>"); } } //点击处理任务 else if (e.CommandName == "openDealSuperviseMxModal") { string[] commandArgument = e.CommandArgument.ToString().Split(','); int assignID = int.Parse(commandArgument[0]); string bigTitle = commandArgument[1]; string smallTitle = commandArgument[2]; string updateReplyMemo = commandArgument[3]; string updateMemo = commandArgument[4]; UploadBLL uploadBLL = new UploadBLL(); string UserID = Session["UserID"].ToString(); SqlDataReader read = uploadBLL.SearchFileByAssignIDAndUserID(assignID, UserID); string file = ""; while (read.Read()) { if (read["Path"].ToString() != "") { file += read["Path"].ToString() + ","; } } UpdateAssignID.Text = assignID.ToString(); UpdateBigTitle.Text = bigTitle; UpdateSmallTitle.Text = smallTitle; UpdateReplyMemo.InnerText = updateReplyMemo; UpdateMemo.InnerText = updateMemo; string path2 = file.Replace("~/File/", ""); UploadFile.InnerText = path2; RegisterJS(@" $('#DealSuperviseMxModal').modal({ show: true, backdrop: 'static' });", this); } else if (e.CommandName == "openSearchFiles") { UploadBLL uploadBLL = new UploadBLL(); int AssignID = int.Parse(e.CommandArgument.ToString()); DataSet ds = new DataSet(); ds = uploadBLL.SearchFileByAssignID(AssignID); DataView dv = ds.Tables[0].DefaultView; FileGridView.DataSource = dv; FileGridView.DataBind(); RegisterJS(@" $('#FileModal').modal({ show: true, backdrop: 'static' }); ", this); } }