Ejemplo n.º 1
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.º 2
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;


    }