/// <summary> /// 背景常駐AJAX程式 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void time_New_Msg_Tick(object sender, EventArgs e) { try { if (this.imgbut_New_Msg.Visible == false && this.lab_New_Msg.Visible == false) { #region 從資料庫讀取資料 BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB); BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(string.Empty, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(string.Empty, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter("20", "int", false)); ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false)); DataSet ds_Return = new DataSet(); ds_Return.Tables.Add(bco.QuerySwitch(BCO.MaintainCRMessage.QueryType.QueryCRMMessageByFind, ParameterList).Copy()); #endregion if (ds_Return.Tables[0].Rows.Count > 0) { #region 使用XML轉回DataSet DataSet ds_OldData = new DataSet(); System.IO.StringReader sr_OldData = new System.IO.StringReader(xml_MessageOLDData.InnerHtml); ds_OldData.ReadXml(sr_OldData); #endregion #region 比對資料 DateTime d_DataBaseFirst = DateTime.Parse(ds_Return.Tables[0].Rows[0]["UPDATEDATE"].ToString());//新資料 DateTime d_OldDataFirst = DateTime.Now.AddYears((DateTime.Now.Year * -1) + 1); if (ds_OldData.Tables.Count > 0) { d_OldDataFirst = DateTime.Parse(ds_OldData.Tables[0].Rows[0]["UPDATEDATE"].ToString()); }//舊資料 if (d_DataBaseFirst != d_OldDataFirst) { this.lab_New_Msg.Visible = true; this.imgbut_New_Msg.Visible = true; } #endregion } } //2010/10/19 added this.txt_ANSWER_TIME.Text = DateTime.Now.ToString("HH:mm");//接聽時間 yyyy/MM/dd HH:mm:ss up_Master.Update(); } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { GetPageDefault(); } }
/// <summary> /// BUTTON 查詢前三筆紀錄 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Down_Record_Three_Click(object sender, EventArgs e) { try { #region 檢查條件 System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (this.slp_Up_CHAN_NO.Text.Trim() == string.Empty) { sb.Append("欄位[通路]為必填欄位<br/>"); } if (this.slp_STORE.Text.Trim() == string.Empty) { sb.Append("欄位[門市]為必填欄位<br/>"); } if (sb.ToString() != string.Empty) { this.ErrorMsgLabel.Text = sb.ToString(); return; } #endregion #region 傳入參數 BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Up_CHAN_NO.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_STORE.Text, "string", false)); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); #endregion #region 連結資料庫 BCO.RecordCRMRecord bco = new BCO.RecordCRMRecord(ConntionDB); DataTable dt_Return = bco.QuerySwitch(BCO.RecordCRMRecord.QueryType.QueryLastThreeCRMRecord, ParameterList); #endregion #region 繫結GridView this.gv_Three.DataSource = dt_Return.DefaultView; this.gv_Three.DataBind(); #endregion #region 檢查回傳資料 if (dt_Return.Rows.Count == 0) { ScriptManager.RegisterStartupScript(this.up_Three, typeof(UpdatePanel), "隨便寫", "alert('查無資料!');", true); } #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { GetPageDefault(); } }
/// <summary> /// BUTTON 下面的查詢鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Down_Query_Click(object sender, EventArgs e) { try { #region 檢查條件 System.Text.StringBuilder sb = new System.Text.StringBuilder(); //if (this.slp_Down_Date.Text.Trim() == string.Empty) //{ sb.Append("欄位[日期]為必填欄位<br/>"); } //if (this.slp_Down_CHAN_NO.Text.Trim() == string.Empty) //{ sb.Append("欄位[通路]為必填欄位<br/>"); } if (sb.ToString() != string.Empty) { this.ErrorMsgLabel.Text = sb.ToString(); return; } #endregion #region 從資料庫讀取資料 BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB); BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Down_Date.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Down_CHAN_NO.Text, "string", this.CheckBoxLikeSearch.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter((this.TextBoxRowCountLimit.Text == "") ? "10" : (int.Parse(TextBoxRowCountLimit.Text) < 0) ? "10" : TextBoxRowCountLimit.Text, "int", false)); ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false)); DataSet ds_Return = new DataSet(); ds_Return.Tables.Add(bco.QuerySwitch(BCO.MaintainCRMessage.QueryType.QueryCRMMessageByFind, ParameterList).Copy()); #endregion #region 使用XML放置到前端資料 xml_MessageOLDData.InnerHtml = ds_Return.GetXml(); #endregion #region 將資料與 GridView Binding //抓取本頁初次登記的時間 string SessionIDName = "CRM011_" + PageTimeStamp.Value; Session["SessionID"] = SessionIDName; Session[SessionIDName] = ds_Return.Tables[0]; this.gv_Message.DataSource = ds_Return.Tables[0].DefaultView; this.gv_Message.PageSize = (this.TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); this.gv_Message.DataBind(); #endregion #region 檢查回傳資料 if (ds_Return.Tables[0].Rows.Count == 0) { this.ErrorMsgLabel.Text = "查無資料"; } #endregion this.lab_New_Msg.Visible = false; this.imgbut_New_Msg.Visible = false; } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { GetPageDefault(); } }
private DataTable GetData() { #region 傳入參數 BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); if (this.chkCOMIC.Checked) { ParameterList.Add(CRMComm.GetValueSetParameter("1", "string", false)); } else { ParameterList.Add(CRMComm.GetValueSetParameter("0", "string", false)); } ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_CHAN_NO_B.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_CHAN_NO_E.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_STORE_B.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_STORE_E.Text, "string", false)); ParameterList.Add(Session["UID"].ToString()); #endregion #region 取得資料 BCO.QueryCRMStoreTag bco = new BCO.QueryCRMStoreTag(ConntionDB); DataTable dt_Result = new DataTable(); dt_Result = bco.QueryOutDisCRMStore(ParameterList); #endregion return dt_Result; }
}//設定各種模式預設值 private void GetCustomerMessage() { #region 從資料庫讀取資料 BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB); BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(string.Empty, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(string.Empty, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter("20", "int", false)); ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false)); DataSet ds_Return = new DataSet(); ds_Return.Tables.Add(bco.QuerySwitch(BCO.MaintainCRMessage.QueryType.QueryCRMMessageByFind, ParameterList).Copy()); #endregion #region 使用XML放置到前端資料 xml_MessageOLDData.InnerHtml = ds_Return.GetXml(); #endregion #region 將資料與 GridView Binding //抓取本頁初次登記的時間 string SessionIDName = "CRM011_" + PageTimeStamp.Value; Session["SessionID"] = SessionIDName; Session[SessionIDName] = ds_Return.Tables[0]; this.gv_Message.DataSource = ds_Return.Tables[0].DefaultView; this.gv_Message.PageSize = 5; this.gv_Message.PageIndex = 0; this.gv_Message.DataBind(); #endregion }
/// <summary> /// BUTTON [執行]鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Execute_Click(object sender, EventArgs e) { BCO.CRMCommon CRMComm = new BCO.CRMCommon(); try { #region 建立 Temp Table,將待處理的資料寫入 Temp Table DataTable dt_Temp = new DataTable(); DataColumn dc_ITEM = new DataColumn("ITEM", System.Type.GetType("System.String"));//品號 DataColumn dc_PERIOD = new DataColumn("PERIOD", System.Type.GetType("System.String"));//期別 DataColumn dc_USER_ID = new DataColumn("USER_ID", System.Type.GetType("System.String"));//登入人員 DataColumn dc_CHECKED = new DataColumn("CHECKED", System.Type.GetType("System.String"));//勾選狀態 DataColumn dc_ID = new DataColumn("ID", System.Type.GetType("System.String"));//勾選狀態 DataColumn dc_PID = new DataColumn("PID", System.Type.GetType("System.String"));//勾選狀態 dt_Temp.Columns.Add(dc_ITEM); dt_Temp.Columns.Add(dc_PERIOD); dt_Temp.Columns.Add(dc_USER_ID); dt_Temp.Columns.Add(dc_CHECKED); dt_Temp.Columns.Add(dc_ID); dt_Temp.Columns.Add(dc_PID); //--------------------------------------------------------------------- #region old //foreach (GridViewRow gvRow in this.gv_Query_Result.Rows) //{ // CheckBox chk_Sgl = (CheckBox)gvRow.FindControl("chk_Sgl"); // if (chk_Sgl.Checked == true) // { // DataRow dRow = dt_Temp.NewRow(); // dRow["ITEM"] = gvRow.Cells[0].Text; // dRow["PERIOD"] = gvRow.Cells[2].Text; // dRow["USER_ID"] = Session["UID"].ToString(); // dRow["CHECKED"] = "TRUE"; // //if (chk_Sgl.Checked == true) // //{ dRow["CHECKED"] = "TRUE"; } // //else // //{ dRow["CHECKED"] = "FALSE"; } // dRow["ID"] = ((Label)gvRow.FindControl("lblID")).Text; // dRow["PID"] = ((Label)gvRow.FindControl("lblPID")).Text; // dt_Temp.Rows.Add(dRow); // } //} #endregion #region new string SessionIDName = "CRM081_" + PageTimeStamp.Value; DataTable dtTemp2 = (DataTable)Session[SessionIDName]; string s_Checked, s_ID, s_PID; foreach (DataRow drTemp2 in dtTemp2.Rows) { s_Checked = drTemp2["CHECKED"].ToString().Trim(); s_ID = drTemp2["ID"].ToString().Trim(); s_PID = drTemp2["PID"].ToString().Trim(); if (s_Checked != "0")//表示未被設成【未勾選】 { DataRow dr_Parameter = dt_Temp.NewRow(); dr_Parameter["ITEM"] = drTemp2["ITEM"].ToString().Trim(); dr_Parameter["PERIOD"] = drTemp2["PERIOD"].ToString().Trim(); dr_Parameter["USER_ID"] = Session["UID"].ToString(); dr_Parameter["CHECKED"] = "TRUE"; dr_Parameter["ID"] = int.Parse(s_ID); dr_Parameter["PID"] = int.Parse(s_PID); dt_Temp.Rows.Add(dr_Parameter); } } #endregion //--------------------------------------------------------------------- //異動 VDS_CRM_08_TMP 的 UPDATEUID BCO.ProcessCRMHQStock bco = new BCO.ProcessCRMHQStock(ConntionDB); bco.CheckTrankData2(dt_Temp, Session["UID"].ToString(), null); #endregion #region 參數[PreCalculateQty]預算處理項目 ArrayList arl_PreCalculateQty = new ArrayList(); arl_PreCalculateQty.Clear(); arl_PreCalculateQty.Add(Session["UID"].ToString()); #endregion #region 參數[ProcessCRMTransTmpForHQStock]執行 ArrayList arl_ProcessCRMTransTmpForHQStock = new ArrayList(); arl_ProcessCRMTransTmpForHQStock.Clear(); arl_ProcessCRMTransTmpForHQStock.Add(GetValueSetParameter(this.slp_TRANS_DATE.Text, "string", false)); arl_ProcessCRMTransTmpForHQStock.Add(GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "string", false)); arl_ProcessCRMTransTmpForHQStock.Add(Session["UID"].ToString()); #endregion #region 處理資料 ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString()); ArrayList arl_Return = new ArrayList(); arl_Return = bco.PreCalculateQty(dt_Temp, arl_PreCalculateQty, null); bco.ProcessCRMTransTmpForHQStock(arl_ProcessCRMTransTmpForHQStock, null); #endregion #region 將資料顯示在畫面上 this.RightMsgLabel.Text = "手開單產生成功"; string s_ScriptManager_Script = string.Empty; s_ScriptManager_Script = @" if (document.getElementById('" + this.lab_Expect_Store.ClientID + @"')) { document.getElementById('" + this.lab_Expect_Store.ClientID + @"').innerHTML = '" + arl_Return[0].ToString() + @"';} if (document.getElementById('" + this.lab_Expect_Item_Count.ClientID + @"')) { document.getElementById('" + this.lab_Expect_Item_Count.ClientID + @"').innerHTML = '" + arl_Return[1].ToString() + @"';} if (document.getElementById('" + this.lab_Expect_Count.ClientID + @"')) { document.getElementById('" + this.lab_Expect_Count.ClientID + @"').innerHTML = '" + arl_Return[2].ToString() + @"'; } if (document.getElementById('" + this.lab_Execute_Store.ClientID + @"')) { document.getElementById('" + this.lab_Execute_Store.ClientID + @"').innerHTML = '" + arl_Return[0].ToString() + @"'; } if (document.getElementById('" + this.lab_Execute_Item_Count.ClientID + @"')) { document.getElementById('" + this.lab_Execute_Item_Count.ClientID + @"').innerHTML = '" + arl_Return[1].ToString() + @"';} if (document.getElementById('" + this.lab_Execute_Count.ClientID + @"')) { document.getElementById('" + this.lab_Execute_Count.ClientID + @"').innerHTML = '" + arl_Return[2].ToString() + @"'; } if (document.getElementById('" + this.but_Execute.ClientID + @"')) { document.getElementById('" + this.but_Execute.ClientID + @"').disabled = true; } if (document.getElementById('" + this.but_Trans_Error.ClientID + @"')) { document.getElementById('" + this.but_Trans_Error.ClientID + @"').disabled = true; } if (document.getElementById('" + this.but_Query.ClientID + @"')) { document.getElementById('" + this.but_Query.ClientID + @"').disabled = false; } if (document.getElementById('" + this.but_Expect_Item.ClientID + @"')) { document.getElementById('" + this.but_Expect_Item.ClientID + @"').disabled = true; } "; #region 預設POP查詢使用參數 string SessionIdName = "POP_QueryDisNo_" + PageTimeStamp.Value; Session[SessionIdName] = null; ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_TRANS_DATE.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter("", "string", false)); //0代表未逾期客訂,1代表是逾期客訂 ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_TRANS_NO_B.Text.Trim(), "string", false));//擷轉序號起 ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_TRANS_NO_E.Text.Trim(), "string", false));//擷轉序號迄 ParameterList.Add(Session["UID"].ToString()); Session[SessionIdName] = ParameterList; #endregion s_ScriptManager_Script += "alert('手開單產生成功');"; s_ScriptManager_Script += string.Format(@"POP_QueryDisNo('{0}','{1}','{2}','{3}','{4}','{5}');", slp_ROOT_NO.Text, slp_TRANS_DATE.Text, slp_ST_ACCEPT_DATE.Text, "0", //非逾期 txt_TRANS_NO_B.Text.ToString(), txt_TRANS_NO_E.Text.ToString()); ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CRM081", s_ScriptManager_Script, true); #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; #region 控制Button string s_ScriptManager_Script = string.Empty; s_ScriptManager_Script = @" if (document.getElementById('" + this.but_Trans_Error.ClientID + @"')) { document.getElementById('" + this.but_Trans_Error.ClientID + @"').disabled = false; } "; ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CRM081", s_ScriptManager_Script, true); #endregion } finally { CRMComm = null; } }
protected void gv_Item_Detl_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { #region 傳入參數 TextBox txt_MEMO = (TextBox)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("txt_MEMO"); HiddenField hid_TRANS_DATE = (HiddenField)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("hid_TRANS_DATE"); Label lab_ITEM = (Label)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("lab_ITEM"); Label lab_PERIOD = (Label)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("lab_PERIOD"); Label lab_SRC_LOCATE_NO = (Label)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("lab_SRC_LOCATE_NO"); Label lab_DST_LOCATE_NO = (Label)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("lab_DST_LOCATE_NO"); if (GetStringLen(txt_MEMO.Text.Trim()) > txt_MEMO.MaxLength) { //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CRM071", "alert('[注意事項]欄位輸入資料長度過長');", true); throw new Exception("[注意事項]欄位輸入資料長度過長"); return; } BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(CRMComm.GetValueSetParameter(txt_MEMO.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(hid_TRANS_DATE.Value, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(lab_ITEM.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(lab_PERIOD.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(lab_SRC_LOCATE_NO.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(lab_DST_LOCATE_NO.Text, "string", false)); #endregion #region 儲存明細編輯資訊 BCO.RecordCRMOrder bco = new BCO.RecordCRMOrder(ConntionDB); bco.UpdateTransferMemo(ParameterList, null); #endregion this.RightMsgLabel.Text = "更新成功"; } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; return; } //finally //{ HiddenField hid_TRANS_DATE2 = (HiddenField)this.gv_Item_Detl.Rows[e.RowIndex].FindControl("hid_TRANS_DATE"); this.gv_Item_Detl.EditIndex = -1; int i_PageSize = this.gv_Item_Detl.PageSize; int i_PageIndex = this.gv_Item_Detl.PageIndex; Get_Trans_Detl_Data(hid_TRANS_DATE2.Value, i_PageSize, i_PageIndex); //} }
/// <summary> /// BUTTON [檢視異常報表]鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Trans_Error_Click(object sender, EventArgs e) { try { #region 將變數寫入Session Session["POP_CRMTransError2_ParameterList"] = null; BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_up_TRANS_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); //ParameterList.Add(CRMComm.GetValueSetParameter("0", "string", false));//0代表未逾期客訂,1代表是逾期客訂 ParameterList.Add(DBNull.Value);//DBNull.Value代表全部 ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_Handle_TRANS_NO.Text.Trim(), "string", false));//擷轉序號起 ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_Handle_TRANS_NO.Text.Trim(), "string", false));//擷轉序號迄 ParameterList.Add(Session["UID"].ToString()); Session["POP_CRMTransError2_ParameterList"] = ParameterList; #endregion #region 設定 Url & Style string s_Url = string.Empty; string s_Style = string.Empty; s_Url = "../CRM/POP/POP_CRMTransError.aspx"; s_Style = "dialogWidth:800px;dialogHeight:600px;status=yes;help=no;center;scroll=yes;"; #endregion if (iTransferResult == 1)//如果擷轉成功或第一次進入 { //轉頁 Response.Redirect(string.Format("CRM07A.aspx?Code=CRM07&TransDate={0}&StAcceptDate={1}&RootNo={2}&IsOverDue={3}&TransNoBegin={4}&TransNoEnd={5}&PageTimeStamp={6}", slp_up_TRANS_DATE.Text, slp_ST_ACCEPT_DATE.Text, slp_ROOT_NO.Text, DBNull.Value, txt_Handle_TRANS_NO.Text.Trim(), txt_Handle_TRANS_NO.Text.Trim(), PageTimeStamp.Value)); } else { //開POP視窗 ScriptManager.RegisterStartupScript(this.up_Trans_Error, typeof(UpdatePanel), "CRM071", "window.showModalDialog('" + s_Url + "','','" + s_Style + "');", true); } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { } }
private DataTable databind() { #region 傳入參數 string s_slp_GRADE_String = string.Empty; string s_slp_PROC_FLAG_String = string.Empty; BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_CHAN_NO.Text, "string", this.chb_Like_Search.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_STORE.Text, "string", this.chb_Like_Search.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_CRM_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_CRM_NO.Text, "string", this.chb_Like_Search.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_CODE.Text, "string", this.chb_Like_Search.Checked)); //客服單號 //ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_REQUEST_NO.Text, "string", this.chb_Like_Search.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_REQUEST_NO.Text, "string", this.chb_Like_Search.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_GRADE.Text, "int", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_PROC_FLAG.Text, "int", false)); //ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_PROC_UNIT.Text, "string", this.chb_Like_Search.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_PROC_UNIT.Text, "string", this.chb_Like_Search.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_PROC_MAN.Text, "string", this.chb_Like_Search.Checked)); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); ParameterList.Add(TextBoxRowCountLimit.Text.Trim().Length == 0 ? "10" : TextBoxRowCountLimit.Text); #endregion #region 讀取資料 DataTable dt_Ticket = new DataTable(); BCO.RecordCRMTicket bco = new BCO.RecordCRMTicket(ConntionDB); dt_Ticket = bco.QueryByFind(ParameterList); #endregion #region 資料與GridView繫結 //抓取本頁初次登記的時間 string SessionIDName = "CRM031_" + PageTimeStamp.Value; Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt_Ticket; this.gv_Ticket.DataSource = dt_Ticket.DefaultView; this.gv_Ticket.PageSize = (this.TextBoxPagesize.Text == string.Empty) ? 10 : (int.Parse(this.TextBoxPagesize.Text) < 0) ? 10 : int.Parse(this.TextBoxPagesize.Text); this.gv_Ticket.PageIndex = 0; this.gv_Ticket.DataBind(); #endregion return dt_Ticket; }
/// <summary> /// BUTTON [查詢]鈕(上方) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_up_Query_Click(object sender, EventArgs e) { #region try { #region 清空商品儲區移轉明細資料 //抓取本頁初次登記的時間 this.gv_Item_Detl.DataSource = null; this.gv_Item_Detl.DataBind(); Session["CRM071_gv_Item_Detl" + PageTimeStamp.Value] = null; #endregion #region 檢查條件 string s_CheckPage = CheckPage(sender); if (s_CheckPage != string.Empty) { this.ErrorMsgLabel.Text = s_CheckPage; return; } #endregion #region 傳入參數 BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_up_TRANS_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); ParameterList.Add(Session["UID"].ToString()); #endregion #region 取得資料 DataTable dt_Return = new DataTable(); BCO.RecordCRMOrder bco = new BCO.RecordCRMOrder(ConntionDB); dt_Return = bco.QueryForTransfer(ParameterList); bAfterQueryDataBinding = true; if (dt_Return != null && !dt_Return.Columns.Contains("CHECKED"))//增加欄位以方便判別是否已勾選 dt_Return.Columns.Add("CHECKED"); #endregion #region 資料與GridView繫結 //抓取本頁初次登記的時間 string SessionIDName = "CRM071_gv_WaitForWork" + PageTimeStamp.Value; Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt_Return; this.gv_WaitForWork.DataSource = dt_Return; this.gv_WaitForWork.PageSize = (TextBoxPagesize_Query.Text == "") ? 20 : (int.Parse(TextBoxPagesize_Query.Text) <= 0) ? 20 : int.Parse(TextBoxPagesize_Query.Text); this.gv_WaitForWork.DataBind(); bAfterQueryDataBinding = false; #endregion #region 檢查是否有資料 string s_ScriptManager_Script = string.Empty; if (dt_Return.Rows.Count == 0) { s_ScriptManager_Script = @" document.getElementById('" + this.panel_Tab2.ClientID + @"').style.display = 'none'; document.getElementById('" + this.but_Execute.ClientID + @"').disabled = true;"; this.ErrorMsgLabel.Text = "查無資料"; } else { s_ScriptManager_Script = @" document.getElementById('" + this.panel_Tab2.ClientID + @"').style.display = 'block'; document.getElementById('" + this.but_Execute.ClientID + @"').disabled = false;"; } ScriptManager.RegisterStartupScript(this.up_gv_WaitForWork, typeof(UpdatePanel), "CRM071", s_ScriptManager_Script, true); #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { } #endregion }
/// <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 } }
/// <summary> /// 取得商品儲區擷轉明細 /// </summary> private DataTable Get_Trans_Detl_Data(string s_TRANS_DATE, int i_PageSize, int i_PageIndex) { #region 傳入參數 BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(s_TRANS_DATE, "date", false)); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(GetValueSetParameter(this.TextBoxRowCountLimit.Text.Trim(), "int", false)); #endregion #region 取得資料 DataTable dt_Return = new DataTable(); BCO.MaintainCRMOrderTransfer bco = new BCO.MaintainCRMOrderTransfer(ConntionDB); dt_Return = bco.QueryCRMStockTransfer(ParameterList); #endregion #region 資料與GridView繫結 //抓取本頁初次登記的時間 string SessionIDName = "CRM071_gv_Item_Detl" + PageTimeStamp.Value; DataView dv_Return = new DataView(dt_Return); if (ViewState["SortField_gv_Item_Detl"] != null && ViewState["SortDirect_gv_Item_Detl"] != null) { dv_Return.Sort = ViewState["SortField_gv_Item_Detl"].ToString() + ViewState["SortDirect_gv_Item_Detl"].ToString(); } Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt_Return; this.gv_Item_Detl.DataSource = dv_Return; this.gv_Item_Detl.PageSize = i_PageSize; this.gv_Item_Detl.PageIndex = i_PageIndex; this.gv_Item_Detl.DataBind(); #endregion return dt_Return; }
protected void but_CheckDup_Click(object sender, EventArgs e) { string Err; if (slp_ROOT_NO.Text == "1") { ErrorMsgLabel.Text ="雜誌無檢核功能!"; up_Msg.Update(); return; } BCO.MaintainCRMOrderTransfer bco = new BCO.MaintainCRMOrderTransfer(ConntionDB); BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); bco.CheckDup(ParameterList,out Err); if (Err != string.Empty) { ErrorMsgLabel.Text = Err; } else { ErrorMsgLabel.Text = "查無重複品項"; } up_Msg.Update(); }
public static string CRM07AJAXPOPSession(string PageTimeStamp, string RootNo, string TransDate, string STAcceptDate, string PocTransNo, string UID ) { BCO.CRMCommon CRMComm = new BCO.CRMCommon(); CRM_CRM071 CRMJOBPage = new CRM_CRM071(); string SessionIdName = "POP_QueryDisNo_" + PageTimeStamp; CRMJOBPage.Session[SessionIdName] = null; ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(RootNo, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(TransDate, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(STAcceptDate, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter("", "string", false)); //0代表未逾期客訂,1代表是逾期客訂 ParameterList.Add(CRMComm.GetValueSetParameter(PocTransNo, "string", false));//擷轉序號起 ParameterList.Add(CRMComm.GetValueSetParameter(PocTransNo, "string", false));//擷轉序號迄 ParameterList.Add(UID); CRMJOBPage.Session[SessionIdName] = ParameterList; return "OK"; }
}//UC_RecPre #endregion Toolbar #region GridView gv_Message protected void gv_Message_RowCommand(object sender, GridViewCommandEventArgs e) { try { ArrayList ParameterList = new ArrayList();//20091117 if (this.hid_Page_Status.Value != "INSERT" && this.hid_Page_Status.Value != "EDIT") { if (e.CommandName == "del") { //System.Threading.Thread.Sleep(2000); int i_GridView_Index_del = int.Parse(e.CommandArgument.ToString()); #region 使用XML轉回DataSet DataSet ds_MessageOldData = new DataSet(); System.IO.StringReader sr_MessageOldData = new System.IO.StringReader(xml_MessageOLDData.InnerHtml); ds_MessageOldData.ReadXml(sr_MessageOldData); #endregion #region 刪除所選取的資料 string s_CODE = string.Empty; s_CODE = ((HiddenField)this.gv_Message.Rows[i_GridView_Index_del].FindControl("HiddenField1")).Value; DataRow dRow = ds_MessageOldData.Tables[0].Select("CODE = '" + s_CODE + "'")[0]; //if (ds_MessageOldData.Tables.Count > 0) //{ // DataRow[] Rows = ds_MessageOldData.Tables[0].Select("CODE = '" + s_CODE +"'"); // dRow = Rows[0];// //} ParameterList.Clear(); ParameterList.Add(dRow["ID"]); ParameterList.Add(dRow["CODE"]); ParameterList.Add(dRow["CREATEDATE"]); ParameterList.Add(dRow["CREATEUID"]); ParameterList.Add(dRow["UPDATEDATE"]); ParameterList.Add(dRow["UPDATEUID"]); ParameterList.Add(dRow["ENABLE"]); ParameterList.Add(dRow["ACT_DATE"]); ParameterList.Add(dRow["CHAN_NO"]); ParameterList.Add(dRow["MESSAGE"]); ParameterList.Add(DateTime.Now); ParameterList.Add(Session["UID"].ToString()); BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB); bco.DeletCRMMessage(ParameterList, null); #endregion #region 重新讀取 gv_Message 資料 BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Down_Date.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Down_CHAN_NO.Text, "string", this.CheckBoxLikeSearch.Checked)); ParameterList.Add(CRMComm.GetValueSetParameter((this.TextBoxRowCountLimit.Text == "") ? "10" : (int.Parse(TextBoxRowCountLimit.Text) < 0) ? "10" : TextBoxRowCountLimit.Text, "int", false)); ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false)); DataSet ds_Return = new DataSet(); ds_Return.Tables.Add(bco.QuerySwitch(BCO.MaintainCRMessage.QueryType.QueryCRMMessageByFind, ParameterList).Copy()); #region 使用XML放置到前端資料 xml_MessageOLDData.InnerHtml = ds_Return.GetXml(); #endregion //抓取本頁初次登記的時間 string SessionIDName = "CRM011_" + PageTimeStamp.Value; Session["SessionID"] = SessionIDName; Session[SessionIDName] = ds_Return.Tables[0]; this.gv_Message.DataSource = ds_Return.Tables[0].DefaultView; this.gv_Message.DataBind(); #endregion this.RightMsgLabel.Text = "刪除成功"; } else if (e.CommandName == "edi") { int i_GridView_Index_edi = int.Parse(e.CommandArgument.ToString()); #region 處理Session Session["POP_CRM01A2_Mode"] = null; Session["POP_CRM01A2_CRM011_CODE"] = null; Session["POP_CRM01A2_Mode"] = "EDIT"; Session["POP_CRM01A2_CRM011_CODE"] = ((HiddenField)this.gv_Message.Rows[i_GridView_Index_edi].FindControl("HiddenField1")).Value; #endregion //#region 設定 Url & Style //string s_Url = string.Empty; //string s_Style = string.Empty; //s_Url = "../CRM/POP/POP_CRM01A.aspx"; //s_Style = "dialogWidth:800px;dialogHeight:600px;status=yes;help=no;center;scroll=yes;"; //#endregion //ScriptManager.RegisterStartupScript(this.up_Message, typeof(UpdatePanel), "CRM011", "window.showModalDialog('" + s_Url + "','','" + s_Style + "');", true); ScriptManager.RegisterStartupScript(this.up_Message, typeof(UpdatePanel), "CRM011", "POP_CRMMessage();", true); } } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { GetPageDefault(); } }
/// <summary> /// BUTTON [轉手開配本]鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_CreateDisRecord_Click(object sender, EventArgs e) { #region string s_HANDLE_COUNT = string.Empty; string s_SUCCESS_COUNT = string.Empty; BCO.CRMCommon CRMComm = new BCO.CRMCommon(); try { #region 設定頁面狀態 int i_FmOp_Step = -1; try { i_FmOp_Step = int.Parse(this.hid_FmOp_Step.Value); } catch { this.ErrorMsgLabel.Text = "頁面狀態錯誤"; return; } if (i_FmOp_Step < 4) { this.ErrorMsgLabel.Text = "請先執行[訂單庫存檢查]鈕"; return; } this.hid_FmOp_Step.Value = "BUTTON [轉手開配本]鈕開始"; #endregion #region 傳入參數 ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(this.slp_TRANS_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(string.Format("{0}_{1}", PageTimeStamp.Value, Session["UID"].ToString())); ParameterList.Add(hiddenProcessingID.Value); #endregion #region 轉手開配本 ArrayList arl_Return = new ArrayList(); BCO.ProcessCRMOverDu bco = new BCO.ProcessCRMOverDu(ConntionDB); //2010/06/25 modified for new spec //arl_Return = bco.ProcessCreateDisRecord(ParameterList, null); arl_Return = bco.ProcessCreateDisRecord2(ParameterList, null); #endregion #region 檢查轉手開配本的回傳資料 string s_Err_Msg = string.Empty; s_Err_Msg = arl_Return[0].ToString(); if (s_Err_Msg != string.Empty) { this.hid_FmOp_Step.Value = "BUTTON [轉手開配本]鈕發生錯誤"; this.ErrorMsgLabel.Text = s_Err_Msg; } else { s_HANDLE_COUNT = arl_Return[1].ToString(); s_SUCCESS_COUNT = arl_Return[2].ToString(); this.hid_FmOp_Step.Value = "6"; this.RightMsgLabel.Text = "轉手開配本成功"; #region 預設POP查詢使用參數 string SessionIdName = "POP_QueryDisNo_" + PageTimeStamp.Value; Session[SessionIdName] = null; ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter("1", "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_TRANS_DATE.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter("", "string", false)); //0代表未逾期客訂,1代表是逾期客訂 ParameterList.Add(CRMComm.GetValueSetParameter("", "string", false));//擷轉序號起 ParameterList.Add(CRMComm.GetValueSetParameter("", "string", false));//擷轉序號迄 ParameterList.Add(Session["UID"].ToString()); Session[SessionIdName] = ParameterList; #endregion //顯示配本序號 string s_ScriptManager_Script = string.Empty; s_ScriptManager_Script += "alert('逾期客訂轉手開單產生成功');"; s_ScriptManager_Script += string.Format(@"POP_QueryDisNo('{0}','{1}','{2}','{3}','{4}','{5}');", "1", //逾期客訂固定為雜誌 this.slp_TRANS_DATE.Text, this.slp_ST_ACCEPT_DATE.Text, "1", //逾期客訂 "", //擷轉序號起迄為空值 ""); ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CRM101", s_ScriptManager_Script, true); } #endregion } catch (Exception ex) { this.hid_FmOp_Step.Value = "BUTTON [轉手開配本]鈕發生錯誤"; WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { CRMComm = null; Set_but_CreateDisRecord_Click_PageStatus(s_HANDLE_COUNT, s_SUCCESS_COUNT); } #endregion }
/// <summary> /// 按下Button [存檔] /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Save_Click(object sender, EventArgs e) { //System.Threading.Thread.Sleep(2000); try { ArrayList ParameterList = new ArrayList();//20091118 bool b_Check_GridView = false; if (Session["POP_CRM01A2_Mode"].ToString() == "INSERT") { #region 檢查必填欄位是否輸入 System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (this.slp_ACT_DATE.Text.Trim() == string.Empty) { sb.Append("[日期]欄位不可空白\\r\\n"); } if (this.txt_MESSAGE.Text.Trim() == string.Empty) { sb.Append("[訊息內容]欄位不可空白\\r\\n"); } if (this.slp_CREATEUID.Text.Trim() == string.Empty) { sb.Append("[維護者]欄位不可空白\\r\\n"); } if (this.slp_CHAN_NO.Text.Trim() == string.Empty) { foreach (GridViewRow dRow in this.gv_Store_Chain.Rows) { CheckBox chb = ((CheckBox)dRow.FindControl("chb_Store_Chain")); if (chb.Checked == true) { b_Check_GridView = true; break; } } //if (b_Check_GridView == false) //{ sb.Append("[通路代號]至少需有一筆被勾選"); } } if (sb.ToString() != string.Empty) { System.Web.UI.ScriptManager.RegisterStartupScript(this.but_Save, this.GetType(), "TO_CRM01A.aspx", "alert('" + sb.ToString() + "');", true); return; } #endregion #region 取得 VDS_CRM_MESSAGE 的 SCHEMA ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); DataTable dt_VDS_CRM_MESSAGE = new DataTable(); BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB); dt_VDS_CRM_MESSAGE = bco.GET_VDS_CRM_MESSAGE_SCHEMA(ParameterList); #endregion #region 取得畫面上 [@日期]、[@訊息內容]、[@維護者]、[@通路] DateTime d_Now = DateTime.Now; DateTime d_ACT_DATE = DateTime.ParseExact(this.slp_ACT_DATE.Text.Trim(), "yyyy/MM/dd", null);//日期 string s_MESSAGE = this.txt_MESSAGE.Text.Trim(); string s_CREATEUID = this.slp_CREATEUID.Text.Trim(); string s_CHAN_NO = this.slp_CHAN_NO.Text.Trim(); #endregion if (this.slp_CHAN_NO.Text.Trim() == string.Empty) { #region 儲存多筆新增資料 foreach (GridViewRow gvRow in this.gv_Store_Chain.Rows) { CheckBox chb = (CheckBox)gvRow.FindControl("chb_Store_Chain"); if (b_Check_GridView == true) { if (chb.Checked == true) { DataRow dRow = dt_VDS_CRM_MESSAGE.NewRow(); dRow["CREATEDATE"] = d_Now; dRow["CREATEUID"] = s_CREATEUID; dRow["UPDATEDATE"] = d_Now; dRow["UPDATEUID"] = s_CREATEUID; dRow["ENABLE"] = 1; dRow["ACT_DATE"] = d_ACT_DATE; dRow["CHAN_NO"] = chb.Text.Trim(); dRow["MESSAGE"] = s_MESSAGE; dt_VDS_CRM_MESSAGE.Rows.Add(dRow); } } else { DataRow dRow = dt_VDS_CRM_MESSAGE.NewRow(); dRow["CREATEDATE"] = d_Now; dRow["CREATEUID"] = s_CREATEUID; dRow["UPDATEDATE"] = d_Now; dRow["UPDATEUID"] = s_CREATEUID; dRow["ENABLE"] = 1; dRow["ACT_DATE"] = d_ACT_DATE; dRow["CHAN_NO"] = chb.Text.Trim(); dRow["MESSAGE"] = s_MESSAGE; dt_VDS_CRM_MESSAGE.Rows.Add(dRow); } } #endregion } else { #region 儲存單筆新增資料 DataRow dRow = dt_VDS_CRM_MESSAGE.NewRow(); dRow["CREATEDATE"] = d_Now; dRow["CREATEUID"] = s_CREATEUID; dRow["UPDATEDATE"] = d_Now; dRow["UPDATEUID"] = s_CREATEUID; dRow["ENABLE"] = 1; dRow["ACT_DATE"] = d_ACT_DATE; dRow["CHAN_NO"] = s_CHAN_NO; dRow["MESSAGE"] = s_MESSAGE; dt_VDS_CRM_MESSAGE.Rows.Add(dRow); #endregion } #region 將資料寫入資料庫 ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); bco.CreateCRMMessage(ParameterList, null, dt_VDS_CRM_MESSAGE); #endregion System.Web.UI.ScriptManager.RegisterStartupScript(this.but_Save, this.GetType(), "TO_CRM01A.aspx", "alert('新增成功');window.close();", true); } else if (Session["POP_CRM01A2_Mode"].ToString() == "EDIT") { #region 檢查必填欄位 System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (this.slp_ACT_DATE.Text.Trim() == string.Empty) { sb.Append("[日期]欄位不可空白\\r\\n"); } if (this.slp_CREATEUID.Text.Trim() == string.Empty) { sb.Append("[維護者]欄位不可空白\\r\\n"); } if (this.slp_CHAN_NO.Text.Trim() == string.Empty) { sb.Append("[通路]欄位不可空白\\r\\n"); } if (this.txt_MESSAGE.Text.Trim() == string.Empty) { sb.Append("[訊息內容]欄位不可空白\\r\\n"); } if (sb.ToString() != string.Empty) { System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM01A.aspx", "alert('" + sb.ToString() + "')", true); return; } #endregion #region 儲存單筆修改資料 #region 使用XML轉回DataSet DataSet ds_OldData = new DataSet(); System.IO.StringReader sr_OldData = new System.IO.StringReader(xml_MessageOLDData.InnerHtml); ds_OldData.ReadXml(sr_OldData); #endregion #region 將資料寫入 ParameterList BCO.CRMCommon CRMComm = new BCO.CRMCommon(); //新資料 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ACT_DATE.Text, "date", false));//日期 ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_CREATEUID.Text, "string", false));//維護者 ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_CHAN_NO.Text, "string", false));//通路 ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_MESSAGE.Text, "string", false));//訊息內容 ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(DateTime.Now); //舊資料 if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("ID")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["ID"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("CODE")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["CODE"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("CREATEDATE")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["CREATEDATE"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("CREATEUID")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["CREATEUID"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("UPDATEDATE")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["UPDATEDATE"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("UPDATEUID")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["UPDATEUID"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("ENABLE")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["ENABLE"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("ACT_DATE")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["ACT_DATE"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("CHAN_NO")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["CHAN_NO"]); } else { ParameterList.Add(DBNull.Value); } if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("MESSAGE")) { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["MESSAGE"]); } else { ParameterList.Add(DBNull.Value); } #endregion #region 儲存單筆修改資料 BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB); bco.UpdateCRMMessage(ParameterList, null); #endregion #endregion System.Web.UI.ScriptManager.RegisterStartupScript(this.but_Save, this.GetType(), "TO_CRM01A.aspx", "alert('修改成功');window.close();", true); } } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { } }
private void databind() { #region 傳入參數 CRMModel.CRMCommon CRMComm = new CRMModel.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Msg.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.TextBoxDate.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.SLP_StoreChain_B.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.SLP_StoreChain_E.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(TextBoxRowCountLimit.Text.Length == 0 ? "100" : TextBoxRowCountLimit.Text, "int", false)); ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false)); #endregion #region 連結資料庫 CRMModel.MaintainChainMessage BCO = new CRMModel.MaintainChainMessage(ConntionDB); DataTable dt = BCO.QuerySwitch(CRMModel.MaintainChainMessage.QueryType.CRM121_Query_All, ParameterList); #endregion #region 繫結GridView //抓取本頁初次登記的時間 string SessionIDName = "CRM121_" + PageTimeStamp.Value; Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt; GridView1.DataSource = dt; //設定分頁大小 GridView1.PageSize = (this.TextBoxPagesize.Text == string.Empty) ? 10 : (int.Parse(this.TextBoxPagesize.Text) < 0) ? 10 : int.Parse(this.TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); this.LabelQueryRecordCount.Text = string.Format(" {0} Rows ", dt.Rows.Count.ToString()); #endregion #region 檢查回傳資料 if (dt.Rows.Count == 0) { this.ErrorMsgLabel.Text = "查無資料"; } #endregion }
/// <summary> /// BUTTON [檢視異常報表]鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void but_Trans_Error_Click(object sender, EventArgs e) { try { #region 將變數寫入Session Session["POP_CRMTransError2_ParameterList"] = null; BCO.CRMCommon CRMComm = new BCO.CRMCommon(); ArrayList ParameterList = new ArrayList();//20091117 ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_TRANS_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter("0", "string", false));//0代表未逾期客訂,1代表是逾期客訂 ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_TRANS_NO_B.Text.Trim(), "string", false));//擷轉序號起 ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_TRANS_NO_E.Text.Trim(), "string", false));//擷轉序號迄 ParameterList.Add(Session["UID"].ToString()); Session["POP_CRMTransError2_ParameterList"] = ParameterList; #endregion #region 設定 Url & Style string s_Url = string.Empty; string s_Style = string.Empty; s_Url = "../CRM/POP/POP_CRMTransError.aspx"; s_Style = "dialogWidth:750px;dialogHeight:500px;status=yes;help=no;center;scroll=yes;"; #endregion ScriptManager.RegisterStartupScript(this.up_Msg, typeof(UpdatePanel), "CRM081", "window.showModalDialog('" + s_Url + "','','" + s_Style + "');", true); } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } finally { } }
protected void Button1_Click(object sender, EventArgs e) { ArrayList arl_Return = new ArrayList(); BCO.CRMCommon CRMComm = new BCO.CRMCommon(); #region Test Error //try //{ // #region 將變數寫入Session // Session["POP_CRMTransError2_ParameterList"] = null; // BCO.CRMCommon CRMComm = new BCO.CRMCommon(); // ArrayList ParameterList = new ArrayList();//20091117 // ParameterList.Clear(); // ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_up_TRANS_DATE.Text, "date", false)); // ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false)); // ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); // ParameterList.Add(CRMComm.GetValueSetParameter("0", "string", false));//0代表未逾期客訂,1代表是逾期客訂 // ParameterList.Add(CRMComm.GetValueSetParameter("XA912100001", "string", false));//擷轉序號起 // ParameterList.Add(CRMComm.GetValueSetParameter("XA912100001", "string", false));//擷轉序號迄 // ParameterList.Add(Session["UID"].ToString()); // Session["POP_CRMTransError2_ParameterList"] = ParameterList; // #endregion // #region 設定 Url & Style // string s_Url = string.Empty; // string s_Style = string.Empty; // s_Url = "../CRM/POP/POP_CRMTransError.aspx"; // s_Style = "dialogWidth:800px;dialogHeight:600px;status=yes;help=no;center;scroll=yes;"; // #endregion // ScriptManager.RegisterStartupScript(this.up_Trans_Error, typeof(UpdatePanel), "CRM071", "window.showModalDialog('" + s_Url + "','','" + s_Style + "');", true); //} //catch (Exception ex) //{ // WaringLogProcess(ex.Message); // this.ErrorMsgLabel.Text = ex.Message; //} //finally { } #endregion #region Test OK string SessionIdName = "POP_QueryDisNo_" + PageTimeStamp.Value; Session[SessionIdName] = null; ParameterList.Clear(); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ROOT_NO.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_up_TRANS_DATE.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(CRMComm.GetValueSetParameter("", "string", false)); //0代表未逾期客訂,1代表是逾期客訂 ParameterList.Add(CRMComm.GetValueSetParameter("XA912100001", "string", false));//擷轉序號起 ParameterList.Add(CRMComm.GetValueSetParameter("XA912100001", "string", false));//擷轉序號迄 ParameterList.Add(Session["UID"].ToString()); Session[SessionIdName] = ParameterList; string s_ScriptManager_Script = string.Empty; s_ScriptManager_Script += "alert('圖書擷轉手開單產生成功!');"; s_ScriptManager_Script += string.Format(@"POP_QueryDisNo('{0}','{1}','{2}','{3}','{4}','{5}');", this.slp_ROOT_NO.Text, this.slp_up_TRANS_DATE.Text, this.slp_ST_ACCEPT_DATE.Text, "0", //非逾期 "XA912100001",//擷轉序號起=擷轉序號迄 "XA912100001"); ScriptManager.RegisterStartupScript(this.up_Execute, typeof(UpdatePanel), "CRM071", s_ScriptManager_Script, true); #endregion }