Ejemplo n.º 1
0
    protected void btnAdd_C_Click(object sender, EventArgs e)
    {

        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string strROOT_NO = "";
            string strPMA = "";
            string strCATEGORY = "";
            string s_CheckPage = CheckPage(sender, "C");

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            #endregion

            string SessionIDName = "STM193_gvC" + PageTimeStamp.Value;
            DataTable dtC = new DataTable();
            if (Session[SessionIDName] == null)
            {
                dtC = this.MakeDTForPriceDis();
            }
            else
            {
                dtC = (DataTable)Session[SessionIDName];
            }

            //取得ROOT_NO,PMA,CATEGORY的值
            DataTable dtItem = new DataTable();
            dtItem = this.GetItem(this.SLP_SKU_C.Text.Trim());
            if (dtItem.Rows.Count > 0)
            {
                for (int i = 0; i < dtItem.Rows.Count; i++)
                {
                    strROOT_NO = dtItem.Rows[i]["ROOT_NO"].ToString();
                    strPMA = dtItem.Rows[i]["PMA"].ToString();
                    strCATEGORY = dtItem.Rows[i]["CATEGORY"].ToString();
                }
            }

            DataRow[] drC2 = (DataRow[])dtC.Select("ID=" + (this.HidIDC.Value == "" ? "0" : this.HidIDC.Value) + " AND EFF_START =CONVERT('" + Convert.ToDateTime(SLP_SLPDate3.Text).ToShortDateString() + "','System.DateTime')");

            if (drC2.Length == 0)
            {
                #region 檢查生效日期
                //DataRow[] drC1 = (DataRow[])dtC.Select("STORE='" + SLP_Store1.Text.Trim() + "' AND ROOT_NO ='" + strROOT_NO + "' AND  PMA ='" + strPMA
                //            + "' AND  CATEGORY ='" + strCATEGORY + "' AND  ITEM ='" + SLP_SKU_C.Text.Trim() + "' AND  PERIOD ='" + SLP_ItemPeriod_C.Text.Trim()
                //            + "' AND  EFF_END >=CONVERT('" + Convert.ToDateTime(SLP_SLPDate3.Text).ToShortDateString() + "','System.DateTime')");
                //string strCn = "STORE='" + SLP_Store1.Text.Trim() + "' AND ITEM ='" + SLP_SKU_C.Text.Trim()
                //            + @"' AND  PERIOD ='" + SLP_ItemPeriod_C.Text.Trim()
                //            + "' AND  EFF_END >=CONVERT('" + Convert.ToDateTime(SLP_SLPDate3.Text).ToShortDateString() + "','System.DateTime')";
                //DataRow[] drC1 = (DataRow[])dtC.Select(strCn);
                //if (drC1.Length > 0)
                //{
                //    ErrorMsgLabel.Text = "a有效開始日期輸入有誤,應大於相同商品期別折扣的有效結束日" + strCn;
                //    return;
                //}

                //檢查生效日期
                ArrayList ArrPar = new ArrayList();
                ArrPar.Add(this.SLP_Store1.Text.Trim());
                ArrPar.Add(32);
                ArrPar.Add(Convert.ToDateTime(this.SLP_SLPDate3.Text.Trim()));
                ArrPar.Add(strROOT_NO);
                ArrPar.Add(strPMA);
                ArrPar.Add(strCATEGORY);
                ArrPar.Add(this.SLP_SKU_C.Text.Trim());
                ArrPar.Add(SLP_ItemPeriod_C.Text.Trim());

                BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
                int iResult;
                bco.QueryDisCountStartDate(ArrPar, out iResult);
                if (iResult > 0)
                {
                    ErrorMsgLabel.Text = "有效開始日期輸入有誤,應大於相同商品期別折扣的有效結束日";
                    return;
                }
                #endregion
            }


            if (this.HidIDC.Value != "")
            {
                DataRow drC = dtC.Select("ID=" + this.HidIDC.Value)[0];
                drC["PERIOD"] = this.SLP_ItemPeriod_C.Text.Trim();
                drC["PERIOD_END"] = this.txtItemPeriod_END_C.Text.Trim();
                drC["PRICE_DISCOUNT"] = GetValueSetParameter(this.SLP_SLPNumber_C.Text.Trim(), "string", false);
                drC["FIX_PRICE_DISCOUNT"] = GetValueSetParameter(this.SLP_SLPNumber_C2.Text.Trim(), "string", false);
                drC["VENDOR_SUBSIDY_PERCENT"] = GetValueSetParameter(this.SLP_SLPNumber2.Text.Trim(), "string", false);
                drC["COST_PERCENT"] = GetValueSetParameter(this.SLP_SLPNumber3.Text.Trim(), "string", false);
                if (this.SLP_SLPDate3.Text.Trim() != "")
                    drC["EFF_START"] = Convert.ToDateTime(this.SLP_SLPDate3.Text.Trim());
                else
                    drC["EFF_START"] = System.DBNull.Value;

                if (this.SLP_SLPDate4.Text.Trim() != "")
                    drC["EFF_END"] = Convert.ToDateTime(this.SLP_SLPDate4.Text.Trim());
                else
                    drC["EFF_END"] = System.DBNull.Value;

                drC["UPDATEUID"] = Session["UID"].ToString();
                drC["FUN_TYPE"] = "U";
            }
            else
            {
                DataView dv = dtC.DefaultView;
                dv.Sort = "ID desc";

                DataRow drC = dtC.NewRow();
                drC["ID"] = Convert.ToInt64(dv.Count == 0 ? 0 : dv[0]["ID"]) + 1;
                drC["STORE"] = this.SLP_Store1.Text.Trim();
                drC["ROOT_NO"] = strROOT_NO;
                drC["PMA"] = strPMA;
                drC["CATEGORY"] = strCATEGORY;
                drC["ITEM"] = this.SLP_SKU_C.Text.Trim();
                drC["PERIOD"] = this.SLP_ItemPeriod_C.Text.Trim();
                drC["PERIOD_END"] = this.txtItemPeriod_END_C.Text.Trim();
                drC["PRICE_DISCOUNT"] = GetValueSetParameter(this.SLP_SLPNumber_C.Text.Trim(), "string", false);
                drC["FIX_PRICE_DISCOUNT"] = GetValueSetParameter(this.SLP_SLPNumber_C2.Text.Trim(), "string", false);
                drC["VENDOR_SUBSIDY_PERCENT"] = GetValueSetParameter(this.SLP_SLPNumber2.Text.Trim(), "string", false);
                drC["COST_PERCENT"] = GetValueSetParameter(this.SLP_SLPNumber3.Text.Trim(), "string", false);
                if (this.SLP_SLPDate3.Text.Trim() != "")
                    drC["EFF_START"] = Convert.ToDateTime(this.SLP_SLPDate3.Text.Trim());
                else
                    drC["EFF_START"] = System.DBNull.Value;

                if (this.SLP_SLPDate4.Text.Trim() != "")
                    drC["EFF_END"] = Convert.ToDateTime(this.SLP_SLPDate4.Text.Trim());
                else
                    drC["EFF_END"] = System.DBNull.Value;

                drC["DISCOUNT_KIND"] = 32;
                drC["CONFIRM_CODE"] = 0;
                drC["FUN_TYPE"] = "A";
                dtC.Rows.Add(drC);

            }
            this.GridViewC.Visible = true;
            DataView dvC = dtC.DefaultView;
            dvC.Sort = "EFF_START DESC,ROOT_NO,PMA,CATEGORY,ITEM,PERIOD desc";
            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dtC;
            this.GridViewC.DataSource = dvC;
            this.GridViewC.DataBind();

            SLP_SKU_C.Text = "";
            SLP_ItemPeriod_C.Text = "";
            txtItemPeriod_END_C.Text = "";
            SLP_SLPNumber_C2.Text = "";
            SLP_SLPNumber_C.Text = "";
            SLP_SLPNumber2.Text = "";
            SLP_SLPNumber3.Text = "";
            this.SLP_SLPDate3.Text = string.Empty;//DateTime.Today.ToString("yyyy/MM/dd");
            this.SLP_SLPDate4.Text = string.Empty;//"9999/12/31";
            if (this.HidIDC.Value != "")
            {
                this.panC.Visible = false;
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
    }
Ejemplo n.º 2
0
    private void databind(string N_STORE)
    {

        #region bind GridViewA
        #region 傳入參數
        ParameterList.Clear();
        ParameterList.Add(N_STORE);
        ParameterList.Add(N_STORE);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(GetValueSetParameter("8", "int", false));//GridViewA(DISCOUNT_KIND=8)
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add("99999");
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);

        #endregion

        #region 取得資料

        DataTable dt_ReturnA = new DataTable();
        DataTable dt_ReturnB = new DataTable();
        DataTable dt_ReturnC = new DataTable();

        BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
        dt_ReturnA = bco.QueryStoreDiscount(ParameterList);

        #endregion

        #region 資料與GridView繫結

        //抓取本頁初次登記的時間

        string SessionIDName = "STM193_gvA" + PageTimeStamp.Value;

        this.GridViewA.Visible = true;
        DataView dvA = dt_ReturnA.DefaultView;
        dvA.Sort = "ROOT_NO,PMA";
        Session[SessionIDName] = dt_ReturnA;
        this.GridViewA.DataSource = dvA;
        this.GridViewA.DataBind();
        #endregion
        #endregion

        #region bind GridViewB
        #region 傳入參數
        ParameterList.Clear();
        ParameterList.Add(N_STORE);
        ParameterList.Add(N_STORE);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(GetValueSetParameter("16", "int", false));//GridViewA(DISCOUNT_KIND=16)
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add("99999");
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);

        #endregion

        #region 取得資料

        //BCO.MaintainStoreGroupDiscount bco = new BCO.MaintainStoreGroupDiscount(ConnectionDB);

        dt_ReturnB = bco.QueryStoreDiscount(ParameterList);

        #endregion

        #region 資料與GridView繫結

        //抓取本頁初次登記的時間

        SessionIDName = "STM193_gvB" + PageTimeStamp.Value;

        this.GridViewB.Visible = true;
        DataView dvB = dt_ReturnB.DefaultView;
        dvB.Sort = "ROOT_NO,PMA,CATEGORY";
        Session[SessionIDName] = dt_ReturnB;
        this.GridViewB.DataSource = dvB;
        this.GridViewB.DataBind();
        #endregion
        #endregion

    }
Ejemplo n.º 3
0
    protected void btnAdd_B_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender, "B");

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            #endregion
            string SessionIDName = "STM193_gvB" + PageTimeStamp.Value;
            DataTable dtB = new DataTable();
            if (Session[SessionIDName] == null)
            {
                dtB = this.MakeDTForPriceDis();
            }
            else
            {
                dtB = (DataTable)Session[SessionIDName];
            }

            DataRow[] drB2 = (DataRow[])dtB.Select("ID=" + (this.HidIDB.Value == "" ? "0" : this.HidIDB.Value) + " AND EFF_START =CONVERT('" + Convert.ToDateTime(SLP_SLPDate1.Text).ToShortDateString() + "','System.DateTime')");

            if (drB2.Length == 0)
            {
                #region 檢查生效日期
                DataRow[] drB1 = (DataRow[])dtB.Select("STORE='" + SLP_Store1.Text.Trim() + "' AND ROOT_NO ='" + SLP_RootNo_B.Text.Trim() + "' AND  PMA ='" + SLP_PMA_B.Text.Trim()
                             + "' AND  CATEGORY ='" + SLP_Category_B.Text.Trim() + "'"
                             + " AND  EFF_END >=CONVERT('" + Convert.ToDateTime(SLP_SLPDate1.Text).ToShortDateString() + "','System.DateTime')");
                if (drB1.Length > 0)
                {
                    ErrorMsgLabel.Text = "有效開始日期輸入有誤,應大於相同中分類折扣的有效結束日";
                    return;
                }

                ArrayList ArrPar = new ArrayList();
                ArrPar.Add(this.SLP_Store1.Text.Trim());
                ArrPar.Add(16);
                ArrPar.Add(Convert.ToDateTime(this.SLP_SLPDate1.Text.Trim()));
                ArrPar.Add(this.SLP_RootNo_B.Text.Trim());
                ArrPar.Add(this.SLP_PMA_B.Text.Trim());
                ArrPar.Add(this.SLP_Category_B.Text.Trim());
                ArrPar.Add(System.DBNull.Value);
                ArrPar.Add(System.DBNull.Value);

                BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
                int iResult;
                bco.QueryDisCountStartDate(ArrPar, out iResult);
                if (iResult > 0)
                {
                    ErrorMsgLabel.Text = "有效開始日期輸入有誤,應大於相同中分類折扣的有效結束日";
                    return;
                }
                #endregion
            }

            if (this.HidIDB.Value != "")
            {
                DataRow drB = dtB.Select("ID=" + this.HidIDB.Value)[0];
                drB["PRICE_DISCOUNT"] = this.SLP_SLPNumber1.Text.Trim();
                drB["FIX_PRICE_DISCOUNT"] = System.DBNull.Value;
                if (this.SLP_SLPDate1.Text.Trim() != "")
                    drB["EFF_START"] = Convert.ToDateTime(this.SLP_SLPDate1.Text.Trim());
                else
                    drB["EFF_START"] = System.DBNull.Value;

                if (this.SLP_SLPDate2.Text.Trim() != "")
                    drB["EFF_END"] = Convert.ToDateTime(this.SLP_SLPDate2.Text.Trim());
                else
                    drB["EFF_END"] = System.DBNull.Value;

                drB["UPDATEUID"] = Session["UID"].ToString();
                drB["FUN_TYPE"] = "U";
            }
            else
            {
                DataView dv = dtB.DefaultView;
                dv.Sort = "ID desc";

                DataRow drB = dtB.NewRow();
                drB["ID"] = Convert.ToInt64(dv.Count == 0 ? 0 : dv[0]["ID"]) + 1;
                drB["STORE"] = this.SLP_Store1.Text.Trim();
                drB["ROOT_NO"] = this.SLP_RootNo_B.Text.Trim();
                drB["PMA"] = this.SLP_PMA_B.Text.Trim();
                drB["CATEGORY"] = this.SLP_Category_B.Text.Trim();
                drB["PRICE_DISCOUNT"] = this.SLP_SLPNumber1.Text.Trim();
                if (this.SLP_SLPDate1.Text.Trim() != "")
                    drB["EFF_START"] = Convert.ToDateTime(this.SLP_SLPDate1.Text.Trim());
                else
                    drB["EFF_START"] = System.DBNull.Value;

                if (this.SLP_SLPDate2.Text.Trim() != "")
                    drB["EFF_END"] = Convert.ToDateTime(this.SLP_SLPDate2.Text.Trim());
                else
                    drB["EFF_END"] = System.DBNull.Value;

                drB["DISCOUNT_KIND"] = 16;
                drB["CONFIRM_CODE"] = 0;
                drB["FUN_TYPE"] = "A";
                dtB.Rows.Add(drB);
            }
            this.GridViewB.Visible = true;
            DataView dvB = dtB.DefaultView;
            dvB.Sort = "ROOT_NO,PMA,CATEGORY";
            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dtB;
            this.GridViewB.DataSource = dvB;
            this.GridViewB.DataBind();

            SLP_RootNo_B.Text = "";
            SLP_PMA_B.Text = "";
            SLP_Category_B.Text = "";
            SLP_SLPNumber1.Text = "";
            this.SLP_SLPDate1.Text = DateTime.Today.ToString("yyyy/MM/dd");
            this.SLP_SLPDate2.Text = "9999/12/31";
            if (this.HidIDB.Value != "")
            {
                this.panB.Visible = false;
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
    }
Ejemplo n.º 4
0
    //帶入ITEM取得該筆資料
    private DataTable GetItem(string V_ITEM)
    {
        #region 取得資料

        DataTable dt_Return = new DataTable();

        BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
        dt_Return = bco.QueryItem(V_ITEM);
        return dt_Return;

        #endregion

    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AuthorityControls(this);
        SetAuthCRUD();
        TextBox txtSKU = (TextBox)this.SLP_SKU_C.FindControl("TextBoxCode");
        TextBox txtPeriod = (TextBox)this.SLP_ItemPeriod_C.FindControl("TextBoxCode");
        this.btnCancel.Attributes.Add("onclick", "javascript:if (confirm('確定取消所有動作')){this.disabled=true;location.href='STM191.aspx';}else{return false;}");
        this.LinkButton1.Attributes.Add("onclick", "AddIFrameTab('門市主檔','../STM/STM011.aspx?Code=STM01')");
        txtSKU.Attributes["onblur"] = "ItemPeriodOnblur(document.getElementById('" + txtSKU.ClientID + "') ,document.getElementById('" + txtPeriod.ClientID + "'));";
        txtPeriod.Attributes["onblur"] = "SetTheSameValue1('SLP_ItemPeriod_C_TextBoxCode','txtItemPeriod_END_C');ItemPeriodOnblur(document.getElementById('" + txtSKU.ClientID + "') ,document.getElementById('" + txtPeriod.ClientID + "'));";

        TextBox txtPRICE_DIS_A = (TextBox)this.SLP_SLPNumber_PRICE_DIS_A.FindControl("TextBoxCode");
        TextBox txtPRICE_DIS_B = (TextBox)this.SLP_SLPNumber1.FindControl("TextBoxCode");
        TextBox txtPRICE_DIS_C = (TextBox)this.SLP_SLPNumber_C.FindControl("TextBoxCode");
        TextBox txtPRICE_DIS_D = (TextBox)this.SLP_SLPNumber2.FindControl("TextBoxCode");
        TextBox txtPRICE_DIS_E = (TextBox)this.SLP_SLPNumber3.FindControl("TextBoxCode");

        txtPRICE_DIS_A.Attributes.Add("onkeydown", "return Check_PercentValue(document.getElementById('" + txtPRICE_DIS_A.ClientID + "'));");
        txtPRICE_DIS_B.Attributes.Add("onkeydown", "return Check_PercentValue(document.getElementById('" + txtPRICE_DIS_B.ClientID + "'));");
        txtPRICE_DIS_C.Attributes.Add("onkeydown", "return Check_PercentValue(document.getElementById('" + txtPRICE_DIS_C.ClientID + "'));");
        txtPRICE_DIS_D.Attributes.Add("onkeydown", "return Check_PercentValue(document.getElementById('" + txtPRICE_DIS_D.ClientID + "'));");
        txtPRICE_DIS_E.Attributes.Add("onkeydown", "return Check_PercentValue(document.getElementById('" + txtPRICE_DIS_E.ClientID + "'));");

        //限制只能 key 入數字+小數點
        string strJS = "function OnlyNegNumber(obj,len)";
        strJS += " {";
        strJS += "    var tmpCount = 0;";
        strJS += "    var v_cnt=0;  ";
        strJS += "    var v_cnt1=0;  ";

        strJS += "    for (var tmpI = 0; tmpI < obj.value.length; tmpI++) ";
        strJS += "    {";
        strJS += "       tmpCount = obj.value.charCodeAt(tmpI);";
        strJS += "        if(tmpCount == 46)";
        strJS += "        {";
        strJS += "          if(tmpI>len)";
        strJS += "          {";
        strJS += "             obj.value = obj.value.substr(0, tmpI);";
        strJS += "          }";
        strJS += "          break;";
        strJS += "        }";
        strJS += "        else if(tmpI == obj.value.length-1)";
        strJS += "        {";
        strJS += "          if(tmpI>len-1)";
        strJS += "          {";
        strJS += "             obj.value = obj.value.substr(0, tmpI);";
        strJS += "          }";
        strJS += "          break;";
        strJS += "        }";
        strJS += "    }";

        strJS += "    for (var tmpI = 0; tmpI < obj.value.length; tmpI++) ";
        strJS += "    {";
        strJS += "        tmpCount = obj.value.charCodeAt(tmpI);";
        strJS += "        if (tmpI == 0)";
        strJS += "        {";
        strJS += "             if((tmpCount < 48) || (tmpCount > 57))";
        strJS += "            {";
        strJS += "               obj.value = obj.value.substr(0, tmpI);";
        strJS += "            }";
        strJS += "        }";
        strJS += "        else";
        strJS += "        {";
        strJS += "           if(((tmpCount < 48) || (tmpCount > 57)) && tmpCount != 46)";
        strJS += "          {";
        strJS += "           obj.value = obj.value.substr(0, tmpI);";
        strJS += "          }";
        strJS += "        }";
        strJS += "        if (tmpCount == 46)";
        strJS += "        {";
        strJS += "           v_cnt++;";
        strJS += "           v_cnt1++;";
        strJS += "        }";
        strJS += "        else";
        strJS += "        {";
        strJS += "           if (v_cnt1 > 0)";
        strJS += "           {";
        strJS += "              v_cnt1++;";
        strJS += "           }";
        strJS += "        }";
        strJS += "        if (v_cnt > 1)";
        strJS += "        {";
        strJS += "            obj.value = obj.value.substr(0, tmpI);";
        strJS += "        }";
        strJS += "        if (v_cnt1 > 3)";
        strJS += "        {";
        strJS += "            obj.value = obj.value.substr(0, tmpI);";
        strJS += "        }";
        strJS += "    }";
        strJS += " }";

        SLP_SLPNumber_C2.Attributes.Add("onkeyup", strJS + " OnlyNegNumber(this,6)");


        #region
        try
        {
            ErrorMsgLabel.Text = "";

            if (!IsPostBack)
            {
                //寫入首次載入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')
                                                    );
                Finally_Function();

                Initialization_Component();

                //預設三個頁籤裡的新增明細panel須隱藏
                this.panA.Visible = false;
                this.panB.Visible = false;
                this.panC.Visible = false;
                //須更新後才可以審核
                //this.btnConfirm.Enabled = false; !!
                if (Request["STORE"].ToString() != "")
                {
                    databind(Request["STORE"].ToString());
                }
                this.SLP_Store1.Text = Request["STORE"].ToString();
                this.SLP_Store1.ReadOnly = true;
                string sStoreGroup = string.Empty;
                string sStoreGName = string.Empty;
                int iCNT = 0;
                BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
                bco.QueryStoreGroupByStore(SLP_Store1.Text, out sStoreGroup, out sStoreGName, out iCNT);
                this.SLP_StoreGroup1.Text = sStoreGroup;
                this.SLP_StoreGroup1.Name = sStoreGName;
            }

            ToolBarInit();

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { Finally_Function(); }
        #endregion
    }//page_load
Ejemplo n.º 6
0
    protected void btnDel_C_Click(object sender, EventArgs e)
    {
        string SessionIDName = "STM193_gvC" + PageTimeStamp.Value;
        DataTable dtA = new DataTable();
        dtA = (DataTable)Session[SessionIDName];
        LinkButton btn = sender as LinkButton;
        GridViewRow gr = (btn.BindingContainer as GridViewRow);

        ArrayList ParameterList = new ArrayList();
        ParameterList.Clear();
        ParameterList.Add(((Label)gr.FindControl("lblCSTORE")).Text.Trim());
        ParameterList.Add(((Label)gr.FindControl("lblCITEM")).Text.Trim());
        ParameterList.Add(((Label)gr.FindControl("lblCPERIOD")).Text.Trim());
        ParameterList.Add(Session["UID"].ToString());

        BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);

        string strMsg = bco.QueryVdsPssHistory(ParameterList);

        if (strMsg == "")
        {
            DataRow drA = dtA.Select("ID=" + ((Label)gr.FindControl("lblCID")).Text.Trim())[0];
            drA.Delete();

            Session[SessionIDName] = dtA;
            this.GridViewC.DataSource = dtA;
            this.GridViewC.DataBind();

            SLP_SKU_C.Text = "";
            SLP_ItemPeriod_C.Text = "";
            txtItemPeriod_END_C.Text = "";
            SLP_SLPNumber_C2.Text = "";
            SLP_SLPNumber_C.Text = "";
            SLP_SLPNumber2.Text = "";
            SLP_SLPNumber3.Text = "";
            SLP_SLPDate3.Text = "";
            SLP_SLPDate4.Text = "";
            this.HidIDC.Value = "";
            this.panC.Visible = false;
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel4, typeof(UpdatePanel), "STM19", "alert('" + strMsg + "');", true);
        }
    }
Ejemplo n.º 7
0
    protected void btnQ_C_Click(object sender, EventArgs e)
    {
        #region bind GridViewC
        #region 傳入參數
        ParameterList.Clear();
        ParameterList.Add(SLP_Store1.Text);
        ParameterList.Add(SLP_Store1.Text);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(GetValueSetParameter("32", "int", false));//GridViewA(DISCOUNT_KIND=32)
        ParameterList.Add(GetValueSetParameter(this.SLP_RootNo_C_DET.Text.Trim(), "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_PMA_C_DET.Text.Trim(), "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_PMA_C_DET.Text.Trim(), "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_Category_C_DET.Text.Trim(), "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_Category_C_DET.Text.Trim(), "string", false));
        ParameterList.Add(GetValueSetParameter(SLP_SKU_C_DET.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(SLP_SKU_C_DET.Text, "string", false));
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(GetValueSetParameter(SLP_ItemPeriod_C_DET.Text, "string", false));
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(System.DBNull.Value);
        ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text.Trim(), "int", false));
        ParameterList.Add(GetValueSetParameter(SLP_ItemPeriod_C_DET.Text, "string", false));
        ParameterList.Add(System.DBNull.Value);

        #endregion

        #region 取得資料

        DataTable dt_ReturnC = new DataTable();

        BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
        dt_ReturnC = bco.QueryStoreDiscount(ParameterList);

        #endregion

        #region 資料與GridView繫結

        //抓取本頁初次登記的時間
        string SessionIDName = "STM193_gvC" + PageTimeStamp.Value;

        this.GridViewC.Visible = true;
        Session[SessionIDName] = dt_ReturnC;
        #endregion
        #endregion

        DataView dvA = dt_ReturnC.DefaultView;
        dvA.Sort = "EFF_START DESC,ROOT_NO,PMA,CATEGORY,ITEM,PERIOD desc";

        this.GridViewC.DataSource = dvA;
        this.GridViewC.DataBind();
    }
Ejemplo n.º 8
0
    //審核確認
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        #region
        try
        {

            BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
            DataTable dtA = (DataTable)Session["STM193_gvA" + PageTimeStamp.Value];
            DataTable dtB = (DataTable)Session["STM193_gvB" + PageTimeStamp.Value];
            DataTable dtC = (DataTable)Session["STM193_gvC" + PageTimeStamp.Value];

            //for (int i = 0; i < ha.Count; i++)
            //    ha[i] = true;

            foreach (GridViewRow gr in this.GridViewA.Rows)
            {
                DataRow drA = dtA.Select("ID=" + ((Label)gr.FindControl("lblAID")).Text.Trim())[0];
                if (((CheckBox)gr.FindControl("chkConfirmA")).Checked == true)
                {
                    drA["CONFIRM_CODE"] = "1";
                    drA["UPDATEUID"] = Session["UID"].ToString();
                    drA["FUN_TYPE"] = "U";
                }
                else
                {
                    drA["CONFIRM_CODE"] = "0";
                    drA["UPDATEUID"] = Session["UID"].ToString();
                    drA["FUN_TYPE"] = "U";
                }
            }

            foreach (GridViewRow gr in this.GridViewB.Rows)
            {
                DataRow drA = dtB.Select("ID=" + ((Label)gr.FindControl("lblBID")).Text.Trim())[0];
                if (((CheckBox)gr.FindControl("chkConfirmB")).Checked == true)
                {
                    drA["CONFIRM_CODE"] = "1";
                    drA["UPDATEUID"] = Session["UID"].ToString();
                    drA["FUN_TYPE"] = "U";
                }
                else
                {
                    drA["CONFIRM_CODE"] = "0";
                    drA["UPDATEUID"] = Session["UID"].ToString();
                    drA["FUN_TYPE"] = "U";
                }
            }

            foreach (GridViewRow gr in this.GridViewC.Rows)
            {
                DataRow drA = dtC.Select("ID=" + ((Label)gr.FindControl("lblCID")).Text.Trim())[0];
                if (((CheckBox)gr.FindControl("chkConfirmC")).Checked == true)
                {
                    drA["CONFIRM_CODE"] = "1";
                    drA["UPDATEUID"] = Session["UID"].ToString();
                    drA["FUN_TYPE"] = "U";
                }
                else
                {
                    drA["CONFIRM_CODE"] = "0";
                    drA["UPDATEUID"] = Session["UID"].ToString();
                    drA["FUN_TYPE"] = "U";
                }
            }

            bco.UpdateStoreDiscount(dtA, dtB, dtC, Session["UID"].ToString(), null);
            this.btnConfirm.Enabled = false;
            this.btnAdd.Enabled = true;
            databind(this.SLP_Store1.Text.Trim());

            //抓取本頁初次登記的時間
            string SessionIDName = "STM193_gvC" + PageTimeStamp.Value;
            this.TabContainer1.ActiveTabIndex = 0;
            SLP_RootNo_C_DET.Text = "";
            SLP_PMA_C_DET.Text = "";
            SLP_Category_C_DET.Text = "";
            SLP_SKU_C_DET.Text = "";
            SLP_ItemPeriod_C_DET.Text = "";
            TextBoxRowCountLimit.Text = "500";

            this.GridViewC.Visible = false;
            dtC = null;
            Session[SessionIDName] = dtC;
            this.GridViewC.DataSource = dtC;
            this.GridViewC.DataBind();

            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('審核完成');", Session["UID"].ToString().Trim()), true);

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }
Ejemplo n.º 9
0
    //更新
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            SLP_SKU_C.Text = "";
            SLP_ItemPeriod_C.Text = "";
            txtItemPeriod_END_C.Text = "";
            SLP_SLPNumber_C2.Text = "";
            SLP_SLPNumber_C.Text = "";
            SLP_SLPNumber2.Text = "";
            SLP_SLPNumber3.Text = "";
            SLP_SLPDate3.Text = "";
            SLP_SLPDate4.Text = "";
            this.HidIDC.Value = "";
            this.panC.Visible = false;

            SLP_RootNo_B.Text = "";
            SLP_PMA_B.Text = "";
            SLP_Category_B.Text = "";
            SLP_SLPNumber1.Text = "";
            SLP_SLPDate1.Text = "";
            SLP_SLPDate2.Text = "";
            this.HidIDB.Value = "";
            this.panB.Visible = false;

            SLP_RootNo_A.Text = "";
            SLP_PMA_A.Text = "";
            SLP_SLPNumber_PRICE_DIS_A.Text = "";
            SLP_SLPDate_EFF_S_A.Text = "";
            SLP_SLPDate_EFF_S_B.Text = "";
            this.HidIDA.Value = "";
            this.panA.Visible = false;

            BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
            DataTable dtA = (DataTable)Session["STM193_gvA" + PageTimeStamp.Value];
            DataTable dtB = (DataTable)Session["STM193_gvB" + PageTimeStamp.Value];
            DataTable dtC = (DataTable)Session["STM193_gvC" + PageTimeStamp.Value];

            if (dtA == null && dtB == null && dtC == null)
            {
                ErrorMsgLabel.Text = "無設定商品折扣明細資料,請確認";
                return;
            }

            bco.UpdateStoreDiscount(dtA, dtB, dtC, Session["UID"].ToString(), null);
            this.btnConfirm.Enabled = true;

            databind(this.SLP_Store1.Text.Trim());

            //抓取本頁初次登記的時間
            string SessionIDName = "STM193_gvC" + PageTimeStamp.Value;
            this.TabContainer1.ActiveTabIndex = 0;
            SLP_RootNo_C_DET.Text = "";
            SLP_PMA_C_DET.Text = "";
            SLP_Category_C_DET.Text = "";
            SLP_SKU_C_DET.Text = "";
            SLP_ItemPeriod_C_DET.Text = "";
            TextBoxRowCountLimit.Text = "500";

            this.GridViewC.Visible = false;
            dtC=null;
            Session[SessionIDName] = dtC;
            this.GridViewC.DataSource = dtC;
            this.GridViewC.DataBind();

            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('更新完成');", Session["UID"].ToString().Trim()), true);

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }
Ejemplo n.º 10
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            if (this.SLP_Store1.Text.Trim() == string.Empty)
            {
                ErrorMsgLabel.Text = "[門市]欄位請輸入值<br/>";
                return;
            }
            else
            {
                if (Request[SLP_Store1.TextBox_Name.UniqueID].ToString() == "查無資料")
                {
                    ErrorMsgLabel.Text = "查無門市資料";
                    return;
                }
            }

            if (Session["STM192_GROUP_NO"] != null) SLP_StoreGroup1.Text = Session["STM192_GROUP_NO"].ToString();
            if (Session["STM192_GROUP_NAME"] != null) SLP_StoreGroup1.TextBox_Name.Text = Session["STM192_GROUP_NAME"].ToString();

            BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
            DataTable dtA = (DataTable)Session["STM192_gvA" + PageTimeStamp.Value];
            DataTable dtB = (DataTable)Session["STM192_gvB" + PageTimeStamp.Value];
            DataTable dtC = (DataTable)Session["STM192_gvC" + PageTimeStamp.Value];

            if (dtA == null && dtB == null && dtC == null)
            {
                ErrorMsgLabel.Text = "無設定商品折扣明細資料,請確認";
                return;
            }

            bco.CreateStoreDiscount(dtA, dtB, dtC, Session["UID"].ToString(), null);

            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", string.Format("alert('新增完成');location.replace('STM191.aspx');", Session["UID"].ToString().Trim()), true);

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }
Ejemplo n.º 11
0
    protected void btnAdd_A_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender, "A");

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            string SessionIDName = "STM192_gvA" + PageTimeStamp.Value;
            DataTable dtA = new DataTable();
            if (Session[SessionIDName] == null)
            {
                dtA = this.MakeDTForPriceDis();
            }
            else
            {
                dtA = (DataTable)Session[SessionIDName];
            }

            #endregion

            DataRow[] drA1 = (DataRow[])dtA.Select("STORE='" + SLP_Store1.Text.Trim() + "' AND ROOT_NO ='" + SLP_RootNo_A.Text.Trim() + "' AND  PMA ='" + SLP_PMA_A.Text.Trim()
                             + "' AND  CATEGORY IS NULL AND  ITEM IS NULL AND  PERIOD  IS NULL"
                             + " AND  EFF_START =CONVERT('" + Convert.ToDateTime(SLP_SLPDate_EFF_S_A.Text).ToShortDateString() + "','System.DateTime')");
            if (drA1.Length > 0)
            {
                drA1[0].BeginEdit();
                drA1[0]["STORE"] = this.SLP_Store1.Text.Trim();
                drA1[0]["ROOT_NO"] = this.SLP_RootNo_A.Text.Trim();
                drA1[0]["PMA"] = this.SLP_PMA_A.Text.Trim();
                drA1[0]["PRICE_DISCOUNT"] = this.SLP_SLPNumber_PRICE_DIS_A.Text.Trim();
                if (this.SLP_SLPDate_EFF_S_A.Text.Trim() != "")
                    drA1[0]["EFF_START"] = Convert.ToDateTime(this.SLP_SLPDate_EFF_S_A.Text.Trim());
                else
                    drA1[0]["EFF_START"] = System.DBNull.Value;

                if (this.SLP_SLPDate_EFF_S_B.Text.Trim() != "")
                    drA1[0]["EFF_END"] = Convert.ToDateTime(this.SLP_SLPDate_EFF_S_B.Text.Trim());
                else
                    drA1[0]["EFF_END"] = System.DBNull.Value;
                drA1[0].EndEdit();
            }
            else
            {
                DataRow[] drA2 = (DataRow[])dtA.Select("STORE='" + SLP_Store1.Text.Trim() + "' AND ROOT_NO ='" + SLP_RootNo_A.Text.Trim() + "' AND  PMA ='" + SLP_PMA_A.Text.Trim()
                         + "' AND  EFF_END >=CONVERT('" + Convert.ToDateTime(SLP_SLPDate_EFF_S_A.Text).ToShortDateString() + "','System.DateTime')");
                if (drA2.Length > 0)
                {
                    ErrorMsgLabel.Text = "有效開始日期輸入有誤,應大於相同大分類折扣的有效結束日";
                    return;
                }

                //檢查生效日期
                ArrayList ArrPar = new ArrayList();
                ArrPar.Add(this.SLP_Store1.Text.Trim());
                ArrPar.Add(8);
                ArrPar.Add(Convert.ToDateTime(this.SLP_SLPDate_EFF_S_A.Text.Trim()));
                ArrPar.Add(this.SLP_RootNo_A.Text.Trim());
                ArrPar.Add(this.SLP_PMA_A.Text.Trim());
                ArrPar.Add(System.DBNull.Value);
                ArrPar.Add(System.DBNull.Value);
                ArrPar.Add(System.DBNull.Value);

                BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
                int iResult;
                bco.QueryDisCountStartDate(ArrPar, out iResult);
                if (iResult > 0)
                {
                    ErrorMsgLabel.Text = "有效開始日期輸入有誤,應大於相同大分類折扣的有效結束日";
                    return;
                }

                DataRow drA = dtA.NewRow();
                drA["STORE"] = this.SLP_Store1.Text.Trim();
                drA["ROOT_NO"] = this.SLP_RootNo_A.Text.Trim();
                drA["PMA"] = this.SLP_PMA_A.Text.Trim();
                drA["PRICE_DISCOUNT"] = this.SLP_SLPNumber_PRICE_DIS_A.Text.Trim();
                if (this.SLP_SLPDate_EFF_S_A.Text.Trim() != "")
                    drA["EFF_START"] = Convert.ToDateTime(this.SLP_SLPDate_EFF_S_A.Text.Trim());
                else
                    drA["EFF_START"] = System.DBNull.Value;

                if (this.SLP_SLPDate_EFF_S_B.Text.Trim() != "")
                    drA["EFF_END"] = Convert.ToDateTime(this.SLP_SLPDate_EFF_S_B.Text.Trim());
                else
                    drA["EFF_END"] = System.DBNull.Value;

                drA["DISCOUNT_KIND"] = 8;
                drA["CONFIRM_CODE"] = 0;
                drA["FUN_TYPE"] = "A";
                dtA.Rows.Add(drA);
            }

            this.GridViewA.Visible = true;
            DataView dvA = dtA.DefaultView;
            dvA.Sort = "ROOT_NO,PMA";
            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = dtA;
            this.GridViewA.DataSource = dvA;
            this.GridViewA.DataBind();

            SLP_RootNo_A.Text = "";
            SLP_PMA_A.Text = "";
            SLP_SLPNumber_PRICE_DIS_A.Text = "";
            this.SLP_SLPDate_EFF_S_A.Text = DateTime.Today.ToString("yyyy/MM/dd");
            this.SLP_SLPDate_EFF_S_B.Text = "9999/12/31";
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
    }
Ejemplo n.º 12
0
    public static string GetStoreGroup(string txtStore)
    {
        BCO.MaintainStoreDiscount bco = new BCO.MaintainStoreDiscount(ConnectionDB);
        string sStoreGroup = string.Empty;
        string sStoreGName = string.Empty;
        int iCNT = 0;
        bco.QueryStoreGroupByStore(txtStore, out sStoreGroup, out sStoreGName, out iCNT);

        STM_STM192 stm192 = new STM_STM192();
        stm192.setSession(sStoreGroup, sStoreGName);
        return sStoreGroup + "," + sStoreGName + "," + iCNT;


    }