2020年6月30日 星期二

Web RWD APP 代購系統 #3

換寫到後台訂單作業了
有點麻煩,因採用一對多檔模式;在aspnet上的呈現無法像windows app 那樣直覺式,想來想去就是採用2層式來處理:主檔+明細+付款
(未來結構會綁定更多的應用區塊,等有空再貼上來了)


2020年6月28日 星期日

Using GridView's EmptyDataTemplate to insert new row

參考來源:Using GridView's EmptyDataTemplate to insert new row
--
精華段:
Sub ButtonEmptyInsert_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Insert new record
        Dim RowIndex As Integer = DirectCast(DirectCast(sender, Control).NamingContainer, GridViewRow).RowIndex
        Dim misship_id As DropDownList = TryCast(GridViewDetails.Rows(RowIndex).FindControl("DropListMisShipIDEmpty"), DropDownList)
        Dim code_id As DropDownList = TryCast(GridViewDetails.Rows(RowIndex).FindControl("DropListCodeEmpty"), DropDownList)
        Dim upc As TextBox = TryCast(GridViewDetails.Rows(RowIndex).FindControl("txtUPC"), TextBox)
        Dim description As TextBox = TryCast(GridViewDetails.Rows(RowIndex).FindControl("txtDescription"), TextBox)
        Dim qty_ordered As TextBox = TryCast(GridViewDetails.Rows(RowIndex).FindControl("txtQtyOrdered"), TextBox)
        Dim qty_received As TextBox = TryCast(GridViewDetails.Rows(RowIndex).FindControl("txtQtyReceived"), TextBox)
        Dim cost As TextBox = TryCast(GridViewDetails.Rows(RowIndex).FindControl("txtCost"), TextBox)
        Dim adjust_amount As TextBox = TryCast(GridViewDetails.Rows(RowIndex).FindControl("txtAdjAmt"), TextBox)
        Dim status As DropDownList = TryCast(GridViewDetails.Rows(RowIndex).FindControl("DropListStatusEmpty"), DropDownList)
        Dim status_quantity As TextBox = TryCast(GridViewDetails.Rows(RowIndex).FindControl("txtStatusQty"), TextBox)
        SourceMisShipDetails.InsertParameters("misship_id").DefaultValue = misship_id.SelectedValue
        SourceMisShipDetails.InsertParameters("code_id").DefaultValue = code_id.SelectedValue
        SourceMisShipDetails.InsertParameters("upc").DefaultValue = upc.Text
        SourceMisShipDetails.InsertParameters("description").DefaultValue = description.Text
        SourceMisShipDetails.InsertParameters("qty_ordered").DefaultValue = qty_ordered.Text
        SourceMisShipDetails.InsertParameters("qty_received").DefaultValue = qty_received.Text
        SourceMisShipDetails.InsertParameters("cost").DefaultValue = cost.Text
        SourceMisShipDetails.InsertParameters("adjust_amount").DefaultValue = adjust_amount.Text
        SourceMisShipDetails.InsertParameters("status").DefaultValue = status.SelectedValue
        SourceMisShipDetails.InsertParameters("status_quantity").DefaultValue = status_quantity.Text
        SourceMisShipDetails.Insert()
    End Sub

2020年6月27日 星期六

從RowCommand上的嵌套GridView中的DropDownList中檢索值

從RowCommand上的嵌套GridView中的DropDownList中檢索值
--
底下這段真是精華

// Calls when Inner GridView 's button clicked
protected void GridView_Inner_RowCommand(object sender, GridViewCommandEventArgs e)
{
    // get Inner GridView 's clicked row
    GridViewRow InnerGridViewRow = (GridViewRow)(((Control)e.CommandSource).NamingContainer);

    // get Inner GridView 's controls from clicked row
    TextBox TextBox_Inner = (TextBox)InnerGridViewRow.FindControl("TextBox_Inner");
    DropDownList DropDownList_Inner = (DropDownList)InnerGridViewRow.FindControl("DropDownList_Inner");

    // check if correct button is clicked
    if (e.CommandName == "BtnInnerCmd")
    {
        string DropDownListValue = DropDownList_Inner.SelectedValue;
        string TextBoxValue = TextBox_Inner.Text;

        Label_Result.Text = "DropDownList 's Selected Value is " + DropDownListValue +
                            "
TextBox 's Entered Value is " + TextBoxValue;
    }
}

2020年6月18日 星期四

crystal report 控制字體大小

1.請利用 CrystalReports 公式去判斷字數再去變更其字體大小
2.在欄位上右鍵 --> 格式物件 --> 字型(標籤) --> 大小 ,編輯其公式
3.參考以下公式
if length({@欄位名稱}) > 15 then 9 else 12