Example #1
0
    /// <summary>
    /// UP BUTTON 刪除鈕

    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_up_Delete_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.hid_PageStatus.Value == "VIEW")
            {
                #region 檢視主檔與明細檔所有資料的結案狀態


                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Remove(0, sb.Length);

                string s_Filter_D = string.Empty;
                string s_Filter_M = string.Empty;
                s_Filter_M = "STATUS = 75";//75代表已結案
                s_Filter_D = "(STATUS = 75) or (TRANS_RESULT <> 0)";//75代表已結案



                if (dt_Master.Select(s_Filter_M).Length > 0 ||
                    dt_Detail.Select(s_Filter_D).Length > 0)
                { sb.Append("本訂單有品項已結案或已擷轉,不可刪除"); }

                if (sb.ToString() != string.Empty)
                {
                    ScriptManager.RegisterStartupScript(this.up_Up_Button, typeof(UpdatePanel), "CRM041", "alert('" + sb.ToString() + "');", true);
                    return;
                }

                #endregion

                #region 確認刪除時,呼叫 RecordCRMOrder.DeleteCRMOrder] 刪除資料

                DateTime d_Now = DateTime.Now;
                ArrayList ParameterList = new ArrayList();//20091117

                ParameterList.Clear();

                //新的資料
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(d_Now);

                ////舊資料內容值

                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["ID"].ToString(), "int"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["CODE"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["BUSDATE"].ToString(), "date"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["BUSUID"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["CREATEDATE"].ToString(), "datetime"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["CREATEUID"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["UPDATEDATE"].ToString(), "datetime"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["UPDATEUID"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["STATUS"].ToString(), "int"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["ENABLE"].ToString(), "int"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["CRM_NO"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["CRM_REQUEST_NO"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["CHAN_NO"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["STORE"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["CLOSE_DATE"].ToString(), "date"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["PO_SOURCE_NO"].ToString(), "string"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["ORDER_TYPE"].ToString(), "int"));
                ParameterList.Add(GetValueSetParameter(dt_Master.Rows[0]["CREATE_ROLE"].ToString(), "string"));

                BCO.RecordCRMOrder bco = new BCO.RecordCRMOrder(ConntionDB);
                bco.DeleteCRMOrder(ParameterList, null, dt_Detail);

                #endregion

                #region 清空靜態變數

                dtChainPOSetting = null;//異動欄位[門市] -- 檢視模式清空

                dtStock = null;//異動欄位[期別]
                s_PMA = string.Empty;//大分類(異動欄位[品號/品名])
                s_ROOT_NO = string.Empty;//群分類(異動欄位[品號/品名])
                s_SRC_LOCATE_TYPE = string.Empty;//建議儲區類別(異動欄位[訂貨量])

                dt_Detail = null;
                //Session["CRM041_dt_Detail" + PageTimeStamp.Value] = null;
                dt_Master = null;
                dt_Detail_Original = null;

                #endregion

                #region 設定頁面狀態


                this.hid_PageStatus.Value = "QUERY";
                this.txt_PageStatus.Text = "QUERY";
                SetPageStartValue();
                SetPageStatus();

                this.RightMsgLabel.Text = "刪除成功";

                #endregion

                #region 設定各欄位模式ReadOnly

                this.slp_up_CHAN_NO.ReadOnly = false;
                this.slp_up_STORE.ReadOnly = false;
                this.slp_up_Z_O.ReadOnly = false;
                this.slp_up_BUSDATE.ReadOnly = false;
                this.slp_up_SALE_ID.ReadOnly = false;
                this.slp_up_BUSUID.ReadOnly = false;
                this.drop_up_ORDER_TYPE.ReadOnly = false;
                this.txt_up_PO_SOURCE_NO.ReadOnly = false;
                this.txt_up_PO_SOURCE_NO.CssClass = "";
                this.txt_up_CODE.ReadOnly = false;
                this.txt_up_CODE.CssClass = "";
                this.txt_up_CRM_NO.ReadOnly = false;
                this.txt_up_CRM_NO.CssClass = "";

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