Example #1
0
    public static string SetBtn_PurchaseCardStatus(string s_ItemValue)
    {
        #region by功能權限 決定連結採購卡Button disable or enable

        MKT_MKT141 MKT141 = new MKT_MKT141();
        string strRootNo = "";
        string strRetuenValue = "disable";

        if (s_ItemValue.Trim() != "")
        {
            #region 取得Root No決定連結 採購卡or圖書採購卡

            ParameterList.Clear();
            ParameterList.Add(s_ItemValue.Trim());
            BCO.MaintainGift bcoGift = new BCO.MaintainGift(ConnectionDB);
            DataTable dt = new DataTable();
            dt = bcoGift.GetItemDataByItem(ParameterList);

            //取得Root No
            if (dt == null || (dt.Rows.Count == 0))
            {
                strRootNo = "";
            }
            else
            {
                strRootNo = dt.Rows[0]["ROOT_NO"].ToString();
            }

            if (strRootNo == "1") //雜誌
            {
                MKT141.SetAuthority("MKT05");//判斷功能MKT05權限

                if (MKT141.AuthCreate == true)
                {
                    strRetuenValue = "enable";
                }
                else
                {
                    strRetuenValue = "disable";
                }
            }
            else if (strRootNo == "2")//圖書
            {
                MKT141.SetAuthority("MKT06");//判斷功能MKT06權限

                if (MKT141.AuthCreate == true)
                {
                    strRetuenValue = "enable";
                }
                else
                {
                    strRetuenValue = "disable";
                }
            }
            else
            {
                strRetuenValue = "disable";
            }

            #endregion
        }
        else
        {
            strRetuenValue = "disable";
        }

        return strRetuenValue;

        #endregion
    }
Example #2
0
    protected void Btn_PurchaseCard_Click(object sender, EventArgs e)
    {
        string strRootNo = string.Empty;
        string strUrl = string.Empty;
        string strItem = this.SLP_SKU1.Text;
        string strPeriod = this.SLP_ItemPeriod1.Text;

        #region 取得Root No決定連結 採購卡or圖書採購卡

        BCO.MaintainGift bcoGift = new BCO.MaintainGift(ConnectionDB);

        DataTable dt = new DataTable();

        dt = bcoGift.GetItemDataByItem(this.getParameterList());

        //品號資料check
        if (dt == null || (dt != null && dt.Rows.Count <= 0))
        {
            ErrorMsgLabel.Text = "品號資料錯誤";
            return;
        }

        strRootNo = dt.Rows[0]["ROOT_NO"].ToString();

        #endregion

        #region 連結 採購卡or圖書採購卡

        if (strRootNo == "1") //雜誌
        {
            ParameterList.Clear();
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "M.ENABLE", 1, "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "ROWNUM", "2", "<=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.ITEM", SLP_SKU1.Text, "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "M.PERIOD", SLP_ItemPeriod1.Text, "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.MANUFACTURE", "", "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.PUBLISH_TYPE", "", "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "M.CREATEUID", "", "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_ACCEPT_DATE", "", ">=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_ACCEPT_DATE", "", "<=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_PUBLISH_DATE", "", ">=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_PUBLISH_DATE", "", "<=", "and");
            MaintainPurchaseCard bco = new MaintainPurchaseCard(ConnectionDB);
            DataTable Dt = bco.QueryPurchaseCardByFind_1(ParameterList);
            string ID = "";
            if (Dt.Rows.Count > 0)
            {
                DataRow[] dr = Dt.Select("1=1", "createdate desc");
                ID = dr[0]["ID"].ToString();
                strUrl = Application["AppSite_RootDir"] + "MKT/MKT052.aspx?Code=MKT05&ID=" + ID;
                //開啟[採購卡維護], 預設進入新增模式,並帶入品號&期別作為預設條件
                ScriptManager.RegisterStartupScript(this.upButton, typeof(UpdatePanel), "MKT052", "AddIFrameTab('採購卡維護','" + strUrl + "')", true);
            }
            else
                ScriptManager.RegisterClientScriptBlock(this.upButton, typeof(UpdatePanel), "", "if (confirm('該品項尚未開立採購卡,是否進入採購卡新增畫面?')){this.disabled=true;__doPostBack('','GoInsert05');}", true);
        }
        else if (strRootNo == "2")//圖書
        {
            ParameterList.Clear();
            SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "M.ENABLE", 1, "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "ROWNUM", "2", "<=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.ITEM", SLP_SKU1.Text, "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.MANUFACTURE", "", "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.PATTERN_NO", "", "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.String, "M.COMMODITY_LEVEL", "", "=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_ACCEPT_DATE", "", ">=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_ACCEPT_DATE", "", "<=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_PUBLISH_DATE", "", ">=", "and");
            SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_PUBLISH_DATE", "", "<=", "and");
            MaintainBooksPurchaseCardMain bco = new MaintainBooksPurchaseCardMain(ConnectionDB);
            DataTable Dt = bco.QueryBooksPurchaseCardMainByFind_1(ParameterList);
            string ID = "";
            if (Dt.Rows.Count > 0)
            {
                DataRow[] dr = Dt.Select("1=1", "createdate desc");
                ID = dr[0]["ID"].ToString();
                strUrl = Application["AppSite_RootDir"] + "MKT/MKT062.aspx?Code=MKT06&ID=" + ID;

                //開啟[圖書採購卡維護],預設進入新增模式,並帶入品號作為預設條件
                ScriptManager.RegisterStartupScript(this.upButton, typeof(UpdatePanel), "MKT062", "AddIFrameTab('圖書採購卡維護','" + strUrl + "')", true);
            }
            else
                ScriptManager.RegisterClientScriptBlock(this.upButton, typeof(UpdatePanel), "", "if (confirm('該品項尚未開立圖書採購卡,是否進入圖書採購卡新增畫面?')){this.disabled=true;__doPostBack('','GoInsert06');}", true);
        }

        #endregion
    }