protected void kddlFOPUNCHTYPE_OFF_SelectedIndexChanged(object sender, EventArgs e)
    {
        KYTDropDownList _FOPUNCHTYPE_OFF = (KYTDropDownList)sender;

        if (_FOPUNCHTYPE_OFF.SelectedValue == "")
        {
            kdtpFOPUNCH_TIME_OFF.Text = "";
        }
    }
    /// <summary>
    /// 明細項資料綁定事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gvItems_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
    {
        GridViewRow gr = e.Row;

        gr.Attributes.Add("onmouseover", "this.bkc=this.style.backgroundColor;this.style.backgroundColor='#ccffff'"); // 設定每筆資料在滑鼠移動進去時的背景顏色
        gr.Attributes.Add("onmouseout", "this.style.backgroundColor=this.bkc");                                       // 設定每筆資料在滑鼠移出時的背景色
        if (gr.RowType == DataControlRowType.DataRow)
        {
            DataTable       tblItems       = gvItems.DataTable;
            DataRow         row            = tblItems.Rows[gr.DataItemIndex];
            LinkButton      lbtnReSend     = (LinkButton)gr.FindControl("lbtnReSend");          // 重送按鈕
            KYTCheckBox     kcbSelect      = (KYTCheckBox)gr.FindControl("kcbSelect");          // RFC傳送狀態
            KYTDropDownList kddlRFC_STATUS = (KYTDropDownList)gr.FindControl("kddlRFC_STATUS"); // 選取
            LinkButton      lbtnDOC_NBR    = gr.FindControl("lbtnDOC_NBR") as LinkButton;       // 表單編號

            lbtnReSend.Visible     = false;
            kcbSelect.Visible      = false;
            kddlRFC_STATUS.Visible = false;
            kcbSelect.Checked      = false;

            if (row["TRIGGER_STATUS"].ToString() == "0")
            {
                lbtnReSend.Visible = true;
            }
            else
            {
                kddlRFC_STATUS.Visible = true;
                kcbSelect.Visible      = true;
            }
            //KYTUtilLibs.Utils.WebUtils.DynamicListItemBind(kddlRFC_STATUS, new object[] {
            //    new { Text = "成功", Value = "1" },
            //    new { Text = "失敗", Value = "0" },
            //    new { Text = "取消", Value = "NULL" }
            //});

            kddlRFC_STATUS.SelectedValue = row["SEND_RESULT"].ToString() == "True" ? "1" : row["SEND_RESULT"].ToString() == "False" ? "0" : "NULL";

            string url = "";
            //if () // 現在是APP
            //    url = "~/WKF/FormUse/Mobile/ViewForm.aspx";
            //else
            url = "~/WKF/FormUse/ViewForm.aspx";
            Ede.Uof.Utility.Page.Common.Dialog.Open2(lbtnDOC_NBR, url, row["DOC_NBR"].ToString(), 960, 720, Ede.Uof.Utility.Page.Common.Dialog.PostBackType.None, new { TASK_ID = row["TASK_ID"].ToString() }.ToExpando());
        }
    }
Beispiel #3
0
    protected void lbtnDEL_Click(object sender, EventArgs e)
    {
        LinkButton      _lbtnDEL        = (LinkButton)sender;
        GridViewRow     gr              = _lbtnDEL.NamingContainer as GridViewRow;
        KYTDropDownList kddlFormName    = (KYTDropDownList)gr.FindControl("kddlFormName"); // 表單名稱
        KYTTextBox      ktxtRFC_NAME    = (KYTTextBox)gr.FindControl("ktxtRFC_NAME");      // RFC方法名稱
        KYTTextBox      ktxtDLL_PATH    = (KYTTextBox)gr.FindControl("ktxtDLL_PATH");      // DLL組件路徑
        KYTTextBox      ktxtZTABLE_NAME = (KYTTextBox)gr.FindControl("ktxtZTABLE_NAME");   // 中繼表主表表格名稱

        using (SqlDataAdapter sda = new SqlDataAdapter(@"
                SET NOCOUNT ON;
                DELETE
                  FROM [ZUOF_RFC_MA] 
                 WHERE [FORM_ID] = @FORM_ID 
                   AND [RFC_NAME] = @RFC_NAME 
            ", new DatabaseHelper().Command.Connection.ConnectionString))
            using (DataSet ds = new DataSet())
            {
                sda.SelectCommand.Parameters.AddWithValue("@FORM_ID", kddlFormName.SelectedValue);
                sda.SelectCommand.Parameters.AddWithValue("@RFC_NAME", ktxtRFC_NAME.Text.Trim());
                try
                {
                    sda.Fill(ds);
                    DataTable dtSource = gvForms.DataTable;
                    dtSource.Rows.RemoveAt(gr.DataItemIndex);

                    gvForms.BindDataOnly = true; // 不要收納現在網頁上的內容
                    gvForms.DataSource   = dtSource;
                    gvForms.DataBind();
                }
                catch (Exception ex)
                {
                    KYTUtilLibs.KYTDebugLog.Log(KYTLog.DebugLog.LogLevel.Error, string.Format(@"MAINTAIN_RFC_STATUS_RELATION.lbtnDEL_Click.DELETE.ZUOF_RFC_MA.ERROR::{0}", ex.Message));
                }
            }
    }
    /// <summary>
    /// 按下變更RFC狀態按鈕後觸發事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnRUN_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow gr in gvItems.Rows)
        {
            DataTable       tblItems       = gvItems.DataTable;
            DataRow         row            = tblItems.Rows[gr.DataItemIndex];
            KYTCheckBox     kcbSelect      = (KYTCheckBox)gr.FindControl("kcbSelect");          // RFC傳送狀態
            KYTDropDownList kddlRFC_STATUS = (KYTDropDownList)gr.FindControl("kddlRFC_STATUS"); // 選取
            if (kcbSelect.Visible &&
                Request[kcbSelect.UniqueID + "$CheckBox1"] != null &&
                kddlRFC_STATUS.Visible)
            {
                string RFC_STATUS = Request[kddlRFC_STATUS.UniqueID + "$DropDownList1"];
                using (SqlDataAdapter sda = new SqlDataAdapter(@"
                    IF EXISTS (SELECT * 
                                 FROM ZUOF_RFC 
                                WHERE TASK_ID = @TASK_ID
                                  AND [TYPE] = @TYPE)
                            BEGIN
                                UPDATE ZUOF_RFC
                                   SET SEND_RESULT = @SEND_RESULT,
                                       MODIFIER = @MODIFIER,
                                       MODIFY_TIME = GETDATE(),
                                       MSG_EXCEPTION = '手動變更狀態'
                                 WHERE TASK_ID = @TASK_ID
                                   AND [TYPE] = @TYPE
                            END
                        ELSE
                            BEGIN
                                INSERT INTO ZUOF_RFC ([TASK_ID], [TYPE], [FORM_NBR], [SEND_RESULT], [SEND_TIME], [MSG_EXCEPTION], [CREATOR], [CREATE_TIME], [MODIFIER], [MODIFY_TIME], [FORM_VERSION_ID], [FORM_NAME])
                                     SELECT @TASK_ID, 
                                            RFC_NAME, 
                                            @FORM_NBR, 
                                            @SEND_RESULT, 
                                            GETDATE(), 
                                            '手動變更狀態', 
                                            @MODIFIER, 
                                            GETDATE(), 
                                            @MODIFIER, 
                                            GETDATE(), 
                                            @FORM_VERSION_ID, 
                                            @FORM_NAME
                                       FROM ZUOF_RFC_MA 
                                      WHERE FORM_ID = (SELECT FORM_ID 
				                                         FROM TB_WKF_FORM_VERSION
				                                        WHERE FORM_VERSION_ID = @FORM_VERSION_ID)
                            END
                    
                ", new DatabaseHelper().Command.Connection.ConnectionString))
                    using (DataSet ds = new DataSet())
                    {
                        sda.SelectCommand.Parameters.AddWithValue("@SEND_RESULT", RFC_STATUS == "NULL" ? Convert.DBNull : RFC_STATUS == "1");
                        sda.SelectCommand.Parameters.AddWithValue("@MODIFIER", Ede.Uof.EIP.SystemInfo.Current.UserGUID);
                        sda.SelectCommand.Parameters.AddWithValue("@TASK_ID", row["TASK_ID"].ToString());
                        sda.SelectCommand.Parameters.AddWithValue("@TYPE", row["TYPE"].ToString());
                        sda.SelectCommand.Parameters.AddWithValue("@FORM_NBR", row["DOC_NBR"].ToString());
                        sda.SelectCommand.Parameters.AddWithValue("@FORM_VERSION_ID", row["FORM_VERSION_ID"].ToString());
                        sda.SelectCommand.Parameters.AddWithValue("@FORM_NAME", row["FORM_NAME"].ToString());
                        try
                        {
                            sda.Fill(ds);
                        }
                        catch (Exception ex)
                        {
                            KYTUtilLibs.KYTDebugLog.Log(KYTLog.DebugLog.LogLevel.Error, string.Format(@"RFC_STATUS_REPORT.btnRUN_Click.foreach.TASK_ID: {0}.DOC_NBR: {1}.TYPE: {2}. RFC變更狀態由 : {3}→{4}. DOC_NBR: {6}. FORM_VERSION_ID: {7}. FORM_NAME: {8} .ERROR: {5}",
                                                                                                      row["TASK_ID"].ToString(),
                                                                                                      row["DOC_NBR"].ToString(),
                                                                                                      row["TYPE"].ToString(),
                                                                                                      row["SEND_RESULT"].ToString() == "True" ? "成功" : row["SEND_RESULT"].ToString() == "False" ? "失敗" : "取消",
                                                                                                      kddlRFC_STATUS.SelectedItem.Text,
                                                                                                      ex.Message,
                                                                                                      row["DOC_NBR"].ToString(),
                                                                                                      row["FORM_VERSION_ID"].ToString(),
                                                                                                      row["FORM_NAME"].ToString()
                                                                                                      ));
                        }
                    }
            }
        }
        btnSearch_Click(btnSearch, null); // 重新整理明細項
    }
Beispiel #5
0
    protected void gvForms_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        GridViewRow gr = e.Row;

        gr.Attributes.Add("onmouseover", "this.bkc=this.style.backgroundColor;this.style.backgroundColor='#ccffff'"); // 設定每筆資料在滑鼠移動進去時的背景顏色
        gr.Attributes.Add("onmouseout", "this.style.backgroundColor=this.bkc");                                       // 設定每筆資料在滑鼠移出時的背景色
        if (gr.RowType == DataControlRowType.DataRow)
        {
            DataTable       tblItems            = gvForms.DataTable;
            DataRow         row                 = tblItems.Rows[gr.DataItemIndex];
            LinkButton      lbtnCOPY            = (LinkButton)gr.FindControl("lbtnCOPY");            // 複製按鈕
            LinkButton      lbtnDEL             = (LinkButton)gr.FindControl("lbtnDEL");             // 刪除按鈕
            KYTDropDownList kddlFormName        = (KYTDropDownList)gr.FindControl("kddlFormName");   // 表單名稱
            KYTTextBox      ktxtRFC_NAME        = (KYTTextBox)gr.FindControl("ktxtRFC_NAME");        // RFC方法名稱
            KYTTextBox      ktxtDLL_FILE_NAME   = (KYTTextBox)gr.FindControl("ktxtDLL_FILE_NAME");   // DLL檔案名稱
            KYTTextBox      ktxtDLL_PATH        = (KYTTextBox)gr.FindControl("ktxtDLL_PATH");        // DLL組件路徑
            KYTTextBox      ktxtRE_PROCESS_NAME = (KYTTextBox)gr.FindControl("ktxtRE_PROCESS_NAME"); // 重送RFC方法名稱
            KYTTextBox      ktxtZTABLE_NAME     = (KYTTextBox)gr.FindControl("ktxtZTABLE_NAME");     // 中繼表主表表格名稱
            HiddenField     hidDBData           = (HiddenField)gr.FindControl("hidDBData");          // 在DB有資料
            hidDBData.Value = row["IS_DBDATA"].ToString() == "Y" ? "Y" : "N";
            if (kddlFormName.DataSource == null)
            {
                kddlFormName.DataSource     = getFORMNAME();
                kddlFormName.DataTextField  = "FORM_NAME";
                kddlFormName.DataValueField = "FORM_ID";
                kddlFormName.DataBind();
            }
            kddlFormName.SelectedValue       = row["FORM_ID"].ToString();
            kddlFormName.DropDownList1.Width = 150;
            if (row["IS_DBDATA"].ToString() == "Y")
            {
                lbtnDEL.OnClientClick = string.Format(@"return confirm('是否要刪除?\n, 表單名稱: {0}, RFC: {1}');",
                                                      kddlFormName.SelectedItem.Text,
                                                      !string.IsNullOrEmpty(ktxtRFC_NAME.Text.Trim()) ? ktxtRFC_NAME.Text.Trim() : "未填寫");
            }
        }
        else if (gr.RowType == DataControlRowType.Footer)
        {
            #region 設定輸入框最大寬度
            int MAX_RFC_NAME_Width         = 0;
            int MAX_DLL_FILE_NAME_Width    = 0;
            int MAX_DLL_PATH_Width         = 0;
            int MAX_RE_PROCESS_NAMEE_Width = 0;
            int MAX_ZTABLE_NAME_Width      = 0;
            foreach (GridViewRow _gr in gvForms.Rows)
            {
                KYTTextBox ktxtRFC_NAME        = (KYTTextBox)_gr.FindControl("ktxtRFC_NAME");        // RFC方法名稱
                KYTTextBox ktxtDLL_FILE_NAME   = (KYTTextBox)_gr.FindControl("ktxtDLL_FILE_NAME");   // DLL檔案名稱
                KYTTextBox ktxtDLL_PATH        = (KYTTextBox)_gr.FindControl("ktxtDLL_PATH");        // DLL組件路徑
                KYTTextBox ktxtRE_PROCESS_NAME = (KYTTextBox)_gr.FindControl("ktxtRE_PROCESS_NAME"); // 重送RFC方法名稱
                KYTTextBox ktxtZTABLE_NAME     = (KYTTextBox)_gr.FindControl("ktxtZTABLE_NAME");     // 中繼表主表表格名稱
                #region 取得最大寬度
                int RFC_NAME_Width = getTextBoxWidth(ktxtRFC_NAME, 30, 50);
                MAX_RFC_NAME_Width = RFC_NAME_Width > MAX_RFC_NAME_Width ? RFC_NAME_Width : MAX_RFC_NAME_Width;

                int DLL_FILE_NAME_Width = getTextBoxWidth(ktxtDLL_FILE_NAME, 15, 50);
                MAX_DLL_FILE_NAME_Width = DLL_FILE_NAME_Width > MAX_DLL_FILE_NAME_Width ? DLL_FILE_NAME_Width : MAX_DLL_FILE_NAME_Width;

                int DLL_PATH_Width = getTextBoxWidth(ktxtDLL_PATH, 50, 50);
                MAX_DLL_PATH_Width = DLL_PATH_Width > MAX_DLL_PATH_Width ? DLL_PATH_Width : MAX_DLL_PATH_Width;

                int RE_PROCESS_NAMEE_Width = getTextBoxWidth(ktxtRE_PROCESS_NAME, 20, 50);
                MAX_RE_PROCESS_NAMEE_Width = RE_PROCESS_NAMEE_Width > MAX_RE_PROCESS_NAMEE_Width ? RE_PROCESS_NAMEE_Width : MAX_RE_PROCESS_NAMEE_Width;

                int ZTABLE_NAME_Width = getTextBoxWidth(ktxtZTABLE_NAME, 25, 50);
                MAX_ZTABLE_NAME_Width = ZTABLE_NAME_Width > MAX_ZTABLE_NAME_Width ? ZTABLE_NAME_Width : MAX_ZTABLE_NAME_Width;
                #endregion 取得最大寬度
            }
            foreach (GridViewRow _gr in gvForms.Rows)
            {
                KYTTextBox ktxtRFC_NAME        = (KYTTextBox)_gr.FindControl("ktxtRFC_NAME");        // RFC方法名稱
                KYTTextBox ktxtDLL_FILE_NAME   = (KYTTextBox)_gr.FindControl("ktxtDLL_FILE_NAME");   // DLL檔案名稱
                KYTTextBox ktxtDLL_PATH        = (KYTTextBox)_gr.FindControl("ktxtDLL_PATH");        // DLL組件路徑
                KYTTextBox ktxtRE_PROCESS_NAME = (KYTTextBox)_gr.FindControl("ktxtRE_PROCESS_NAME"); // 重送RFC方法名稱
                KYTTextBox ktxtZTABLE_NAME     = (KYTTextBox)_gr.FindControl("ktxtZTABLE_NAME");     // 中繼表主表表格名稱
                ktxtRFC_NAME.Width        = MAX_RFC_NAME_Width;
                ktxtDLL_FILE_NAME.Width   = MAX_DLL_FILE_NAME_Width;
                ktxtDLL_PATH.Width        = MAX_DLL_PATH_Width;
                ktxtRE_PROCESS_NAME.Width = MAX_RE_PROCESS_NAMEE_Width;
                ktxtZTABLE_NAME.Width     = MAX_ZTABLE_NAME_Width;
            }
            #endregion 設定輸入框最大寬度
        }
    }