private void ReloadFileList() { try { string Tsql = "SELECT ID, FileName FROM PMMissionFile WHERE (Alive = '1') AND (ProjectID = '" + Session["ProjectID"].ToString() + "') AND (MissionID = '" + Session["MissionID"].ToString() + "')"; DataSet ds = SS.GetSqlTable(Tsql); GridView_FileList.DataSource = ds; GridView_FileList.DataBind(); } catch { Response.Write("<script> alert('附件列表讀取失敗');</script>"); Response.Write("<script>window.opener=null;self.close()</script>"); } }
private void CreatList() { int FileCout = Convert.ToInt32(HiddenField_FileCout.Value); //創建檔案烈表 DataTable dt = new DataTable(); DataRow drow; for (int i = 0; i < FileCout; i++) { drow = dt.NewRow(); dt.Rows.Add(drow); } GridView_FileList.DataSource = dt; GridView_FileList.DataBind(); }
private void Reload() { try { // 取得mission表資料 string DTsql = "SELECT MissionID, ProjectID, MType, Creator, Title, Description, StartDate, EndDate, CreatDate, ResponsibleName, Complete, CompleteDate FROM PMMission WHERE (ProjectID = '" + Session["ProjectID"].ToString() + "') AND (MissionID = '" + Session["MissionID"].ToString() + "') AND (Alive = '1');"; // 取得mission協力者資料 DTsql += "SELECT ProjectID, MissionID, UserID, ExecutorName, JoinDate, Responsible, Complete, CompleteDate FROM PMMMember WHERE (ProjectID = '" + Session["ProjectID"].ToString() + "') AND (MissionID = '" + Session["MissionID"].ToString() + "') AND (Alive = '1');"; // 取得上傳檔案 DTsql += "SELECT FileName FROM PMMissionFile WHERE (Alive = '1') AND (ProjectID = '" + Session["ProjectID"].ToString() + "') AND (MissionID = '" + Session["MissionID"].ToString() + "')"; DataSet ds = SS.GetSqlTable(DTsql); Session["Title"] = "任務名稱 : " + ds.Tables[0].Rows[0]["Title"].ToString(); string Helper = ""; int HelperCount = Convert.ToInt32(HiddenField_HelperCount.Value); //檢查哪些人為協力者 for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { if (ds.Tables[1].Rows[i]["Responsible"].ToString() == "0") { if (HelperCount < 3) { Helper += ds.Tables[1].Rows[i]["ExecutorName"].ToString() + " "; HelperCount++; } else { Helper += ds.Tables[1].Rows[i]["ExecutorName"].ToString() + "<br />"; HelperCount = 0; } } } #region 管理員按鈕開啟判定 if (ds.Tables[0].Rows.Count > 0) { if (Convert.ToInt32(Session["isAdministrator"]) == 1) { Button_Edit.Visible = true; Button_Delete.Visible = true; if (ds.Tables[0].Rows[0]["Complete"].ToString() == "1") { Label_MissionStatus.Text = "任務已完成"; Label_MissionStatus.ForeColor = System.Drawing.Color.Green; Button_StatusUpdate.Visible = false; } else { Label_MissionStatus.Text = "任務未完成"; Label_MissionStatus.ForeColor = System.Drawing.Color.Red; Button_StatusUpdate.Visible = true; } } else { if (ds.Tables[0].Rows[0]["Complete"].ToString() == "1") { Label_MissionStatus.Text = "任務已完成"; Label_MissionStatus.ForeColor = System.Drawing.Color.Green; Button_Complete.Visible = false; } else { string MTsql = "SELECT Complete, CompleteDate FROM PMMMember WHERE (ProjectID = '" + Session["ProjectID"].ToString() + "') AND (MissionID = '" + Session["MissionID"].ToString() + "') AND (Alive = '1') AND (UserID = '" + Session["UserID"] + "')"; string[] IsComplete = SS.GetSqlString(MTsql, "Complete,CompleteDate").Split(','); if (IsComplete[0] == "1") { Label_MissionStatus.Text = "你的部分完成囉 " + IsComplete[1]; Label_MissionStatus.ForeColor = System.Drawing.Color.Green; Button_Complete.Visible = false; } else { Button_Complete.Visible = true; Label_MissionStatus.Text = "任務未完成"; Label_MissionStatus.ForeColor = System.Drawing.Color.Red; } } } } else { Response.Write("<script> alert('系統錯誤');</script>"); Response.Write("<script>window.opener.location.reload();</script>"); Response.Write("<script>window.opener=null;self.close()</script>"); } #endregion #region 資料顯示 string[] TypeName = SS.GetMissionType(); Label_Title.Text = "主題 : " + ds.Tables[0].Rows[0]["Title"].ToString(); Label_MType.Text = "任務類型 : " + TypeName[Convert.ToInt32(ds.Tables[0].Rows[0]["MType"])]; Label_Creater.Text = "任務創建者 : " + ds.Tables[0].Rows[0]["Creator"].ToString(); Label_Responsible.Text = "負責人 : " + ds.Tables[0].Rows[0]["ResponsibleName"].ToString(); if (Helper != string.Empty) { Label_Helper.Text = " 協力者 : <br /><br />" + Helper; } else { Label_Helper.Text = " 協力者 : 無"; } DateTime StartDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["StartDate"]); DateTime EndDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["EndDate"]); Label_Time.Text = "任務時間 : " + StartDate.ToString("yyyy-MM-dd") + " ~ " + EndDate.ToString("yyyy-MM-dd"); TextBox_MText.Text = ds.Tables[0].Rows[0]["Description"].ToString(); //顯示內文 #endregion #region 傳檔案顯示 GridView_FileList.DataSource = ds.Tables[2]; GridView_FileList.DataBind(); #endregion MessageReload(); } catch { Response.Write("<script> alert('系統錯誤');</script>"); Response.Write("<script>window.opener.location.reload();</script>"); Response.Write("<script>window.opener=null;self.close()</script>"); } }