chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// 訓練溝通記錄使用的 script
|
||||
//
|
||||
function OpenAttachment(id)
|
||||
{
|
||||
window.open("附件檢視.aspx?id=" + id);
|
||||
}
|
||||
|
||||
function ShowReference(id)
|
||||
{
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "溝通記錄.aspx/GetReference",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
data: "{ id:\"" + id + "\"}",
|
||||
dataType: "json",
|
||||
success: function (response)
|
||||
{
|
||||
if (response && response.d)
|
||||
$("span[name=lbReference]").html(response.d);
|
||||
else
|
||||
$("span[name=lbReference]").html("");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site2.Master" AutoEventWireup="true" CodeBehind="檢附資料參考.aspx.cs" Inherits="Education.Forms.溝通記錄.檢附資料參考" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
||||
|
||||
<asp:ObjectDataSource ID="ds檢附資料參考" runat="server"
|
||||
DataObjectTypeName="Education.檢附資料參考Item"
|
||||
OldValuesParameterFormatString="original_{0}"
|
||||
SelectMethod="SelectAll"
|
||||
TypeName="Education.DAC_檢附資料參考"
|
||||
UpdateMethod="UpdateOne">
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
<asp:GridView ID="gv檢附資料參考" runat="server"
|
||||
AutoGenerateColumns="False"
|
||||
DataSourceID="ds檢附資料參考"
|
||||
EnableModelValidation="True"
|
||||
DataKeyNames="BSPAR,BSCLS"
|
||||
Width="100%">
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
|
||||
CssClass="button green60" Text="更正"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
|
||||
CssClass="button blue60" Text="儲存"></asp:LinkButton>
|
||||
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
CssClass="button red60" OnClientClick="return confirm("是否確定放棄更正?");"
|
||||
Text="取消"></asp:LinkButton>
|
||||
</EditItemTemplate>
|
||||
<HeaderStyle Width="140px" />
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="TEXT" HeaderText="溝通歷程" SortExpression="TEXT" ReadOnly="True">
|
||||
<HeaderStyle Width="23em" />
|
||||
</asp:BoundField>
|
||||
<asp:TemplateField HeaderText="檢附資料參考" SortExpression="TEXT">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox runat="server" Text='<%# Bind("BSSCR") %>' ID="TextBox1" CssClass="inputFull" TextMode="MultiLine" Rows="5"></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label runat="server" Text='<%# Eval("BSSCR", "{0}").Replace("\r\n", "<br/>").Replace("\r", "<br/>").Replace("\n", "<br/>") %>' ID="Label1"></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
public partial class 檢附資料參考 : FormBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
FunctionName = "檢附資料參考設定";
|
||||
|
||||
if (IsPostBack)
|
||||
gv檢附資料參考.DataBind();
|
||||
}
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自動產生>
|
||||
// 這段程式碼是由工具產生的。
|
||||
//
|
||||
// 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
|
||||
// 程式碼,則會遺失變更。
|
||||
// </自動產生>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
|
||||
|
||||
public partial class 檢附資料參考
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// ds檢附資料參考 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ds檢附資料參考;
|
||||
|
||||
/// <summary>
|
||||
/// gv檢附資料參考 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView gv檢附資料參考;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site2.Master" AutoEventWireup="true" CodeBehind="溝通記錄.aspx.cs" Inherits="Education.Forms.溝通記錄.溝通記錄" %>
|
||||
|
||||
<%@ Register Src="../Common/訓練企劃搜尋.ascx" TagName="訓練企劃搜尋" TagPrefix="uc1" %>
|
||||
<%@ Register Assembly="WebLib" Namespace="WebLib" TagPrefix="weblib" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
||||
|
||||
<style type="text/css">
|
||||
.labelCol {
|
||||
width: 110px !important;
|
||||
}
|
||||
|
||||
.controlCol_1 {
|
||||
width: 160px !important;
|
||||
}
|
||||
|
||||
.controlCol_2 {
|
||||
width: 160px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" src="CommRecord.js"></script>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
||||
|
||||
<uc1:訓練企劃搜尋 ID="訓練企劃搜尋" runat="server" 包含已結案="True" OnClick="btn查詢_Click"
|
||||
訓練企劃狀態="全部" />
|
||||
<asp:Label ID="lbMessage" runat="server" CssClass="ErrorMessage" EnableViewState="False"></asp:Label>
|
||||
|
||||
<asp:ObjectDataSource ID="ds訓練溝通記錄Form" runat="server" DataObjectTypeName="Education.訓練溝通記錄Item"
|
||||
TypeName="Education.DAC_訓練溝通記錄" OldValuesParameterFormatString="original_{0}"
|
||||
SelectMethod="SelectOne" InsertMethod="InsertOne" UpdateMethod="UpdateOne" DeleteMethod="DeleteOne"
|
||||
OnObjectCreating="ds訓練溝通記錄Form_ObjectCreating">
|
||||
<SelectParameters>
|
||||
<asp:ControlParameter Name="編號" Type="Int32" ControlID="gv訓練溝通記錄" PropertyName="SelectedDataKey["編號"]"></asp:ControlParameter>
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
<asp:ObjectDataSource ID="ds訓練溝通記錄Grid" runat="server" DataObjectTypeName="Education.訓練溝通記錄Item"
|
||||
TypeName="Education.DAC_訓練溝通記錄" OldValuesParameterFormatString="original_{0}"
|
||||
EnablePaging="true" SelectMethod="SelectPage" SelectCountMethod="SelectCount"
|
||||
OnObjectCreating="ds訓練溝通記錄Grid_ObjectCreating">
|
||||
<SelectParameters>
|
||||
<asp:Parameter Name="noInputReturnAll" Type="Boolean" DefaultValue="true" />
|
||||
<asp:Parameter Name="orderBy" Type="String" DefaultValue="溝通歷程,日期" />
|
||||
<asp:ControlParameter Name="訓練課程企劃編號" Type="Int32" ControlID="訓練企劃搜尋" PropertyName="訓練企劃編號"></asp:ControlParameter>
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
<asp:Panel runat="server" ID="Panel1" Visible="false">
|
||||
|
||||
<asp:FormView ID="fv訓練溝通記錄" runat="server" EnableModelValidation="True" EnableViewState="False"
|
||||
DataKeyNames="編號,訓練課程企劃編號,DB_APPNO" DataSourceID="ds訓練溝通記錄Form"
|
||||
OnItemInserting="fv訓練溝通記錄_ItemInserting"
|
||||
OnItemDeleted="fv訓練溝通記錄_ItemDeleted"
|
||||
OnDataBound="fv訓練溝通記錄_DataBound">
|
||||
<ItemTemplate>
|
||||
<div>
|
||||
<asp:LinkButton ID="btnInsert" runat="server" Text="新增" CommandName="New" CssClass="button blue80" />
|
||||
<asp:LinkButton ID="btnUpdate" runat="server" Text="更正" CommandName="Edit" CssClass="button green80" />
|
||||
<asp:LinkButton ID="btnDelete" runat="server" Text="刪除" CommandName="Delete" CssClass="button red80"
|
||||
OnClientClick="return confirm("是否確定刪除此筆資料?");" />
|
||||
<asp:LinkButton ID="btnAttach" runat="server" Text="附件管理" CssClass="button orange100"
|
||||
OnClientClick='<%# GetOpenWindowJS("溝通記錄附件.aspx", "_attach", "id", Eval("編號")) %>' />
|
||||
</div>
|
||||
<table border="0" cellpadding="3" cellspacing="2" style="table-layout: fixed;">
|
||||
<tr>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb溝通歷程Label" runat="server" Text="溝通歷程"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="3">
|
||||
<asp:Label ID="lb溝通歷程" runat="server" Text='<%# Dao訓練溝通記錄歷程.GetName(Eval("溝通歷程")) %>' CssClass="inputFull"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb日期Label" runat="server" Text="日期"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="1">
|
||||
<asp:Label ID="lb日期" runat="server" Text='<%# Eval("日期", "{0:yyyyMMdd}") %>' CssClass="inputFull"></asp:Label>
|
||||
</td>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb對象Label" runat="server" Text="對象"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="1">
|
||||
<asp:Label ID="lb對象" runat="server" Text='<%# Bind("對象") %>' CssClass="inputFull"></asp:Label>
|
||||
</td>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb溝通方式Label" runat="server" Text="溝通方式"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="1">
|
||||
<asp:Label ID="lb溝通方式" runat="server" Text='<%# Bind("溝通方式") %>' CssClass="inputFull"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb主題Label" runat="server" Text="主題"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="7">
|
||||
<asp:Label ID="lb主題" runat="server" Text='<%# Bind("主題") %>' CssClass="inputFull"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb內容Label" runat="server" Text="內容"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="7">
|
||||
<asp:Label ID="lb內容" runat="server" Text='<%# Eval("內容", "{0}").Replace("\r\n", "<br/>").Replace("\r", "<br/>").Replace("\n", "<br/>") %>' CssClass="inputFull"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ItemTemplate>
|
||||
<InsertItemTemplate>
|
||||
<div>
|
||||
<asp:LinkButton ID="btnSave" runat="server" Text="存檔" CommandName="Insert" CssClass="button blue80" />
|
||||
<asp:LinkButton ID="btnCancel" runat="server" Text="取消" CommandName="Cancel" CausesValidation="false" CssClass="button red80" OnClientClick="return confirm("是否確定取消新增?");" />
|
||||
</div>
|
||||
<table border="0" cellpadding="3" cellspacing="2" style="table-layout: fixed;">
|
||||
<tr>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb溝通歷程Label" runat="server" Text="溝通歷程"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="3">
|
||||
<weblib:WDropDownList ID="dd溝通歷程" runat="server" SelectedValue='<%# Bind("溝通歷程") %>' CssClass="inputFull"
|
||||
onchange="ShowReference(this.value)">
|
||||
<asp:ListItem Value="1" Text="年度計劃溝通紀錄(包含老師、學員、主管、客戶)" />
|
||||
<asp:ListItem Value="2" Text="課程設計溝通紀錄(包含老師、學員、主管、客戶)" />
|
||||
<asp:ListItem Value="3" Text="課程執行溝通紀錄(課中執行情況)" />
|
||||
<asp:ListItem Value="4" Text="課後查核溝通紀錄(檢討會議紀錄)" />
|
||||
<asp:ListItem Value="5" Text="成果溝通紀錄(老師、學員、主管回饋、意見)" />
|
||||
<asp:ListItem Value="999" Text="其他" />
|
||||
</weblib:WDropDownList>
|
||||
<asp:RequiredFieldValidator ID="rfv溝通歷程" runat="server" ControlToValidate="dd溝通歷程" Display="Dynamic" ErrorMessage="請選擇"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb日期Label" runat="server" Text="日期"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="1">
|
||||
<weblib:DateTextBox ID="txt日期" runat="server" Value='<%# Bind("日期") %>' DateOrder="YMD" DateSeparator="" CssClass="inputFull"></weblib:DateTextBox>
|
||||
<asp:RequiredFieldValidator ID="rfv日期" runat="server" ControlToValidate="txt日期" Display="Dynamic" ErrorMessage="請輸入"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb對象Label" runat="server" Text="對象"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="1">
|
||||
<asp:TextBox ID="txt對象" runat="server" Text='<%# Bind("對象") %>' MaxLength="50" CssClass="inputFull"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="rfv對象" runat="server" ControlToValidate="txt對象" Display="Dynamic" ErrorMessage="請輸入"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb溝通方式Label" runat="server" Text="溝通方式"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="1">
|
||||
<asp:TextBox ID="txt溝通方式" runat="server" Text='<%# Bind("溝通方式") %>' MaxLength="50" CssClass="inputFull"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="rfv溝通方式" runat="server" ControlToValidate="txt溝通方式" Display="Dynamic" ErrorMessage="請輸入"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">檢附資料參考</td>
|
||||
<td class="datadisplay" colspan="7">
|
||||
<asp:Label id="lbReference" runat="server" name="lbReference"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb主題Label" runat="server" Text="主題"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="7">
|
||||
<asp:TextBox ID="txt主題" runat="server" Text='<%# Bind("主題") %>' MaxLength="100" CssClass="inputFull"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="rfv主題" runat="server" ControlToValidate="txt主題" Display="Dynamic" ErrorMessage="請輸入"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb內容Label" runat="server" Text="內容"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="7">
|
||||
<asp:TextBox ID="txt內容" runat="server" Text='<%# Bind("內容") %>'
|
||||
MaxLength="2147483647" CssClass="inputFull" TextMode="MultiLine" Rows="10"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</InsertItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<div>
|
||||
<asp:LinkButton ID="btnSave" runat="server" Text="存檔" CommandName="Update" CssClass="button blue80" />
|
||||
<asp:LinkButton ID="btnCancel" runat="server" Text="取消" CommandName="Cancel" CausesValidation="false" CssClass="button red80" OnClientClick="return confirm("是否確定取消更正?");" />
|
||||
<asp:HiddenField ID="hfDBAPPNO" runat="server" Value='<%# Bind("DB_APPNO") %>' />
|
||||
</div>
|
||||
<table border="0" cellpadding="3" cellspacing="2" style="table-layout: fixed;">
|
||||
<tr>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb溝通歷程Label" runat="server" Text="溝通歷程"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="3">
|
||||
<weblib:WDropDownList ID="dd溝通歷程" runat="server" SelectedValue='<%# Bind("溝通歷程") %>' CssClass="inputFull"
|
||||
onchange="ShowReference(this.value)">
|
||||
<asp:ListItem Value="1" Text="年度計劃溝通紀錄(包含老師、學員、主管、客戶)" />
|
||||
<asp:ListItem Value="2" Text="課程設計溝通紀錄(包含老師、學員、主管、客戶)" />
|
||||
<asp:ListItem Value="3" Text="課程執行溝通紀錄(課中執行情況)" />
|
||||
<asp:ListItem Value="4" Text="課後查核溝通紀錄(檢討會議紀錄)" />
|
||||
<asp:ListItem Value="5" Text="成果溝通紀錄(老師、學員、主管回饋、意見)" />
|
||||
<asp:ListItem Value="999" Text="其他" />
|
||||
</weblib:WDropDownList>
|
||||
<asp:RequiredFieldValidator ID="rfv溝通歷程" runat="server" ControlToValidate="dd溝通歷程" Display="Dynamic" ErrorMessage="請選擇"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb日期Label" runat="server" Text="日期"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="1">
|
||||
<weblib:DateTextBox ID="txt日期" runat="server" Value='<%# Bind("日期") %>' DateOrder="YMD" DateSeparator="" CssClass="inputFull"></weblib:DateTextBox>
|
||||
<asp:RequiredFieldValidator ID="rfv日期" runat="server" ControlToValidate="txt日期" Display="Dynamic" ErrorMessage="請輸入"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb對象Label" runat="server" Text="對象"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="1">
|
||||
<asp:TextBox ID="txt對象" runat="server" Text='<%# Bind("對象") %>' MaxLength="50" CssClass="inputFull"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="rfv對象" runat="server" ControlToValidate="txt對象" Display="Dynamic" ErrorMessage="請輸入"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb溝通方式Label" runat="server" Text="溝通方式"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="1">
|
||||
<asp:TextBox ID="txt溝通方式" runat="server" Text='<%# Bind("溝通方式") %>' MaxLength="50" CssClass="inputFull"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="rfv溝通方式" runat="server" ControlToValidate="txt溝通方式" Display="Dynamic" ErrorMessage="請輸入"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">檢附資料參考</td>
|
||||
<td class="datadisplay" colspan="7">
|
||||
<asp:Label id="lbReference" runat="server" name="lbReference"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<span style="color: red;">*</span><asp:Label ID="lb主題Label" runat="server" Text="主題"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="7">
|
||||
<asp:TextBox ID="txt主題" runat="server" Text='<%# Bind("主題") %>' MaxLength="100" CssClass="inputFull"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="rfv主題" runat="server" ControlToValidate="txt主題" Display="Dynamic" ErrorMessage="請輸入"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb內容Label" runat="server" Text="內容"></asp:Label>
|
||||
</td>
|
||||
<td class="datainput" colspan="7">
|
||||
<asp:TextBox ID="txt內容" runat="server" Text='<%# Bind("內容") %>'
|
||||
MaxLength="2147483647" CssClass="inputFull" TextMode="MultiLine" Rows="10"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</EditItemTemplate>
|
||||
<EmptyDataTemplate>
|
||||
<div>
|
||||
<asp:LinkButton ID="btnInsert" runat="server" Text="新增" CommandName="New" CssClass="button blue80" />
|
||||
</div>
|
||||
<table border="0" style="table-layout: fixed">
|
||||
<tr>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_1"></td>
|
||||
<td colspan="1" class="widthcontrol labelCol"></td>
|
||||
<td colspan="1" class="widthcontrol controlCol_2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb溝通歷程Label" runat="server" Text="溝通歷程"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb日期Label" runat="server" Text="日期"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="1"></td>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb對象Label" runat="server" Text="對象"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="1"></td>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb溝通方式Label" runat="server" Text="溝通方式"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb主題Label" runat="server" Text="主題"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="7"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="lb內容Label" runat="server" Text="內容"></asp:Label>
|
||||
</td>
|
||||
<td class="datadisplay" colspan="7"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</EmptyDataTemplate>
|
||||
</asp:FormView>
|
||||
|
||||
<asp:GridView ID="gv訓練溝通記錄" runat="server" DataKeyNames="編號,訓練課程企劃編號,DB_APPNO"
|
||||
AutoGenerateColumns="False" EnableModelValidation="True" DataSourceID="ds訓練溝通記錄Grid"
|
||||
AllowPaging="true" PageSize="10" Width="100%" OnRowDataBound="gv訓練溝通記錄_RowDataBound">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="btnSelect" runat="server" CausesValidation="False" CommandName="Select" Text=""></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
<HeaderStyle Width="0" />
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="溝通歷程" SortExpression="溝通歷程">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Dao訓練溝通記錄歷程.GetName(Eval("溝通歷程")) %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="日期" HeaderText="日期" SortExpression="日期" DataFormatString="{0:yyyyMMdd}" HeaderStyle-Width="6em">
|
||||
<HeaderStyle Width="5em" />
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
</asp:BoundField>
|
||||
<asp:BoundField DataField="對象" HeaderText="對象" SortExpression="對象" HeaderStyle-Width="8em" >
|
||||
</asp:BoundField>
|
||||
<asp:BoundField DataField="溝通方式" HeaderText="溝通方式" SortExpression="溝通方式" HeaderStyle-Width="8em" >
|
||||
</asp:BoundField>
|
||||
<asp:BoundField DataField="主題" HeaderText="主題" SortExpression="主題" />
|
||||
<asp:TemplateField HeaderText="附件">
|
||||
<ItemTemplate>
|
||||
<asp:ObjectDataSource ID="ds訓練溝通記錄附件Grid" runat="server"
|
||||
DataObjectTypeName="Education.訓練溝通記錄附件Item"
|
||||
TypeName="Education.DAC_訓練溝通記錄附件"
|
||||
SelectMethod="SelectBy訓練溝通記錄編號">
|
||||
<SelectParameters>
|
||||
<asp:Parameter Name="訓練溝通記錄編號" Type="Int32"></asp:Parameter>
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
<asp:DataList runat="server" ID="dl訓練溝通記錄附件"
|
||||
DataSourceID="ds訓練溝通記錄附件Grid" RepeatDirection="Horizontal" RepeatLayout="Flow" OnItemDataBound="dl訓練溝通記錄附件_ItemDataBound">
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink runat="server" ID="hlItem" NavigateUrl="javascript:void(0)">
|
||||
<div style="display:inline-block">
|
||||
<asp:Image runat="server" ImageUrl='<%# GetAttachImageUrl(Eval("編號"), Eval("檔案名稱"), Eval("副檔名")) %>' />
|
||||
<asp:Label runat="server" Text='<%# Eval("標題") %>'></asp:Label>
|
||||
</div>
|
||||
</asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
</asp:DataList>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
<PagerTemplate>
|
||||
<weblib:GridViewPager runat="server" />
|
||||
</PagerTemplate>
|
||||
</asp:GridView>
|
||||
|
||||
</asp:Panel>
|
||||
</asp:Content>
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using WebLib;
|
||||
using System.Web.Services;
|
||||
using System.Web.Script.Services;
|
||||
using System.IO;
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
public partial class 溝通記錄 : FormBase
|
||||
{
|
||||
private DAC_訓練溝通記錄 Dao訓練溝通記錄;
|
||||
private DAC_訓練溝通記錄附件 Dao訓練溝通記錄附件;
|
||||
protected DAC_訓練溝通記錄歷程 Dao訓練溝通記錄歷程;
|
||||
private DAC_檔案圖示 Dao檔案圖示;
|
||||
private string 圖檔儲存路徑;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
FunctionName = "課程溝通紀錄";
|
||||
Dao訓練溝通記錄 = new DAC_訓練溝通記錄(conn);
|
||||
Dao訓練溝通記錄附件 = new DAC_訓練溝通記錄附件(conn);
|
||||
Dao訓練溝通記錄歷程 = new DAC_訓練溝通記錄歷程();
|
||||
Dao檔案圖示 = new DAC_檔案圖示();
|
||||
圖檔儲存路徑 = Server.MapPath(Education.PublicVariable.溝通記錄上傳路徑);
|
||||
|
||||
Form_View = fv訓練溝通記錄;
|
||||
Grid_View = gv訓練溝通記錄;
|
||||
FormView_DataSource = ds訓練溝通記錄Form;
|
||||
GridView_DataSource = ds訓練溝通記錄Grid;
|
||||
|
||||
if (IsPostBack)
|
||||
{
|
||||
Grid_View.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
protected void ds訓練溝通記錄Form_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
|
||||
{
|
||||
e.ObjectInstance = Dao訓練溝通記錄;
|
||||
}
|
||||
|
||||
protected void ds訓練溝通記錄Grid_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
|
||||
{
|
||||
e.ObjectInstance = Dao訓練溝通記錄;
|
||||
}
|
||||
|
||||
protected void btn查詢_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (訓練企劃搜尋.訓練企劃編號 == 0)
|
||||
{
|
||||
Panel1.Visible = false;
|
||||
lbMessage.Text = "請選擇課程企劃";
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Grid_View.DataBind();
|
||||
Form_View.DataBind();
|
||||
Panel1.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void fv訓練溝通記錄_ItemInserting(object sender, FormViewInsertEventArgs e)
|
||||
{
|
||||
e.Values["訓練課程企劃編號"] = 訓練企劃搜尋.訓練企劃編號;
|
||||
}
|
||||
|
||||
protected void gv訓練溝通記錄_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
var ds訓練溝通記錄附件Grid = e.Row.Cells[5].FindControl("ds訓練溝通記錄附件Grid") as ObjectDataSource;
|
||||
var dl訓練溝通記錄附件 = e.Row.Cells[5].FindControl("dl訓練溝通記錄附件") as DataList;
|
||||
|
||||
ds訓練溝通記錄附件Grid.SelectParameters["訓練溝通記錄編號"].DefaultValue = (e.Row.DataItem as 訓練溝通記錄Item)?.編號.ToString();
|
||||
dl訓練溝通記錄附件.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
protected string GetAttachImageUrl(object o編號, object o檔案名稱, object o副檔名)
|
||||
{
|
||||
var 編號 = DAC.GetInt32(o編號);
|
||||
var 檔案名稱 = DAC.GetString(o檔案名稱);
|
||||
var 副檔名 = DAC.GetString(o副檔名);
|
||||
var icon = Dao檔案圖示.GetName(副檔名.ToLower());
|
||||
if (icon == String.Empty)
|
||||
icon = "file.png";
|
||||
return ResolveClientUrl($"~/picture/{icon}");
|
||||
}
|
||||
|
||||
protected void dl訓練溝通記錄附件_ItemDataBound(object sender, DataListItemEventArgs e)
|
||||
{
|
||||
var hlItem = e.Item.FindControl("hlItem") as HyperLink;
|
||||
hlItem.Attributes.Add("onclick", $"OpenAttachment({(e.Item.DataItem as 訓練溝通記錄附件Item)?.編號});");
|
||||
}
|
||||
|
||||
protected void fv訓練溝通記錄_DataBound(object sender, EventArgs e)
|
||||
{
|
||||
if (fv訓練溝通記錄.CurrentMode == FormViewMode.Insert || fv訓練溝通記錄.CurrentMode == FormViewMode.Edit)
|
||||
{
|
||||
var lbReference = fv訓練溝通記錄.FindControl("lbReference") as Label;
|
||||
if (lbReference != null)
|
||||
{
|
||||
if (fv訓練溝通記錄.CurrentMode == FormViewMode.Insert)
|
||||
{
|
||||
lbReference.Text = GetData.取得檢附資料參考("1");
|
||||
}
|
||||
if (fv訓練溝通記錄.CurrentMode == FormViewMode.Edit)
|
||||
{
|
||||
lbReference.Text = GetData.取得檢附資料參考((fv訓練溝通記錄.DataItem as 訓練溝通記錄Item).溝通歷程.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public static string GetReference(string id)
|
||||
{
|
||||
return new DAC_GetData().取得檢附資料參考(id);
|
||||
}
|
||||
|
||||
protected void fv訓練溝通記錄_ItemDeleted(object sender, FormViewDeletedEventArgs e)
|
||||
{
|
||||
int 編號 = DAC.GetInt32(e.Keys["編號"]);
|
||||
|
||||
var attachList = Dao訓練溝通記錄附件.SelectBy訓練溝通記錄編號(編號);
|
||||
var path = $"{圖檔儲存路徑}{編號}";
|
||||
foreach (var item in attachList)
|
||||
{
|
||||
Dao訓練溝通記錄附件.DeleteOne(item);
|
||||
string fileName1 = String.Format("{0}\\{1:000000}.{2}", path, item.編號, item.副檔名);
|
||||
try
|
||||
{
|
||||
if (File.Exists(fileName1))
|
||||
File.Delete(fileName1);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
Directory.Delete(path);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自動產生>
|
||||
// 這段程式碼是由工具產生的。
|
||||
//
|
||||
// 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
|
||||
// 程式碼,則會遺失變更。
|
||||
// </自動產生>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
|
||||
|
||||
public partial class 溝通記錄
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 訓練企劃搜尋 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::Education.Forms.Common.訓練企劃搜尋 訓練企劃搜尋;
|
||||
|
||||
/// <summary>
|
||||
/// lbMessage 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lbMessage;
|
||||
|
||||
/// <summary>
|
||||
/// ds訓練溝通記錄Form 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ds訓練溝通記錄Form;
|
||||
|
||||
/// <summary>
|
||||
/// ds訓練溝通記錄Grid 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ds訓練溝通記錄Grid;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// fv訓練溝通記錄 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.FormView fv訓練溝通記錄;
|
||||
|
||||
/// <summary>
|
||||
/// gv訓練溝通記錄 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView gv訓練溝通記錄;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/PopupForm.Master" AutoEventWireup="true" CodeBehind="溝通記錄編輯.aspx.cs" Inherits="Education.Forms.溝通記錄.溝通記錄編輯" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
||||
</asp:Content>
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
public partial class 溝通記錄編輯 : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 這段程式碼是由工具產生的。
|
||||
//
|
||||
// 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
|
||||
// 變更將會遺失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
|
||||
|
||||
public partial class 溝通記錄編輯
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/PopupForm.Master" AutoEventWireup="true" CodeBehind="溝通記錄附件.aspx.cs" Inherits="Education.Forms.溝通記錄.溝通記錄附件" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
||||
|
||||
<script type="text/javascript" src="CommRecord.js"></script>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
||||
|
||||
<asp:ObjectDataSource ID="ds訓練溝通記錄附件Grid" runat="server"
|
||||
DataObjectTypeName="Education.訓練溝通記錄附件Item"
|
||||
TypeName="Education.DAC_訓練溝通記錄附件"
|
||||
SelectMethod="SelectBy訓練溝通記錄編號"
|
||||
OnObjectCreating="ds訓練溝通記錄附件Grid_ObjectCreating"
|
||||
UpdateMethod="UpdateOne" DeleteMethod="DeleteOne">
|
||||
<SelectParameters>
|
||||
<asp:QueryStringParameter Name="訓練溝通記錄編號" Type="Int32" QueryStringField="id"></asp:QueryStringParameter>
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
<table border="0" cellpadding="3" cellspacing="2" style="table-layout: fixed;">
|
||||
<tr>
|
||||
<td class="caption">課程</td>
|
||||
<td class="datadisplay">
|
||||
<asp:Label runat="server" ID="lb課程"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">溝通歷程</td>
|
||||
<td class="datadisplay">
|
||||
<asp:Label runat="server" ID="lb溝通歷程"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">檢附資料參考</td>
|
||||
<td class="datadisplay">
|
||||
<asp:Label runat="server" ID="lb檢附資料參考"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="Label3" runat="server" Text="標題"></asp:Label></td>
|
||||
<td class="datainput">
|
||||
<asp:TextBox ID="txt標題" runat="server" Columns="100" ValidationGroup="insert"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt標題"
|
||||
CssClass="ErrorMessage" Display="Dynamic" ErrorMessage="請輸入" ValidationGroup="insert"></asp:RequiredFieldValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">
|
||||
<asp:Label ID="Label1" runat="server" Text="檔案上傳"></asp:Label></td>
|
||||
<td class="datainput">
|
||||
<asp:FileUpload ID="fu檔案上傳" runat="server" />
|
||||
<asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="fu檔案上傳"
|
||||
CssClass="ErrorMessage" Display="Dynamic" ErrorMessage="請選擇要上傳的檔案" OnServerValidate="CustomValidator1_ServerValidate"
|
||||
ValidateEmptyText="True" ValidationGroup="insert"></asp:CustomValidator>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td class="datainput">
|
||||
<asp:LinkButton ID="btnInsert" runat="server" CssClass="button blue80" OnClick="btnInsert_Click"
|
||||
ValidationGroup="insert">新增</asp:LinkButton>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<asp:GridView ID="gv訓練溝通記錄附件" runat="server" DataKeyNames="訓練溝通記錄編號,編號,檔案名稱,副檔名,DB_APPNO"
|
||||
AutoGenerateColumns="False" EnableModelValidation="True" DataSourceID="ds訓練溝通記錄附件Grid"
|
||||
OnRowDataBound="gv訓練溝通記錄附件_RowDataBound" OnRowDeleting="gv訓練溝通記錄附件_RowDeleting"
|
||||
Width="100%">
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<EditItemTemplate>
|
||||
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
|
||||
CssClass="button blue60" Text="儲存"></asp:LinkButton>
|
||||
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
CssClass="button red60" OnClientClick="return confirm("是否確定放棄更正?");"
|
||||
Text="取消"></asp:LinkButton>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
|
||||
CssClass="button green60" Text="更正"></asp:LinkButton>
|
||||
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
|
||||
CssClass="button red60" OnClientClick="return confirm("是否確定刪除此項附件?");"
|
||||
Text="刪除"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
<HeaderStyle Width="140px" />
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="標題" SortExpression="標題">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("標題") %>' CssClass="inputFull"></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Bind("標題") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="檔案名稱" HeaderText="檔案名稱" SortExpression="檔案名稱" ReadOnly="true" />
|
||||
<asp:TemplateField HeaderText="檔案下載">
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink runat="server" ID="hlItem" NavigateUrl="javascript:void(0)">
|
||||
<div style="display:inline-block">
|
||||
<asp:Image runat="server" ImageUrl='<%# GetAttachImageUrl(Eval("編號"), Eval("檔案名稱"), Eval("副檔名")) %>' />
|
||||
</div>
|
||||
</asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
<HeaderStyle Width="80px" />
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</asp:Content>
|
||||
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebLib;
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
public partial class 溝通記錄附件 : FormBase
|
||||
{
|
||||
private int id;
|
||||
private DAC_檔案圖示 Dao檔案圖示;
|
||||
private DAC_訓練溝通記錄附件 Dao訓練溝通記錄附件;
|
||||
private DAC_訓練溝通記錄 Dao訓練溝通記錄;
|
||||
private string 圖檔儲存路徑;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
FunctionName = "溝通紀錄附件管理";
|
||||
id = DAC.GetInt32(Request["id"]);
|
||||
Dao檔案圖示 = new DAC_檔案圖示();
|
||||
Dao訓練溝通記錄附件 = new DAC_訓練溝通記錄附件(conn);
|
||||
Dao訓練溝通記錄 = new DAC_訓練溝通記錄(conn);
|
||||
圖檔儲存路徑 = Server.MapPath(Education.PublicVariable.溝通記錄上傳路徑);
|
||||
|
||||
RegisterPostbackTrigger(btnInsert);
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
var 訓練溝通記錄 = Dao訓練溝通記錄.SelectOne(id).FirstOrDefault();
|
||||
if (訓練溝通記錄 != null)
|
||||
{
|
||||
var 訓練課程企劃 = new DAC_訓練課程企劃().SelectOne(訓練溝通記錄.訓練課程企劃編號).FirstOrDefault();
|
||||
if (訓練課程企劃 != null)
|
||||
lb課程.Text = $"[{訓練課程企劃.顯示編號}] [{訓練課程企劃.訓練日期, 0:yyyy-MM-dd}]{訓練課程企劃.訓練名稱}";
|
||||
lb溝通歷程.Text = new DAC_訓練溝通記錄歷程().GetName(訓練溝通記錄.溝通歷程);
|
||||
lb檢附資料參考.Text = GetData.取得檢附資料參考(訓練溝通記錄.溝通歷程.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gv訓練溝通記錄附件.DataBind();
|
||||
}
|
||||
|
||||
(Master as PopupForm).RefreshOpener = true;
|
||||
}
|
||||
|
||||
protected string GetAttachImageUrl(object o編號, object o檔案名稱, object o副檔名)
|
||||
{
|
||||
var 編號 = DAC.GetInt32(o編號);
|
||||
var 檔案名稱 = DAC.GetString(o檔案名稱);
|
||||
var 副檔名 = DAC.GetString(o副檔名);
|
||||
var icon = Dao檔案圖示.GetName(副檔名.ToLower());
|
||||
if (icon == String.Empty)
|
||||
icon = "file.png";
|
||||
return ResolveClientUrl($"~/picture/{icon}");
|
||||
}
|
||||
|
||||
protected void gv訓練溝通記錄附件_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
var hlItem = e.Row.Cells[3].FindControl("hlItem") as HyperLink;
|
||||
hlItem.Attributes.Add("onclick", $"OpenAttachment({(e.Row.DataItem as 訓練溝通記錄附件Item)?.編號});");
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnInsert_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsValid)
|
||||
return;
|
||||
|
||||
var fileName = fu檔案上傳.FileName;
|
||||
var fileExt = Path.GetExtension(fu檔案上傳.FileName).ToLower();
|
||||
if (fileExt.StartsWith("."))
|
||||
fileExt = fileExt.Substring(1);
|
||||
|
||||
var newValue = new 訓練溝通記錄附件Item()
|
||||
{
|
||||
訓練溝通記錄編號 = id,
|
||||
標題 = txt標題.Text,
|
||||
檔案名稱 = fileName,
|
||||
副檔名 = fileExt,
|
||||
ContentType = fu檔案上傳.PostedFile.ContentType
|
||||
};
|
||||
|
||||
Dao訓練溝通記錄附件.InsertOne(newValue);
|
||||
|
||||
string savePath = String.Format("{0}{1}", 圖檔儲存路徑, id);
|
||||
if (!Directory.Exists(savePath))
|
||||
Directory.CreateDirectory(savePath);
|
||||
|
||||
var tFullName = String.Format("{0}\\{1:000000}.{2}", savePath, newValue.編號, fileExt);
|
||||
fu檔案上傳.PostedFile.SaveAs(tFullName);
|
||||
|
||||
gv訓練溝通記錄附件.DataBind();
|
||||
}
|
||||
|
||||
protected void ds訓練溝通記錄附件Grid_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
|
||||
{
|
||||
e.ObjectInstance = Dao訓練溝通記錄附件;
|
||||
}
|
||||
|
||||
protected void gv訓練溝通記錄附件_RowDeleting(object sender, GridViewDeleteEventArgs e)
|
||||
{
|
||||
int 訓練溝通記錄編號 = DAC.GetInt32(e.Keys["訓練溝通記錄編號"]);
|
||||
int 編號 = DAC.GetInt32(e.Keys["編號"]);
|
||||
string 副檔名 = DAC.GetString(e.Keys["副檔名"]);
|
||||
string fileName1 = String.Format("{0}{1}\\{2:000000}.{3}", 圖檔儲存路徑, 訓練溝通記錄編號, 編號, 副檔名);
|
||||
if (File.Exists(fileName1))
|
||||
File.Delete(fileName1);
|
||||
}
|
||||
|
||||
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
|
||||
{
|
||||
args.IsValid = fu檔案上傳.HasFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自動產生>
|
||||
// 這段程式碼是由工具產生的。
|
||||
//
|
||||
// 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
|
||||
// 程式碼,則會遺失變更。
|
||||
// </自動產生>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
|
||||
|
||||
public partial class 溝通記錄附件
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// ds訓練溝通記錄附件Grid 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ds訓練溝通記錄附件Grid;
|
||||
|
||||
/// <summary>
|
||||
/// lb課程 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lb課程;
|
||||
|
||||
/// <summary>
|
||||
/// lb溝通歷程 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lb溝通歷程;
|
||||
|
||||
/// <summary>
|
||||
/// lb檢附資料參考 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lb檢附資料參考;
|
||||
|
||||
/// <summary>
|
||||
/// Label3 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label3;
|
||||
|
||||
/// <summary>
|
||||
/// txt標題 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txt標題;
|
||||
|
||||
/// <summary>
|
||||
/// RequiredFieldValidator1 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// fu檔案上傳 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.FileUpload fu檔案上傳;
|
||||
|
||||
/// <summary>
|
||||
/// CustomValidator1 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CustomValidator CustomValidator1;
|
||||
|
||||
/// <summary>
|
||||
/// btnInsert 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton btnInsert;
|
||||
|
||||
/// <summary>
|
||||
/// gv訓練溝通記錄附件 控制項。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自動產生的欄位。
|
||||
/// 若要修改,請將欄位宣告從設計工具檔案移到程式碼後置檔案。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView gv訓練溝通記錄附件;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/PopupForm.Master" AutoEventWireup="true" CodeBehind="附件檢視.aspx.cs"
|
||||
Inherits="Education.Forms.溝通記錄.附件檢視" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
||||
</asp:Content>
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebLib;
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
public partial class 附件檢視 : FormBase
|
||||
{
|
||||
private int id;
|
||||
private DAC_訓練溝通記錄附件 Dao訓練溝通記錄附件;
|
||||
private string 圖檔儲存路徑;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
FunctionName = "溝通紀錄附件檢視";
|
||||
id = DAC.GetInt32(Request["id"]);
|
||||
Dao訓練溝通記錄附件 = new DAC_訓練溝通記錄附件(conn);
|
||||
圖檔儲存路徑 = Server.MapPath(Education.PublicVariable.溝通記錄上傳路徑);
|
||||
|
||||
var item = Dao訓練溝通記錄附件.SelectOne(id).FirstOrDefault();
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
string fileName = String.Format("{0}{1}\\{2:000000}.{3}", 圖檔儲存路徑, item.訓練溝通記錄編號, item.編號, item.副檔名);
|
||||
string fileName1 = Server.UrlEncode(item.檔案名稱);
|
||||
Response.ClearHeaders();
|
||||
Response.Clear();
|
||||
Response.Expires = 0;
|
||||
Response.Buffer = true;
|
||||
Response.AddHeader("Accept-Language", "zh-tw");
|
||||
Response.AddHeader("content-disposition", String.Format("attachment; filename=\"{0}\"", fileName1));
|
||||
Response.ContentType = item.ContentType;
|
||||
Response.WriteFile(fileName);
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自動產生>
|
||||
// 這段程式碼是由工具產生的。
|
||||
//
|
||||
// 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
|
||||
// 程式碼,則會遺失變更。
|
||||
// </自動產生>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
|
||||
|
||||
public partial class 附件檢視
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
public class 附件檢視
|
||||
{
|
||||
public void WriteFile(int id, HttpContext cnx)
|
||||
{
|
||||
DAC_訓練溝通記錄附件 Dao訓練溝通記錄附件 = new DAC_訓練溝通記錄附件();
|
||||
string 圖檔儲存路徑 = cnx.Server.MapPath(Education.PublicVariable.溝通記錄上傳路徑);
|
||||
|
||||
var item = Dao訓練溝通記錄附件.SelectOne(id).FirstOrDefault();
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
string fileName = String.Format("{0}{1}\\{2:000000}.{3}", 圖檔儲存路徑, item.訓練溝通記錄編號, item.編號, item.副檔名);
|
||||
string fileName1 = cnx.Server.UrlEncode(item.檔案名稱);
|
||||
cnx.Response.ClearHeaders();
|
||||
cnx.Response.Clear();
|
||||
cnx.Response.Expires = 0;
|
||||
cnx.Response.Buffer = true;
|
||||
cnx.Response.AddHeader("Accept-Language", "zh-tw");
|
||||
cnx.Response.AddHeader("content-disposition", String.Format("attachment; filename=\"{0}\"", fileName1));
|
||||
cnx.Response.ContentType = item.ContentType;
|
||||
cnx.Response.WriteFile(fileName);
|
||||
cnx.Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user