<InsertItemTemplate>
<br />
<div class="subtitle">
基本</div>
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" Text="確定"
OnClick="InsertButton_Click" />
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" Text="取消"
OnClick="UpdateCancelButton_Click" />
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Message_Add_1" runat="server" ForeColor="Red"></asp:Label>
<table class="detailstable" frame="box">
<tr>
<td align="right" class="styleC1">
ID :
</td>
<td class="styleC2">
(新增)
</td>
<td class="styleC3" rowspan="14">
</td>
<td align="right" class="styleC1">
流水號 :
</td>
<td class="styleC2">
<asp:TextBox ID="Flow_NoTextBoxA" runat="server" Text='<%# Bind("Flow_No") %>' Width="99.1%" />
</td>
</tr>
<tr>
<td align="center" class="styleCPicture" colspan="2" rowspan="13">
<div>
請先新增資料,再上傳圖片</div>
</td>
<td align="right" class="styleC1">
廠款號 :
</td>
<td class="styleC2">
<asp:TextBox ID="Factory_Style_NoTextBoxA" runat="server" Text='<%# Bind("Factory_Style_No") %>'
Width="99.1%" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
客款號 :
</td>
<td class="styleC2">
<asp:TextBox ID="Customer_Style_NoTextBoxA" runat="server" Text='<%# Bind("Customer_Style_No") %>'
Width="99.1%" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
廠款式描述 :
</td>
<td class="styleC2">
<asp:TextBox ID="Sample_DescriptionTextBoxA" runat="server" Text='<%# Bind("Sample_Description") %>'
Width="99.1%" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
客款式描述 :
</td>
<td class="styleC2">
<asp:TextBox ID="Customer_Sample_DescriptionTextBoxA" runat="server"
Text='<%# Bind("Customer_Sample_Description") %>' Width="99.1%" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
客品牌 :
</td>
<td class="styleC2">
<asp:TextBox ID="Customer_BrandTextBoxA" runat="server"
Text='<%# Bind("Customer_Brand") %>' Width="99.1%" CssClass="pick_box disable_textbox" />
<asp:DropDownExtender ID="Customer_BrandTextBoxA_DropDownExtender"
runat="server" DropDownControlID="Customer_Brand_PanelA"
Enabled="True" TargetControlID="Customer_BrandTextBoxA">
</asp:DropDownExtender>
<asp:Panel CssClass="ContainPanel" ID="Customer_Brand_PanelA" runat="server" Style="visibility: hidden; position:absolute;" Width="31.5%">
<asp:DataList ID="DataList5" runat="server" DataSourceID="Customer_Brand_SqlDataSource"
Width="100%">
<ItemTemplate>
<asp:Label ID="Label17" style="cursor:pointer;" runat="server" Text='<%# Eval("Customer_Brand") %>'></asp:Label>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
</td>
</tr>
<tr>
<td align="right" class="styleC1">
廠辦類 :
</td>
<td class="styleC2">
<asp:TextBox ID="Sample_TypeTextBoxA" runat="server" Text='<%# Bind("Sample_Type") %>'
Width="99.1%" CssClass=" pick_box"/>
<asp:DropDownExtender ID="Sample_TypeTextBoxA_DropDownExtender" runat="server" DropDownControlID="Sample_Type_PanelA"
Enabled="True" TargetControlID="Sample_TypeTextBoxA">
</asp:DropDownExtender>
<asp:Panel CssClass="ContainPanel" ID="Sample_Type_PanelA" runat="server" Style="visibility: hidden; position:absolute;" Width="31.5%">
<asp:DataList ID="DataList6" runat="server" DataSourceID="Sample_Type_SqlDataSource"
Width="100%">
<ItemTemplate>
<asp:Label ID="Label13" runat="server" style="cursor:pointer;" Text='<%# Eval("Sample_Type")%>'></asp:Label>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
</td>
</tr>
<tr>
<td align="right" class="styleC1">
客辦類 :
</td>
<td class="styleC2">
<asp:TextBox ID="Customer_Sample_TypeTextBoxA" runat="server" Text='<%# Bind("Customer_Sample_Type") %>'
Width="99.1%" CssClass=" pick_box" />
<asp:DropDownExtender ID="Customer_Sample_TypeTextBoxA_DropDownExtender" runat="server"
DropDownControlID="Customer_Sample_Type_PanelA" Enabled="True"
TargetControlID="Customer_Sample_TypeTextBoxA">
</asp:DropDownExtender>
<asp:Panel CssClass="ContainPanel" ID="Customer_Sample_Type_PanelA" runat="server"
Style="visibility: hidden; position:absolute;" Width="31.5%">
<asp:DataList ID="DataList33" runat="server" DataSourceID="Customer_Sample_Type_SqlDataSource"
Width="100%">
<ItemTemplate>
<asp:Label ID="Label13" runat="server" style="cursor:pointer;" Text='<%# Eval("Customer_Sample_Type") %>'></asp:Label>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
</td>
</tr>
<tr>
<td align="right" class="styleC1">
季度 :
</td>
<td class="styleC2">
<asp:TextBox ID="SeasonTextBoxA" runat="server" Text='<%# Bind("Season") %>' Width="99.1%" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
主身布 :
</td>
<td class="styleC2">
<asp:TextBox ID="Main_FabricTextBoxA" runat="server" Text='<%# Bind("Main_Fabric") %>'
Width="99.1%" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
成衣洗水 :
</td>
<td class="styleC2">
<asp:TextBox ID="Garment_WashTextBoxA" runat="server" Text='<%# Bind("Garment_Wash") %>'
Width="99.1%" CssClass="pick_box" />
<asp:DropDownExtender ID="DropDownExtender3" runat="server" DropDownControlID="Garment_Wash_PanelA"
Enabled="True" TargetControlID="Garment_WashTextBoxA">
</asp:DropDownExtender>
<asp:Panel CssClass="ContainPanel" ID="Garment_Wash_PanelA" runat="server" Style="visibility: hidden; position:absolute;"
Width="31.5%">
<asp:DataList ID="DataList7Edit" runat="server" DataSourceID="Garment_WashSqlDataSource"
Width="100%">
<ItemTemplate>
<asp:Label ID="Label16Edit" style="cursor:pointer;" runat="server" Text='<%# Eval("Garment_Wash")%>'></asp:Label>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
</td>
</tr>
<tr>
<td align="right" class="styleC1">
*營業組 :
</td>
<td class="styleC2">
<asp:TextBox ID="Sales_TeamTextBoxA" runat="server"
Text='<%# Bind("Sales_Team")%>' CssClass="width_class1 pick_box disable_textbox" />
<asp:DropDownExtender ID="Sales_TeamDropDownExtenderA"
runat="server" Enabled="True"
TargetControlID="Sales_TeamTextBoxA" DropDownControlID="Sales_TeamPanelA">
</asp:DropDownExtender>
<asp:Panel CssClass="ContainPanel" ID="Sales_TeamPanelA" runat="server" Width="31.5%" Style="visibility: hidden; position:absolute;">
<asp:DataList ID="Sales_TeamDataListA" runat="server" DataSourceID="Sales_TeamSqlDataSource" Width="100%">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" style="cursor:pointer;" Text='<%# Eval("Sales_Team")%>'></asp:Label>
</ItemTemplate>
</asp:DataList>
</asp:Panel>
</td>
</tr>
<tr>
<td align="right" class="styleC1">
跟單員 :
</td>
<td class="styleC2">
<asp:Label ID="Writer" runat="server" Text='<%# Session("People_Name").toString()%>' />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
*數量 :
</td>
<td class="styleC2">
<asp:TextBox ID="QuantityTextBoxA" runat="server" Text='<%# Bind("Quantity") %>'
Width="99.1%" />
</td>
</tr>
<tr>
<td class="styleC1" align="right" colspan="5">
</td>
</tr>
</table>
<br />
<br />
<div class="subtitle">
詳細
</div>
<asp:Label ID="Message_Add" runat="server" ForeColor="Red"></asp:Label>
<table class="detailstable">
<tr>
<td align="right" class="styleC1">
*預計走辦期 :
</td>
<td class="styleC2">
<asp:TextBox ID="Request_Finish_DateTextBoxA" runat="server" Text='<%# Bind("Request_Finish_Date") %>'
Width="99.1%" Enabled="False" OnDataBinding="Request_Finish_DateTextBoxA_DataBinding"></asp:TextBox>
<asp:CalendarExtender ID="Request_Finish_DateTextBoxA_CalendarExtender" runat="server"
DaysModeTitleFormat="MMMM, yyyy HH:mm:ss" Enabled="True" Format="yyyy/MM/dd HH:mm:ss"
TargetControlID="Request_Finish_DateTextBoxA">
</asp:CalendarExtender>
</td>
<td class="styleC3" rowspan="8">
</td>
<td align="right" class="styleC1">
*預計齊布期 :
</td>
<td class="styleC2">
<asp:TextBox ID="Fabric_Expected_DateTextBoxA" runat="server"
Text="<%#DateTime.Now.ToString()%>" Width="99.1%" />
<asp:CalendarExtender ID="Fabric_Expected_DateTextBoxA_CalendarExtender"
runat="server" Enabled="True" Format="yyyy/MM/dd HH:mm:ss"
TargetControlID="Fabric_Expected_DateTextBoxA">
</asp:CalendarExtender>
</td>
</tr>
<tr>
<td align="right" class="styleC1">
參考衫辦 :
</td>
<td class="styleC2">
<asp:CheckBox ID="Reference_SampleCheckBoxA" runat="server"
Checked='<%# Bind("Reference_Sample") %>' />
</td>
<td align="right" class="styleC1">
*預計齊輔料期 :
</td>
<td class="styleC2">
<asp:TextBox ID="Accessories_Expected_DateTextBoxA" runat="server"
Text="<%#DateTime.Now.ToString()%>" Width="99.1%" />
<asp:CalendarExtender ID="Accessories_Expected_DateTextBoxA_CalendarExtender"
runat="server" Enabled="True" Format="yyyy/MM/dd HH:mm:ss"
TargetControlID="Accessories_Expected_DateTextBoxA">
</asp:CalendarExtender>
</td>
</tr>
<tr>
<td align="right" class="styleC1">
工藝難度 :
</td>
<td class="styleC2">
<asp:DropDownList ID="WorkmanshipDropDownListA" runat="server"
SelectedValue='<%# Bind("Workmanship") %>' Width="100%">
<asp:ListItem>鈒仚</asp:ListItem>
<asp:ListItem>平車</asp:ListItem>
<asp:ListItem>重工</asp:ListItem>
<asp:ListItem>模辦</asp:ListItem>
</asp:DropDownList>
</td>
<td align="right" class="styleC1">
建立日期 :
</td>
<td class="styleC2">
<asp:Label ID="Write_DateLabel" runat="server"
Text="<%#DateTime.Now.ToString()%>" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
*裁片加工 :
</td>
<td class="styleC2">
<asp:DropDownList ID="Panel_ProcessDropDownListA" runat="server"
SelectedValue='<%# Bind("Panel_Process") %>' Width="100%">
<asp:ListItem>無</asp:ListItem>
<asp:ListItem>長安車花</asp:ListItem>
<asp:ListItem>長安燙畫</asp:ListItem>
<asp:ListItem>長安車花+長安燙畫</asp:ListItem>
<asp:ListItem>長安車花+外廠加工</asp:ListItem>
<asp:ListItem>外廠加工</asp:ListItem>
<asp:ListItem>外廠裁片加工長安車花+外廠加工</asp:ListItem>
<asp:ListItem>長安燙畫+外廠加工</asp:ListItem>
</asp:DropDownList>
</td>
<td align="right" class="styleC1">
①派單 :
</td>
<td class="styleC2">
<asp:CheckBox ID="Submit_DateLabel_C" runat="server" AutoPostBack="True"
Enabled="False" OnCheckedChanged="Submit_DateLabel_C_CheckedChanged" />
<asp:Label ID="Submit_DateLabel" runat="server"
Text='<%# Bind("Submit_Date") %>' />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
*半成品加工 :
</td>
<td class="styleC2">
<asp:DropDownList ID="Half_Finished_ProcessDropDownListA" runat="server"
SelectedValue='<%# Bind("Half_Finished_Process") %>' Width="100%">
<asp:ListItem>無</asp:ListItem>
<asp:ListItem>長安半成品車花</asp:ListItem>
<asp:ListItem>長安半成品燙畫</asp:ListItem>
<asp:ListItem>外廠半成品加工</asp:ListItem>
</asp:DropDownList>
</td>
<td align="right" class="styleC1">
急單 :
</td>
<td class="styleC2">
<asp:CheckBox ID="UrgentLabelCheckBox" runat="server" AutoPostBack="True"
Checked='<%# Bind("Urgent") %>' Enabled="False"
OnCheckedChanged="UrgentLabelCheckBox_CheckedChanged1" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
*成品加工 :
</td>
<td class="styleC2">
<asp:DropDownList ID="Garment_ProcessDropDownListA" runat="server"
SelectedValue='<%# Bind("Garment_Process") %>' Width="100%">
<asp:ListItem>無</asp:ListItem>
<asp:ListItem>長安成衣車花</asp:ListItem>
<asp:ListItem>長安成衣燙畫</asp:ListItem>
<asp:ListItem>長安成衣洗水</asp:ListItem>
<asp:ListItem>外廠成衣加工</asp:ListItem>
</asp:DropDownList>
</td>
<td align="right" class="styleC1">
修正 :</td>
<td class="styleC2">
<asp:CheckBox ID="CheckBox1" runat="server" Enabled="False" />
</td>
</tr>
<tr>
<td align="right" class="styleC1">
紙樣 :
</td>
<td class="styleC2">
<asp:DropDownList ID="Paper_PatternDropDownListA" runat="server"
SelectedValue='<%# Bind("Paper_Pattern") %>' Width="100%">
<asp:ListItem>起紙樣</asp:ListItem>
<asp:ListItem>用舊樣</asp:ListItem>
<asp:ListItem>客供樣</asp:ListItem>
<asp:ListItem>改舊樣</asp:ListItem>
<asp:ListItem>無</asp:ListItem>
</asp:DropDownList>
</td>
<td align="right" class="styleC1">
</td>
<td class="styleC2">
</td>
</tr>
<tr>
<td align="right" class="styleC1">
是否排料 :
</td>
<td class="styleC2">
<asp:CheckBox ID="Maker_MakingCheckBoxA" runat="server"
Checked='<%# Bind("Maker_Making") %>' />
</td>
<td align="right" class="styleC1">
</td>
<td class="styleC2">
</td>
</tr>
<tr style="background-color: #FFFF99;">
<td align="right" class="styleC1">
跟單備註 :
</td>
<td class="styleCRemarks" colspan="4">
<asp:TextBox ID="Writer_RemarksTextBoxA" runat="server" Text='<%# Bind("Writer_Remarks") %>'
Width="99.6%" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</InsertItemTemplate>
Protected Sub InsertButton_Click(ByVal sender As Object, ByVal e As EventArgs) '基本頁新增
Try
Dim formview As FormView = FormView1
Dim submit_date As Label = DirectCast(formview.FindControl("Submit_DateLabel"), Label)
Dim local_massage1 As Label = DirectCast(formview.FindControl("Message_Add_1"), Label)
Dim local_massage2 As Label = DirectCast(formview.FindControl("Message_Add"), Label)
Dim request_finish_date As TextBox = DirectCast(formview.FindControl("Request_Finish_DateTextBoxA"), TextBox)
Dim quantity As TextBox = DirectCast(FormView1.FindControl("QuantityTextBoxA"), TextBox)
Dim sales_team As TextBox = DirectCast(formview.FindControl("Sales_TeamTextBoxA"), TextBox)
If submit_date.Text <> "" And request_finish_date.Text = "" Then
local_massage2.Text = "*必須取得預計走辦期!"
Return
End If
If quantity.Text = "" Or Not IsNumeric(quantity.Text) Then
local_massage1.Text = "*數量需為數字類型!"
quantity.Focus()
Return
ElseIf sales_team.Text = "" Then
local_massage1.Text = "*請選擇營業組!"
sales_team.Focus()
Return
End If
Using cn As New SqlConnection()
cn.ConnectionString = ConfigurationManager.ConnectionStrings("Sample_Room_ProgressConnectionString").ConnectionString
cn.Open()
Dim sqlStr As String = "INSERT INTO Progress(Flow_No, Factory_Style_No, Customer_Style_No, Sample_Description, Customer_Sample_Description," & _
"Customer_Brand, Sample_Type, Customer_Sample_Type, Season, Quantity, Main_Fabric, Garment_Wash, Writer, Writer_Inline_No, Write_Date, Sales_Team, Request_Finish_Date, " & _
"Reference_Sample, Workmanship, Panel_Process, Half_Finished_Process, Garment_Process, Paper_Pattern, Maker_Making, Fabric_Expected_Date," & _
"Accessories_Expected_Date, Writer_Remarks, Submit_Date, Status, Urgent)" & _
_
"VALUES(@Flow_No, @Factory_Style_No, @Customer_Style_No, @Sample_Description, @Customer_Sample_Description," & _
"@Customer_Brand, @Sample_Type, @Customer_Sample_Type, @Season, @Quantity, @Main_Fabric, @Garment_Wash, @Writer, @Writer_Inline_No, @Write_Date, @Sales_Team, @Request_Finish_Date, " & _
"@Reference_Sample, @Workmanship, @Panel_Process, @Half_Finished_Process, @Garment_Process, @Paper_Pattern, @Maker_Making, @Fabric_Expected_Date," & _
"@Accessories_Expected_Date, @Writer_Remarks, @Submit_Date, @Status, @Urgent)"
Dim cmd As New SqlCommand(sqlStr, cn)
cmd.Parameters.Add(New SqlParameter("@Flow_No", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Factory_Style_No", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Customer_Style_No", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Sample_Description", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Customer_Sample_Description", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Customer_Brand", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Sample_Type", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Customer_Sample_Type", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Season", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Quantity", SqlDbType.Int))
cmd.Parameters.Add(New SqlParameter("@Main_Fabric", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Garment_Wash", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Writer", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Writer_Inline_No", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Write_Date", SqlDbType.DateTime))
cmd.Parameters.Add(New SqlParameter("@Sales_Team", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Request_Finish_Date", SqlDbType.Date))
cmd.Parameters.Add(New SqlParameter("@Reference_Sample", SqlDbType.Bit))
cmd.Parameters.Add(New SqlParameter("@Workmanship", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Panel_Process", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Half_Finished_Process", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Garment_Process", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Paper_Pattern", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Maker_Making", SqlDbType.Bit))
cmd.Parameters.Add(New SqlParameter("@Fabric_Expected_Date", SqlDbType.Date))
cmd.Parameters.Add(New SqlParameter("@Accessories_Expected_Date", SqlDbType.Date))
cmd.Parameters.Add(New SqlParameter("@Writer_Remarks", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Submit_Date", SqlDbType.DateTime))
cmd.Parameters.Add(New SqlParameter("@Status", SqlDbType.NVarChar))
cmd.Parameters.Add(New SqlParameter("@Urgent", SqlDbType.Bit))
cmd.Parameters("@Flow_No").Value = TryCast(formview.FindControl("Flow_NoTextBoxA"), TextBox).Text
cmd.Parameters("@Factory_Style_No").Value = TryCast(formview.FindControl("Factory_Style_NoTextBoxA"), TextBox).Text
cmd.Parameters("@Customer_Style_No").Value = TryCast(formview.FindControl("Customer_Style_NoTextBoxA"), TextBox).Text
cmd.Parameters("@Sample_Description").Value = TryCast(formview.FindControl("Sample_DescriptionTextBoxA"), TextBox).Text
cmd.Parameters("@Customer_Sample_Description").Value = TryCast(formview.FindControl("Customer_Sample_DescriptionTextBoxA"), TextBox).Text
cmd.Parameters("@Customer_Brand").Value = TryCast(formview.FindControl("Customer_BrandTextBoxA"), TextBox).Text
cmd.Parameters("@Sample_Type").Value = TryCast(formview.FindControl("Sample_TypeTextBoxA"), TextBox).Text
cmd.Parameters("@Customer_Sample_Type").Value = TryCast(formview.FindControl("Customer_Sample_TypeTextBoxA"), TextBox).Text
cmd.Parameters("@Season").Value = TryCast(formview.FindControl("SeasonTextBoxA"), TextBox).Text
If Val(TryCast(formview.FindControl("QuantityTextBoxA"), TextBox).Text) <= 1 Then
cmd.Parameters("@Quantity").Value = 0
Else
cmd.Parameters("@Quantity").Value = Math.Round(Val((TryCast(formview.FindControl("QuantityTextBoxA"), TextBox).Text)))
End If
cmd.Parameters("@Main_Fabric").Value = TryCast(formview.FindControl("Main_FabricTextBoxA"), TextBox).Text
cmd.Parameters("@Garment_Wash").Value = TryCast(formview.FindControl("Garment_WashTextBoxA"), TextBox).Text
cmd.Parameters("@Writer").Value = IIf(IsNothing(Session("People_Name")), "匿名", Session("People_Name").ToString)
cmd.Parameters("@Writer_Inline_No").Value = Session("Inline_No")
Try
Dim targetbox As String = "Write_DateLabel"
Dim parameters As String = "@Write_Date"
If CType(formview.FindControl(targetbox), Label).Text = "" Then
cmd.Parameters(parameters).Value = DBNull.Value
Else
cmd.Parameters(parameters).Value = DateTime.Parse(Convert.ToDateTime(DirectCast(formview.FindControl(targetbox), Label).Text))
End If
Catch ex As Exception
local_massage1.Text = "*寫入日期需為日期格式!"
Return
End Try
cmd.Parameters("@Sales_Team").Value = sales_team.Text
Try
Dim targetbox As String = "Request_Finish_DateTextBoxA"
Dim parameters As String = "@Request_Finish_Date"
If CType(formview.FindControl(targetbox), TextBox).Text = "" Then
cmd.Parameters(parameters).Value = DBNull.Value
Else
cmd.Parameters(parameters).Value = DateTime.Parse(Convert.ToDateTime(CType(formview.FindControl(targetbox), TextBox).Text))
End If
Catch ex As Exception
CType(formview.FindControl("Message_Add_1"), Label).Text = "*預計走辦期需為日期格式!"
Return
End Try
cmd.Parameters("@Reference_Sample").Value = CType(formview.FindControl("Reference_SampleCheckBoxA"), CheckBox).Checked
cmd.Parameters("@Workmanship").Value = CType(formview.FindControl("WorkmanshipDropDownListA"), DropDownList).Text
cmd.Parameters("@Panel_Process").Value = CType(formview.FindControl("Panel_ProcessDropDownListA"), DropDownList).Text
cmd.Parameters("@Half_Finished_Process").Value = CType(formview.FindControl("Half_Finished_ProcessDropDownListA"), DropDownList).Text
cmd.Parameters("@Garment_Process").Value = CType(formview.FindControl("Garment_ProcessDropDownListA"), DropDownList).Text
cmd.Parameters("@Paper_Pattern").Value = CType(formview.FindControl("Paper_PatternDropDownListA"), DropDownList).Text
cmd.Parameters("@Maker_Making").Value = CType(formview.FindControl("Maker_MakingCheckBoxA"), CheckBox).Checked
Try
Dim targetbox As String = "Fabric_Expected_DateTextBoxA"
Dim parameters As String = "@Fabric_Expected_Date"
If CType(formview.FindControl(targetbox), TextBox).Text = "" Then
cmd.Parameters(parameters).Value = DBNull.Value
Else
cmd.Parameters(parameters).Value = DateTime.Parse(Convert.ToDateTime(CType(formview.FindControl(targetbox), TextBox).Text))
End If
Catch ex As Exception
CType(formview.FindControl("Message_Add_1"), Label).Text = "*預計齊布期需為日期格式!"
Return
End Try
Try
Dim targetbox As String = "Accessories_Expected_DateTextBoxA"
Dim parameters As String = "@Accessories_Expected_Date"
If CType(formview.FindControl(targetbox), TextBox).Text = "" Then
cmd.Parameters(parameters).Value = DBNull.Value
Else
cmd.Parameters(parameters).Value = DateTime.Parse(Convert.ToDateTime(DirectCast(formview.FindControl(targetbox), TextBox).Text))
End If
Catch ex As Exception
DirectCast(formview.FindControl("Message_Add_1"), Label).Text = "*預計齊輔料期需為日期格式!"
Return
End Try
cmd.Parameters("@Writer_Remarks").Value = DirectCast(formview.FindControl("Writer_RemarksTextBoxA"), TextBox).Text
cmd.Parameters("@Urgent").Value = DirectCast(formview.FindControl("UrgentLabelCheckBox"), CheckBox).Checked
If CType(formview.FindControl("Submit_DateLabel_C"), CheckBox).Checked = True Then
cmd.Parameters("@Status").Value = "已派單"
cmd.Parameters("@Submit_Date").Value = DateTime.Parse(Convert.ToDateTime(CType(formview.FindControl("Submit_DateLabel"), Label).Text))
Else
cmd.Parameters("@Status").Value = "未派單"
cmd.Parameters("@Submit_Date").Value = DBNull.Value
End If
If cmd.ExecuteNonQuery() = 1 Then
Dim sqlCmd As New SqlCommand("Select @@IDENTITY", cn)
Dim dr As SqlDataReader = sqlCmd.ExecuteReader()
If dr.Read() Then
Response.Redirect("Progress_Details.aspx?ID=" & dr.GetValue(0).ToString())
End If
dr.Close()
End If
End Using
Catch ex As Exception
DirectCast(FormView1.FindControl("Message_Add_1"), Label).Text = ex.Message.ToString
End Try
End Sub