/// <summary> /// CRM07_1 /// </summary> /// <param name="Parameter">變數集</param> /// <param name="Dt">回傳結果</param> /// <returns>回傳成功失敗</returns> public bool CRM07_1(ArrayList ParameterList, ref DataTable Dt ) { bool Result = false; try { CRMModel.MaintainCRMOrderTransfer bco = new CRMModel.MaintainCRMOrderTransfer(ConntionDB); Dt = bco.ProcessCreateCRMOrderTransfer3(ParameterList, null); Result = true; } catch (Exception ex) { throw ex; } return Result; }
/// <summary> /// BUTTON [執行擷轉]鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //protected void but_Execute_Click() protected void but_Execute_Click(object sender, EventArgs e) { #region if (this.ErrorMsgLabel.Text != "") { return; } #endregion ArrayList arl_Return = new ArrayList(); DataTable Dt = null; string s_ErrorMsg = ""; BCO.CRMCommon CRMComm = new BCO.CRMCommon(); #region 建立暫存表格 //DataTable dt_Parameter = new DataTable(); //DataColumn dc_Parameter_TRANS_DATE = new DataColumn("TRANS_DATE", System.Type.GetType("System.String")); //DataColumn dc_Parameter_ST_ACCEPT_DATE = new DataColumn("ST_ACCEPT_DATE", System.Type.GetType("System.String")); //DataColumn dc_Parameter_ROOT_NO = new DataColumn("ROOT_NO", System.Type.GetType("System.String")); //DataColumn dc_Parameter_USER_ID = new DataColumn("USER_ID", System.Type.GetType("System.String")); //DataColumn dc_Parameter_ID = new DataColumn("ID", System.Type.GetType("System.Int32")); //DataColumn dc_Parameter_PID = new DataColumn("PID", System.Type.GetType("System.Int32")); //dt_Parameter.Columns.Add(dc_Parameter_TRANS_DATE); //dt_Parameter.Columns.Add(dc_Parameter_ST_ACCEPT_DATE); //dt_Parameter.Columns.Add(dc_Parameter_ROOT_NO); //dt_Parameter.Columns.Add(dc_Parameter_USER_ID); //dt_Parameter.Columns.Add(dc_Parameter_ID); //dt_Parameter.Columns.Add(dc_Parameter_PID); #endregion try { #region 傳入參數 ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(slp_up_TRANS_DATE.Text); ParameterList.Add(slp_ST_ACCEPT_DATE.Text); ParameterList.Add(slp_ROOT_NO.Text); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(string.Format("{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString())); //--------------------------------------------------------------------- #region oldest //foreach (GridViewRow gvRow in this.gv_WaitForWork.Rows) //{ // CheckBox chk_Sgl = (CheckBox)gvRow.FindControl("chk_Sgl"); // HiddenField hid_ID = (HiddenField)gvRow.FindControl("hid_ID"); // HiddenField hid_PID = (HiddenField)gvRow.FindControl("hid_PID"); // if (chk_Sgl.Checked == true) // { // DataRow dr_Parameter = dt_Parameter.NewRow(); // dr_Parameter["TRANS_DATE"] = CRMComm.GetValueSetParameter(this.slp_up_TRANS_DATE.Text, "string", false); // dr_Parameter["ST_ACCEPT_DATE"] = CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "string", false); // dr_Parameter["ROOT_NO"] = CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false); // dr_Parameter["USER_ID"] = Session["UID"].ToString(); // dr_Parameter["ID"] = int.Parse(hid_ID.Value.Trim()); // dr_Parameter["PID"] = int.Parse(hid_PID.Value.Trim()); // dt_Parameter.Rows.Add(dr_Parameter); // } //} #endregion #region old //string SessionIDName = "CRM071_gv_WaitForWork" + PageTimeStamp.Value; //DataTable dtTemp = (DataTable)Session[SessionIDName]; //string s_Checked, s_ID, s_PID; //foreach (DataRow drTemp in dtTemp.Rows) //{ // s_Checked = drTemp["CHECKED"].ToString().Trim(); // s_ID = drTemp["ID"].ToString().Trim(); // s_PID = drTemp["PID"].ToString().Trim(); // if (s_Checked != "0")//表示未被設成【未勾選】 // { // DataRow dr_Parameter = dt_Parameter.NewRow(); // dr_Parameter["TRANS_DATE"] = CRMComm.GetValueSetParameter(this.slp_up_TRANS_DATE.Text, "string", false); // dr_Parameter["ST_ACCEPT_DATE"] = CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "string", false); // dr_Parameter["ROOT_NO"] = CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false); // dr_Parameter["USER_ID"] = Session["UID"].ToString(); // dr_Parameter["ID"] = int.Parse(s_ID); // dr_Parameter["PID"] = int.Parse(s_PID); // dt_Parameter.Rows.Add(dr_Parameter); // } //} #endregion //if (dt_Parameter.Rows.Count == 0) //{ // this.ErrorMsgLabel.Text = "請選擇待擷轉品項"; // return; //} //--------------------------------------------------------------------- #endregion #region 連結資料庫 BCO.MaintainCRMOrderTransfer bco = new BCO.MaintainCRMOrderTransfer(ConntionDB); //arl_Return = bco.ProcessCreateCRMOrderTransfer(ParameterList, dt_Parameter, null, out s_ErrorMsg); iTransferResult = 0; //arl_Return = bco.ProcessCreateCRMOrderTransfer3(ParameterList, null); Dt = bco.ProcessCreateCRMOrderTransfer3(ParameterList, null); #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; this.up_Msg.Update(); } finally { #region string s_ScriptManager_Script = string.Empty; if (arl_Return != null && arl_Return.Count > 0) { if (arl_Return[0].ToString() == "1") iTransferResult = 1; if (arl_Return[0].ToString() == "1" && arl_Return[1].ToString() == string.Empty)//代表處理成功 { #region TextBox txt_Handle_Count = (TextBox)this.slp_Handle_Count.FindControl("TextBoxCode"); txt_Handle_Count.Text = arl_Return[3].ToString(); txt_Handle_TRANS_NO.Text = arl_Return[2].ToString(); this.RightMsgLabel.Text = "執行擷轉成功,請按【檢視異常報表】查詢本次擷轉異常資料。"; this.up_Msg.Update(); if (this.slp_ROOT_NO.Text == "2") // 圖書時直接轉手開單,並做配本確認 { #region 圖書 string SessionIdName = "POP_QueryDisNo_" + PageTimeStamp.Value; Session[SessionIdName] = null; ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(slp_ROOT_NO.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(slp_up_TRANS_DATE.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(slp_ST_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter("", "string", false)); //0代表未逾期客訂,1代表是逾期客訂 ParameterList.Add(CRMComm.GetValueSetParameter(arl_Return[2].ToString().Trim(), "string", false));//擷轉序號起 ParameterList.Add(CRMComm.GetValueSetParameter(arl_Return[2].ToString().Trim(), "string", false));//擷轉序號迄 ParameterList.Add(Session["UID"].ToString()); Session[SessionIdName] = ParameterList; s_ScriptManager_Script += "$get('" + txt_Handle_TRANS_NO.ClientID + "').value = '" + arl_Return[2].ToString() + @"';" + "$get('" + txt_Handle_Count.ClientID + "').value = '" + arl_Return[3].ToString() + @"';"; s_ScriptManager_Script += "alert('圖書擷轉手開單產生成功!');"; s_ScriptManager_Script += string.Format(@"POP_QueryDisNo('{0}','{1}','{2}','{3}','{4}','{5}');", slp_ROOT_NO.Text, slp_up_TRANS_DATE.Text, slp_ST_ACCEPT_DATE.Text, "0", //非逾期 arl_Return[2].ToString(),//擷轉序號起=擷轉序號迄 arl_Return[2].ToString()); ScriptManager.RegisterStartupScript(this.up_Execute, typeof(UpdatePanel), "CRM071", s_ScriptManager_Script, true); #endregion } else { #region 雜誌 s_ScriptManager_Script += "$get('" + txt_Handle_TRANS_NO.ClientID + "').value = '" + arl_Return[2].ToString() + @"';" + "$get('" + txt_Handle_Count.ClientID + "').value = '" + arl_Return[3].ToString() + @"';"; ScriptManager.RegisterStartupScript(this.up_Execute, typeof(UpdatePanel), "CRM071", s_ScriptManager_Script, true); #endregion } #endregion } else { this.ErrorMsgLabel.Text = "執行擷轉有異常:" + arl_Return[1].ToString(); this.up_Msg.Update(); } } else { //this.ErrorMsgLabel.Text = "無法建立擷轉資料,執行擷轉發生異常"; if (s_ErrorMsg != "") { this.ErrorMsgLabel.Text = s_ErrorMsg; } else { this.ErrorMsgLabel.Text = "執行擷轉失敗!"; } this.up_Msg.Update(); } CRMComm = null; //ScriptManager.RegisterStartupScript(this.up_Execute, typeof(UpdatePanel), "CRM071", "but_Execute_End();" + s_ScriptManager_Script, true); #endregion } }