示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AuthorityControls(this);
        try
        {
            #region 清空Message

            this.ErrorMsgLabel.Text = string.Empty;

            #endregion

            if (!IsPostBack)
            {
                #region 寫入首次載入Page TimeStamp

                PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}",
                                                    DateTime.Now.Year.ToString(),
                                                    DateTime.Now.Month.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Day.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Hour.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Minute.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Second.ToString().PadLeft(2, '0')
                                                    );

                #endregion

                #region 設定ToolBar預設狀態

                ToolBarInit();

                #endregion

                #region 設定DefaultButton

                Form.DefaultButton = btnQuery.UniqueID;

                #endregion

                #region 設定頁面初始狀態

                this.but_Import.Enabled = false;//確定匯入
                this.but_Error.Enabled = false;//檢視異常

                #endregion

                #region Attributes

                this.but_LoadFile.Attributes["onclick"] += "Lock_Control();";
                this.but_Error.Attributes["onclick"] = "return CALL_POP_ITM07();";

                #endregion
            }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            #region Focus欄位

            if (!IsPostBack)
            {
                STMModel.ITMCommon ITMComm = new STMModel.ITMCommon();
                string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(this.txtITEM.TextBox_Code.ClientID, false);
                ScriptManager.RegisterStartupScript(this.upError, typeof(UpdatePanel), "ITM071", s_ScriptManager_Script, true);
            }

            #endregion
        }
    }//page_load
示例#2
0
    /// <summary>
    /// 檢查條件
    /// </summary>
    /// <param name="s_Type"></param>
    /// <returns></returns>
    private ArrayList Check_Condition(string s_Type)
    {
        #region 宣告

        ITMCommon ITMComm = new ITMCommon();
        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region BUTTON [確定匯入]

        if (s_Type == "BUTTON [確定匯入]")
        {
            #region 自訂檢查

            TextBox txt_UP11 = (TextBox)this.UploadStatusPanel1.FindControl("txtUP11");//處理總筆數
            TextBox txt_UP12 = (TextBox)this.UploadStatusPanel1.FindControl("txtUP12");//成功筆數
            TextBox txt_UP13 = (TextBox)this.UploadStatusPanel1.FindControl("txtUP13");//異常筆數

            int i_Total_Count = int.Parse(txt_UP11.Text);
            int i_Success_Count = int.Parse(txt_UP12.Text);
            int i_Failure_Count = int.Parse(txt_UP13.Text);

            if (((i_Total_Count == i_Success_Count) &&
               (i_Failure_Count == 0)) == false)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "上傳檔案有誤,不可匯入", "1", string.Empty); }

            #endregion
        }

        #endregion

        return arl_Return;
    }
示例#3
0
    /// <summary>
    /// 檢查文字檔條件
    /// </summary>
    /// <param name="dr"></param>
    /// <returns></returns>
    private ArrayList Check_Condition_DataLine(DataRow dr)
    {
        #region 宣告

        ITMCommon ITMComm = new ITMCommon();
        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region 檢查各個欄位型別,長度,是否必填

        #region Column[序號]

        arl_Return = ITMComm.Check_MustFillin_Column(dr["序號"].ToString(), "text", "欄位[序號]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["序號"].ToString(), "欄位[序號]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["序號"].ToString()) > 38)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[序號]長度不可大於 38 Byte", "1", string.Empty); }

        #endregion

        #region Column[通路代號]

        arl_Return = ITMComm.Check_MustFillin_Column(dr["通路代號"].ToString(), "text", "欄位[通路代號]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["通路代號"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[通路代號]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[品號]

        arl_Return = ITMComm.Check_MustFillin_Column(dr["品號"].ToString(), "text", "欄位[品號]為必填欄位", "1", string.Empty, arl_Return);
        System.Text.RegularExpressions.Regex reg_SIX = new System.Text.RegularExpressions.Regex(@"^[0-9]{6}$");
        if (reg_SIX.IsMatch(dr["品號"].ToString()) == false)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品號]必需為六位數目字", "1", string.Empty); }

        #endregion

        #region Column[期別]

        arl_Return = ITMComm.Check_MustFillin_Column(dr["期別"].ToString(), "text", "欄位[期別]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["期別"].ToString()) > 6)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[期別]長度不可大於 6 Byte", "1", string.Empty); }

        #endregion

        #endregion

        #region 如果基本檢查有誤,則Return

        if (arl_Return[1].ToString() != string.Empty)
        { return arl_Return; }

        #endregion

        return arl_Return;
    }
示例#4
0
    /// <summary>
    /// BUTTON [整批修改]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Save_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            BCO.ITMCommon ITMComm = new BCO.ITMCommon();

            ArrayList arl_Check_Condition = Check_Condition();

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM075", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            #region 傳入參數

            #region 設定TempTable的框架

            DataTable dt_Temp = new DataTable();

            dt_Temp.Columns.Add("ITEM", typeof(string));//[品號]
            dt_Temp.Columns.Add("PERIOD_B", typeof(string));//[期別(起)]
            dt_Temp.Columns.Add("PERIOD_E", typeof(string));//[期別(迄)]
            dt_Temp.Columns.Add("ITEM_NAME", typeof(string));//[品名]
            dt_Temp.Columns.Add("MDC_END_DATE", typeof(DateTime));//[DC結束日]
            dt_Temp.Columns.Add("PERIOD_END_DATE", typeof(DateTime));//[期別結束日]
            dt_Temp.Columns.Add("EFFECTIVE_DATE", typeof(DateTime));//[通路生效日]
            dt_Temp.Columns.Add("CHAN_END_DATE", typeof(DateTime));//[通路結束日]
            dt_Temp.Columns.Add("NOTICE_RETURN_DATE", typeof(DateTime));//[退貨通知日]
            dt_Temp.Columns.Add("PLAN_RETURN_DATE", typeof(DateTime));//[首次預退日]
            dt_Temp.Columns.Add("RTN_DDL", typeof(DateTime));//[退書截止日]
            dt_Temp.Columns.Add("EDIT_REASON", typeof(string));//[異動原因]
            dt_Temp.Columns.Add("UPDATEUID", typeof(string));//[異動人員]
            dt_Temp.Columns.Add("UPDATEDATE", typeof(DateTime));//[異動時間]

            #endregion

            #region 將參數寫入TempTable

            #region 設定變數

            string s_ITEM_FileName = string.Empty;
            string s_PERIOD_B_FileName = string.Empty;
            string s_PERIOD_E_FileName = string.Empty;
            DateTime d_Now = DateTime.Now;

            #endregion

            for (int i = 1; i <= 10; i++)
            {
                s_ITEM_FileName = "slp_ITEM_" + i.ToString();
                s_PERIOD_B_FileName = "slp_PERIOD_B_" + i.ToString();
                s_PERIOD_E_FileName = "slp_PERIOD_E_" + i.ToString();

                if (((ASP.itm_slp_slp_sku_ascx)this.table1.FindControl(s_ITEM_FileName)).Text.Trim() != string.Empty)
                {
                    DataRow dr = dt_Temp.NewRow();
                    dr["ITEM"] = ITMComm.GetValueSetParameter(((ASP.itm_slp_slp_sku_ascx)this.table1.FindControl(s_ITEM_FileName)).Text, "string", false);//[品號]
                    dr["PERIOD_B"] = ITMComm.GetValueSetParameter(((ASP.itm_slp_slp_itemperiod_ascx)this.table1.FindControl(s_PERIOD_B_FileName)).Text, "string", false);//[期別(起)]
                    dr["PERIOD_E"] = ITMComm.GetValueSetParameter(((ASP.itm_slp_slp_itemperiod_ascx)this.table1.FindControl(s_PERIOD_E_FileName)).Text, "string", false);//[期別(迄)]
                    dr["ITEM_NAME"] = ITMComm.GetValueSetParameter(this.txt_ITEM_NAME.Text, "string", false);//[品名]
                    dr["MDC_END_DATE"] = ITMComm.GetValueSetParameter(this.slp_MDC_END_DATE.Text, "date", false);//[DC結束日]
                    dr["PERIOD_END_DATE"] = ITMComm.GetValueSetParameter(this.slp_PERIOD_END_DATE.Text, "date", false);//[期別結束日]
                    dr["EFFECTIVE_DATE"] = ITMComm.GetValueSetParameter(this.slp_EFFECTIVE_DATE.Text, "date", false);//[通路生效日]
                    dr["CHAN_END_DATE"] = ITMComm.GetValueSetParameter(this.slp_CHAN_END_DATE.Text, "date", false);//[通路結束日]
                    dr["NOTICE_RETURN_DATE"] = ITMComm.GetValueSetParameter(this.slp_NOTICE_RETURN_DATE.Text, "date", false);//[退貨通知日]
                    dr["PLAN_RETURN_DATE"] = ITMComm.GetValueSetParameter(this.slp_PLAN_RETURN_DATE.Text, "date", false);//[首次預退日]
                    dr["RTN_DDL"] = ITMComm.GetValueSetParameter(this.slp_RTN_DDL.Text, "date", false);//[退書截止日]
                    dr["EDIT_REASON"] = ITMComm.GetValueSetParameter(this.txt_EDIT_REASON.Text, "string", false);//[異動原因]
                    dr["UPDATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//[異動人員]
                    dr["UPDATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);//[異動時間]

                    dt_Temp.Rows.Add(dr);
                }
            }

            #endregion

            #endregion

            #region 連結資料庫

            BCO.ITM07_BCO bco = new BCO.ITM07_BCO(ConntionDB);
            bco.UPDATE_ITM075_BULK(null, dt_Temp);

            #endregion

            #region 整批修改成功,將欄位清空

            this.ErrorMsgLabel.Text = "整批修改成功!";

            this.txt_ITEM_NAME.Text = string.Empty;//品名
            this.slp_MDC_END_DATE.Text = string.Empty;//DC結束日
            this.slp_PERIOD_END_DATE.Text = string.Empty;//期別結束日

            this.slp_EFFECTIVE_DATE.Text = string.Empty;//通路生效日
            this.slp_CHAN_END_DATE.Text = string.Empty;//通路結束日
            this.slp_NOTICE_RETURN_DATE.Text = string.Empty;//退貨通知日
            this.slp_PLAN_RETURN_DATE.Text = string.Empty;//首次預退日
            this.slp_RTN_DDL.Text = string.Empty;//退書截止日
            this.txt_EDIT_REASON.Text = string.Empty;//異動原因

            this.slp_ITEM_1.Text = string.Empty;//品號_1
            this.slp_PERIOD_B_1.Text = string.Empty;//期別(起)_1
            this.slp_PERIOD_E_1.Text = string.Empty;//期別(迄)_1
            this.slp_ITEM_2.Text = string.Empty;//品號_2
            this.slp_PERIOD_B_2.Text = string.Empty;//期別(起)_2
            this.slp_PERIOD_E_2.Text = string.Empty;//期別(迄)_2
            this.slp_ITEM_3.Text = string.Empty;//品號_3
            this.slp_PERIOD_B_3.Text = string.Empty;//期別(起)_3
            this.slp_PERIOD_E_3.Text = string.Empty;//期別(迄)_3
            this.slp_ITEM_4.Text = string.Empty;//品號_4
            this.slp_PERIOD_B_4.Text = string.Empty;//期別(起)_4
            this.slp_PERIOD_E_4.Text = string.Empty;//期別(迄)_4
            this.slp_ITEM_5.Text = string.Empty;//品號_5
            this.slp_PERIOD_B_5.Text = string.Empty;//期別(起)_5
            this.slp_PERIOD_E_5.Text = string.Empty;//期別(迄)_5
            this.slp_ITEM_6.Text = string.Empty;//品號_6
            this.slp_PERIOD_B_6.Text = string.Empty;//期別(起)_6
            this.slp_PERIOD_E_6.Text = string.Empty;//期別(迄)_6
            this.slp_ITEM_7.Text = string.Empty;//品號_7
            this.slp_PERIOD_B_7.Text = string.Empty;//期別(起)_7
            this.slp_PERIOD_E_7.Text = string.Empty;//期別(迄)_7
            this.slp_ITEM_8.Text = string.Empty;//品號_8
            this.slp_PERIOD_B_8.Text = string.Empty;//期別(起)_8
            this.slp_PERIOD_E_8.Text = string.Empty;//期別(迄)_8
            this.slp_ITEM_9.Text = string.Empty;//品號_9
            this.slp_PERIOD_B_9.Text = string.Empty;//期別(起)_9
            this.slp_PERIOD_E_9.Text = string.Empty;//期別(迄)_9
            this.slp_ITEM_10.Text = string.Empty;//品號_10
            this.slp_PERIOD_B_10.Text = string.Empty;//期別(起)_10
            this.slp_PERIOD_E_10.Text = string.Empty;//期別(迄)_10

            this.up_All.Update();

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        { }
    }
示例#5
0
    /// <summary>
    /// 檢查條件
    /// </summary>
    /// <param name="s_Type"></param>
    /// <returns></returns>
    private ArrayList Check_Condition()
    {
        #region 宣告

        BCO.ITMCommon ITMComm = new BCO.ITMCommon();
        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region SLP轉型

        TextBox txt_MDC_END_DATE = (TextBox)this.slp_MDC_END_DATE.FindControl("TextBoxCode"); //DC結束日
        TextBox txt_PERIOD_END_DATE = (TextBox)this.slp_PERIOD_END_DATE.FindControl("TextBoxCode"); //期別結束日
        TextBox txt_EFFECTIVE_DATE = (TextBox)this.slp_EFFECTIVE_DATE.FindControl("TextBoxCode"); //通路生效日
        TextBox txt_CHAN_END_DATE = (TextBox)this.slp_CHAN_END_DATE.FindControl("TextBoxCode"); //通路結束日
        TextBox txt_NOTICE_RETURN_DATE = (TextBox)this.slp_NOTICE_RETURN_DATE.FindControl("TextBoxCode"); //退貨通知日
        TextBox txt_PLAN_RETURN_DATE = (TextBox)this.slp_PLAN_RETURN_DATE.FindControl("TextBoxCode"); //首次預退日
        TextBox txt_RTN_DDL = (TextBox)this.slp_RTN_DDL.FindControl("TextBoxCode"); //退書截止日

        #endregion

        #region 檢查欄位的Byte長度

        if (ITMComm.Get_Byte_Length(this.txt_ITEM_NAME.Text) > 30)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品名]長度不可大於 30 Byte", "1", this.txt_ITEM_NAME.ClientID); }

        if (ITMComm.Get_Byte_Length(this.txt_EDIT_REASON.Text) > 50)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動原因]長度不可大於 50 Byte", "1", this.txt_EDIT_REASON.ClientID); }

        #endregion

        #region 檢查SLP日期格式

        arl_Return = ITMComm.Check_Format_Date(this.slp_MDC_END_DATE.Text, "欄位[DC結束日]日期格式錯誤", "1", txt_MDC_END_DATE.ClientID, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(this.slp_PERIOD_END_DATE.Text, "欄位[期別結束日]日期格式錯誤", "1", txt_PERIOD_END_DATE.ClientID, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(this.slp_EFFECTIVE_DATE.Text, "欄位[通路生效日]日期格式錯誤", "1", txt_EFFECTIVE_DATE.ClientID, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(this.slp_CHAN_END_DATE.Text, "欄位[通路結束日]日期格式錯誤", "1", txt_CHAN_END_DATE.ClientID, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(this.slp_NOTICE_RETURN_DATE.Text, "欄位[退貨通知日]日期格式錯誤", "1", txt_NOTICE_RETURN_DATE.ClientID, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(this.slp_PLAN_RETURN_DATE.Text, "欄位[首次預退日]日期格式錯誤", "1", txt_PLAN_RETURN_DATE.ClientID, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(this.slp_RTN_DDL.Text, "欄位[退書截止日]日期格式錯誤", "1", txt_RTN_DDL.ClientID, arl_Return);

        #endregion

        #region 檢查必填欄位(除了欄位[品名][DC結束日]外,如果其他欄位有值才做以下檢查)

        if ((this.slp_PERIOD_END_DATE.Text.Trim() == string.Empty &&//期別結束日
            this.slp_EFFECTIVE_DATE.Text.Trim() == string.Empty &&//通路生效日
            this.slp_CHAN_END_DATE.Text.Trim() == string.Empty &&//通路結束日
            this.slp_NOTICE_RETURN_DATE.Text.Trim() == string.Empty &&//退貨通知日
            this.slp_PLAN_RETURN_DATE.Text.Trim() == string.Empty &&//首次預退日
            this.slp_RTN_DDL.Text.Trim() == string.Empty)//退書截止日
            == false)
        {
            //欄位[品號][期別(起)][期別(迄)],每一行的資料只要三個欄位其中一個有值,則其他兩個皆為必填欄位

            if (this.slp_ITEM_1.Text != string.Empty ||
                this.slp_PERIOD_B_1.Text != string.Empty ||
                this.slp_PERIOD_E_1.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_1.Text, "text", "欄位[序號(1)品號]為必填欄位", "1", this.slp_ITEM_1.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_1.Text, "text", "欄位[序號(1)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_1.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_1.Text, "text", "欄位[序號(1)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_1.TextBox_Code.ClientID, arl_Return);
            }
            if (this.slp_ITEM_2.Text != string.Empty ||
                this.slp_PERIOD_B_2.Text != string.Empty ||
                this.slp_PERIOD_E_2.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_2.Text, "text", "欄位[序號(2)品號]為必填欄位", "1", this.slp_ITEM_2.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_2.Text, "text", "欄位[序號(2)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_2.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_2.Text, "text", "欄位[序號(2)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_2.TextBox_Code.ClientID, arl_Return);
            }

            if (this.slp_ITEM_3.Text != string.Empty ||
                this.slp_PERIOD_B_3.Text != string.Empty ||
                this.slp_PERIOD_E_3.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_3.Text, "text", "欄位[序號(3)品號]為必填欄位", "1", this.slp_ITEM_3.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_3.Text, "text", "欄位[序號(3)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_3.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_3.Text, "text", "欄位[序號(3)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_3.TextBox_Code.ClientID, arl_Return);
            }

            if (this.slp_ITEM_4.Text != string.Empty ||
                this.slp_PERIOD_B_4.Text != string.Empty ||
                this.slp_PERIOD_E_4.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_4.Text, "text", "欄位[序號(4)品號]為必填欄位", "1", this.slp_ITEM_4.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_4.Text, "text", "欄位[序號(4)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_4.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_4.Text, "text", "欄位[序號(4)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_4.TextBox_Code.ClientID, arl_Return);
            }

            if (this.slp_ITEM_5.Text != string.Empty ||
                this.slp_PERIOD_B_5.Text != string.Empty ||
                this.slp_PERIOD_E_5.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_5.Text, "text", "欄位[序號(5)品號]為必填欄位", "1", this.slp_ITEM_5.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_5.Text, "text", "欄位[序號(5)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_5.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_5.Text, "text", "欄位[序號(5)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_5.TextBox_Code.ClientID, arl_Return);
            }

            if (this.slp_ITEM_6.Text != string.Empty ||
                this.slp_PERIOD_B_6.Text != string.Empty ||
                this.slp_PERIOD_E_6.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_6.Text, "text", "欄位[序號(6)品號]為必填欄位", "1", this.slp_ITEM_6.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_6.Text, "text", "欄位[序號(6)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_6.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_6.Text, "text", "欄位[序號(6)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_6.TextBox_Code.ClientID, arl_Return);
            }

            if (this.slp_ITEM_7.Text != string.Empty ||
                this.slp_PERIOD_B_7.Text != string.Empty ||
                this.slp_PERIOD_E_7.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_7.Text, "text", "欄位[序號(7)品號]為必填欄位", "1", this.slp_ITEM_7.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_7.Text, "text", "欄位[序號(7)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_7.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_7.Text, "text", "欄位[序號(7)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_7.TextBox_Code.ClientID, arl_Return);
            }
            if (this.slp_ITEM_8.Text != string.Empty ||
                this.slp_PERIOD_B_8.Text != string.Empty ||
                this.slp_PERIOD_E_8.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_8.Text, "text", "欄位[序號(8)品號]為必填欄位", "1", this.slp_ITEM_8.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_8.Text, "text", "欄位[序號(8)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_8.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_8.Text, "text", "欄位[序號(8)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_8.TextBox_Code.ClientID, arl_Return);
            }
            if (this.slp_ITEM_9.Text != string.Empty ||
                this.slp_PERIOD_B_9.Text != string.Empty ||
                this.slp_PERIOD_E_9.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_9.Text, "text", "欄位[序號(9)品號]為必填欄位", "1", this.slp_ITEM_9.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_9.Text, "text", "欄位[序號(9)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_9.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_9.Text, "text", "欄位[序號(9)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_9.TextBox_Code.ClientID, arl_Return);
            }
            if (this.slp_ITEM_10.Text != string.Empty ||
                this.slp_PERIOD_B_10.Text != string.Empty ||
                this.slp_PERIOD_E_10.Text != string.Empty)
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM_10.Text, "text", "欄位[序號(10)品號]為必填欄位", "1", this.slp_ITEM_10.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_B_10.Text, "text", "欄位[序號(10)期別(起)]為必填欄位", "1", this.slp_PERIOD_B_10.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_E_10.Text, "text", "欄位[序號(10)期別(迄)]為必填欄位", "1", this.slp_PERIOD_E_10.TextBox_Code.ClientID, arl_Return);
            }
        }

        #endregion

        #region 如果基本檢查有誤,則Return

        if (arl_Return[1].ToString() != string.Empty)
        { return arl_Return; }

        #endregion

        #region 檢查Between欄位

        #region 欄位[期別]_1

        if (this.slp_PERIOD_B_1.Text != string.Empty ||
            this.slp_PERIOD_E_1.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_1.Text,
                 this.slp_PERIOD_E_1.Text,
                 "(序號1)期別",
                 "1",
                 this.slp_PERIOD_B_1.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_1.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_1.Text,
                 this.slp_PERIOD_E_1.Text,
                 "string",
                 "欄位[(序號1)期別(迄)]一定要大於或等於欄位[(序號1)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_1.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_2

        if (this.slp_PERIOD_B_2.Text != string.Empty ||
            this.slp_PERIOD_E_2.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_2.Text,
                 this.slp_PERIOD_E_2.Text,
                 "(序號2)期別",
                 "1",
                 this.slp_PERIOD_B_2.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_2.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_2.Text,
                 this.slp_PERIOD_E_2.Text,
                 "string",
                 "欄位[(序號2)期別(迄)]一定要大於或等於欄位[(序號2)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_2.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_3

        if (this.slp_PERIOD_B_3.Text != string.Empty ||
            this.slp_PERIOD_E_3.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_3.Text,
                 this.slp_PERIOD_E_3.Text,
                 "(序號3)期別",
                 "1",
                 this.slp_PERIOD_B_3.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_3.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_3.Text,
                 this.slp_PERIOD_E_3.Text,
                 "string",
                 "欄位[(序號3)期別(迄)]一定要大於或等於欄位[(序號3)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_3.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_4

        if (this.slp_PERIOD_B_4.Text != string.Empty ||
            this.slp_PERIOD_E_4.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_4.Text,
                 this.slp_PERIOD_E_4.Text,
                 "(序號4)期別",
                 "1",
                 this.slp_PERIOD_B_4.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_4.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_4.Text,
                 this.slp_PERIOD_E_4.Text,
                 "string",
                 "欄位[(序號4)期別(迄)]一定要大於或等於欄位[(序號4)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_4.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_5

        if (this.slp_PERIOD_B_5.Text != string.Empty ||
            this.slp_PERIOD_E_5.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_5.Text,
                 this.slp_PERIOD_E_5.Text,
                 "(序號5)期別",
                 "1",
                 this.slp_PERIOD_B_5.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_5.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_5.Text,
                 this.slp_PERIOD_E_5.Text,
                 "string",
                 "欄位[(序號5)期別(迄)]一定要大於或等於欄位[(序號5)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_5.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_6

        if (this.slp_PERIOD_B_6.Text != string.Empty ||
            this.slp_PERIOD_E_6.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_6.Text,
                 this.slp_PERIOD_E_6.Text,
                 "(序號6)期別",
                 "1",
                 this.slp_PERIOD_B_6.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_6.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_6.Text,
                 this.slp_PERIOD_E_6.Text,
                 "string",
                 "欄位[(序號6)期別(迄)]一定要大於或等於欄位[(序號6)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_6.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_7

        if (this.slp_PERIOD_B_7.Text != string.Empty ||
            this.slp_PERIOD_E_7.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_7.Text,
                 this.slp_PERIOD_E_7.Text,
                 "(序號7)期別",
                 "1",
                 this.slp_PERIOD_B_7.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_7.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_7.Text,
                 this.slp_PERIOD_E_7.Text,
                 "string",
                 "欄位[(序號7)期別(迄)]一定要大於或等於欄位[(序號7)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_7.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_8

        if (this.slp_PERIOD_B_8.Text != string.Empty ||
            this.slp_PERIOD_E_8.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_8.Text,
                 this.slp_PERIOD_E_8.Text,
                 "(序號8)期別",
                 "1",
                 this.slp_PERIOD_B_8.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_8.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_8.Text,
                 this.slp_PERIOD_E_8.Text,
                 "string",
                 "欄位[(序號8)期別(迄)]一定要大於或等於欄位[(序號8)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_8.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_9

        if (this.slp_PERIOD_B_9.Text != string.Empty ||
            this.slp_PERIOD_E_9.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_9.Text,
                 this.slp_PERIOD_E_9.Text,
                 "(序號9)期別",
                 "1",
                 this.slp_PERIOD_B_9.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_9.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_9.Text,
                 this.slp_PERIOD_E_9.Text,
                 "string",
                 "欄位[(序號9)期別(迄)]一定要大於或等於欄位[(序號9)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_9.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #region 欄位[期別]_10

        if (this.slp_PERIOD_B_10.Text != string.Empty ||
            this.slp_PERIOD_E_10.Text != string.Empty)
        {
            #region 檢查Between欄位如果輸入其中一個欄位則另一個欄位也必須填值

            arl_Return = ITMComm.Check_Between_BeginEnd_Value
                (this.slp_PERIOD_B_10.Text,
                 this.slp_PERIOD_E_10.Text,
                 "(序號10)期別",
                 "1",
                 this.slp_PERIOD_B_10.TextBox_Code.ClientID,
                 this.slp_PERIOD_E_10.TextBox_Code.ClientID,
                 arl_Return);

            #endregion

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_PERIOD_B_10.Text,
                 this.slp_PERIOD_E_10.Text,
                 "string",
                 "欄位[(序號10)期別(迄)]一定要大於或等於欄位[(序號10)期別(起)]",
                 "1",
                 this.slp_PERIOD_E_10.TextBox_Code.ClientID,
                 arl_Return);

            #endregion
        }

        #endregion

        #endregion

        #region 自訂檢查

        #region 檢查是否至少填一組修改條件

        if (this.txt_ITEM_NAME.Text.Trim() == string.Empty &&//品名
           this.slp_MDC_END_DATE.Text.Trim() == string.Empty &&//DC結束日
           this.slp_PERIOD_END_DATE.Text.Trim() == string.Empty &&//期別結束日
           this.slp_EFFECTIVE_DATE.Text.Trim() == string.Empty &&//通路生效日
           this.slp_CHAN_END_DATE.Text.Trim() == string.Empty &&//通路結束日
           this.slp_NOTICE_RETURN_DATE.Text.Trim() == string.Empty &&//退貨通知日
           this.slp_PLAN_RETURN_DATE.Text.Trim() == string.Empty &&//首次預退日
           this.slp_RTN_DDL.Text.Trim() == string.Empty &&//退書截止日
           this.txt_EDIT_REASON.Text.Trim() == string.Empty)//異動原因
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "至少填一組修改條件", "1", this.txt_ITEM_NAME.ClientID); }

        #endregion

        #region 檢查是否至少填一組品號

        string s_Check_FileName = string.Empty;
        string s_Check_ITEM = string.Empty;

        for (int i = 1; i <= 10; i++)
        {
            s_Check_FileName = "slp_ITEM_" + i.ToString();
            s_Check_ITEM += ((ASP.itm_slp_slp_sku_ascx)this.table1.FindControl(s_Check_FileName)).Text.Trim();
        }

        if (s_Check_ITEM == string.Empty)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "至少填一組品號條件", "1", this.slp_ITEM_1.TextBox_Code.ClientID); }

        #endregion

        #endregion

        return arl_Return;
    }
示例#6
0
    /// <summary>
    /// BUTTON [模板設定查詢]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnQUERY_Click(object sender, EventArgs e)
    {
        #region 檢查條件

        BCO.ITMCommon ITMComm = new BCO.ITMCommon();

        ArrayList arl_Check_Condition = Check_Condition("BUTTON [模板設定查詢]鈕");

        #region 如果檢查有誤,則Return

        if (arl_Check_Condition[1].ToString() != string.Empty)
        {
            #region 錯誤訊息

            this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

            #endregion

            #region Focus欄位

            if (arl_Check_Condition[0].ToString() != string.Empty)
            {
                string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM111", s_ScriptManager_Script, true);
            }

            #endregion

            return;
        }

        #endregion

        #endregion

        ParameterList.Clear();
        ParameterList.Add(slpCHAN_NO.Text);
        ParameterList.Add(slpT_DATE.Text);
        ParameterList.Add(Session["UID"].ToString());
        DataTable dt_Return = new DataTable();

        BCO.MaintainReturnTemplate bco = new BCO.MaintainReturnTemplate(ConntionDB);
        dt_Return = bco.QueryRegularReturnItem(ParameterList);

        string SessionIDName = "ITM111_StoreCount" + PageTimeStamp.Value;
        txtSTORE_COUNT.Text = Session[SessionIDName].ToString();

        if (dt_Return.Rows.Count == 0)
        {
            txtSTORE_COUNT.Text = Page.Request.Form[txtSTORE_COUNT.UniqueID];
            ErrorMsgLabel.Text = "模板日期 : " + slpT_DATE.Text + " 查無資料";
            return;
        }
        string strLockUID = string.Empty;
        string strLockTime = string.Empty;
        int iChkResult = QueryControlChk(out strLockUID, out strLockTime);
        if (iChkResult == 1)
        {
            string script = "if(confirm('使用者:" + strLockUID + " 從 " + strLockTime.Substring(0, 16) + " 正在使用中,如果確定執行將中斷正在執行的作業?')==true){document.getElementById('" + btnEnter.ClientID + "').click();}";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EXEC", script, true);
        }
        else
        {
            EnterResult();
        }
    }
示例#7
0
    /// <summary>
    /// BUTTON [載入檔案]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_LoadFile_Click(object sender, EventArgs e)
    {
        try
        {
            #region 將Client端的檔案上傳至AP端

            #region 宣告變數

            string s_UploadPath = string.Empty;
            ArrayList arl_Return = new ArrayList();

            #endregion

            #region 將Client端的檔案上傳至AP端

            s_UploadPath = Server.MapPath("..\\") + System.Configuration.ConfigurationManager.AppSettings["UploadPath"] + "ITM\\";

            arl_Return = bco.FileUpload(s_UploadPath, this.fileupload_Path, Session["UID"].ToString());

            #endregion

            #region 檢查回傳結果

            if (arl_Return[0].ToString() == "FALSE")
            {
                #region 清空上傳匯入結果

                this.UploadStatusPanel1.UploadSum = 0;//上傳結果總筆數
                this.UploadStatusPanel1.UploadOK = 0;//上傳結果正常筆數
                this.UploadStatusPanel1.UploadNG = 0;//上傳結果錯誤筆數
                this.UploadStatusPanel1.ImportSum = 0;//匯入結果總筆數
                this.UploadStatusPanel1.ImportOK = 0;//匯入結果正常筆數
                this.UploadStatusPanel1.ImportNG = 0;//匯入結果錯誤筆數

                #endregion

                #region 設定控制項

                this.but_Import.Enabled = false;//確定匯入
                this.but_Error.Enabled = false;//檢視異常

                #endregion

                this.ErrorMsgLabel.Text = arl_Return[1].ToString();
                return;
            }

            #endregion

            #endregion

            #region 依據AP端檔案資料匯入TmpTable

            #region 取得 TempTable VDS_ITM_ITEM_TMP 的 SCHEMA

            ITMCommon ITMComm = new ITMCommon();
            DataTable dt_Temp = new DataTable();

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

            dt_Temp = bco.GET_ITM_PRE_ITEM_TMP_SCHEMA(ParameterList);

            #endregion

            #region 將資料寫入 TempTable

            DateTime d_Now = DateTime.Now;

            #region 讀取 Excel 資料

            OleDbConnection oleConnection = null;
            DataSet ds_Excel = new DataSet();

            try
            {
                //HDR=YES是表示Excel中的第一列為欄名。
                //IMEX=1是表示儲存格內容若是文字和數字混合的內容, 要當做文字處理。
                String connString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source =" + arl_Return[1].ToString() + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1';";
                oleConnection = new OleDbConnection(connString);
                oleConnection.Open();
                OleDbCommand oleCommand = new OleDbCommand("SELECT * FROM [Sheet1$] where (ID is not null and ID <> 'ID')", oleConnection);
                OleDbDataAdapter oleAdapter = new OleDbDataAdapter(oleCommand);
                oleAdapter.Fill(ds_Excel);

                #region 請注意如果EXCEL檔欄位有值,但到DB卻沒有資料
                //請修改,機碼 HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\Engines\Excel\TypeGuessRows 值
                //預設是 8, 表示會先讀取前 8 列來決定每一個欄位的型態, 所以如果前 8 列的資料都是數字, 到了第 9 列以後出現的文字資料都會變成 null
                //如果要解決這個問題, 只要把 TypeGuessRows 機碼值改成 0
                #endregion
            }
            catch (Exception ex)
            { throw new Exception("讀取 Excel 資料失敗:" + ex.Message); }
            finally
            {
                if (oleConnection != null)
                {
                    oleConnection.Close();
                    oleConnection.Dispose();
                }
            }

            #endregion

            #region 取得[出刊種類][銷售單位][印製國家][語文]的代號表

            #region 設定變數

            DataTable dt_PUBLISH_TYPE = new DataTable();//出刊種類
            DataTable dt_UNIT = new DataTable();//銷售單位
            DataTable dt_PRINT_CNTY = new DataTable();//印製國家
            DataTable dt_LANGUAGE = new DataTable();//語文

            #endregion

            #region 取得[出刊種類]代號表

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter("5", "string", false));
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

            dt_PUBLISH_TYPE = bco.QUERY_SYS_CODE_DETL_CODE(ParameterList);

            #endregion

            #region 取得[銷售單位]代號表

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter("ITM", "string", false));
            ParameterList.Add(ITMComm.GetValueSetParameter("ITEM_UNIT", "string", false));
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

            dt_UNIT = bco.QUERY_SYS_ENUMBASE_CODE(ParameterList);

            #endregion

            #region 取得[印製國家]代號表

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter("I8", "string", false));
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

            dt_PRINT_CNTY = bco.QUERY_SYS_CODE_DETL_CODE(ParameterList);

            #endregion

            #region 取得[語文]代號表

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter("I6", "string", false));
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

            dt_LANGUAGE = bco.QUERY_SYS_CODE_DETL_CODE(ParameterList);

            #endregion

            #endregion

            foreach (DataRow dr in ds_Excel.Tables[0].Rows)
            {
                #region 檢查條件

                ArrayList arl_ConditionReturn = Check_Condition_DataLine(dr,
                                                                         dt_Temp,
                                                                         dt_PUBLISH_TYPE,//出刊種類
                                                                         dt_UNIT,//銷售單位
                                                                         dt_PRINT_CNTY,//印製國家
                                                                         dt_LANGUAGE,
                                                                          ds_Excel.Tables[0]);//語文

                #endregion



                if (arl_ConditionReturn[1].ToString() == string.Empty)
                {
                    #region 檢查正確
                    DataRow dr_Temp = dt_Temp.NewRow();

                    #region 計算[折扣率]

                    //若欄位[零售價]=0,則欄位[折扣率]必須=0
                    //折扣率=成本/零售價

                    if (dr["PRICE"].ToString() == "0")
                    { dr["DISCOUNT_RATE"] = 0; }
                    else
                    { dr["DISCOUNT_RATE"] = System.Math.Round(double.Parse(dr["COST"].ToString()) / int.Parse(dr["PRICE"].ToString()), 2, MidpointRounding.AwayFromZero); }

                    #endregion

                    dr_Temp["ID"] = ITMComm.GetValueSetParameter(dr["ID"].ToString(), "int", false);//ID
                    dr_Temp["STATUS"] = ITMComm.GetValueSetParameter("1", "int", false);//處理狀態(1:正常資料;2:錯誤資料)
                    dr_Temp["DATASOURCE"] = ITMComm.GetValueSetParameter(arl_Return[3].ToString(), "string", false);//匯入檔案
                    dr_Temp["DATATYPE"] = ITMComm.GetValueSetParameter("1", "int", false);//資料類別(1:FILE TO TMP;2:TMP TO DB)
                    dr_Temp["MEMO"] = ITMComm.GetValueSetParameter(string.Empty, "string", false);//說明
                    dr_Temp["ITEM"] = ITMComm.GetValueSetParameter(dr["ITEM"].ToString(), "string", false);//品號
                    dr_Temp["ITEM_NAME"] = ITMComm.GetValueSetParameter(dr["ITEM_NAME"].ToString(), "string", false);//品名
                    dr_Temp["VICE_ITEM_NAME"] = ITMComm.GetValueSetParameter(dr["VICE_ITEM_NAME"].ToString(), "string", false);//副主題
                    dr_Temp["MDC_START_DATE"] = ITMComm.GetValueSetParameter(dr["MDC_START_DATE"].ToString(), "datecustom", "yyyyMMdd", false);//DC開始日
                    dr_Temp["MDC_END_DATE"] = ITMComm.GetValueSetParameter(dr["MDC_END_DATE"].ToString(), "datecustom", "yyyyMMdd", false);//DC結束日
                    dr_Temp["MANUFACTURE"] = ITMComm.GetValueSetParameter(dr["MANUFACTURE"].ToString(), "string", false);//供應商
                    dr_Temp["EDIT_NO"] = ITMComm.GetValueSetParameter(dr["EDIT_NO"].ToString(), "string", false);//異動序號
                    dr_Temp["EDIT_REASON"] = ITMComm.GetValueSetParameter(dr["EDIT_REASON"].ToString(), "string", false);//異動原因
                    dr_Temp["ROOT_NO"] = ITMComm.GetValueSetParameter(dr["ROOT_NO"].ToString(), "string", false);//群分類
                    dr_Temp["OUT_OF_PRINT"] = ITMComm.GetValueSetParameter(dr["OUT_OF_PRINT"].ToString(), "int", false);//絕版
                    dr_Temp["PMA"] = ITMComm.GetValueSetParameter(dr["PMA"].ToString(), "string", false);//大分類
                    dr_Temp["CATEGORY"] = ITMComm.GetValueSetParameter(dr["CATEGORY"].ToString(), "string", false);//中分類
                    dr_Temp["SORT_OUT"] = ITMComm.GetValueSetParameter(dr["SORT_OUT"].ToString(), "string", false);//小分類
                    dr_Temp["STATEMENTS"] = ITMComm.GetValueSetParameter(dr["STATEMENTS"].ToString(), "string", false);//敘述
                    dr_Temp["ATTRIBUTE"] = ITMComm.GetValueSetParameter(dr["ATTRIBUTE"].ToString(), "int", false);//是否定期
                    dr_Temp["FIRST_PERIOD"] = ITMComm.GetValueSetParameter(dr["FIRST_PERIOD"].ToString(), "string", false);//首期期別
                    dr_Temp["NEW_SW"] = ITMComm.GetValueSetParameter(dr["NEW_SW"].ToString(), "string", false);//新商品
                    dr_Temp["PERIOD_STEP"] = ITMComm.GetValueSetParameter(dr["PERIOD_STEP"].ToString(), "int", false);//期別累加值
                    dr_Temp["INTERVAL"] = ITMComm.GetValueSetParameter(dr["INTERVAL"].ToString(), "int", false);//出刊間隔
                    dr_Temp["PUBLISH_TYPE"] = ITMComm.GetValueSetParameter(dr["PUBLISH_TYPE"].ToString(), "string", false);//出刊種類
                    dr_Temp["UNIT"] = ITMComm.GetValueSetParameter(dr["UNIT"].ToString(), "int", false);//銷售單位
                    dr_Temp["OPEN_SIZE"] = ITMComm.GetValueSetParameter(dr["OPEN_SIZE"].ToString(), "string", false);//開本
                    dr_Temp["PAGE_NUM"] = ITMComm.GetValueSetParameter(dr["PAGE_NUM"].ToString(), "int", false);//頁數
                    dr_Temp["WIDTH"] = ITMComm.GetValueSetParameter(dr["WIDTH"].ToString(), "double", false);//寬
                    dr_Temp["HIEGHT"] = ITMComm.GetValueSetParameter(dr["HIEGHT"].ToString(), "double", false);//高
                    dr_Temp["LENGTH"] = ITMComm.GetValueSetParameter(dr["LENGTH"].ToString(), "double", false);//深
                    dr_Temp["AUTHOR"] = ITMComm.GetValueSetParameter(dr["AUTHOR"].ToString(), "string", false);//作者
                    dr_Temp["CIP"] = ITMComm.GetValueSetParameter(dr["CIP"].ToString(), "string", false);//中央圖書分類碼
                    dr_Temp["PUBLISH"] = ITMComm.GetValueSetParameter(dr["PUBLISH"].ToString(), "string", false);//VCMS出版社
                    dr_Temp["ITEM_PUBLISHER_NO"] = ITMComm.GetValueSetParameter(dr["ITEM_PUBLISHER_NO"].ToString(), "string", false);//商品出版商代號
                    dr_Temp["ITEM_PUBLISHER_NAME"] = ITMComm.GetValueSetParameter(dr["ITEM_PUBLISHER_NAME"].ToString(), "string", false);//商品出版商名稱
                    dr_Temp["PUBLISHER_TYPE"] = ITMComm.GetValueSetParameter(dr["PUBLISHER_TYPE"].ToString(), "string", false);//出版社書系
                    dr_Temp["PUBLISH_DATE"] = ITMComm.GetValueSetParameter(dr["PUBLISH_DATE"].ToString(), "datecustom", "yyyyMMdd", false);//出版日期
                    dr_Temp["PERIOD_END_DATE"] = ITMComm.GetValueSetParameter(dr["PERIOD_END_DATE"].ToString(), "datecustom", "yyyyMMdd", false);//期別結束日
                    dr_Temp["BARCODE"] = ITMComm.GetValueSetParameter(dr["BARCODE"].ToString(), "string", false);//商品條碼
                    dr_Temp["PERIOD_BARCODE"] = ITMComm.GetValueSetParameter(dr["PERIOD_BARCODE"].ToString(), "string", false);//二段條碼
                    dr_Temp["PRICE"] = ITMComm.GetValueSetParameter(dr["PRICE"].ToString(), "int", false);//零售價
                    dr_Temp["COST"] = ITMComm.GetValueSetParameter(dr["COST"].ToString(), "double", false);//成本價
                    dr_Temp["DISCOUNT_RATE"] = ITMComm.GetValueSetParameter(dr["DISCOUNT_RATE"].ToString(), "double", false);//折扣率
                    dr_Temp["PERIOD_PAY_TYPE"] = ITMComm.GetValueSetParameter(dr["PERIOD_PAY_TYPE"].ToString(), "int", false);//物流費基準
                    dr_Temp["TARGET_RULE"] = ITMComm.GetValueSetParameter(dr["TARGET_RULE"].ToString(), "int", false);//物流費規則
                    dr_Temp["TAX_TYPE"] = ITMComm.GetValueSetParameter(dr["TAX_TYPE"].ToString(), "int", false);//稅別
                    dr_Temp["DIS_ACCEPT_RATE"] = ITMComm.GetValueSetParameter(dr["DIS_ACCEPT_RATE"].ToString(), "double", false);//進貨物流費
                    dr_Temp["DIS_RETURN_RATE"] = ITMComm.GetValueSetParameter(dr["DIS_RETURN_RATE"].ToString(), "double", false);//退貨物流費
                    dr_Temp["DIS_ACCEPT_DOLLAR"] = ITMComm.GetValueSetParameter(dr["DIS_ACCEPT_DOLLAR"].ToString(), "double", false);//進貨物流費
                    dr_Temp["DIS_RETURN_DOLLAR"] = ITMComm.GetValueSetParameter(dr["DIS_RETURN_DOLLAR"].ToString(), "double", false);//退貨物流費
                    dr_Temp["PRINT_CNTY"] = ITMComm.GetValueSetParameter(dr["PRINT_CNTY"].ToString(), "string", false);//印製國家
                    dr_Temp["LANGUAGE"] = ITMComm.GetValueSetParameter(dr["LANGUAGE"].ToString(), "string", false);//語文
                    dr_Temp["DISTRIBUTE_MODE"] = ITMComm.GetValueSetParameter(dr["DISTRIBUTE_MODE"].ToString(), "string", false);//配量方式
                    dr_Temp["QUANTITY"] = ITMComm.GetValueSetParameter(dr["QUANTITY"].ToString(), "int", false);//每店
                    dr_Temp["ACCEPT_TOTAL"] = ITMComm.GetValueSetParameter(dr["ACCEPT_TOTAL"].ToString(), "int", false);//總進貨量
                    dr_Temp["RESEMBLE_GOODS"] = ITMComm.GetValueSetParameter(dr["RESEMBLE_GOODS"].ToString(), "string", false);//類似商品
                    dr_Temp["GOODS_MATTER"] = ITMComm.GetValueSetParameter(dr["GOODS_MATTER"].ToString(), "string", false);//商品說明
                    dr_Temp["COMMEND_CAUSE"] = ITMComm.GetValueSetParameter(dr["COMMEND_CAUSE"].ToString(), "string", false);//推薦理由
                    dr_Temp["CREATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//建立人員
                    dr_Temp["CREATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);//建立日期
                    dr_Temp["UPDATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//異動人員
                    dr_Temp["UPDATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);//異動日期

                    dt_Temp.Rows.Add(dr_Temp);
                    #endregion
                }
                else
                {
                    #region 檢查不正確
                    DataRow dr_Temp = dt_Temp.NewRow();

                    string s_ErrorMsg = string.Empty;
                    s_ErrorMsg = arl_ConditionReturn[1].ToString().Replace("<br/>", ",");
                    s_ErrorMsg = ITMComm.Get_Byte_Length(s_ErrorMsg) > 500 ? s_ErrorMsg.Substring(0, 250) : s_ErrorMsg;//MEMO欄位=VARCHAR2(500)

                    dr_Temp["ID"] = ITMComm.GetValueSetParameter((arl_ConditionReturn[1].ToString().IndexOf("欄位[ID]數字格式錯誤") == -1) ? dr["ID"].ToString() : string.Empty, "int", false);
                    dr_Temp["STATUS"] = ITMComm.GetValueSetParameter("2", "int", false);//處理狀態(1:正常資料;2:錯誤資料)
                    dr_Temp["DATASOURCE"] = ITMComm.GetValueSetParameter(arl_Return[3].ToString(), "string", false);//匯入檔案
                    dr_Temp["DATATYPE"] = ITMComm.GetValueSetParameter("1", "int", false);//資料類別(1:FILE TO TMP;2:TMP TO DB)
                    dr_Temp["MEMO"] = s_ErrorMsg;//說明
                    dr_Temp["CREATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);
                    dr_Temp["CREATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);
                    dr_Temp["UPDATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);
                    dr_Temp["UPDATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);

                    dt_Temp.Rows.Add(dr_Temp);
                    #endregion
                }
            }

            #endregion

            #region 連結資料庫

            if (dt_Temp.Rows.Count == 0)
            {
                this.ErrorMsgLabel.Text = "無匯入資料";
                return;
            }
            else
            {
                #region 將資料寫入TempTable

                DataTable dt_Return = bco.FileToTmp(null, Session["UID"].ToString(), dt_Temp);

                #endregion

                #region 計算[總筆數][正常筆數][錯誤筆數]

                int i_Total_Count = 0;//總筆數
                int i_Success_Count = 0;//正常筆數
                int i_Failure_Count = 0;//錯誤筆數

                string s_FilterExpression = string.Empty;

                s_FilterExpression = "STATUS ='1'";//1:正常資料;
                DataRow[] dr_Success = dt_Return.Select(s_FilterExpression);
                if (dr_Success.Length == 1)
                { i_Success_Count = int.Parse(dr_Success[0]["count"].ToString()); }

                s_FilterExpression = "STATUS ='2'";//2:錯誤資料;
                DataRow[] dr_Failure = dt_Return.Select(s_FilterExpression);
                if (dr_Failure.Length == 1)
                { i_Failure_Count = int.Parse(dr_Failure[0]["count"].ToString()); }

                i_Total_Count = i_Success_Count + i_Failure_Count;

                this.UploadStatusPanel1.UploadSum = i_Total_Count;//上傳結果總筆數
                this.UploadStatusPanel1.UploadOK = i_Success_Count;//上傳結果正常筆數
                this.UploadStatusPanel1.UploadNG = i_Failure_Count;//上傳結果錯誤筆數
                this.UploadStatusPanel1.ImportSum = 0;//匯入結果總筆數
                this.UploadStatusPanel1.ImportOK = 0;//匯入結果正常筆數
                this.UploadStatusPanel1.ImportNG = 0;//匯入結果錯誤筆數

                #endregion

                #region 設定控制項

                if ((i_Total_Count == i_Success_Count) &&
                   (i_Failure_Count == 0))
                {
                    this.but_Import.Enabled = true;//確定匯入
                    this.but_Error.Enabled = false;//檢視異常
                }

                if (i_Failure_Count > 0)
                {
                    this.but_Import.Enabled = false;//確定匯入
                    this.but_Error.Enabled = true;//檢視異常
                }

                #endregion
            }

            #endregion

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            #region 設定 TabContainer 的 ActiveTabIndex

            this.TabContainer1.ActiveTabIndex = 1;

            #endregion
        }
    }
示例#8
0
    /// <summary>
    /// BUTTON [刪除]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Delete_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢視模式

            if (this.hid_PageStatus.Value == "view")
            {
                #region 設定變數

                BCO.ITMCommon ITMComm = new BCO.ITMCommon();
                BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
                string s_ITEM = string.Empty;
                string s_ScriptManager_MSG = string.Empty;

                #endregion

                #region 傳入參數

                ParameterList.Clear();
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_ITEM.Text, "string", false));//[品號]
                ParameterList.Add(ITMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));//[異動日期]
                ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[異動人員]

                #endregion

                #region 連結資料庫

                s_ITEM = bco.DELETE_ITM042_VDS_ITM_ITEM(null, ParameterList);

                #endregion

                #region 檢查回傳值

                if (s_ITEM == "99999999999")//回傳11個9,代表該筆商品下存在期別
                { s_ScriptManager_MSG = "alert('請先於「期別主檔維護」刪除此品號資料');"; }
                else
                { s_ScriptManager_MSG = "alert('刪除成功');location.replace('ITM041.aspx?Code=ITM04');"; }

                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", s_ScriptManager_MSG, true);

                #endregion
            }

            #endregion

            #region 其他模式

            else
            { throw new Exception("BUTTON [刪除]鈕,必須在[檢視模式]下才可以使用,請聯絡系統管理員。"); }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
示例#9
0
    /// <summary>
    /// BUTTON [儲存]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Save_Click(object sender, EventArgs e)
    {
        try
        {
            #region 新增模式

            if (this.hid_PageStatus.Value == "insert")
            {
                #region 檢查條件

                BCO.ITMCommon ITMComm = new BCO.ITMCommon();
                ArrayList arl_Check_Condition = Check_Condition("BUTTON [儲存]鈕,新增狀態", null);

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 條碼檢查是否重覆
                if (hdfSaveFlag.Value == "0")
                {
                    if (CheckDup_BARCODE(txt_BARCODE.Text, slp_ITEM.Text) == true)
                    {
                        Page currentPage = (Page)HttpContext.Current.Handler;
                        string strScriptName = "ConfirmSave";

                        string strScriptContent = "DupBarcodeSave('" + but_Save.ClientID + "','" + hdfSaveFlag.ClientID + "');";
                        ScriptManager.RegisterClientScriptBlock(currentPage, currentPage.GetType(), strScriptName, strScriptContent, true);
                        return;
                    }
                }
                #endregion

                #region 傳入參數

                ParameterList.Clear();
                //頁籤=商品主檔
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_ITEM.Text, "string", false));//[品號]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_ITEM_NAME.Text, "string", false));//[品名]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_VICE_ITEM_NAME.Text, "string", false));//[副主題]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_MDC_START_DATE.Text, "date", false));//[DC開始日]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_MDC_END_DATE.Text, "date", false));//[DC結束日]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_MANUFACTURE.Text, "string", false));//[供應商]
                ParameterList.Add(ITMComm.GetValueSetParameter("0", "string", false));//[異動序號](新增模式下,畫面上該欄位是空值,但寫入資料庫時固定給值=0)
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_EDIT_REASON.Text, "string", false));//[異動原因]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false));//[群分類]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.radl_OUT_OF_PRINT.SelectedValue, "int", false));//[絕版]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_PMA.Text, "string", false));//[大分類]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_CATEGORY.Text, "string", false));//[中分類]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_SORT_OUT.Text, "string", false));//[小分類]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_STATEMENTS.Text, "string", false));//[敘述]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.radl_ATTRIBUTE.SelectedValue, "int", false));//[是否定期]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_FIRST_PERIOD.Text, "string", false));//[首期期別]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.radl_NEW_SW.SelectedValue, "string", false));//[新商品]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_PERIOD_STEP.Text, "int", false));//[期別累加值]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_INTERVAL.Text, "int", false));//[出刊間隔]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_PUBLISH_TYPE.Text, "string", false));//[出刊種類]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_UNIT.Text, "int", false));//[銷售單位]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_OPEN_SIZE.Text, "string", false));//[開本]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_PAGE_NUM.Text, "int", false));//[頁數]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_WIDTH.Text, "double", false));//[寬]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_HIEGHT.Text, "double", false));//[高]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_LENGTH.Text, "double", false));//[深]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_AUTHOR.Text, "string", false));//[作者]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_CIP.Text, "string", false));//[中央圖書分類碼(CIP)]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_PUBLISH.Text, "string", false));//[VCMS出版社]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_ITEM_PUBLISHER_NO.Text, "string", false));//[商品出版商代號]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_ITEM_PUBLISHER_NAME.Text, "string", false));//[商品出版商名稱]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_PUBLISHER_TYPE.Text, "string", false));//[出版社書系]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_PUBLISH_DATE.Text, "date", false));//[出版日期]
                //頁籤=首期期別
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_PERIOD_END_DATE.Text, "date", false));//[期別結束日]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_BARCODE.Text, "string", false));//[商品條碼]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_PERIOD_BARCODE.Text, "string", false));//[二段條碼]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_PRICE.Text, "int", false));//[零售價]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_COST.Text, "double", false));//[成本價]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_DISCOUNT_RATE.Text, "double", false));//[折扣率]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.radl_PERIOD_PAY_TYPE.SelectedValue, "int", false));//[物流費基準]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_TARGET_RULE.Text, "int", false));//[物流費規則]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_TAX_TYPE.Text, "int", false));//[稅別]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_ACCEPT_RATE.Text, "double", false));//[進貨物流費(%)]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_RETURN_RATE.Text, "double", false));//[退貨物流費(%)]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_ACCEPT_AMT.Text, "double", false));//[進貨物流費(元)]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_RETURN_AMT.Text, "double", false));//[退貨物流費(元)]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_PRINT_CNTY.Text, "string", false));//[印製國家]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_LANGUAGE.Text, "string", false));//[語文]
                //頁籤=商品指定參照
                ParameterList.Add(ITMComm.GetValueSetParameter(this.radl_DISTRIBUTE_MODE.SelectedValue, "string", false));//[配量方式]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_QUANTITY.Text, "int", false));//[每店]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_ACCEPT_TOTAL.Text, "int", false));//[總進貨量]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_RESEMBLE_GOODS.Text, "string", false));//[類似商品]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_GOODS_MATTER.Text, "string", false));//[商品說明]
                ParameterList.Add(ITMComm.GetValueSetParameter(this.txt_COMMEND_CAUSE.Text, "string", false));//[推薦理由]
                //====================================================================================================
                ParameterList.Add(ITMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));//[建立日期]
                ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[建立人員]

                #endregion

                #region 連結資料庫

                BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
                string s_ITEM = bco.ADD_ITM042_ITEM(null, ParameterList);

                #endregion

                #region 清空變數,跳轉頁面至檢視模式

                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", "alert('新增完成');location.replace('ITM042.aspx?Code=ITM04&ITM042_Mode=view&ITM042_ITEM=" + s_ITEM + "');", true);

                #endregion
            }

            #endregion

            #region 編輯模式

            else if (this.hid_PageStatus.Value == "edit")
            {
                #region 宣告變數

                BCO.ITMCommon ITMComm = new BCO.ITMCommon();
                BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
                DataTable dt_UpdateDB = new DataTable();
                string s_ITEM = string.Empty;

                #endregion

                #region 檢查條件

                ArrayList arl_Check_Condition = Check_Condition("BUTTON [儲存]鈕,編輯狀態", null);

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 設定 TempTable 的 SCHEMA

                foreach (DataColumn dc in dt_Original.Columns)
                {
                    dt_UpdateDB.Columns.Add("OLD_" + dc.ColumnName, dc.DataType);
                    dt_UpdateDB.Columns.Add("NEW_" + dc.ColumnName, dc.DataType);
                }

                #endregion

                #region 將資料寫入 TempTable

                DataRow dr_UpdateDB = dt_UpdateDB.NewRow();

                //舊資料
                foreach (DataRow dr in dt_Original.Rows)
                {
                    foreach (DataColumn dc in dt_Original.Columns)
                    { dr_UpdateDB["OLD_" + dc.ColumnName] = dr[dc.ColumnName]; }
                }

                //新資料
                //頁籤=商品主檔
                dr_UpdateDB["NEW_ITEM_NAME"] = ITMComm.GetValueSetParameter(this.txt_ITEM_NAME.Text, "string", false);//品名
                dr_UpdateDB["NEW_VICE_ITEM_NAME"] = ITMComm.GetValueSetParameter(this.txt_VICE_ITEM_NAME.Text, "string", false);//副主題
                dr_UpdateDB["NEW_MDC_START_DATE"] = ITMComm.GetValueSetParameter(this.slp_MDC_START_DATE.Text, "date", false);//DC開始日
                dr_UpdateDB["NEW_MDC_END_DATE"] = ITMComm.GetValueSetParameter(this.slp_MDC_END_DATE.Text, "date", false);//DC結束日
                dr_UpdateDB["NEW_MANUFACTURE"] = ITMComm.GetValueSetParameter(this.slp_MANUFACTURE.Text, "string", false);//供應商
                dr_UpdateDB["NEW_EDIT_NO"] = ITMComm.GetValueSetParameter(this.txt_EDIT_NO.Text, "string", false);//異動原因
                dr_UpdateDB["NEW_EDIT_REASON"] = ITMComm.GetValueSetParameter(this.txt_EDIT_REASON.Text, "string", false);//異動原因
                dr_UpdateDB["NEW_ROOT_NO"] = ITMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false);//群分類
                dr_UpdateDB["NEW_OUT_OF_PRINT"] = ITMComm.GetValueSetParameter(this.radl_OUT_OF_PRINT.SelectedValue, "int", false);//絕版
                dr_UpdateDB["NEW_PMA"] = ITMComm.GetValueSetParameter(this.slp_PMA.Text, "string", false);//大分類
                dr_UpdateDB["NEW_CATEGORY"] = ITMComm.GetValueSetParameter(this.slp_CATEGORY.Text, "string", false);//中分類
                dr_UpdateDB["NEW_SORT_OUT"] = ITMComm.GetValueSetParameter(this.slp_SORT_OUT.Text, "string", false);//小分類
                dr_UpdateDB["NEW_STATEMENTS"] = ITMComm.GetValueSetParameter(this.txt_STATEMENTS.Text, "string", false);//敘述
                dr_UpdateDB["NEW_ATTRIBUTE"] = ITMComm.GetValueSetParameter(this.radl_ATTRIBUTE.SelectedValue, "int", false);//是否定期
                dr_UpdateDB["NEW_FIRST_PERIOD"] = ITMComm.GetValueSetParameter(this.txt_FIRST_PERIOD.Text, "string", false);//首期期別
                dr_UpdateDB["NEW_NEW_SW"] = ITMComm.GetValueSetParameter(this.radl_NEW_SW.SelectedValue, "string", false);//新商品
                dr_UpdateDB["NEW_PERIOD_STEP"] = ITMComm.GetValueSetParameter(this.slp_PERIOD_STEP.Text, "int", false);//期別累加值
                dr_UpdateDB["NEW_INTERVAL"] = ITMComm.GetValueSetParameter(this.slp_INTERVAL.Text, "int", false);//出刊間隔
                dr_UpdateDB["NEW_PUBLISH_TYPE"] = ITMComm.GetValueSetParameter(this.slp_PUBLISH_TYPE.Text, "string", false);//出刊種類
                dr_UpdateDB["NEW_UNIT"] = ITMComm.GetValueSetParameter(this.slp_UNIT.Text, "int", false);//銷售單位
                dr_UpdateDB["NEW_OPEN_SIZE"] = ITMComm.GetValueSetParameter(this.txt_OPEN_SIZE.Text, "string", false);//開本
                dr_UpdateDB["NEW_PAGE_NUM"] = ITMComm.GetValueSetParameter(this.slp_PAGE_NUM.Text, "int", false);//頁數
                dr_UpdateDB["NEW_WIDTH"] = ITMComm.GetValueSetParameter(this.slp_WIDTH.Text, "double", false);//寬
                dr_UpdateDB["NEW_HIEGHT"] = ITMComm.GetValueSetParameter(this.slp_HIEGHT.Text, "double", false);//高
                dr_UpdateDB["NEW_LENGTH"] = ITMComm.GetValueSetParameter(this.slp_LENGTH.Text, "double", false);//深
                dr_UpdateDB["NEW_AUTHOR"] = ITMComm.GetValueSetParameter(this.txt_AUTHOR.Text, "string", false);//作者
                dr_UpdateDB["NEW_CIP"] = ITMComm.GetValueSetParameter(this.txt_CIP.Text, "string", false);//中央圖書分類碼(CIP)
                dr_UpdateDB["NEW_PUBLISH"] = ITMComm.GetValueSetParameter(this.txt_PUBLISH.Text, "string", false);//VCMS出版社
                dr_UpdateDB["NEW_ITEM_PUBLISHER_NO"] = ITMComm.GetValueSetParameter(this.txt_ITEM_PUBLISHER_NO.Text, "string", false);//商品出版商代號
                dr_UpdateDB["NEW_ITEM_PUBLISHER_NAME"] = ITMComm.GetValueSetParameter(this.txt_ITEM_PUBLISHER_NAME.Text, "string", false);//商品出版商名稱
                dr_UpdateDB["NEW_PUBLISHER_TYPE"] = ITMComm.GetValueSetParameter(this.txt_PUBLISHER_TYPE.Text, "string", false);//出版社書系
                dr_UpdateDB["NEW_PUBLISH_DATE"] = ITMComm.GetValueSetParameter(this.slp_PUBLISH_DATE.Text, "date", false);//出版日期
                //頁籤=商品指定參照
                dr_UpdateDB["NEW_DISTRIBUTE_MODE"] = ITMComm.GetValueSetParameter(this.radl_DISTRIBUTE_MODE.SelectedValue, "string", false);//配量方式
                dr_UpdateDB["NEW_QUANTITY"] = ITMComm.GetValueSetParameter(this.slp_QUANTITY.Text, "int", false);//每店
                dr_UpdateDB["NEW_ACCEPT_TOTAL"] = ITMComm.GetValueSetParameter(this.slp_ACCEPT_TOTAL.Text, "int", false);//總進貨量
                dr_UpdateDB["NEW_RESEMBLE_GOODS"] = ITMComm.GetValueSetParameter(this.txt_RESEMBLE_GOODS.Text, "string", false);//類似商品
                dr_UpdateDB["NEW_GOODS_MATTER"] = ITMComm.GetValueSetParameter(this.txt_GOODS_MATTER.Text, "string", false);//商品說明
                dr_UpdateDB["NEW_COMMEND_CAUSE"] = ITMComm.GetValueSetParameter(this.txt_COMMEND_CAUSE.Text, "string", false);//推薦理由
                //====================================================================================================
                dr_UpdateDB["NEW_UPDATEDATE"] = ITMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false);//[異動日期]
                dr_UpdateDB["NEW_UPDATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//[異動人員]

                dt_UpdateDB.Rows.Add(dr_UpdateDB);

                #endregion

                #region 連結資料庫

                s_ITEM = bco.UPDATE_ITM042_VDS_ITM_ITEM(null, dt_UpdateDB);

                #endregion

                #region 清空變數,跳轉頁面至檢視模式

                if (dt_Original != null)
                { dt_Original.Clear(); }

                #region 組合跳轉頁面字串

                string s_ADDLocation_Replace_String = string.Empty;

                try
                {
                    int i_Count = int.Parse(Request.QueryString["ITM042_COUNT"]);
                    string s_Request_Key = Request.QueryString["ITM042_PageTimeStamp"];

                    s_ADDLocation_Replace_String = "&ITM042_COUNT=" + i_Count.ToString() + "&ITM042_PageTimeStamp=" + s_Request_Key;
                }
                catch { s_ADDLocation_Replace_String = string.Empty; }

                #endregion

                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", "alert('更新成功');location.replace('ITM042.aspx?Code=ITM04&ITM042_Mode=view&ITM042_ITEM=" + s_ITEM + s_ADDLocation_Replace_String + "');", true);

                #endregion
            }

            #endregion

            #region 其他模式

            else
            { throw new Exception("BUTTON [儲存]鈕,必須在[新增模式][編輯模式]下才可以使用,請聯絡系統管理員。"); }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
示例#10
0
    /// <summary>
    /// 檢視模式 & 編輯模式,取得該品號相關資料
    /// </summary>
    private void Get_PageData()
    {
        #region 傳入參數

        string s_ITEM = Request.QueryString["ITM042_ITEM"];

        BCO.ITMCommon ITMComm = new BCO.ITMCommon();

        ParameterList.Clear();
        ParameterList.Add(ITMComm.GetValueSetParameter(s_ITEM, "string", false));//[商品品號]
        ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UID

        #endregion

        #region 連結資料庫

        BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
        DataTable dt_Return_ITEM = bco.QUERY_ITM042_ITEM(ParameterList);
        DataTable dt_Return_ITEM_PERIOD = bco.QUERY_ITM042_ITEM_PERIOD(ParameterList);

        #endregion

        #region 檢查回傳資料

        string s_RequestString = Request.QueryString["ITM042_Type"];

        if (dt_Return_ITEM.Rows.Count != 1 && s_RequestString != "ToolBar")
        { throw new Exception("查無品號:" + s_ITEM + "的相關資料"); }
        else if (dt_Return_ITEM.Rows.Count != 1 && s_RequestString == "ToolBar")
        { throw new Exception("查無此筆資料或已被其他使用者刪除,請點選上一筆/下一筆鈕或回查詢頁重新查詢!"); }

        #endregion

        #region 編輯模式,將資料寫入 TempTable

        if (this.hid_PageStatus.Value == "edit")
        {
            dt_Original = null;
            dt_Original = dt_Return_ITEM;
        }

        #endregion

        #region 將資料寫入控制項

        #region 頁籤=商品主檔

        this.slp_ITEM.Text = dt_Return_ITEM.Rows[0]["ITEM"].ToString();//品號
        this.txt_ITEM_NAME.Text = dt_Return_ITEM.Rows[0]["ITEM_NAME"].ToString();//品名
        this.txt_VICE_ITEM_NAME.Text = dt_Return_ITEM.Rows[0]["VICE_ITEM_NAME"].ToString();//副主題
        this.slp_MDC_START_DATE.Text = dt_Return_ITEM.Rows[0]["MDC_START_DATE"].ToString();//DC開始日
        this.slp_MDC_END_DATE.Text = dt_Return_ITEM.Rows[0]["MDC_END_DATE"].ToString();//DC結束日
        this.slp_MANUFACTURE.Text = dt_Return_ITEM.Rows[0]["MANUFACTURE"].ToString();//供應商
        this.txt_EDIT_NO.Text = dt_Return_ITEM.Rows[0]["EDIT_NO"].ToString();//異動序號
        this.txt_EDIT_REASON.Text = dt_Return_ITEM.Rows[0]["EDIT_REASON"].ToString();//異動原因
        this.slp_ROOT_NO.Text = dt_Return_ITEM.Rows[0]["ROOT_NO"].ToString();//群分類
        this.radl_OUT_OF_PRINT.Text = dt_Return_ITEM.Rows[0]["OUT_OF_PRINT"].ToString();//絕版
        this.slp_PMA.Text = dt_Return_ITEM.Rows[0]["PMA"].ToString();//大分類
        this.slp_CATEGORY.Text = dt_Return_ITEM.Rows[0]["CATEGORY"].ToString();//中分類
        this.slp_SORT_OUT.Text = dt_Return_ITEM.Rows[0]["SORT_OUT"].ToString();//小分類
        this.txt_STATEMENTS.Text = dt_Return_ITEM.Rows[0]["STATEMENTS"].ToString();//敘述
        this.radl_ATTRIBUTE.SelectedValue = dt_Return_ITEM.Rows[0]["ATTRIBUTE"].ToString();//是否定期
        this.txt_FIRST_PERIOD.Text = dt_Return_ITEM.Rows[0]["FIRST_PERIOD"].ToString();//首期期別
        this.radl_NEW_SW.SelectedValue = dt_Return_ITEM.Rows[0]["NEW_SW"].ToString();//新商品
        this.slp_PERIOD_STEP.Text = dt_Return_ITEM.Rows[0]["PERIOD_STEP"].ToString();//期別累加值
        this.slp_INTERVAL.Text = dt_Return_ITEM.Rows[0]["INTERVAL"].ToString();//出刊間隔
        this.slp_PUBLISH_TYPE.Text = dt_Return_ITEM.Rows[0]["PUBLISH_TYPE"].ToString();//出刊種類
        this.slp_UNIT.Text = dt_Return_ITEM.Rows[0]["UNIT"].ToString();//銷售單位
        this.txt_OPEN_SIZE.Text = dt_Return_ITEM.Rows[0]["OPEN_SIZE"].ToString();//開本
        this.slp_PAGE_NUM.Text = dt_Return_ITEM.Rows[0]["PAGE_NUM"].ToString();//頁數
        this.slp_WIDTH.Text = dt_Return_ITEM.Rows[0]["WIDTH"].ToString();//寬
        this.slp_HIEGHT.Text = dt_Return_ITEM.Rows[0]["HIEGHT"].ToString();//高
        this.slp_LENGTH.Text = dt_Return_ITEM.Rows[0]["LENGTH"].ToString();//深
        this.txt_AUTHOR.Text = dt_Return_ITEM.Rows[0]["AUTHOR"].ToString();//作者
        this.txt_CIP.Text = dt_Return_ITEM.Rows[0]["CIP"].ToString();//中央圖書分類碼(CIP)
        this.txt_PUBLISH.Text = dt_Return_ITEM.Rows[0]["PUBLISH"].ToString();//VCMS出版社
        this.txt_ITEM_PUBLISHER_NO.Text = dt_Return_ITEM.Rows[0]["ITEM_PUBLISHER_NO"].ToString();//商品出版商代號
        this.txt_ITEM_PUBLISHER_NAME.Text = dt_Return_ITEM.Rows[0]["ITEM_PUBLISHER_NAME"].ToString();//商品出版商名稱
        this.txt_PUBLISHER_TYPE.Text = dt_Return_ITEM.Rows[0]["PUBLISHER_TYPE"].ToString();//出版社書系
        this.slp_PUBLISH_DATE.Text = dt_Return_ITEM.Rows[0]["PUBLISH_DATE"].ToString();//出版日期

        #endregion

        #region 頁籤=商品指定參照

        this.radl_DISTRIBUTE_MODE.SelectedValue = dt_Return_ITEM.Rows[0]["DISTRIBUTE_MODE"].ToString();//配量方式
        this.slp_QUANTITY.Text = dt_Return_ITEM.Rows[0]["QUANTITY"].ToString();//每店
        this.slp_ACCEPT_TOTAL.Text = dt_Return_ITEM.Rows[0]["ACCEPT_TOTAL"].ToString();//總進貨量
        this.txt_RESEMBLE_GOODS.Text = dt_Return_ITEM.Rows[0]["RESEMBLE_GOODS"].ToString();//類似商品
        this.txt_GOODS_MATTER.Text = dt_Return_ITEM.Rows[0]["GOODS_MATTER"].ToString();//商品說明
        this.txt_COMMEND_CAUSE.Text = dt_Return_ITEM.Rows[0]["COMMEND_CAUSE"].ToString();//推薦理由

        #endregion

        #region 頁籤=期別明細

        //抓取本頁初次登記的時間
        string SessionIDName = "ITM042_" + PageTimeStamp.Value;

        Session["SessionID"] = SessionIDName;
        Session[SessionIDName] = dt_Return_ITEM_PERIOD;

        this.gv_ITEM_PERIOD.DataSource = dt_Return_ITEM_PERIOD;
        this.gv_ITEM_PERIOD.PageSize = 20;
        this.gv_ITEM_PERIOD.PageIndex = 0;
        this.gv_ITEM_PERIOD.DataBind();

        #endregion

        #endregion
    }
示例#11
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                AuthorityControls(this);

                #region 設定TabIndex

                SetTabIndex();

                #endregion

                #region Attributes

                #region 新增模式

                if (this.hid_PageStatus.Value == "insert")
                {
                    //必須在 Page_PreRender 加入 SLP onblur 事件,如果在 Page_Load 加,事件會被覆蓋掉。
                    this.radl_PERIOD_PAY_TYPE.Attributes["onclick"] = "Chg_PERIOD_PAY_TYPE();";
                    this.slp_COST.TextBox_Code.Attributes["onblur"] += "Chg_PRICE_COST();";
                    this.slp_PRICE.TextBox_Code.Attributes["onblur"] += "Chg_PRICE_COST();";
                }

                #endregion

                #endregion

                #region 重新建立[群分類][大分類][中分類][小分類]的階層關係

                this.slp_PMA.RootNo = this.slp_ROOT_NO.Text;
                this.slp_PMA.Text = this.slp_PMA.Text;

                this.slp_CATEGORY.RootNo = this.slp_ROOT_NO.Text;
                this.slp_CATEGORY.PMA = this.slp_PMA.Text;
                this.slp_CATEGORY.Text = this.slp_CATEGORY.Text;

                this.slp_SORT_OUT.RootNo = this.slp_ROOT_NO.Text;
                this.slp_SORT_OUT.PMA = this.slp_PMA.Text;
                this.slp_SORT_OUT.Category = this.slp_CATEGORY.Text;
                this.slp_SORT_OUT.Text = this.slp_SORT_OUT.Text;

                #endregion

                #region Focus欄位

                BCO.ITMCommon ITMComm = new BCO.ITMCommon();
                string s_ScriptManager_Script = string.Empty;

                if (this.hid_PageStatus.Value == "insert")
                { s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(this.slp_ITEM.TextBox_Code.ClientID, false); }

                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", s_ScriptManager_Script, true);

                #endregion
            }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
示例#12
0
    /// <summary>
    /// 檢查條件
    /// </summary>
    /// <param name="s_Type"></param>
    /// <returns></returns>
    private ArrayList Check_Condition(string s_Type, DataTable dt_CHK)
    {
        #region 宣告

        BCO.ITMCommon ITMComm = new BCO.ITMCommon();
        BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region SLP轉型

        TextBox txt_MDC_START_DATE = (TextBox)this.slp_MDC_START_DATE.FindControl("TextBoxCode");//[DC開始日]
        TextBox txt_MDC_END_DATE = (TextBox)this.slp_MDC_END_DATE.FindControl("TextBoxCode");//[DC結束日]
        TextBox txt_PUBLISH_DATE = (TextBox)this.slp_PUBLISH_DATE.FindControl("TextBoxCode");//[出版日期]
        TextBox txt_PERIOD_END_DATE = (TextBox)this.slp_PERIOD_END_DATE.FindControl("TextBoxCode");//[期別結束日]

        DropDownList drop_PUBLISH_TYPE = (DropDownList)this.slp_PUBLISH_TYPE.FindControl("D1");//出刊種類
        DropDownList drop_UNIT = (DropDownList)this.slp_UNIT.FindControl("D1");//銷售單位
        DropDownList drop_TARGET_RULE = (DropDownList)this.slp_TARGET_RULE.FindControl("D1");//物流費規則
        DropDownList drop_TAX_TYPE = (DropDownList)this.slp_TAX_TYPE.FindControl("D1");//稅別

        #endregion

        #region 新增模式 & 編輯模式 BUTTON [儲存]鈕,編輯模式 BUTTON [產生異動序號]鈕

        if (s_Type == "BUTTON [儲存]鈕,新增狀態" ||
            s_Type == "BUTTON [儲存]鈕,編輯狀態" ||
            s_Type == "BUTTON [產生異動序號]鈕,編輯狀態_1")
        {
            #region 檢查欄位的Byte長度

            #region 頁籤=商品主檔

            if (ITMComm.Get_Byte_Length(this.slp_ITEM.Text) > 10)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品號]長度不可大於 10 Byte", "1", this.slp_ITEM.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_ITEM_NAME.Text) > 30)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品名]長度不可大於 30 Byte", "1", this.txt_ITEM_NAME.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_VICE_ITEM_NAME.Text) > 20)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[副主題]長度不可大於 20 Byte", "1", this.txt_VICE_ITEM_NAME.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_MANUFACTURE.Text) > 12)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[供應商]長度不可大於 12 Byte", "1", this.slp_MANUFACTURE.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_EDIT_NO.Text) > 11)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動序號]長度不可大於 11 Byte", "1", this.txt_EDIT_NO.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_EDIT_REASON.Text) > 50)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動原因]長度不可大於 50 Byte", "1", this.txt_EDIT_REASON.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_ROOT_NO.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[群分類]長度不可大於 2 Byte", "1", this.slp_ROOT_NO.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_PMA.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[大分類]長度不可大於 2 Byte", "1", this.slp_PMA.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_CATEGORY.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[中分類]長度不可大於 2 Byte", "1", this.slp_CATEGORY.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_SORT_OUT.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[小分類]長度不可大於 2 Byte", "1", this.slp_SORT_OUT.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_STATEMENTS.Text) > 30)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[敘述]長度不可大於 30 Byte", "1", this.txt_STATEMENTS.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_FIRST_PERIOD.Text) > 6)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[首期期別]長度不可大於 6 Byte", "1", this.txt_FIRST_PERIOD.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_OPEN_SIZE.Text) > 10)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[開本]長度不可大於 10 Byte", "1", this.txt_OPEN_SIZE.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_AUTHOR.Text) > 20)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[作者]長度不可大於 20 Byte", "1", this.txt_AUTHOR.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_CIP.Text) > 8)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[中央圖書分類碼(CIP)]長度不可大於 8 Byte", "1", this.txt_CIP.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_PUBLISH.Text) > 10)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[VCMS出版社]長度不可大於 10 Byte", "1", this.txt_PUBLISH.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_ITEM_PUBLISHER_NO.Text) > 10)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品出版商代號]長度不可大於 10 Byte", "1", this.txt_ITEM_PUBLISHER_NO.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_ITEM_PUBLISHER_NAME.Text) > 20)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品出版商名稱]長度不可大於 20 Byte", "1", this.txt_ITEM_PUBLISHER_NAME.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_PUBLISHER_TYPE.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出版社書系]長度不可大於 2 Byte", "1", this.txt_PUBLISHER_TYPE.ClientID); }

            #endregion

            #region 頁籤=首期期別

            if (ITMComm.Get_Byte_Length(this.txt_BARCODE.Text) > 15)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品條碼]長度不可大於 15 Byte", "1", this.txt_BARCODE.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_PERIOD_BARCODE.Text) > 13)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[二段條碼]長度不可大於 13 Byte", "1", this.txt_PERIOD_BARCODE.ClientID); }

            #endregion

            #region 頁籤=商品指定參照

            if (ITMComm.Get_Byte_Length(this.txt_RESEMBLE_GOODS.Text) > 100)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[類似商品]長度不可大於 100 Byte", "1", this.txt_RESEMBLE_GOODS.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_GOODS_MATTER.Text) > 100)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品說明]長度不可大於 100 Byte", "1", this.txt_GOODS_MATTER.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_COMMEND_CAUSE.Text) > 100)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[推薦理由]長度不可大於 100 Byte", "1", this.txt_COMMEND_CAUSE.ClientID); }

            #endregion

            #endregion

            #region 檢查必填欄位

            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM.Text, "text", "欄位[品號]為必填欄位", "1", this.slp_ITEM.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.txt_ITEM_NAME.Text, "text", "欄位[品名]為必填欄位", "1", this.txt_ITEM_NAME.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_MDC_START_DATE.Text, "text", "欄位[DC開始日]為必填欄位", "1", txt_MDC_START_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_MDC_END_DATE.Text, "text", "欄位[DC結束日]為必填欄位", "1", txt_MDC_END_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_MANUFACTURE.Text, "text", "欄位[供應商]為必填欄位", "1", this.slp_MANUFACTURE.TextBox_Code.ClientID, arl_Return);
            if (s_Type == "BUTTON [產生異動序號]鈕,編輯狀態_1")
            { arl_Return = ITMComm.Check_MustFillin_Column(this.txt_EDIT_REASON.Text, "text", "欄位[異動原因]為必填欄位", "1", this.txt_EDIT_REASON.ClientID, arl_Return); }
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ROOT_NO.Text, "text", "欄位[群分類]為必填欄位", "1", this.slp_ROOT_NO.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.radl_OUT_OF_PRINT.SelectedIndex.ToString(), "radio", "欄位[絕版]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PMA.Text, "text", "欄位[大分類]為必填欄位", "1", this.slp_PMA.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_CATEGORY.Text, "text", "欄位[中分類]為必填欄位", "1", this.slp_CATEGORY.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_SORT_OUT.Text, "text", "欄位[小分類]為必填欄位", "1", this.slp_SORT_OUT.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.radl_ATTRIBUTE.SelectedIndex.ToString(), "radio", "欄位[是否定期]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.txt_FIRST_PERIOD.Text, "text", "欄位[首期期別]為必填欄位", "1", this.txt_FIRST_PERIOD.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.radl_NEW_SW.SelectedIndex.ToString(), "radio", "欄位[新商品]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_STEP.Text, "text", "欄位[期別累加值]為必填欄位", "1", this.slp_PERIOD_STEP.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_INTERVAL.Text, "text", "欄位[出刊間隔]為必填欄位", "1", this.slp_INTERVAL.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(drop_PUBLISH_TYPE.SelectedIndex.ToString(), "drop", "欄位[出刊種類]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(drop_UNIT.SelectedIndex.ToString(), "drop", "欄位[銷售單位]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.txt_ITEM_PUBLISHER_NO.Text, "text", "欄位[商品出版商代號]為必填欄位", "1", this.txt_ITEM_PUBLISHER_NO.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.txt_ITEM_PUBLISHER_NAME.Text, "text", "欄位[商品出版商名稱]為必填欄位", "1", this.txt_ITEM_PUBLISHER_NAME.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.radl_DISTRIBUTE_MODE.SelectedIndex.ToString(), "radio", "欄位[配量方式]為必填欄位", "1", string.Empty, arl_Return);

            if (s_Type == "BUTTON [儲存]鈕,新增狀態")
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.txt_BARCODE.Text, "text", "欄位[商品條碼]為必填欄位", "1", this.txt_BARCODE.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PRICE.Text, "text", "欄位[零售價]為必填欄位", "1", this.slp_PRICE.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_COST.Text, "text", "欄位[成本價]為必填欄位", "1", this.slp_COST.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.radl_PERIOD_PAY_TYPE.SelectedIndex.ToString(), "radio", "欄位[物流費基準]為必填欄位", "1", string.Empty, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(drop_TARGET_RULE.SelectedIndex.ToString(), "drop", "欄位[物流費規則]為必填欄位", "1", string.Empty, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(drop_TAX_TYPE.SelectedIndex.ToString(), "drop", "欄位[稅別]為必填欄位", "1", string.Empty, arl_Return);
            }

            #endregion

            #region 檢查SLP日期格式

            arl_Return = ITMComm.Check_Format_Date(this.slp_MDC_START_DATE.Text, "欄位[DC開始日]日期格式錯誤", "1", txt_MDC_START_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Date(this.slp_MDC_END_DATE.Text, "欄位[DC開始日]日期格式錯誤", "1", txt_MDC_END_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Date(this.slp_PUBLISH_DATE.Text, "欄位[出版日期]日期格式錯誤", "1", txt_PUBLISH_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Date(this.slp_PERIOD_END_DATE.Text, "欄位[期別結束日]日期格式錯誤", "1", txt_PERIOD_END_DATE.ClientID, arl_Return);

            #endregion

            #region 檢查SLP數字格式

            arl_Return = ITMComm.Check_Format_Int(this.slp_PERIOD_STEP.Text, "欄位[期別累加值]數字格式錯誤", "32", "1", this.slp_PERIOD_STEP.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_INTERVAL.Text, "欄位[出刊間隔]數字格式錯誤", "32", "1", this.slp_INTERVAL.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_PAGE_NUM.Text, "欄位[頁數]數字格式錯誤", "32", "1", this.slp_PAGE_NUM.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_PRICE.Text, "欄位[零售價]數字格式錯誤", "32", "1", this.slp_PRICE.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_QUANTITY.Text, "欄位[每店]數字格式錯誤", "32", "1", this.slp_QUANTITY.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_ACCEPT_TOTAL.Text, "欄位[總進貨量]數字格式錯誤", "32", "1", this.slp_ACCEPT_TOTAL.TextBox_Code.ClientID, arl_Return);

            arl_Return = ITMComm.Check_Format_Double(this.slp_WIDTH.Text, "欄位[寬]數字格式錯誤", "寬", true, 3, 2, "1", this.slp_WIDTH.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_HIEGHT.Text, "欄位[高]數字格式錯誤", "高", true, 3, 2, "1", this.slp_HIEGHT.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_LENGTH.Text, "欄位[深]數字格式錯誤", "深", true, 3, 2, "1", this.slp_LENGTH.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_COST.Text, "欄位[成本價]數字格式錯誤", "成本價", true, 5, 2, "1", this.slp_COST.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_ACCEPT_RATE.Text, "欄位[進貨物流費(%)]數字格式錯誤", "進貨物流費(%)", true, 4, 3, "1", this.slp_ACCEPT_RATE.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_RETURN_RATE.Text, "欄位[退貨物流費(%)]數字格式錯誤", "退貨物流費(%)", true, 4, 3, "1", this.slp_RETURN_RATE.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_ACCEPT_AMT.Text, "欄位[進貨物流費(元)]數字格式錯誤", "進貨物流費(元)", true, 5, 2, "1", this.slp_ACCEPT_AMT.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_RETURN_AMT.Text, "欄位[退貨物流費(元)]數字格式錯誤", "退貨物流費(元)", true, 5, 2, "1", this.slp_RETURN_AMT.TextBox_Code.ClientID, arl_Return);

            #endregion

            #region 欄位[品號]不可顯示[資料重覆]

            if (Request[this.slp_ITEM.TextBox_Name.UniqueID] == "資料重覆")
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, " 該品號已存在,請重新輸入品號", "1", this.slp_ITEM.TextBox_Code.ClientID); }

            #endregion

            #region 欄位[品號]必需為六位數目字

            System.Text.RegularExpressions.Regex reg_SIX = new System.Text.RegularExpressions.Regex(@"^[0-9]{6}$");
            if (reg_SIX.IsMatch(this.slp_ITEM.Text) == false)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品號]必需為六位數目字", "1", this.slp_ITEM.TextBox_Code.ClientID); }

            #endregion

            #region 欄位[首期期別]必需為六位數目字

            if (reg_SIX.IsMatch(this.txt_FIRST_PERIOD.Text) == false)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[首期期別]必需為六位數目字", "1", this.txt_FIRST_PERIOD.ClientID); }

            #endregion

            #region 如果基本檢查有誤,則Return

            if (arl_Return[1].ToString() != string.Empty)
            { return arl_Return; }

            #endregion

            #region 自訂檢查

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位(DC開始日 & DC結束日)

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_MDC_START_DATE.Text,
                 this.slp_MDC_END_DATE.Text,
                 "date",
                 "欄位[DC結束日]一定要大於或等於欄位[DC開始日]",
                 "1",
                 txt_MDC_END_DATE.ClientID,
                 arl_Return);

            #endregion

            #region 檢查[群分類][大分類][中分類][小分類]的階層關係是否正確

            #region 設定變數

            string s_PATTERN_NO = string.Empty;
            string s_Result = string.Empty;

            #endregion

            #region 傳入參數

            s_PATTERN_NO = this.slp_ROOT_NO.Text + this.slp_PMA.Text + this.slp_CATEGORY.Text + this.slp_SORT_OUT.Text;

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter(s_PATTERN_NO, "string", false));//[PATTERN_NO]
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

            #endregion

            #region 連結資料庫

            s_Result = bco.CHK_ITM042_PATTERN_NO(ParameterList).Rows[0]["result"].ToString();

            #endregion

            #region 檢查回傳值

            if (s_Result == "NO")
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "[群分類][大分類][中分類][小分類]的階層關係不正確", "1", string.Empty); }

            #endregion

            #endregion

            #region 新增模式下,才需要的檢查

            if (s_Type == "BUTTON [儲存]鈕,新增狀態")
            {
                #region 欄位[期別結束日]必需大於或等於系統日

                if (this.slp_PERIOD_END_DATE.Text != string.Empty)
                {
                    DateTime d_PERIOD_END_DATE = DateTime.Parse(this.slp_PERIOD_END_DATE.Text);

                    if (d_PERIOD_END_DATE < DateTime.Now.Date)
                    { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[期別結束日]必需大於或等於系統日", "1", txt_PERIOD_END_DATE.ClientID); }
                }

                #endregion

                #region 欄位[零售價]必需大於欄位[成本價]

                if (double.Parse(this.slp_COST.Text) > int.Parse(this.slp_PRICE.Text))
                { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[零售價]必需大於欄位[成本價]", "1", this.slp_PRICE.TextBox_Code.ClientID); }

                #endregion

                #region 欄位[折扣率]計算是否正確

                //若欄位[零售價]=0,則欄位[折扣率]必須=0
                //折扣率=成本/零售價
                if ((double.Parse(this.slp_PRICE.Text) == 0 && this.txt_DISCOUNT_RATE.Text != "0") &&
                    (Convert.ToString(System.Math.Round(double.Parse(this.slp_COST.Text) / int.Parse(this.slp_PRICE.Text), 2, MidpointRounding.AwayFromZero)) != this.txt_DISCOUNT_RATE.Text))
                { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折扣率]計算錯誤", "1", this.txt_DISCOUNT_RATE.ClientID); }

                #endregion

                #region 判斷欄位[物流費基準]

                if (this.radl_PERIOD_PAY_TYPE.SelectedValue == "1")//元
                {
                    if (this.slp_ACCEPT_RATE.Text != string.Empty ||
                        this.slp_RETURN_RATE.Text != string.Empty)
                    { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]選擇[元]時,只能填寫進退貨物流費(元)", "1", string.Empty); }
                }
                else if (this.radl_PERIOD_PAY_TYPE.SelectedValue == "2")//率
                {
                    if (this.slp_ACCEPT_AMT.Text != string.Empty ||
                        this.slp_RETURN_AMT.Text != string.Empty)
                    { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]選擇[率]時,只能填寫進退貨物流費(%)", "1", string.Empty); }
                }

                #endregion
            }

            #endregion

            #endregion
        }

        #endregion

        #region 編輯模式 BUTTON [產生異動序號]鈕

        else if (s_Type == "BUTTON [產生異動序號]鈕,編輯狀態_2")
        {
            #region 規則

            /* 規則
             * 檢查所有欄位是否有更新,
             * 如果可修改欄位(不含異動原因欄位)都沒有修改,
             * 則顯示[沒有更新任何資料]
             */

            #endregion

            #region 宣告變數

            bool b_Is_All_Same = true;
            ArrayList arl_Chk_Column = new ArrayList();

            #endregion

            #region 設定要檢查的欄位

            arl_Chk_Column.Clear();
            arl_Chk_Column.Add("ITEM_NAME,VARCHAR2");//品名
            arl_Chk_Column.Add("VICE_ITEM_NAME,VARCHAR2");//副主題
            arl_Chk_Column.Add("MDC_START_DATE,DATE");//DC開始日
            arl_Chk_Column.Add("MDC_END_DATE,DATE");//DC結束日
            arl_Chk_Column.Add("MANUFACTURE,VARCHAR2");//供應商
            arl_Chk_Column.Add("ROOT_NO,VARCHAR2");//群分類
            arl_Chk_Column.Add("OUT_OF_PRINT,NUMBER");//絕版
            arl_Chk_Column.Add("PMA,VARCHAR2");//大分類
            arl_Chk_Column.Add("CATEGORY,VARCHAR2");//中分類
            arl_Chk_Column.Add("SORT_OUT,VARCHAR2");//小分類
            arl_Chk_Column.Add("STATEMENTS,VARCHAR2");//敘述
            arl_Chk_Column.Add("ATTRIBUTE,NUMBER");//是否定期
            arl_Chk_Column.Add("FIRST_PERIOD,VARCHAR2");//首期期別
            arl_Chk_Column.Add("NEW_SW,VARCHAR2");//新商品
            arl_Chk_Column.Add("PERIOD_STEP,NUMBER");//期別累加值
            arl_Chk_Column.Add("INTERVAL,NUMBER");//出刊間隔
            arl_Chk_Column.Add("PUBLISH_TYPE,VARCHAR2");//出刊種類
            arl_Chk_Column.Add("UNIT,NUMBER");//銷售單位
            arl_Chk_Column.Add("OPEN_SIZE,VARCHAR2");//開本
            arl_Chk_Column.Add("PAGE_NUM,NUMBER");//頁數
            arl_Chk_Column.Add("WIDTH,NUMBER");//寬
            arl_Chk_Column.Add("HIEGHT,NUMBER");//高
            arl_Chk_Column.Add("LENGTH,NUMBER");//深
            arl_Chk_Column.Add("AUTHOR,VARCHAR2");//作者
            arl_Chk_Column.Add("CIP,VARCHAR2");//中央圖書分類碼(CIP)
            arl_Chk_Column.Add("PUBLISH,VARCHAR2");//VCMS出版社
            arl_Chk_Column.Add("ITEM_PUBLISHER_NO,VARCHAR2");//商品出版商代號
            arl_Chk_Column.Add("ITEM_PUBLISHER_NAME,VARCHAR2");//商品出版商名稱
            arl_Chk_Column.Add("PUBLISHER_TYPE,VARCHAR2");//出版社書系
            arl_Chk_Column.Add("PUBLISH_DATE,DATE");//出版日期
            arl_Chk_Column.Add("DISTRIBUTE_MODE,VARCHAR2");//配量方式
            arl_Chk_Column.Add("QUANTITY,NUMBER");//每店
            arl_Chk_Column.Add("ACCEPT_TOTAL,NUMBER");//總進貨量
            arl_Chk_Column.Add("RESEMBLE_GOODS,VARCHAR2");//類似商品
            arl_Chk_Column.Add("GOODS_MATTER,VARCHAR2");//商品說明
            arl_Chk_Column.Add("COMMEND_CAUSE,VARCHAR2");//推薦理由

            #endregion

            #region 檢查資料是否有異動

            for (int i = 0; i < arl_Chk_Column.Count; i++)
            {
                string[] s_Chk = arl_Chk_Column[i].ToString().Split(',');

                if (s_Chk[1] == "VARCHAR2")
                {
                    if (dt_CHK.Rows[0]["OLD_" + s_Chk[0]].ToString() !=
                        dt_CHK.Rows[0]["NEW_" + s_Chk[0]].ToString())
                    { b_Is_All_Same = false; }
                }
                else if (s_Chk[1] == "NUMBER")
                {
                    if (ITMComm.GetValueSetParameter(dt_CHK.Rows[0]["OLD_" + s_Chk[0]].ToString(), "double", false).ToString() !=
                        ITMComm.GetValueSetParameter(dt_CHK.Rows[0]["NEW_" + s_Chk[0]].ToString(), "double", false).ToString())
                    { b_Is_All_Same = false; }
                }
                else if (s_Chk[1] == "DATE")
                {
                    if (ITMComm.GetValueSetParameter(dt_CHK.Rows[0]["OLD_" + s_Chk[0]].ToString(), "date", false).ToString() !=
                        ITMComm.GetValueSetParameter(dt_CHK.Rows[0]["NEW_" + s_Chk[0]].ToString(), "date", false).ToString())
                    { b_Is_All_Same = false; }
                }
            }

            #endregion

            #region 如果可修改欄位(不含異動原因欄位)都沒有修改,則顯示[沒有更新任何資料]

            if (b_Is_All_Same == true)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "沒有更新任何資料!", "1", string.Empty); }

            #endregion
        }

        #endregion

        #region 檢視模式 BUTTON [確定複製]鈕

        else if (s_Type == "BUTTON [確定複製]鈕,檢視狀態")
        {
            #region 檢查必填欄位

            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_CopyInsert_ITEM.Text, "text", "欄位[品號]為必填欄位", "1", this.slp_CopyInsert_ITEM.TextBox_Code.ClientID, arl_Return);

            #endregion

            #region 欄位[品號]不可顯示[資料重覆]

            if (Request[this.slp_CopyInsert_ITEM.TextBox_Name.UniqueID] == "資料重覆")
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, " 該品號已存在,請重新輸入品號", "1", this.slp_CopyInsert_ITEM.TextBox_Code.ClientID); }

            #endregion
        }

        #endregion

        return arl_Return;
    }
示例#13
0
    /// <summary>
    /// Panel 複製新增 BUTTON [確定複製]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_CopyInsert_Insert_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢視模式

            if (this.hid_PageStatus.Value == "view")
            {
                #region 設定變數

                BCO.ITMCommon ITMComm = new BCO.ITMCommon();
                BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
                string s_ITEM = string.Empty;
                string s_ScriptManager_MSG = string.Empty;

                #endregion

                #region 檢查條件

                ArrayList arl_Check_Condition = Check_Condition("BUTTON [確定複製]鈕,檢視狀態", null);

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel_CopyInsert.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 傳入參數

                ParameterList.Clear();
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_ITEM.Text, "string", false));//[舊品號](被複製的品號)
                ParameterList.Add(ITMComm.GetValueSetParameter(this.slp_CopyInsert_ITEM.Text, "string", false));//[新品號](要新增的品號)
                ParameterList.Add(ITMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));//[建立日期]
                ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[建立人員]

                #endregion

                #region 連結資料庫

                s_ITEM = bco.ADD_ITM042_ITEM_COPYINSERT(null, ParameterList);

                #endregion

                #region 檢查回傳值

                if (s_ITEM == "99999999999")//如果查無舊品號(被複製的品號)的資料,則回傳商品代號99999999999(11個9)
                { throw new Exception("查無品號:" + this.slp_ITEM.Text + "的相關資料"); }
                else
                { s_ScriptManager_MSG = "alert('複製新增完成');location.replace('ITM042.aspx?Code=ITM04&ITM042_Mode=view&ITM042_ITEM=" + s_ITEM + "');"; }

                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", s_ScriptManager_MSG, true);

                #endregion
            }

            #endregion

            #region 其他模式

            else
            { throw new Exception("Panel 複製新增 BUTTON [確定複製]鈕,必須在[檢視模式]下才可以使用,請聯絡系統管理員。"); }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
            this.ErrorMsgLabel_CopyInsert.Text = ex.Message;
        }
    }
示例#14
0
    /// <summary>
    /// 檢查文字檔條件
    /// </summary>
    /// <param name="dr">要檢查的資料</param>
    /// <param name="dt_Temp">寫入TempTable的資料</param>
    /// <param name="dt_PUBLISH_TYPE">出刊種類 CODE</param>
    /// <param name="dt_UNIT">銷售單位 CODE</param>
    /// <param name="dt_PRINT_CNTY">印製國家 CODE</param>
    /// <param name="dt_LANGUAGE">語文 CODE</param>
    /// <returns></returns>
    private ArrayList Check_Condition_DataLine(DataRow dr,
                                               DataTable dt_Temp,
                                               DataTable dt_PUBLISH_TYPE,//出刊種類
                                               DataTable dt_UNIT,//銷售單位
                                               DataTable dt_PRINT_CNTY,//印製國家
                                               DataTable dt_LANGUAGE,//語文
                                               DataTable dt_Excel)//匯入的Excel檔
    {
        #region 宣告

        ITMCommon ITMComm = new ITMCommon();

        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region 檢查各個欄位型別,長度,是否必填

        #region Column[ID] ID

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ID"].ToString(), "text", "欄位[ID]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["ID"].ToString(), "欄位[ID]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ID"].ToString()) > 38)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[ID]長度不可大於 38 Byte", "1", string.Empty); }

        #endregion

        #region Column[ITEM] 品號

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ITEM"].ToString(), "text", "欄位[品號]為必填欄位", "1", string.Empty, arl_Return);
        System.Text.RegularExpressions.Regex reg_SIX = new System.Text.RegularExpressions.Regex(@"^[0-9]{6}$");
        if (reg_SIX.IsMatch(dr["ITEM"].ToString()) == false)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品號]必需為六位數目字", "1", string.Empty); }

        #endregion

        #region Column[ITEM_NAME] 品名

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ITEM_NAME"].ToString(), "text", "欄位[品名]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ITEM_NAME"].ToString()) > 30)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品名]長度不可大於 30 Byte", "1", string.Empty); }

        #endregion

        #region Column[VICE_ITEM_NAME] 副主題

        if (ITMComm.Get_Byte_Length(dr["VICE_ITEM_NAME"].ToString()) > 20)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[副主題]長度不可大於 20 Byte", "1", string.Empty); }

        #endregion

        #region Column[MDC_START_DATE] DC開始日

        arl_Return = ITMComm.Check_MustFillin_Column(dr["MDC_START_DATE"].ToString(), "text", "欄位[DC開始日]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(dr["MDC_START_DATE"].ToString(), "欄位[DC開始日]日期格式錯誤(YYYYMMDD)", "yyyyMMdd", "1", string.Empty, arl_Return);

        #endregion

        #region Column[MDC_END_DATE] DC結束日

        arl_Return = ITMComm.Check_MustFillin_Column(dr["MDC_END_DATE"].ToString(), "text", "欄位[DC結束日]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(dr["MDC_END_DATE"].ToString(), "欄位[DC結束日]日期格式錯誤(YYYYMMDD)", "yyyyMMdd", "1", string.Empty, arl_Return);

        #endregion

        #region Column[MANUFACTURE] 供應商

        arl_Return = ITMComm.Check_MustFillin_Column(dr["MANUFACTURE"].ToString(), "text", "欄位[供應商]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["MANUFACTURE"].ToString()) > 12)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[供應商]長度不可大於 12 Byte", "1", string.Empty); }

        #endregion

        #region Column[EDIT_NO] 異動序號

        if (dr["EDIT_NO"].ToString() != "0")
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動序號]固定為0", "1", string.Empty); }

        #endregion

        #region Column[EDIT_REASON] 異動原因

        if (dr["EDIT_REASON"].ToString() != string.Empty)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動原因]固定為空值", "1", string.Empty); }

        #endregion

        #region Column[ROOT_NO] 群分類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ROOT_NO"].ToString(), "text", "欄位[群分類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ROOT_NO"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[群分類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[OUT_OF_PRINT] 絕版

        arl_Return = ITMComm.Check_MustFillin_Column(dr["OUT_OF_PRINT"].ToString(), "text", "欄位[絕版]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["OUT_OF_PRINT"].ToString(), "欄位[絕版]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["OUT_OF_PRINT"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[絕版]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[PMA] 大分類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PMA"].ToString(), "text", "欄位[大分類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PMA"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[大分類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[CATEGORY] 中分類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["CATEGORY"].ToString(), "text", "欄位[中分類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["CATEGORY"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[中分類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[SORT_OUT] 小分類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["SORT_OUT"].ToString(), "text", "欄位[小分類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["SORT_OUT"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[小分類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[STATEMENTS] 敘述

        if (ITMComm.Get_Byte_Length(dr["STATEMENTS"].ToString()) > 30)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[敘述]長度不可大於 30 Byte", "1", string.Empty); }

        #endregion

        #region Column[ATTRIBUTE] 是否定期

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ATTRIBUTE"].ToString(), "text", "欄位[是否定期]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["ATTRIBUTE"].ToString(), "欄位[是否定期]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ATTRIBUTE"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[是否定期]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[FIRST_PERIOD] 首期期別

        arl_Return = ITMComm.Check_MustFillin_Column(dr["FIRST_PERIOD"].ToString(), "text", "欄位[首期期別]為必填欄位", "1", string.Empty, arl_Return);
        if (reg_SIX.IsMatch(dr["FIRST_PERIOD"].ToString()) == false)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[首期期別]必需為六位數目字", "1", string.Empty); }

        #endregion

        #region Column[NEW_SW] 新商品

        arl_Return = ITMComm.Check_MustFillin_Column(dr["NEW_SW"].ToString(), "text", "欄位[新商品]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["NEW_SW"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[新商品]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[PERIOD_STEP] 期別累加值

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PERIOD_STEP"].ToString(), "text", "欄位[期別累加值]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["PERIOD_STEP"].ToString(), "欄位[期別累加值]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PERIOD_STEP"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[期別累加值]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[INTERVAL] 出刊間隔

        arl_Return = ITMComm.Check_MustFillin_Column(dr["INTERVAL"].ToString(), "text", "欄位[出刊間隔]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["INTERVAL"].ToString(), "欄位[出刊間隔]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["INTERVAL"].ToString()) > 6)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出刊間隔]長度不可大於 6 Byte", "1", string.Empty); }

        #endregion

        #region Column[PUBLISH_TYPE] 出刊種類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PUBLISH_TYPE"].ToString(), "text", "欄位[出刊種類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PUBLISH_TYPE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出刊種類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[UNIT] 銷售單位

        arl_Return = ITMComm.Check_MustFillin_Column(dr["UNIT"].ToString(), "text", "欄位[銷售單位]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["UNIT"].ToString(), "欄位[銷售單位]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["UNIT"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[銷售單位]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[OPEN_SIZE] 開本

        if (ITMComm.Get_Byte_Length(dr["OPEN_SIZE"].ToString()) > 10)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[開本]長度不可大於 10 Byte", "1", string.Empty); }

        #endregion

        #region Column[PAGE_NUM] 頁數

        arl_Return = ITMComm.Check_Format_Int(dr["PAGE_NUM"].ToString(), "欄位[頁數]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PAGE_NUM"].ToString()) > 3)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[頁數]長度不可大於 3 Byte", "1", string.Empty); }

        #endregion

        #region Column[WIDTH] 寬

        arl_Return = ITMComm.Check_Format_Double(dr["WIDTH"].ToString(), "欄位[寬]數字格式錯誤", "WIDTH", true, 3, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[HIEGHT] 高

        arl_Return = ITMComm.Check_Format_Double(dr["HIEGHT"].ToString(), "欄位[高]數字格式錯誤", "WIDTH", true, 3, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[LENGTH] 深

        arl_Return = ITMComm.Check_Format_Double(dr["LENGTH"].ToString(), "欄位[深]數字格式錯誤", "WIDTH", true, 3, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[AUTHOR] 作者

        if (ITMComm.Get_Byte_Length(dr["AUTHOR"].ToString()) > 20)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[作者]長度不可大於 20 Byte", "1", string.Empty); }

        #endregion

        #region Column[CIP] 中央圖書分類碼

        if (ITMComm.Get_Byte_Length(dr["CIP"].ToString()) > 8)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[中央圖書分類碼]長度不可大於 8 Byte", "1", string.Empty); }

        #endregion

        #region Column[PUBLISH] VCMS出版社

        if (ITMComm.Get_Byte_Length(dr["PUBLISH"].ToString()) > 10)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[VCMS出版社]長度不可大於 10 Byte", "1", string.Empty); }

        #endregion

        #region Column[ITEM_PUBLISHER_NO] 商品出版商代號

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ITEM_PUBLISHER_NO"].ToString(), "text", "欄位[商品出版商代號]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ITEM_PUBLISHER_NO"].ToString()) > 10)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品出版商代號]長度不可大於 10 Byte", "1", string.Empty); }

        #endregion

        #region Column[ITEM_PUBLISHER_NAME] 商品出版商名稱

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ITEM_PUBLISHER_NAME"].ToString(), "text", "欄位[商品出版商名稱]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ITEM_PUBLISHER_NAME"].ToString()) > 20)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品出版商名稱]長度不可大於 20 Byte", "1", string.Empty); }

        #endregion

        #region Column[PUBLISHER_TYPE] 出版社書系

        if (ITMComm.Get_Byte_Length(dr["PUBLISHER_TYPE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出版社書系]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[PUBLISH_DATE] 出版日期

        arl_Return = ITMComm.Check_Format_Date(dr["PUBLISH_DATE"].ToString(), "欄位[出版日期]日期格式錯誤", "yyyyMMdd", "1", string.Empty, arl_Return);

        #endregion

        #region Column[PERIOD_END_DATE] 期別結束日

        arl_Return = ITMComm.Check_Format_Date(dr["PERIOD_END_DATE"].ToString(), "欄位[期別結束日]日期格式錯誤", "yyyyMMdd", "1", string.Empty, arl_Return);

        #endregion

        #region Column[BARCODE] 商品條碼
        arl_Return = ITMComm.Check_MustFillin_Column(dr["BARCODE"].ToString(), "text", "欄位[商品條碼]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["BARCODE"].ToString()) > 15)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品條碼]長度不可大於 15 Byte", "1", string.Empty); }
        if (dr["BARCODE"].ToString().Trim() != "")
        {
            DataRow[] FindBarcode = dt_Excel.Select("BARCODE='" + dr["BARCODE"].ToString().Trim() + "'");
            if (FindBarcode.Length > 1)
            {
                arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品條碼]與匯入檔案內的其他商品條碼重覆", "1", string.Empty);
            }
            //if (CheckDup_BARCODE(dr["BARCODE"].ToString(), "") == true)
            //{
            //    arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品條碼]和已存在的商品條碼重覆", "1", string.Empty);
            //}
        }
        #endregion

        #region Column[PERIOD_BARCODE] 二段條碼

        if (ITMComm.Get_Byte_Length(dr["PERIOD_BARCODE"].ToString()) > 13)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[二段條碼]長度不可大於 13 Byte", "1", string.Empty); }

        #endregion

        #region Column[PRICE] 零售價

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PRICE"].ToString(), "text", "欄位[零售價]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["PRICE"].ToString(), "欄位[零售價]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PRICE"].ToString()) > 5)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[零售價]長度不可大於 5 Byte", "1", string.Empty); }

        #endregion

        #region Column[COST] 成本價

        arl_Return = ITMComm.Check_MustFillin_Column(dr["COST"].ToString(), "text", "欄位[成本價]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Double(dr["COST"].ToString(), "欄位[成本價]數字格式錯誤", "COST", true, 5, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[DISCOUNT_RATE] 折扣率

        if (dr["DISCOUNT_RATE"].ToString() != string.Empty)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折扣率]固定為空值", "1", string.Empty); }

        #endregion

        #region Column[PERIOD_PAY_TYPE] 物流費基準

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PERIOD_PAY_TYPE"].ToString(), "text", "欄位[物流費基準]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["PERIOD_PAY_TYPE"].ToString(), "欄位[物流費基準]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PERIOD_PAY_TYPE"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[TARGET_RULE] 物流費規則

        arl_Return = ITMComm.Check_MustFillin_Column(dr["TARGET_RULE"].ToString(), "text", "欄位[物流費規則]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["TARGET_RULE"].ToString(), "欄位[物流費規則]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["TARGET_RULE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費規則]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[TAX_TYPE] 稅別

        arl_Return = ITMComm.Check_MustFillin_Column(dr["TAX_TYPE"].ToString(), "text", "欄位[稅別]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["TAX_TYPE"].ToString(), "欄位[稅別]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["TAX_TYPE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[稅別]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[DIS_ACCEPT_RATE] 進貨物流費(%)

        arl_Return = ITMComm.Check_Format_Double(dr["DIS_ACCEPT_RATE"].ToString(), "欄位[進貨物流費(%)]數字格式錯誤", "DIS_ACCEPT_RATE", true, 4, 3, "1", string.Empty, arl_Return);

        #endregion

        #region Column[DIS_RETURN_RATE] 退貨物流費(%)

        arl_Return = ITMComm.Check_Format_Double(dr["DIS_RETURN_RATE"].ToString(), "欄位[退貨物流費(%)]數字格式錯誤", "DIS_RETURN_RATE", true, 4, 3, "1", string.Empty, arl_Return);

        #endregion

        #region Column[DIS_ACCEPT_DOLLAR] 進貨物流費(元)

        arl_Return = ITMComm.Check_Format_Double(dr["DIS_ACCEPT_DOLLAR"].ToString(), "欄位[進貨物流費(元)]數字格式錯誤", "DIS_ACCEPT_DOLLAR", true, 5, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[DIS_RETURN_DOLLAR] 退貨物流費(元)

        arl_Return = ITMComm.Check_Format_Double(dr["DIS_RETURN_DOLLAR"].ToString(), "欄位[退貨物流費(元)]數字格式錯誤", "DIS_RETURN_DOLLAR", true, 5, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[PRINT_CNTY] 印製國家

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PRINT_CNTY"].ToString(), "text", "欄位[印製國家]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PRINT_CNTY"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[印製國家]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[LANGUAGE] 語文

        arl_Return = ITMComm.Check_MustFillin_Column(dr["LANGUAGE"].ToString(), "text", "欄位[語文]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["LANGUAGE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[語文]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[DISTRIBUTE_MODE] 配量方式

        arl_Return = ITMComm.Check_MustFillin_Column(dr["DISTRIBUTE_MODE"].ToString(), "text", "欄位[配量方式]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["DISTRIBUTE_MODE"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[配量方式]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[QUANTITY] 每店

        arl_Return = ITMComm.Check_Format_Int(dr["QUANTITY"].ToString(), "欄位[每店]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["QUANTITY"].ToString()) > 3)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[每店]長度不可大於 3 Byte", "1", string.Empty); }

        #endregion

        #region Column[ACCEPT_TOTAL] 總進貨量

        arl_Return = ITMComm.Check_Format_Int(dr["ACCEPT_TOTAL"].ToString(), "欄位[總進貨量]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ACCEPT_TOTAL"].ToString()) > 8)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[總進貨量]長度不可大於 8 Byte", "1", string.Empty); }

        #endregion

        #region Column[RESEMBLE_GOODS] 類似商品

        if (ITMComm.Get_Byte_Length(dr["RESEMBLE_GOODS"].ToString()) > 100)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[類似商品]長度不可大於 100 Byte", "1", string.Empty); }

        #endregion

        #region Column[GOODS_MATTER] 商品說明

        if (ITMComm.Get_Byte_Length(dr["GOODS_MATTER"].ToString()) > 100)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品說明]長度不可大於 100 Byte", "1", string.Empty); }

        #endregion

        #region Column[COMMEND_CAUSE] 推薦理由

        if (ITMComm.Get_Byte_Length(dr["COMMEND_CAUSE"].ToString()) > 100)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[推薦理由]長度不可大於 100 Byte", "1", string.Empty); }

        #endregion

        #endregion

        #region 如果基本檢查有誤,則Return

        if (arl_Return[1].ToString() != string.Empty)
        { return arl_Return; }

        #endregion

        #region 自訂檢查

        #region 檢查代號是否有正確對應

        #region 檢查[供應商]代號

        ParameterList.Clear();
        ParameterList.Add(ITMComm.GetValueSetParameter(dr["MANUFACTURE"].ToString(), "string", false));
        ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

        if (bco.QUERY_VENDOR(ParameterList).Rows[0][0].ToString() == "0")
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[供應商]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[出刊種類]代號

        if (dt_PUBLISH_TYPE.Select("CODE = '" + dr["PUBLISH_TYPE"].ToString() + "'").Length == 0)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出刊種類]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[銷售單位]代號

        if (dt_UNIT.Select("CODE = '" + dr["UNIT"].ToString() + "'").Length == 0)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[銷售單位]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[印製國家]代號

        if (dt_PRINT_CNTY.Select("CODE = '" + dr["PRINT_CNTY"].ToString() + "'").Length == 0)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[印製國家]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[語文]代號

        if (dt_LANGUAGE.Select("CODE = '" + dr["LANGUAGE"].ToString() + "'").Length == 0)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[語文]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[配量方式]代號

        if (dr["DISTRIBUTE_MODE"].ToString() != "1" &&
            dr["DISTRIBUTE_MODE"].ToString() != "2" &&
            dr["DISTRIBUTE_MODE"].ToString() != "3" &&
            dr["DISTRIBUTE_MODE"].ToString() != "4" &&
            dr["DISTRIBUTE_MODE"].ToString() != "5")
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[配量方式]的代號不正確", "1", string.Empty); }

        #endregion

        #endregion

        #region 檢查Between欄位結束欄位一定要大於或等於開始欄位(DC開始日 & DC結束日)

        arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
            (dr["MDC_START_DATE"].ToString(),
             dr["MDC_END_DATE"].ToString(),
             "date",
             "欄位[DC結束日]一定要大於或等於欄位[DC開始日]",
             "1",
             string.Empty,
             arl_Return);

        #endregion

        #region 檢查[群分類][大分類][中分類][小分類]的階層關係是否正確

        #region 設定變數

        string s_PATTERN_NO = string.Empty;
        string s_Result = string.Empty;

        #endregion

        #region 傳入參數

        s_PATTERN_NO = dr["ROOT_NO"].ToString() + dr["PMA"].ToString() + dr["CATEGORY"].ToString() + dr["SORT_OUT"].ToString();

        ParameterList.Clear();
        ParameterList.Add(ITMComm.GetValueSetParameter(s_PATTERN_NO, "string", false));//[PATTERN_NO]
        ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

        #endregion

        #region 連結資料庫

        s_Result = bco.CHK_ITM_PATTERN_NO(ParameterList).Rows[0]["result"].ToString();

        #endregion

        #region 檢查回傳值

        if (s_Result == "NO")
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[群分類][大分類][中分類][小分類]的階層關係不正確", "1", string.Empty); }

        #endregion

        #endregion

        #region 欄位[期別結束日]必需大於或等於系統日

        if (dr["PERIOD_END_DATE"].ToString() != string.Empty)
        {
            DateTime d_PERIOD_END_DATE = DateTime.ParseExact(dr["PERIOD_END_DATE"].ToString(), "yyyyMMdd", null);

            if (d_PERIOD_END_DATE < DateTime.Now.Date)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[期別結束日]必需大於或等於系統日", "1", string.Empty); }
        }

        #endregion

        #region 欄位[零售價]必需大於欄位[成本價]

        if (double.Parse(dr["COST"].ToString()) > int.Parse(dr["PRICE"].ToString()))
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[零售價]必需大於欄位[成本價]", "1", string.Empty); }

        #endregion

        #region 欄位[折扣率]計算是否正確
        //整批匯入直接幫使用者算,不必檢查
        #endregion

        #region 判斷欄位[物流費基準]

        if (dr["PERIOD_PAY_TYPE"].ToString() == "1")//元
        {
            if (dr["DIS_ACCEPT_RATE"].ToString() != string.Empty ||
                dr["DIS_RETURN_RATE"].ToString() != string.Empty)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]=1時,[進貨物流費(%)][退貨物流費(%)]必須為空值", "1", string.Empty); }
        }
        else if (dr["PERIOD_PAY_TYPE"].ToString() == "2")//率
        {
            if (dr["DIS_ACCEPT_DOLLAR"].ToString() != string.Empty ||
                dr["DIS_RETURN_DOLLAR"].ToString() != string.Empty)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]=2時,[進貨物流費(元)][退貨物流費(元)]必須為空值", "1", string.Empty); }
        }

        #endregion

        #endregion

        return arl_Return;
    }
示例#15
0
    /// <summary>
    /// BUTTON [載入檔案]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_LoadFile_Click(object sender, EventArgs e)
    {
        try
        {
            #region 將Client端的檔案上傳至AP端

            #region 宣告變數

            string s_UploadPath = string.Empty;
            ArrayList arl_Return = new ArrayList();

            #endregion

            #region 將Client端的檔案上傳至AP端

            s_UploadPath = Server.MapPath("..\\") + System.Configuration.ConfigurationManager.AppSettings["UploadPath"] + "ITM\\";

            ITM07_BCO bco = new ITM07_BCO(ConntionDB);
            arl_Return = bco.FileUpload(s_UploadPath, this.fileupload_Path, Session["UID"].ToString());

            #endregion

            #region 檢查回傳結果

            if (arl_Return[0].ToString() == "FALSE")
            {
                #region 清空上傳匯入結果

                this.UploadStatusPanel1.UploadSum = 0;//上傳結果總筆數
                this.UploadStatusPanel1.UploadOK = 0;//上傳結果正常筆數
                this.UploadStatusPanel1.UploadNG = 0;//上傳結果錯誤筆數
                this.UploadStatusPanel1.ImportSum = 0;//匯入結果總筆數
                this.UploadStatusPanel1.ImportOK = 0;//匯入結果正常筆數
                this.UploadStatusPanel1.ImportNG = 0;//匯入結果錯誤筆數

                #endregion

                #region 設定控制項

                this.but_Import.Enabled = false;//確定匯入
                this.but_Error.Enabled = false;//檢視異常

                #endregion

                this.ErrorMsgLabel.Text = arl_Return[1].ToString();
                return;
            }

            #endregion

            #endregion

            #region 依據AP端檔案資料匯入TmpTable

            #region 取得 TempTable VDS_ITM_CHAN_TMP 的 SCHEMA

            ITMCommon ITMComm = new ITMCommon();
            DataTable dt_Temp = new DataTable();

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UID
            dt_Temp = bco.GET_VDS_ITM_CHAN_TMP_SCHEMA(ParameterList);

            #endregion

            #region 將資料寫入 TempTable

            DateTime d_Now = DateTime.Now;

            #region 讀取 Excel 資料

            OleDbConnection oleConnection = null;
            DataSet ds_Excel = new DataSet();

            try
            {
                //HDR=YES是表示Excel中的第一列為欄名。
                //IMEX=1是表示儲存格內容若是文字和數字混合的內容, 要當做文字處理。
                String connString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source =" + arl_Return[1].ToString() + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1';";
                oleConnection = new OleDbConnection(connString);
                oleConnection.Open();
                OleDbCommand oleCommand = new OleDbCommand("SELECT * FROM [Sheet1$]", oleConnection);
                OleDbDataAdapter oleAdapter = new OleDbDataAdapter(oleCommand);
                oleAdapter.Fill(ds_Excel);

                #region 請注意如果EXCEL檔欄位有值,但到DB卻沒有資料
                //請修改,機碼 HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\Engines\Excel\TypeGuessRows 值
                //預設是 8, 表示會先讀取前 8 列來決定每一個欄位的型態, 所以如果前 8 列的資料都是數字, 到了第 9 列以後出現的文字資料都會變成 null
                //如果要解決這個問題, 只要把 TypeGuessRows 機碼值改成 0
                #endregion
            }
            catch (Exception ex)
            { throw new Exception("讀取 Excel 資料失敗:" + ex.Message); }
            finally
            {
                if (oleConnection != null)
                {
                    oleConnection.Close();
                    oleConnection.Dispose();
                }
            }

            #endregion

            foreach (DataRow dr in ds_Excel.Tables[0].Rows)
            {
                #region 檢查條件

                ArrayList arl_ConditionReturn = Check_Condition_DataLine(dr);

                #endregion

                #region 檢查正確

                if (arl_ConditionReturn[1].ToString() == string.Empty)
                {
                    DataRow dr_Temp = dt_Temp.NewRow();

                    dr_Temp["ID"] = ITMComm.GetValueSetParameter(dr["序號"].ToString(), "int", false);//ID
                    dr_Temp["STATUS"] = ITMComm.GetValueSetParameter("1", "int", false);//處理狀態(1:正常資料;2:錯誤資料)
                    dr_Temp["DATASOURCE"] = ITMComm.GetValueSetParameter(arl_Return[3].ToString(), "string", false);//匯入檔案
                    dr_Temp["DATATYPE"] = ITMComm.GetValueSetParameter("1", "int", false);//資料類別(1:FILE TO TMP;2:TMP TO DB)
                    dr_Temp["MEMO"] = ITMComm.GetValueSetParameter(string.Empty, "string", false);//說明
                    dr_Temp["CHAN_NO"] = ITMComm.GetValueSetParameter(dr["通路代號"].ToString(), "string", false);//通路代號
                    dr_Temp["ITEM_MAP"] = ITMComm.GetValueSetParameter(dr["對照號"].ToString(), "string", false);//對照號
                    dr_Temp["ITEM"] = ITMComm.GetValueSetParameter(dr["品號"].ToString(), "string", false);//品號
                    dr_Temp["PERIOD"] = ITMComm.GetValueSetParameter(dr["期別"].ToString(), "string", false);//期別
                    dr_Temp["CREATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//建立人員
                    dr_Temp["CREATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);//建立日期
                    dr_Temp["UPDATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//異動人員
                    dr_Temp["UPDATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);//異動日期

                    dt_Temp.Rows.Add(dr_Temp);
                }

                #endregion

                #region 檢查不正確

                else
                {
                    DataRow dr_Temp = dt_Temp.NewRow();

                    string s_ErrorMsg = string.Empty;
                    s_ErrorMsg = arl_ConditionReturn[1].ToString().Replace("<br/>", ",");
                    s_ErrorMsg = ITMComm.Get_Byte_Length(s_ErrorMsg) > 500 ? s_ErrorMsg.Substring(0, 250) : s_ErrorMsg;//MEMO欄位=VARCHAR2(500)

                    dr_Temp["ID"] = ITMComm.GetValueSetParameter((arl_ConditionReturn[1].ToString().IndexOf("欄位[ID]數字格式錯誤") == -1) ? dr["序號"].ToString() : string.Empty, "int", false);
                    dr_Temp["STATUS"] = ITMComm.GetValueSetParameter("2", "int", false);//處理狀態(1:正常資料;2:錯誤資料)
                    dr_Temp["DATASOURCE"] = ITMComm.GetValueSetParameter(arl_Return[3].ToString(), "string", false);//匯入檔案
                    dr_Temp["DATATYPE"] = ITMComm.GetValueSetParameter("1", "int", false);//資料類別(1:FILE TO TMP;2:TMP TO DB)
                    dr_Temp["MEMO"] = s_ErrorMsg;//說明
                    dr_Temp["CREATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);
                    dr_Temp["CREATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);
                    dr_Temp["UPDATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);
                    dr_Temp["UPDATEDATE"] = ITMComm.GetValueSetParameter(d_Now.ToString(), "datetime", false);

                    dt_Temp.Rows.Add(dr_Temp);
                }

                #endregion
            }

            #endregion

            #region 連結資料庫

            if (dt_Temp.Rows.Count == 0)
            {
                this.ErrorMsgLabel.Text = "無匯入資料";
                return;
            }
            else
            {
                #region 將資料寫入TempTable

                DataTable dt_Return = bco.FileToTmp(null, Session["UID"].ToString(), dt_Temp);

                #endregion

                #region 計算[總筆數][正常筆數][錯誤筆數]

                int i_Total_Count = 0;//總筆數
                int i_Success_Count = 0;//正常筆數
                int i_Failure_Count = 0;//錯誤筆數

                string s_FilterExpression = string.Empty;

                s_FilterExpression = "STATUS ='1'";//1:正常資料;
                DataRow[] dr_Success = dt_Return.Select(s_FilterExpression);
                if (dr_Success.Length == 1)
                { i_Success_Count = int.Parse(dr_Success[0]["count"].ToString()); }

                s_FilterExpression = "STATUS ='2'";//2:錯誤資料;
                DataRow[] dr_Failure = dt_Return.Select(s_FilterExpression);
                if (dr_Failure.Length == 1)
                { i_Failure_Count = int.Parse(dr_Failure[0]["count"].ToString()); }

                i_Total_Count = i_Success_Count + i_Failure_Count;

                this.UploadStatusPanel1.UploadSum = i_Total_Count;//上傳結果總筆數
                this.UploadStatusPanel1.UploadOK = i_Success_Count;//上傳結果正常筆數
                this.UploadStatusPanel1.UploadNG = i_Failure_Count;//上傳結果錯誤筆數
                this.UploadStatusPanel1.ImportSum = 0;//匯入結果總筆數
                this.UploadStatusPanel1.ImportOK = 0;//匯入結果正常筆數
                this.UploadStatusPanel1.ImportNG = 0;//匯入結果錯誤筆數

                #endregion

                #region 設定控制項

                if ((i_Total_Count == i_Success_Count) &&
                   (i_Failure_Count == 0))
                {
                    this.but_Import.Enabled = true;//確定匯入
                    this.but_Error.Enabled = false;//檢視異常
                }

                if (i_Failure_Count > 0)
                {
                    this.but_Import.Enabled = false;//確定匯入
                    this.but_Error.Enabled = true;//檢視異常
                }

                #endregion
            }

            #endregion

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            //#region 設定 TabContainer 的 ActiveTabIndex

            //this.TabContainer1.ActiveTabIndex = 1;

            //#endregion
        }
    }
示例#16
0
    /// <summary>
    /// BUTTON [產生異動序號]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Edit_No_Click(object sender, EventArgs e)
    {
        try
        {
            #region 編輯模式

            if (this.hid_PageStatus.Value == "edit")
            {
                #region 宣告變數

                BCO.ITMCommon ITMComm = new BCO.ITMCommon();
                BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
                DataTable dt_UpdateDB = new DataTable();
                string s_Return_EDIT_NO = string.Empty;

                #endregion

                #region 檢查條件

                ArrayList arl_Check_Condition = Check_Condition("BUTTON [產生異動序號]鈕,編輯狀態_1", null);

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 設定 TempTable 的 SCHEMA

                foreach (DataColumn dc in dt_Original.Columns)
                {
                    dt_UpdateDB.Columns.Add("OLD_" + dc.ColumnName, dc.DataType);
                    dt_UpdateDB.Columns.Add("NEW_" + dc.ColumnName, dc.DataType);
                }

                #endregion

                #region 將資料寫入 TempTable

                DataRow dr_UpdateDB = dt_UpdateDB.NewRow();

                #region 產生異動序號規則

                /* 俊翰寫程式時寫錯,於 20100402 修正
                 * 修正後規則
                 * 異動序號規則現在由 PKG_VDS_CAA_PUBLIC.ORDERDOCUMENTIDANDCODE 產生。
                 * 在編輯畫面按下[產生異動序號]鈕時,會先執行Client端的檢查
                 * 此時檢查是否為[當日第一次異動資料]是以該品號來做檢查
                 * 假設有A、B兩個品號
                 * A品號先執行[產生異動序號],此時B品號再執行[產生異動序號],此時不會跳出 confirm(已非當日第一次異動資料,確定產生異動序號?)
                 * 假設剛剛B品號已執行[產生異動序號],此時再一次執行[產生異動序號],這時才會跳出 confirm(已非當日第一次異動資料,確定產生異動序號?)
                 */

                #endregion

                #region 舊資料

                foreach (DataRow dr in dt_Original.Rows)
                {
                    foreach (DataColumn dc in dt_Original.Columns)
                    { dr_UpdateDB["OLD_" + dc.ColumnName] = dr[dc.ColumnName]; }
                }

                #endregion

                #region 新資料

                //頁籤=商品主檔
                dr_UpdateDB["NEW_ITEM_NAME"] = ITMComm.GetValueSetParameter(this.txt_ITEM_NAME.Text, "string", false);//品名
                dr_UpdateDB["NEW_VICE_ITEM_NAME"] = ITMComm.GetValueSetParameter(this.txt_VICE_ITEM_NAME.Text, "string", false);//副主題
                dr_UpdateDB["NEW_MDC_START_DATE"] = ITMComm.GetValueSetParameter(this.slp_MDC_START_DATE.Text, "date", false);//DC開始日
                dr_UpdateDB["NEW_MDC_END_DATE"] = ITMComm.GetValueSetParameter(this.slp_MDC_END_DATE.Text, "date", false);//DC結束日
                dr_UpdateDB["NEW_MANUFACTURE"] = ITMComm.GetValueSetParameter(this.slp_MANUFACTURE.Text, "string", false);//供應商
                dr_UpdateDB["NEW_EDIT_REASON"] = ITMComm.GetValueSetParameter(this.txt_EDIT_REASON.Text, "string", false);//異動原因
                dr_UpdateDB["NEW_ROOT_NO"] = ITMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false);//群分類
                dr_UpdateDB["NEW_OUT_OF_PRINT"] = ITMComm.GetValueSetParameter(this.radl_OUT_OF_PRINT.SelectedValue, "int", false);//絕版
                dr_UpdateDB["NEW_PMA"] = ITMComm.GetValueSetParameter(this.slp_PMA.Text, "string", false);//大分類
                dr_UpdateDB["NEW_CATEGORY"] = ITMComm.GetValueSetParameter(this.slp_CATEGORY.Text, "string", false);//中分類
                dr_UpdateDB["NEW_SORT_OUT"] = ITMComm.GetValueSetParameter(this.slp_SORT_OUT.Text, "string", false);//小分類
                dr_UpdateDB["NEW_STATEMENTS"] = ITMComm.GetValueSetParameter(this.txt_STATEMENTS.Text, "string", false);//敘述
                dr_UpdateDB["NEW_ATTRIBUTE"] = ITMComm.GetValueSetParameter(this.radl_ATTRIBUTE.SelectedValue, "int", false);//是否定期
                dr_UpdateDB["NEW_FIRST_PERIOD"] = ITMComm.GetValueSetParameter(this.txt_FIRST_PERIOD.Text, "string", false);//首期期別
                dr_UpdateDB["NEW_NEW_SW"] = ITMComm.GetValueSetParameter(this.radl_NEW_SW.SelectedValue, "string", false);//新商品
                dr_UpdateDB["NEW_PERIOD_STEP"] = ITMComm.GetValueSetParameter(this.slp_PERIOD_STEP.Text, "int", false);//期別累加值
                dr_UpdateDB["NEW_INTERVAL"] = ITMComm.GetValueSetParameter(this.slp_INTERVAL.Text, "int", false);//出刊間隔
                dr_UpdateDB["NEW_PUBLISH_TYPE"] = ITMComm.GetValueSetParameter(this.slp_PUBLISH_TYPE.Text, "string", false);//出刊種類
                dr_UpdateDB["NEW_UNIT"] = ITMComm.GetValueSetParameter(this.slp_UNIT.Text, "int", false);//銷售單位
                dr_UpdateDB["NEW_OPEN_SIZE"] = ITMComm.GetValueSetParameter(this.txt_OPEN_SIZE.Text, "string", false);//開本
                dr_UpdateDB["NEW_PAGE_NUM"] = ITMComm.GetValueSetParameter(this.slp_PAGE_NUM.Text, "int", false);//頁數
                dr_UpdateDB["NEW_WIDTH"] = ITMComm.GetValueSetParameter(this.slp_WIDTH.Text, "double", false);//寬
                dr_UpdateDB["NEW_HIEGHT"] = ITMComm.GetValueSetParameter(this.slp_HIEGHT.Text, "double", false);//高
                dr_UpdateDB["NEW_LENGTH"] = ITMComm.GetValueSetParameter(this.slp_LENGTH.Text, "double", false);//深
                dr_UpdateDB["NEW_AUTHOR"] = ITMComm.GetValueSetParameter(this.txt_AUTHOR.Text, "string", false);//作者
                dr_UpdateDB["NEW_CIP"] = ITMComm.GetValueSetParameter(this.txt_CIP.Text, "string", false);//中央圖書分類碼(CIP)
                dr_UpdateDB["NEW_PUBLISH"] = ITMComm.GetValueSetParameter(this.txt_PUBLISH.Text, "string", false);//VCMS出版社
                dr_UpdateDB["NEW_ITEM_PUBLISHER_NO"] = ITMComm.GetValueSetParameter(this.txt_ITEM_PUBLISHER_NO.Text, "string", false);//商品出版商代號
                dr_UpdateDB["NEW_ITEM_PUBLISHER_NAME"] = ITMComm.GetValueSetParameter(this.txt_ITEM_PUBLISHER_NAME.Text, "string", false);//商品出版商名稱
                dr_UpdateDB["NEW_PUBLISHER_TYPE"] = ITMComm.GetValueSetParameter(this.txt_PUBLISHER_TYPE.Text, "string", false);//出版社書系
                dr_UpdateDB["NEW_PUBLISH_DATE"] = ITMComm.GetValueSetParameter(this.slp_PUBLISH_DATE.Text, "date", false);//出版日期
                //頁籤=商品指定參照
                dr_UpdateDB["NEW_DISTRIBUTE_MODE"] = ITMComm.GetValueSetParameter(this.radl_DISTRIBUTE_MODE.SelectedValue, "string", false);//配量方式
                dr_UpdateDB["NEW_QUANTITY"] = ITMComm.GetValueSetParameter(this.slp_QUANTITY.Text, "int", false);//每店
                dr_UpdateDB["NEW_ACCEPT_TOTAL"] = ITMComm.GetValueSetParameter(this.slp_ACCEPT_TOTAL.Text, "int", false);//總進貨量
                dr_UpdateDB["NEW_RESEMBLE_GOODS"] = ITMComm.GetValueSetParameter(this.txt_RESEMBLE_GOODS.Text, "string", false);//類似商品
                dr_UpdateDB["NEW_GOODS_MATTER"] = ITMComm.GetValueSetParameter(this.txt_GOODS_MATTER.Text, "string", false);//商品說明
                dr_UpdateDB["NEW_COMMEND_CAUSE"] = ITMComm.GetValueSetParameter(this.txt_COMMEND_CAUSE.Text, "string", false);//推薦理由
                //====================================================================================================
                dr_UpdateDB["NEW_UPDATEDATE"] = ITMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false);//[異動日期]
                dr_UpdateDB["NEW_UPDATEUID"] = ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false);//[異動人員]

                #endregion

                dt_UpdateDB.Rows.Add(dr_UpdateDB);

                #endregion

                #region 檢查所有欄位否有更新

                arl_Check_Condition.Clear();
                arl_Check_Condition = Check_Condition("BUTTON [產生異動序號]鈕,編輯狀態_2", dt_UpdateDB);

                #region 如果檢查有誤,則Return

                if (arl_Check_Condition[1].ToString() != string.Empty)
                {
                    #region 錯誤訊息

                    this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                    #endregion

                    #region Focus欄位

                    if (arl_Check_Condition[0].ToString() != string.Empty)
                    {
                        string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                        ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", s_ScriptManager_Script, true);
                    }

                    #endregion

                    return;
                }

                #endregion

                #endregion

                #region 連結資料庫

                s_Return_EDIT_NO = bco.UPDATE_ITM042_EDIT_NO(null, dt_UpdateDB);

                #endregion

                #region 跳轉頁面至查詢模式

                ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM042", "alert('異動序號:" + s_Return_EDIT_NO + "');location.replace('ITM041.aspx?Code=ITM04');", true);

                #endregion
            }

            #endregion

            #region 其他模式

            else
            { throw new Exception("BUTTON [產生異動序號]鈕,必須在[編輯模式]下才可以使用,請聯絡系統管理員。"); }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
示例#17
0
    /// <summary>
    /// BUTTON [查詢]鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Query_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            BCO.ITMCommon ITMComm = new BCO.ITMCommon();

            ArrayList arl_Check_Condition = Check_Condition("BUTTON [查詢]鈕");

            #region 如果檢查有誤,則Return

            if (arl_Check_Condition[1].ToString() != string.Empty)
            {
                #region 錯誤訊息

                this.ErrorMsgLabel.Text = arl_Check_Condition[1].ToString();

                #endregion

                #region Focus欄位

                if (arl_Check_Condition[0].ToString() != string.Empty)
                {
                    string s_ScriptManager_Script = ITMComm.ToMakeUp_SetFocus_Script(arl_Check_Condition[0].ToString(), true);
                    ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "ITM111", s_ScriptManager_Script, true);
                }

                #endregion

                return;
            }

            #endregion

            #endregion

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter(this.slpCHAN_NO.Text, "string", false)); //[通路]
            ParameterList.Add(ITMComm.GetValueSetParameter(this.slpT_DATE.Text, "date", false)); //[模板日期]
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UPDATEUID

            #endregion

            #region 連結資料庫

            DataTable dt_Return = new DataTable();
            BCO.MaintainReturnTemplate bco = new BCO.MaintainReturnTemplate(ConntionDB);
            dt_Return = bco.QUERYSETTEMPLATEDATA(ParameterList);

            #endregion

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            string SessionIDName = "ITM111_" + PageTimeStamp.Value;

            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dt_Return;

            this.gv_QueryResult.DataSource = dt_Return;
            this.gv_QueryResult.DataBind();

            #endregion

            #region 檢查回傳資料

            if (dt_Return.Rows.Count == 0)
            { this.ErrorMsgLabel.Text = "查無資料"; }

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            #region 清空Message

            this.ErrorMsgLabel.Text = string.Empty;

            #endregion

            if (!IsPostBack)
            {
                #region 寫入首次載入Page TimeStamp

                PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}",
                                                    DateTime.Now.Year.ToString(),
                                                    DateTime.Now.Month.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Day.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Hour.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Minute.ToString().PadLeft(2, '0'),
                                                    DateTime.Now.Second.ToString().PadLeft(2, '0')
                                                    );

                #endregion

                #region Attributes

                this.but_Close.Attributes["onclick"] += "window.close();";

                #endregion

                #region 取得資料

                #region 取得欄位[品號][期別],並將資料寫入控制項

                string s_ITEM = string.Empty;
                string s_PERIOD = string.Empty;

                s_ITEM = Request["ITEM"].ToString();
                s_PERIOD = Request["PERIOD"].ToString();

                this.txt_ITEM.Text = s_ITEM;//品號
                this.txt_PERIOD.Text = s_PERIOD;//期別

                #endregion

                #region 傳入參數

                BCO.ITMCommon ITMComm = new BCO.ITMCommon();

                ParameterList.Clear();
                ParameterList.Add(ITMComm.GetValueSetParameter(s_ITEM, "string", false));//[品號]
                ParameterList.Add(ITMComm.GetValueSetParameter(s_PERIOD, "string", false));//[期別]
                ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UID

                #endregion

                #region 連結資料庫

                BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
                DataTable dt_Return = bco.QUERY_ITM042_POPUP_ONHD_QTY(ParameterList);

                #endregion

                #region 資料與GridView繫結

                //抓取本頁初次登記的時間
                string SessionIDName = "POPUP_LOCATE_ITEM_" + PageTimeStamp.Value;

                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dt_Return;

                this.gv_QueryResult.DataSource = dt_Return;
                this.gv_QueryResult.PageIndex = 0;
                this.gv_QueryResult.DataBind();

                #endregion

                #endregion
            }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
示例#19
0
    /// <summary>
    /// 檢查條件
    /// </summary>
    /// <param name="s_Type"></param>
    /// <returns></returns>
    private ArrayList Check_Condition(string s_Type)
    {
        #region 宣告

        BCO.ITMCommon ITMComm = new BCO.ITMCommon();
        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region SLP轉型

        TextBox txt_DATE = (TextBox)this.slpT_DATE.FindControl("TextBoxCode");//[模板日期]

        #endregion

        #region BUTTON [查詢]鈕

        if (s_Type == "BUTTON [查詢]鈕")
        {
            #region 檢查SLP日期格式

            arl_Return = ITMComm.Check_Format_Date(this.slpT_DATE.Text, "欄位[模板日期]日期格式錯誤", "1", txt_DATE.ClientID, arl_Return);

            #endregion

            #region 檢查必填欄位

            arl_Return = ITMComm.Check_MustFillin_Column(this.slpT_DATE.Text, "text", "欄位[模板日期]為必填欄位", "1", txt_DATE.ClientID, arl_Return);

            #endregion
        }

        #endregion

        #region BUTTON [模板設定查詢]鈕

        else if (s_Type == "BUTTON [模板設定查詢]鈕")
        {
            #region 檢查SLP日期格式

            arl_Return = ITMComm.Check_Format_Date(this.slpT_DATE.Text, "欄位[模板日期]日期格式錯誤", "1", txt_DATE.ClientID, arl_Return);

            #endregion

            #region 檢查必填欄位

            arl_Return = ITMComm.Check_MustFillin_Column(this.slpT_DATE.Text, "text", "欄位[模板日期]為必填欄位", "1", txt_DATE.ClientID, arl_Return);

            #endregion

            #region 如果基本檢查有誤,則Return

            if (arl_Return[1].ToString() != string.Empty)
            { return arl_Return; }

            #endregion

            #region 檢查是否已做過退貨模板設定

            #region 傳入參數

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter(this.slpT_DATE.Text, "date", false));//[模板日期]
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//V_LOG_UID

            #endregion

            #region 連結資料庫

            DataTable dt_Return = new DataTable();
            BCO.MaintainReturnTemplate bco = new BCO.MaintainReturnTemplate(ConntionDB);

            dt_Return = bco.QUERY_ITM111_T_DATE(ParameterList);

            #endregion

            #region 檢查回傳資料

            if (int.Parse(dt_Return.Rows[0]["count"].ToString()) > 0)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, this.slpT_DATE.Text + " 已做過退貨模板設定", "1", txt_DATE.ClientID); }

            #endregion

            #endregion
        }

        #endregion

        return arl_Return;
    }
示例#20
0
    private void btnDiffSerialNo_Click()
    {
        #region 檢查資料是否有異動

        #region 宣告變數

        STMModel.ITMCommon ITMComm = new STMModel.ITMCommon();
        DataTable dt_ChkDB = new DataTable();
        bool b_Is_All_Same = true;
        ArrayList arl_Chk_Column = new ArrayList();

        string s_New_ITEM_NAME = string.Empty;//品名
        string s_New_VICE_ITEM_NAME = string.Empty;//副主題
        string s_New_MDC_START_DATE = string.Empty;//DC開始日
        string s_New_MDC_END_DATE = string.Empty;//DC結束日
        string s_New_MANUFACTURE = string.Empty;//供應商
        string s_New_EDIT_REASON = string.Empty;//異動原因
        string s_New_ROOT_NO = string.Empty;//群分類
        string s_New_OUT_OF_PRINT = string.Empty;//絕版
        string s_New_PMA = string.Empty;//大分類
        string s_New_CATEGORY = string.Empty;//中分類
        string s_New_SORT_OUT = string.Empty;//小分類
        string s_New_STATEMENTS = string.Empty;//敘述
        string s_New_ATTRIBUTE = string.Empty;//是否定期
        string s_New_FIRST_PERIOD = string.Empty;//首期期別
        string s_New_NEW_SW = string.Empty;//新商品
        string s_New_PERIOD_STEP = string.Empty;//期別累加值
        string s_New_INTERVAL = string.Empty;//出刊間隔
        string s_New_PUBLISH_TYPE = string.Empty;//出刊種類
        string s_New_UNIT = string.Empty;//銷售單位
        string s_New_OPEN_SIZE = string.Empty;//開本
        string s_New_PAGE_NUM = string.Empty;//頁數
        string s_New_WIDTH = string.Empty;//寬
        string s_New_HIEGHT = string.Empty;//高
        string s_New_LENGTH = string.Empty;//深
        string s_New_AUTHOR = string.Empty;//作者
        string s_New_CIP = string.Empty;//中央圖書分類碼(CIP)
        string s_New_PUBLISH = string.Empty;//VCMS出版社
        string s_New_ITEM_PUBLISHER_NO = string.Empty;//商品出版商代號
        string s_New_ITEM_PUBLISHER_NAME = string.Empty;//商品出版商名稱
        string s_New_PUBLISHER_TYPE = string.Empty;//出版社書系
        string s_New_PUBLISH_DATE = string.Empty;//出版日期

        string s_New_DISTRIBUTE_MODE = string.Empty;//配量方式
        string s_New_QUANTITY = string.Empty;//每店    
        string s_New_ACCEPT_TOTAL = string.Empty;//總進貨量
        string s_New_RESEMBLE_GOODS = string.Empty;//類似商品
        string s_New_GOODS_MATTER = string.Empty;//商品說明
        string s_New_COMMEND_CAUSE = string.Empty;//推薦理由

        #endregion

        #region 設定 TempTable 的 SCHEMA

        foreach (DataColumn dc in dt_Original.Columns)
        {
            dt_ChkDB.Columns.Add("OLD_" + dc.ColumnName, dc.DataType);
            dt_ChkDB.Columns.Add("NEW_" + dc.ColumnName, dc.DataType);
        }

        #endregion

        #region 將畫面上的值寫入變數

        #region 頁籤=商品主檔

        s_New_ITEM_NAME = ((TextBox)this.FormView1.FindControl("txtITEM_NAME")).Text;//品名
        s_New_VICE_ITEM_NAME = ((TextBox)this.FormView1.FindControl("txtVICE_ITEM_NAME")).Text;//副主題
        s_New_MDC_START_DATE = ((ASP.wui_slp_slp_slpdate_ascx)this.FormView1.FindControl("txtMDC_START_DATE")).Text;//DC開始日
        s_New_MDC_END_DATE = ((ASP.wui_slp_slp_slpdate_ascx)this.FormView1.FindControl("txtMDC_END_DATE")).Text;//DC結束日
        s_New_MANUFACTURE = ((ASP.vdm_slp_slp_vendorbase_ascx)this.FormView1.FindControl("txtMANUFACTURE")).Text;//供應商
        s_New_EDIT_REASON = ((TextBox)this.FormView1.FindControl("txtEDIT_REASON")).Text;//異動原因
        s_New_ROOT_NO = ((ASP.itm_slp_slp_rootno_ascx)this.FormView1.FindControl("ddlROOT_NO")).Text;//群分類
        s_New_OUT_OF_PRINT = ((ASP.wui_slp_slp_boolean_ascx)this.FormView1.FindControl("txtOUT_OF_PRINT")).Text;//絕版
        s_New_PMA = ((ASP.itm_slp_slp_pma_ascx)this.FormView1.FindControl("txtPMA")).Text;//大分類
        s_New_CATEGORY = ((ASP.itm_slp_slp_category_ascx)this.FormView1.FindControl("txtCATEGORY")).Text;//中分類
        s_New_SORT_OUT = ((ASP.itm_slp_slp_sortout_ascx)this.FormView1.FindControl("txtSORT_OUT")).Text;//小分類
        s_New_STATEMENTS = ((TextBox)this.FormView1.FindControl("txtSTATEMENTS")).Text;//敘述
        s_New_ATTRIBUTE = ((ASP.wui_slp_slp_boolean_ascx)this.FormView1.FindControl("txtATTRIBUTE")).Text;//是否定期
        s_New_FIRST_PERIOD = ((TextBox)this.FormView1.FindControl("txtFIRST_PERIOD")).Text;//首期期別
        s_New_NEW_SW = ((ASP.wui_slp_slp_boolean_ascx)this.FormView1.FindControl("ddlNEW_SW")).Text;//新商品
        s_New_PERIOD_STEP = ((ASP.wui_slp_slp_slpnumber_ascx)this.FormView1.FindControl("txtPERIOD_STEP")).Text;//期別累加值
        s_New_INTERVAL = ((ASP.wui_slp_slp_slpnumber_ascx)this.FormView1.FindControl("txtINTERVAL")).Text;//出刊間隔
        s_New_PUBLISH_TYPE = ((ASP.sys_slp_slp_codefile_ascx)this.FormView1.FindControl("txtPUBLISH_TYPE")).Text;//出刊種類
        s_New_UNIT = ((ASP.sys_slp_slp_enumbase_ascx)this.FormView1.FindControl("txtUNIT")).Text;//銷售單位
        s_New_OPEN_SIZE = ((TextBox)this.FormView1.FindControl("txtOPEN_SIZE")).Text;//開本
        s_New_PAGE_NUM = ((ASP.wui_slp_slp_slpnumber_ascx)this.FormView1.FindControl("txtPAGE_NUM")).Text;//頁數
        s_New_WIDTH = ((ASP.wui_slp_slp_slpnumber_ascx)this.FormView1.FindControl("txtWEIGHT")).Text;//寬
        s_New_HIEGHT = ((ASP.wui_slp_slp_slpnumber_ascx)this.FormView1.FindControl("txtHEIGHT")).Text;//高
        s_New_LENGTH = ((ASP.wui_slp_slp_slpnumber_ascx)this.FormView1.FindControl("txtDEEP")).Text;//深
        s_New_AUTHOR = ((TextBox)this.FormView1.FindControl("txtAUTHOR")).Text;//作者
        s_New_CIP = ((TextBox)this.FormView1.FindControl("txtCIP")).Text;//中央圖書分類碼(CIP)
        s_New_PUBLISH = ((TextBox)this.FormView1.FindControl("txtPUBLISH")).Text;//VCMS出版社
        s_New_ITEM_PUBLISHER_NO = ((TextBox)this.FormView1.FindControl("txtITEM_PUBLISHER_NO")).Text;//商品出版商代號
        s_New_ITEM_PUBLISHER_NAME = ((TextBox)this.FormView1.FindControl("txtITEM_PUBLISHER_NAME")).Text;//商品出版商名稱
        s_New_PUBLISHER_TYPE = ((TextBox)this.FormView1.FindControl("txtPUBLISHER_TYPE")).Text;//出版社書系
        s_New_PUBLISH_DATE = ((ASP.wui_slp_slp_slpdate_ascx)this.FormView1.FindControl("txtPUBLISH_DATE")).Text;//出版日期

        #endregion

        #region 頁籤=商品指定參照

        s_New_DISTRIBUTE_MODE = ((RadioButtonList)this.FormView2.FindControl("txtDISTRIBUTE_MODE")).SelectedValue;//配量方式
        s_New_QUANTITY = ((ASP.wui_slp_slp_slpnumber_ascx)this.FormView2.FindControl("txtQUANTITY")).Text;//每店    
        s_New_ACCEPT_TOTAL = ((ASP.wui_slp_slp_slpnumber_ascx)this.FormView2.FindControl("txtACCEPT_TOTAL")).Text;//總進貨量
        s_New_RESEMBLE_GOODS = ((TextBox)this.FormView2.FindControl("txtRESEMBLE_GOODS")).Text;//類似商品
        s_New_GOODS_MATTER = ((TextBox)this.FormView2.FindControl("txtGOODS_MATTER")).Text;//商品說明
        s_New_COMMEND_CAUSE = ((TextBox)this.FormView2.FindControl("txtCOMMEND_CAUSE")).Text;//推薦理由

        #endregion

        #endregion

        #region 將資料寫入 TempTable

        DataRow dr_ChkDB = dt_ChkDB.NewRow();

        #region 舊資料

        foreach (DataRow dr_Old in dt_Original.Rows)
        {
            foreach (DataColumn dc in dt_Original.Columns)
            { dr_ChkDB["OLD_" + dc.ColumnName] = dr_Old[dc.ColumnName]; }
        }

        #endregion

        #region 新資料

        //頁籤=商品主檔
        dr_ChkDB["NEW_ITEM_NAME"] = ITMComm.GetValueSetParameter(s_New_ITEM_NAME, "string", false);//品名
        dr_ChkDB["NEW_VICE_ITEM_NAME"] = ITMComm.GetValueSetParameter(s_New_VICE_ITEM_NAME, "string", false);//副主題
        dr_ChkDB["NEW_MDC_START_DATE"] = ITMComm.GetValueSetParameter(s_New_MDC_START_DATE, "date", false);//DC開始日
        dr_ChkDB["NEW_MDC_END_DATE"] = ITMComm.GetValueSetParameter(s_New_MDC_END_DATE, "date", false);//DC結束日
        dr_ChkDB["NEW_MANUFACTURE"] = ITMComm.GetValueSetParameter(s_New_MANUFACTURE, "string", false);//供應商
        dr_ChkDB["NEW_ROOT_NO"] = ITMComm.GetValueSetParameter(s_New_ROOT_NO, "string", false);//群分類
        dr_ChkDB["NEW_OUT_OF_PRINT"] = ITMComm.GetValueSetParameter(s_New_OUT_OF_PRINT, "int", false);//絕版
        dr_ChkDB["NEW_PMA"] = ITMComm.GetValueSetParameter(s_New_PMA, "string", false);//大分類
        dr_ChkDB["NEW_CATEGORY"] = ITMComm.GetValueSetParameter(s_New_CATEGORY, "string", false);//中分類
        dr_ChkDB["NEW_SORT_OUT"] = ITMComm.GetValueSetParameter(s_New_SORT_OUT, "string", false);//小分類
        dr_ChkDB["NEW_STATEMENTS"] = ITMComm.GetValueSetParameter(s_New_STATEMENTS, "string", false);//敘述
        dr_ChkDB["NEW_ATTRIBUTE"] = ITMComm.GetValueSetParameter(s_New_ATTRIBUTE, "int", false);//是否定期
        dr_ChkDB["NEW_FIRST_PERIOD"] = ITMComm.GetValueSetParameter(s_New_FIRST_PERIOD, "string", false);//首期期別
        dr_ChkDB["NEW_NEW_SW"] = ITMComm.GetValueSetParameter(s_New_NEW_SW, "string", false);//新商品
        dr_ChkDB["NEW_PERIOD_STEP"] = ITMComm.GetValueSetParameter(s_New_PERIOD_STEP, "int", false);//期別累加值
        dr_ChkDB["NEW_INTERVAL"] = ITMComm.GetValueSetParameter(s_New_INTERVAL, "int", false);//出刊間隔
        dr_ChkDB["NEW_PUBLISH_TYPE"] = ITMComm.GetValueSetParameter(s_New_PUBLISH_TYPE, "string", false);//出刊種類
        dr_ChkDB["NEW_UNIT"] = ITMComm.GetValueSetParameter(s_New_UNIT, "int", false);//銷售單位
        dr_ChkDB["NEW_OPEN_SIZE"] = ITMComm.GetValueSetParameter(s_New_OPEN_SIZE, "string", false);//開本
        dr_ChkDB["NEW_PAGE_NUM"] = ITMComm.GetValueSetParameter(s_New_PAGE_NUM, "int", false);//頁數
        dr_ChkDB["NEW_WIDTH"] = ITMComm.GetValueSetParameter(s_New_WIDTH, "double", false);//寬
        dr_ChkDB["NEW_HIEGHT"] = ITMComm.GetValueSetParameter(s_New_HIEGHT, "double", false);//高
        dr_ChkDB["NEW_LENGTH"] = ITMComm.GetValueSetParameter(s_New_LENGTH, "double", false);//深
        dr_ChkDB["NEW_AUTHOR"] = ITMComm.GetValueSetParameter(s_New_AUTHOR, "string", false);//作者
        dr_ChkDB["NEW_CIP"] = ITMComm.GetValueSetParameter(s_New_CIP, "string", false);//中央圖書分類碼(CIP)
        dr_ChkDB["NEW_PUBLISH"] = ITMComm.GetValueSetParameter(s_New_PUBLISH, "string", false);//VCMS出版社
        dr_ChkDB["NEW_ITEM_PUBLISHER_NO"] = ITMComm.GetValueSetParameter(s_New_ITEM_PUBLISHER_NO, "string", false);//商品出版商代號
        dr_ChkDB["NEW_ITEM_PUBLISHER_NAME"] = ITMComm.GetValueSetParameter(s_New_ITEM_PUBLISHER_NAME, "string", false);//商品出版商名稱
        dr_ChkDB["NEW_PUBLISHER_TYPE"] = ITMComm.GetValueSetParameter(s_New_PUBLISHER_TYPE, "string", false);//出版社書系
        dr_ChkDB["NEW_PUBLISH_DATE"] = ITMComm.GetValueSetParameter(s_New_PUBLISH_DATE, "date", false);//出版日期
        //頁籤=商品指定參照
        dr_ChkDB["NEW_DISTRIBUTE_MODE"] = ITMComm.GetValueSetParameter(s_New_DISTRIBUTE_MODE, "string", false);//配量方式
        dr_ChkDB["NEW_QUANTITY"] = ITMComm.GetValueSetParameter(s_New_QUANTITY, "int", false);//每店
        dr_ChkDB["NEW_ACCEPT_TOTAL"] = ITMComm.GetValueSetParameter(s_New_ACCEPT_TOTAL, "int", false);//總進貨量
        dr_ChkDB["NEW_RESEMBLE_GOODS"] = ITMComm.GetValueSetParameter(s_New_RESEMBLE_GOODS, "string", false);//類似商品
        dr_ChkDB["NEW_GOODS_MATTER"] = ITMComm.GetValueSetParameter(s_New_GOODS_MATTER, "string", false);//商品說明
        dr_ChkDB["NEW_COMMEND_CAUSE"] = ITMComm.GetValueSetParameter(s_New_COMMEND_CAUSE, "string", false);//推薦理由

        #endregion

        dt_ChkDB.Rows.Add(dr_ChkDB);

        #endregion

        #region 設定要檢查的欄位

        arl_Chk_Column.Clear();
        arl_Chk_Column.Add("ITEM_NAME,VARCHAR2");//品名
        arl_Chk_Column.Add("VICE_ITEM_NAME,VARCHAR2");//副主題
        arl_Chk_Column.Add("MDC_START_DATE,DATE");//DC開始日
        arl_Chk_Column.Add("MDC_END_DATE,DATE");//DC結束日
        arl_Chk_Column.Add("MANUFACTURE,VARCHAR2");//供應商
        arl_Chk_Column.Add("ROOT_NO,VARCHAR2");//群分類
        arl_Chk_Column.Add("OUT_OF_PRINT,NUMBER");//絕版
        arl_Chk_Column.Add("PMA,VARCHAR2");//大分類
        arl_Chk_Column.Add("CATEGORY,VARCHAR2");//中分類
        arl_Chk_Column.Add("SORT_OUT,VARCHAR2");//小分類
        arl_Chk_Column.Add("STATEMENTS,VARCHAR2");//敘述
        arl_Chk_Column.Add("ATTRIBUTE,NUMBER");//是否定期
        arl_Chk_Column.Add("FIRST_PERIOD,VARCHAR2");//首期期別
        arl_Chk_Column.Add("NEW_SW,VARCHAR2");//新商品
        arl_Chk_Column.Add("PERIOD_STEP,NUMBER");//期別累加值
        arl_Chk_Column.Add("INTERVAL,NUMBER");//出刊間隔
        arl_Chk_Column.Add("PUBLISH_TYPE,VARCHAR2");//出刊種類
        arl_Chk_Column.Add("UNIT,NUMBER");//銷售單位
        arl_Chk_Column.Add("OPEN_SIZE,VARCHAR2");//開本
        arl_Chk_Column.Add("PAGE_NUM,NUMBER");//頁數
        arl_Chk_Column.Add("WIDTH,NUMBER");//寬
        arl_Chk_Column.Add("HIEGHT,NUMBER");//高
        arl_Chk_Column.Add("LENGTH,NUMBER");//深
        arl_Chk_Column.Add("AUTHOR,VARCHAR2");//作者
        arl_Chk_Column.Add("CIP,VARCHAR2");//中央圖書分類碼(CIP)
        arl_Chk_Column.Add("PUBLISH,VARCHAR2");//VCMS出版社
        arl_Chk_Column.Add("ITEM_PUBLISHER_NO,VARCHAR2");//商品出版商代號
        arl_Chk_Column.Add("ITEM_PUBLISHER_NAME,VARCHAR2");//商品出版商名稱
        arl_Chk_Column.Add("PUBLISHER_TYPE,VARCHAR2");//出版社書系
        arl_Chk_Column.Add("PUBLISH_DATE,DATE");//出版日期
        arl_Chk_Column.Add("DISTRIBUTE_MODE,VARCHAR2");//配量方式
        arl_Chk_Column.Add("QUANTITY,NUMBER");//每店
        arl_Chk_Column.Add("ACCEPT_TOTAL,NUMBER");//總進貨量
        arl_Chk_Column.Add("RESEMBLE_GOODS,VARCHAR2");//類似商品
        arl_Chk_Column.Add("GOODS_MATTER,VARCHAR2");//商品說明
        arl_Chk_Column.Add("COMMEND_CAUSE,VARCHAR2");//推薦理由

        #endregion

        #region 檢查資料

        for (int i = 0; i < arl_Chk_Column.Count; i++)
        {
            string[] s_Chk = arl_Chk_Column[i].ToString().Split(',');

            if (s_Chk[1] == "VARCHAR2")
            {
                if (dt_ChkDB.Rows[0]["OLD_" + s_Chk[0]].ToString() !=
                    dt_ChkDB.Rows[0]["NEW_" + s_Chk[0]].ToString())
                { b_Is_All_Same = false; }
            }
            else if (s_Chk[1] == "NUMBER")
            {
                if (ITMComm.GetValueSetParameter(dt_ChkDB.Rows[0]["OLD_" + s_Chk[0]].ToString(), "double", false).ToString() !=
                    ITMComm.GetValueSetParameter(dt_ChkDB.Rows[0]["NEW_" + s_Chk[0]].ToString(), "double", false).ToString())
                { b_Is_All_Same = false; }
            }
            else if (s_Chk[1] == "DATE")
            {
                if (ITMComm.GetValueSetParameter(dt_ChkDB.Rows[0]["OLD_" + s_Chk[0]].ToString(), "date", false).ToString() !=
                    ITMComm.GetValueSetParameter(dt_ChkDB.Rows[0]["NEW_" + s_Chk[0]].ToString(), "date", false).ToString())
                { b_Is_All_Same = false; }
            }
        }

        #endregion

        #region 如果可修改欄位(不含異動原因欄位)都沒有修改,則顯示[沒有更新任何資料]

        if (b_Is_All_Same == true)
        {
            Alert("沒有更新任何資料!");
            return;
        }

        #endregion

        #endregion

        string strEDIT_NO = ViewState["EDIT_NO"].ToString();
        int SerialNo = 1;
        if (strEDIT_NO != "0")
        {
            if (strEDIT_NO.Trim() != "" && strEDIT_NO.Substring(0, 8) == DateTime.Today.ToString("yyyyMMdd"))
            {
                try
                {
                    SerialNo = int.Parse(strEDIT_NO.Substring(8, 3)) + 1;
                }
                catch (Exception ex)
                { }
            }
        }
        ViewState["EDIT_NO"] = string.Format("{0}{1}", DateTime.Today.ToString("yyyyMMdd"), SerialNo.ToString().PadLeft(3, '0'));

        //更新主檔資料
        int res = 0;
        try
        {
            #region 取得畫面元件的值

            //FormView1
            string v_ID = ((TextBox)FormView1.FindControl("TextBoxID")).Text.Trim();
            string v_ITEM = ((TextBox)FormView1.FindControl("txtITEM")).Text.Trim();
            string v_ITEM_NAME = ((TextBox)FormView1.FindControl("txtITEM_NAME")).Text.Trim();
            string v_VICE_ITEM_NAME = ((TextBox)FormView1.FindControl("txtVICE_ITEM_NAME")).Text.Trim();
            string v_MDC_START_DATE = ((WUI.SLP.SLPDate)FormView1.FindControl("txtMDC_START_DATE")).Text.Trim();
            string v_MDC_END_DATE = ((WUI.SLP.SLPDate)FormView1.FindControl("txtMDC_END_DATE")).Text.Trim();
            string v_MANUFACTURE = ((WUI.SLP.SLP_VendorBase)FormView1.FindControl("txtMANUFACTURE")).Text.Trim();
            string v_EDIT_NO = ViewState["EDIT_NO"].ToString();
            string v_EDIT_REASON = ((TextBox)FormView1.FindControl("txtEDIT_REASON")).Text.Trim();
            string v_ROOT_NO = ((WUI.SLP.SLP_RootNo)FormView1.FindControl("ddlROOT_NO")).Text.Trim();
            CheckBox cbOUT_OF_PRINT = (CheckBox)((WUI.SLP.SLP_Boolean)FormView1.FindControl("txtOUT_OF_PRINT")).FindControl("C1");
            string v_OUT_OF_PRINT = ((cbOUT_OF_PRINT.Checked) ? "1" : "0");
            //string v_PMA = ((WUI.SLP.CodeFile)FormView1.FindControl("txtPMA")).Text.Trim();
            string v_PMA = ((WUI.SLP.SLP_PMA)FormView1.FindControl("txtPMA")).Text.Trim();
            //string v_CATEGORY = ((WUI.SLP.CodeFile)FormView1.FindControl("txtCATEGORY")).Text.Trim();
            string v_CATEGORY = ((WUI.SLP.SLP_Category)FormView1.FindControl("txtCATEGORY")).Text.Trim();
            //string v_SORT_OUT = ((WUI.SLP.CodeFile)FormView1.FindControl("txtSORT_OUT")).Text.Trim();
            string v_SORT_OUT = ((WUI.SLP.SLP_SortOut)FormView1.FindControl("txtSORT_OUT")).Text.Trim();
            string v_STATEMENTS = ((TextBox)FormView1.FindControl("txtSTATEMENTS")).Text.Trim();
            CheckBox cbATTRIBUTE = (CheckBox)((WUI.SLP.SLP_Boolean)FormView1.FindControl("txtATTRIBUTE")).FindControl("C1");
            string v_ATTRIBUTE = ((cbATTRIBUTE.Checked) ? "1" : "0");
            string v_FIRST_PERIOD = ((TextBox)FormView1.FindControl("txtFIRST_PERIOD")).Text.Trim();
            CheckBox cbNEW_SW = (CheckBox)((WUI.SLP.SLP_Boolean)FormView1.FindControl("ddlNEW_SW")).FindControl("C1");
            string v_NEW_SW = ((cbNEW_SW.Checked) ? "1" : "0");
            string v_PERIOD_STEP = ((WUI.SLP.SLPNumber)FormView1.FindControl("txtPERIOD_STEP")).Text.Trim();
            string v_INTERVAL = ((WUI.SLP.SLPNumber)FormView1.FindControl("txtINTERVAL")).Text.Trim();
            string v_PUBLISH_TYPE = ((WUI.SLP.CodeFile)FormView1.FindControl("txtPUBLISH_TYPE")).Text.Trim();
            string v_UNIT = ((WUI.SLP.EnumBase)FormView1.FindControl("txtUNIT")).Text.Trim();
            string v_OPEN_SIZE = ((TextBox)FormView1.FindControl("txtOPEN_SIZE")).Text.Trim();
            string v_PAGE_NUM = ((WUI.SLP.SLPNumber)FormView1.FindControl("txtPAGE_NUM")).Text.Trim();
            string v_WEIGHT = ((WUI.SLP.SLPNumber)FormView1.FindControl("txtWEIGHT")).Text.Trim();
            string v_HEIGHT = ((WUI.SLP.SLPNumber)FormView1.FindControl("txtHEIGHT")).Text.Trim();
            string v_LENGTH = ((WUI.SLP.SLPNumber)FormView1.FindControl("txtDEEP")).Text.Trim();
            string v_AUTHOR = ((TextBox)FormView1.FindControl("txtAUTHOR")).Text.Trim();
            string v_CIP = ((TextBox)FormView1.FindControl("txtCIP")).Text.Trim();
            string v_PUBLISH = ((TextBox)FormView1.FindControl("txtPUBLISH")).Text.Trim();
            string v_ITEM_PUBLISHER_NO = ((TextBox)FormView1.FindControl("txtITEM_PUBLISHER_NO")).Text.Trim();
            string v_ITEM_PUBLISHER_NAME = ((TextBox)FormView1.FindControl("txtITEM_PUBLISHER_NAME")).Text.Trim();
            string v_PUBLISHER_TYPE = ((TextBox)FormView1.FindControl("txtPUBLISHER_TYPE")).Text.Trim();
            string v_PUBLISH_DATE = ((WUI.SLP.SLPDate)FormView1.FindControl("txtPUBLISH_DATE")).Text.Trim();

            //FormView2
            string v_DISTRIBUTE_MODE = ((RadioButtonList)FormView2.FindControl("txtDISTRIBUTE_MODE")).Text.Trim();
            string v_QUANTITY = ((WUI.SLP.SLPNumber)FormView2.FindControl("txtQUANTITY")).Text.Trim();
            string v_ACCEPT_TOTAL = ((WUI.SLP.SLPNumber)FormView2.FindControl("txtACCEPT_TOTAL")).Text.Trim();
            string v_RESEMBLE_GOODS = ((TextBox)FormView2.FindControl("txtRESEMBLE_GOODS")).Text.Trim();
            string v_GOODS_MATTER = ((TextBox)FormView2.FindControl("txtGOODS_MATTER")).Text.Trim();
            string v_COMMEND_CAUSE = ((TextBox)FormView2.FindControl("txtCOMMEND_CAUSE")).Text.Trim();


            string v_PATTERN_NO = string.Format("{0}{1}{2}{3}", v_ROOT_NO, v_PMA, v_CATEGORY, v_SORT_OUT);

            #endregion 取得畫面元件的值

            ParameterList.Clear();
            //Old Data 
            DataTable dtItem = bco.ConvertXMLToDataTable(MasterOLDData.InnerHtml);
            DataRow dr = dtItem.Rows[0];
            ParameterList.Clear();
            #region OLDDATA
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "OLD_ID", dr["ID"].ToString()); //OLD_ID
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "OLD_UPDATEDATE", dr["UPDATEDATE"].ToString()); //OLD_UPDATEDATE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "OLD_UPDATEUID", dr["UPDATEUID"].ToString()); //OLD_UPDATEUID
            #endregion OLDDATA
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_CODE", v_ITEM); //NEW_CODE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_ITEM", v_ITEM); //NEW_ITEM
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_EDIT_NO", v_EDIT_NO); //NEW_EDIT_NO
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_ITEM_NAME", v_ITEM_NAME); //NEW_ITEM_NAME
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "NEW_MDC_START_DATE", v_MDC_START_DATE); //NEW_MDC_START_DATE
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "NEW_MDC_END_DATE", v_MDC_END_DATE); //NEW_MDC_END_DATE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_PMA", v_PMA); //NEW_PMA
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_CATEGORY", v_CATEGORY); //NEW_CATEGORY
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_SORT_OUT", v_SORT_OUT); //NEW_SORT_OUT
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_PATTERN_NO", v_PATTERN_NO); //NEW_PATTERN_NO
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_ATTRIBUTE", v_ATTRIBUTE); //NEW_ATTRIBUTE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_FIRST_PERIOD", v_FIRST_PERIOD); //NEW_FIRST_PERIOD
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_PERIOD_STEP", v_PERIOD_STEP); //NEW_PERIOD_STEP
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_INTERVAL", v_INTERVAL); //NEW_INTERVAL
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_PUBLISH_TYPE", v_PUBLISH_TYPE); //NEW_PUBLISH_TYPE
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_UNIT", v_UNIT); //NEW_UNIT
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_STATEMENTS", v_STATEMENTS); //NEW_STATEMENTS
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_DISTRIBUTE_MODE", v_DISTRIBUTE_MODE); //NEW_DISTRIBUTE_MODE
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_QUANTITY", v_QUANTITY); //NEW_QUANTITY
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_RESEMBLE_GOODS", v_RESEMBLE_GOODS); //NEW_RESEMBLE_GOODS
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_GOODS_MATTER", v_GOODS_MATTER); //NEW_GOODS_MATTER
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_COMMEND_CAUSE", v_COMMEND_CAUSE); //NEW_COMMEND_CAUSE
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_POS_DAY", null); //NEW_POS_DAY
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_AUTHOR", v_AUTHOR); //NEW_AUTHOR
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_SERIES", null); //NEW_SERIES
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_QTY_SMALL", null); //NEW_QTY_SMALL
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_QTY_GREAT", null); //NEW_QTY_GREAT
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_POS_SW", null); //NEW_POS_SW
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_POS_RATE", null); //NEW_POS_RATE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_NEW_SW", v_NEW_SW); //NEW_NEW_SW
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_QUANTITY1", null); //NEW_QUANTITY1
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_DISTRIBUTE_COMM", null); //NEW_DISTRIBUTE_COMM
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_ACCEPT_TOTAL", v_ACCEPT_TOTAL); //NEW_ACCEPT_TOTAL
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_PUBLISH", v_PUBLISH); //NEW_PUBLISH
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_MANUFACTURE", v_MANUFACTURE); //NEW_MANUFACTURE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_ROOT_NO", v_ROOT_NO); //NEW_ROOT_NO
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_PUBLISHER_TYPE", v_PUBLISHER_TYPE); //NEW_PUBLISHER_TYPE
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "NEW_PUBLISH_DATE", v_PUBLISH_DATE); //NEW_PUBLISH_DATE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_VICE_ITEM_NAME", v_VICE_ITEM_NAME); //NEW_VICE_ITEM_NAME
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_OUT_OF_PRINT", v_OUT_OF_PRINT); //NEW_OUT_OF_PRINT
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_OPEN_SIZE", v_OPEN_SIZE); //NEW_OPEN_SIZE
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_PAGE_NUM", v_PAGE_NUM); //NEW_PAGE_NUM
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_CIP", v_CIP); //NEW_CIP
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_EDIT_REASON", v_EDIT_REASON); //NEW_EDIT_REASON
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_ITEM_PUBLISHER_NO", v_ITEM_PUBLISHER_NO); //NEW_ITEM_PUBLISHER_NO
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_ITEM_PUBLISHER_NAME", v_ITEM_PUBLISHER_NAME); //NEW_ITEM_PUBLISHER_NAME
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_LENGTH", v_LENGTH); //NEW_LENGTH
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_WIDTH", v_WEIGHT); //NEW_WIDTH
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "NEW_HIEGHT", v_HEIGHT); //NEW_HIEGHT
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "NEW_UPDATEDATE", DateTime.Now); //NEW_UPDATEDATE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "NEW_UPDATEUID", "sys"); //NEW_UPDATEUID
            bco.UpdateSKU(ParameterList, DBT);

            //異動紀錄檔===========================================================================================
            //MST
            ParameterList.Clear();
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "vCODE", string.Format("{0}00000{1}", v_ITEM, v_EDIT_NO)); //vCODE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "vEDIT_NO", v_EDIT_NO); //vEDIT_NO
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "vITEM", v_ITEM); //vITEM
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "vPERIOD", v_FIRST_PERIOD); //vPERIOD
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "vCREATEDATE", DateTime.Now); //vCREATEDATE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "vCREATEUID", Session["UID"].ToString()); //vCREATEUID
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "vUPDATEDATE", DateTime.Now); //vUPDATEDATE
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "vUPDATEUID", Session["UID"].ToString()); //vUPDATEUID
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "vEDIT_REASON", v_EDIT_REASON); //vEDIT_REASON

            ViewState["ID_MST"] = bcoMst.CreateSKUDiffSerialNo(ParameterList, DBT);
            //DTL
            if (dr["ITEM"].ToString() != v_ITEM) InsertEDIT_DTL("ITEM", dr["ITEM"].ToString(), v_ITEM);
            //if (dr["EDIT_NO"].ToString() != v_EDIT_NO) InsertEDIT_DTL("EDIT_NO", dr["EDIT_NO"].ToString(), v_EDIT_NO);
            if (dr["ITEM_NAME"].ToString() != v_ITEM_NAME) InsertEDIT_DTL("ITEM_NAME", dr["ITEM_NAME"].ToString(), v_ITEM_NAME);
            if (((DateTime)dr["MDC_START_DATE"]).ToString("yyyy/MM/dd") != v_MDC_START_DATE) InsertEDIT_DTL("MDC_START_DATE", ((DateTime)dr["MDC_START_DATE"]).ToString("yyyy/MM/dd"), v_MDC_START_DATE);
            if (((DateTime)dr["MDC_END_DATE"]).ToString("yyyy/MM/dd") != v_MDC_END_DATE) InsertEDIT_DTL("MDC_END_DATE", ((DateTime)dr["MDC_END_DATE"]).ToString("yyyy/MM/dd"), v_MDC_END_DATE);
            if (dr["PMA"].ToString() != v_PMA) InsertEDIT_DTL("PMA", dr["PMA"].ToString(), v_PMA);
            if (dr["CATEGORY"].ToString() != v_CATEGORY) InsertEDIT_DTL("CATEGORY", dr["CATEGORY"].ToString(), v_CATEGORY);
            if (dr["SORT_OUT"].ToString() != v_SORT_OUT) InsertEDIT_DTL("SORT_OUT", dr["SORT_OUT"].ToString(), v_SORT_OUT);
            if (dr["ATTRIBUTE"].ToString() != v_ATTRIBUTE) InsertEDIT_DTL("ATTRIBUTE", dr["ATTRIBUTE"].ToString(), v_ATTRIBUTE);
            if (dr["FIRST_PERIOD"].ToString() != v_FIRST_PERIOD) InsertEDIT_DTL("FIRST_PERIOD", dr["FIRST_PERIOD"].ToString(), v_FIRST_PERIOD);
            if (dr["PERIOD_STEP"].ToString() != v_PERIOD_STEP) InsertEDIT_DTL("PERIOD_STEP", dr["PERIOD_STEP"].ToString(), v_PERIOD_STEP);
            if (dr["INTERVAL"].ToString() != v_INTERVAL) InsertEDIT_DTL("INTERVAL", dr["INTERVAL"].ToString(), v_INTERVAL);
            if (dr["PUBLISH_TYPE"].ToString() != v_PUBLISH_TYPE) InsertEDIT_DTL("PUBLISH_TYPE", dr["PUBLISH_TYPE"].ToString(), v_PUBLISH_TYPE);
            if (dr["UNIT"].ToString() != v_UNIT) InsertEDIT_DTL("UNIT", dr["UNIT"].ToString(), v_UNIT);
            if (dr["STATEMENTS"].ToString() != v_STATEMENTS) InsertEDIT_DTL("STATEMENTS", dr["STATEMENTS"].ToString(), v_STATEMENTS);
            if (dr["DISTRIBUTE_MODE"].ToString() != v_DISTRIBUTE_MODE) InsertEDIT_DTL("DISTRIBUTE_MODE", dr["DISTRIBUTE_MODE"].ToString(), v_DISTRIBUTE_MODE);
            if (dr["QUANTITY"].ToString() != v_QUANTITY) InsertEDIT_DTL("QUANTITY", dr["QUANTITY"].ToString(), v_QUANTITY);
            if (dr["RESEMBLE_GOODS"].ToString() != v_RESEMBLE_GOODS) InsertEDIT_DTL("RESEMBLE_GOODS", dr["RESEMBLE_GOODS"].ToString(), v_RESEMBLE_GOODS);
            if (dr["GOODS_MATTER"].ToString() != v_GOODS_MATTER) InsertEDIT_DTL("GOODS_MATTER", dr["GOODS_MATTER"].ToString(), v_GOODS_MATTER);
            if (dr["COMMEND_CAUSE"].ToString() != v_COMMEND_CAUSE) InsertEDIT_DTL("COMMEND_CAUSE", dr["COMMEND_CAUSE"].ToString(), v_COMMEND_CAUSE);
            if (dr["AUTHOR"].ToString() != v_AUTHOR) InsertEDIT_DTL("AUTHOR", dr["AUTHOR"].ToString(), v_AUTHOR);
            if (dr["NEW_SW"].ToString() != v_NEW_SW) InsertEDIT_DTL("NEW_SW", dr["NEW_SW"].ToString(), v_NEW_SW);
            if (dr["ACCEPT_TOTAL"].ToString() != v_ACCEPT_TOTAL) InsertEDIT_DTL("ACCEPT_TOTAL", dr["ACCEPT_TOTAL"].ToString(), v_ACCEPT_TOTAL);
            if (dr["PUBLISH"].ToString() != v_PUBLISH) InsertEDIT_DTL("PUBLISH", dr["PUBLISH"].ToString(), v_PUBLISH);
            if (dr["MANUFACTURE"].ToString() != v_MANUFACTURE) InsertEDIT_DTL("MANUFACTURE", dr["MANUFACTURE"].ToString(), v_MANUFACTURE);
            if (dr["ROOT_NO"].ToString() != v_ROOT_NO) InsertEDIT_DTL("ROOT_NO", dr["ROOT_NO"].ToString(), v_ROOT_NO);
            if (dr["PUBLISHER_TYPE"].ToString() != v_PUBLISHER_TYPE) InsertEDIT_DTL("PUBLISHER_TYPE", dr["PUBLISHER_TYPE"].ToString(), v_PUBLISHER_TYPE);
            if ((dr["PUBLISH_DATE"] != System.DBNull.Value && v_PUBLISH_DATE == "") || (dr["PUBLISH_DATE"] == System.DBNull.Value && v_PUBLISH_DATE != ""))
                InsertEDIT_DTL("PUBLISH_DATE", (dr["PUBLISH_DATE"] != System.DBNull.Value ? DateTime.Parse(dr["PUBLISH_DATE"].ToString()).ToShortDateString() : ""), v_PUBLISH_DATE);
            else if (dr["PUBLISH_DATE"] != System.DBNull.Value && v_PUBLISH_DATE != "")
                if (DateTime.Parse(dr["PUBLISH_DATE"].ToString()) != DateTime.Parse(v_PUBLISH_DATE))
                    InsertEDIT_DTL("PUBLISH_DATE", DateTime.Parse(dr["PUBLISH_DATE"].ToString()).ToShortDateString(), v_PUBLISH_DATE);
            if (dr["VICE_ITEM_NAME"].ToString() != v_VICE_ITEM_NAME) InsertEDIT_DTL("VICE_ITEM_NAME", dr["VICE_ITEM_NAME"].ToString(), v_VICE_ITEM_NAME);
            if (dr["OUT_OF_PRINT"].ToString() != v_OUT_OF_PRINT) InsertEDIT_DTL("OUT_OF_PRINT", dr["OUT_OF_PRINT"].ToString(), v_OUT_OF_PRINT);
            if (dr["OPEN_SIZE"].ToString() != v_OPEN_SIZE) InsertEDIT_DTL("OPEN_SIZE", dr["OPEN_SIZE"].ToString(), v_OPEN_SIZE);
            if (dr["PAGE_NUM"].ToString() != v_PAGE_NUM) InsertEDIT_DTL("PAGE_NUM", dr["PAGE_NUM"].ToString(), v_PAGE_NUM);
            if (dr["CIP"].ToString() != v_CIP) InsertEDIT_DTL("CIP", dr["CIP"].ToString(), v_CIP);
            if (dr["EDIT_REASON"].ToString() != v_EDIT_REASON) InsertEDIT_DTL("EDIT_REASON", dr["EDIT_REASON"].ToString(), v_EDIT_REASON);
            if (dr["ITEM_PUBLISHER_NO"].ToString() != v_ITEM_PUBLISHER_NO) InsertEDIT_DTL("ITEM_PUBLISHER_NO", dr["ITEM_PUBLISHER_NO"].ToString(), v_ITEM_PUBLISHER_NO);
            if (dr["ITEM_PUBLISHER_NAME"].ToString() != v_ITEM_PUBLISHER_NAME) InsertEDIT_DTL("ITEM_PUBLISHER_NAME", dr["ITEM_PUBLISHER_NAME"].ToString(), v_ITEM_PUBLISHER_NAME);

            string strTemp = "";
            if (dr["LENGTH"].ToString().Trim() != "")
                strTemp = Convert.ToDecimal(dr["LENGTH"].ToString()).ToString("F2");
            if (strTemp != v_LENGTH)
                InsertEDIT_DTL("LENGTH", Convert.ToDecimal(dr["LENGTH"].ToString()).ToString("F2"), v_LENGTH);

            if (dr["WIDTH"].ToString().Trim() != "")
                strTemp = Convert.ToDecimal(dr["WIDTH"].ToString()).ToString("F2");
            if (strTemp != v_WEIGHT)
                InsertEDIT_DTL("WIDTH", Convert.ToDecimal(dr["WIDTH"].ToString()).ToString("F2"), v_WEIGHT);

            if (dr["HIEGHT"].ToString().Trim() != "")
                strTemp = Convert.ToDecimal(dr["HIEGHT"].ToString()).ToString("F2");
            if (strTemp != v_HEIGHT)
                InsertEDIT_DTL("HIEGHT", Convert.ToDecimal(dr["HIEGHT"].ToString()).ToString("F2"), v_HEIGHT);

            //Response.Write(string.Format("<script>alert('更改完成');location.replace('ITM012.aspx?ID={0}');</script>", v_ID));
            lblEDIT_NO.Text = v_EDIT_NO;
            //this.programmaticModalPopup.Show();
            Page currentPage = (Page)HttpContext.Current.Handler;
            string name = "Confirm_ITM012";
            string script = string.Format("alert('{0}');location.replace('{1}?Code={2}');", "異動序號:" + v_EDIT_NO, "ITM011.aspx", "ITM01");
            ScriptManager.RegisterClientScriptBlock(currentPage, currentPage.GetType(), name, script, true);
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }