protected void Page_Load(object sender, EventArgs e) { try { #region 清空Message this.ErrorMsgLabel.Text = string.Empty; this.RightMsgLabel.Text = string.Empty; #endregion if (!IsPostBack) { #region Attributes this.but_Close.Attributes["onclick"] += "window.close();"; #endregion #region 取得異常資料 #region 傳入參數 ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString()); #endregion #region 連結資料庫 BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB); DataTable dt_Return = bco.QUERYERRORBYFIND(ParameterList); #endregion #region 檢查回傳資料 if (dt_Return.Rows.Count == 0) { this.ErrorMsgLabel.Text = "查無資料"; return; } else { this.gv_Result.DataSource = dt_Return; this.gv_Result.DataBind(); } #endregion #endregion } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { } }
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; } }
/// <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; } }
/// <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; } }
/// <summary> /// 檢查條碼是否重覆 /// </summary> /// <param name="strBARCODE">商品條碼</param> /// <param name="strITEM">要排除的商品代號</param> /// <returns></returns> private bool CheckDup_BARCODE(string strBARCODE, string strITEM) { BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB); bool bResult = false; ArrayList arrPara = new ArrayList(); arrPara.Clear(); arrPara.Add(strITEM); arrPara.Add(strBARCODE); DataTable dt = bco.QueryBARCODE(arrPara); if (dt.Rows.Count > 0) bResult = true; return bResult; }
/// <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; } }
/// <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 }
/// <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; }
/// <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; } }