}//Page_Load

    private void QueryData()
    {
        #region

        string SessionIDName = string.Format("{0}_{1}", strPrefixed, PageTimeStamp.Value);

        DataTable dt = new DataTable();
        ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);

        ArrayList ParameterList = new ArrayList();

        ParameterList.Clear();
        ParameterList.Add(this.SLP_StoreChain1.Text);
        ParameterList.Add(this.SLP_StoreChain2.Text);
        ParameterList.Add(this.SLP_Z_O1.Text);
        ParameterList.Add(this.SLP_Z_O2.Text);
        ParameterList.Add(this.SLP_Store1.Text);
        ParameterList.Add(this.SLP_Store2.Text);

        Int32 iTopRowNum;
        Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum);
        ParameterList.Add(iTopRowNum);

        dt = BCO.QueryStore(ParameterList);


        bAfterQueryDataBinding = true;

        if (!dt.Columns.Contains("CHECKED"))
            dt.Columns.Add("CHECKED");

        if (!dt.Columns.Contains("ROWID"))//判別勾選與否
            dt.Columns.Add("ROWID");


        hidden_RowID_MaxID.Value = dt == null ? "-1" : (dt.Rows.Count - 1).ToString();//記錄最大ROWID
        hidden_RowID_Selected.Value = "";//清空已選ROWID

        Session[SessionIDName] = dt;


        SetRowIDToDataTable(true);//設定ROWID

        GridView1.DataSource = dt;
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();
        GridView1.SelectedIndex = -1;

        GridView2.DataSource = null;
        GridView2.DataBind();


        bAfterQueryDataBinding = false;

        LabelQueryRecordCount.Text = string.Format(" {0} Rows ", dt.Rows.Count.ToString());

        if (dt == null || (dt != null && dt.Rows.Count <= 0))
        {
            ResultMsgLabel.Text = "查無資料";
        }

        #endregion
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 把值傳到Client端
    /// </summary>
    /// <returns></returns>
    public string GetCallbackResult()
    {
        #region

        string rtn = "", strResult = "";

        try
        {
            ALOModel.MaintinDisPattern BCO = new ALOModel.MaintinDisPattern(ConnectionDB);
            ALOModel.MaintainDisStoreMemo BCO2 = new ALOModel.MaintainDisStoreMemo(ConnectionDB);
            ALOModel.MaintainStoreOrderItem BCO3 = new ALOModel.MaintainStoreOrderItem(ConnectionDB);
            ALOModel.MaintainStoreAssignItem BCO4 = new ALOModel.MaintainStoreAssignItem(ConnectionDB);

            DataTable dt = null;
            DataTable dt2 = null;
            DataTable dt3 = null;

            string strChan_No = "", strChan_Name = "", strStore = "", strStore_Name = "", strCommemt = "", strConfirm = "", strStoreStateDesc = "";

            Int32 iResult = 0;


            if (ObjectFrom == "PMA")//改由PageMethod執行
            {
                dt = BCO.QueryRootByPMA(CallServerValue);
            }
            else if (ObjectFrom == "PATTERN")//改由PageMethod執行
            {
                dt = BCO.QueryPMAByPattern(CallServerValue);
            }
            else if (ObjectFrom == "ITEM")//改由PageMethod執行
            {
                dt = BCO.QueryPMA_PatternByItem(CallServerValue);
            }
            else if (ObjectFrom == "STORE")
            {
                #region

                string[] strAry = CallServerValue.Split("_".ToCharArray());

                ArrayList ParameterList = new ArrayList();//20091112
                ParameterList.Clear();
                ParameterList.Add(strAry[0]);//Store

                dt = BCO2.QueryChanNoByStore(ParameterList);
                dt3 = BCO3.CheckSettingStateByStore(ParameterList);

                if (dt != null && dt.Rows.Count > 0)
                {
                    strChan_No = dt.Rows[0][0].ToString().Trim();
                    strChan_Name = dt.Rows[0][1].ToString().Trim();
                    strStore_Name = dt.Rows[0][3].ToString().Trim();

                    #region
                    ParameterList.Clear();
                    ParameterList.Add(strAry[1] != "" ? strAry[1] : strChan_No);//Chan_No
                    ParameterList.Add(strAry[0]);//Store
                    dt2 = BCO2.QueryMemoByChanAndStore(ParameterList);//get memo
                    #endregion

                    if (strChan_No != strAry[1] && strAry[1] != "")
                        strStore_Name = "查無資料";

                    ParameterList.Clear();
                    ParameterList.Add(dt.Rows[0][0].ToString());
                    ParameterList.Add(strAry[0]);
                    strStoreStateDesc = BCO4.CheckByChanAndStore(ParameterList);

                    if (strChan_No != strAry[1] && strAry[1] != "")
                        strStoreStateDesc = "輸入門市不屬於輸入通路";

                }
                else
                {
                    strStore_Name = "查無資料";
                    strStoreStateDesc = "輸入門市不屬於輸入通路";

                    if (strAry[0] == "" || strAry[1] == "")
                        strStoreStateDesc = "通路、門市必填";

                }

                if (dt2 != null && dt2.Rows.Count > 0)
                {
                    strCommemt = dt2.Rows[0][0].ToString().Trim();

                    if (strChan_No != strAry[1] && strAry[1] != "")
                        strCommemt = "";

                    if (strCommemt == "")
                        strCommemt = "無設定備註";
                }
                else
                {
                    strCommemt = "無設定備註";
                }


                if (dt3 != null && dt3.Rows.Count > 0)
                {
                    Int32.TryParse(dt3.Rows[0][0].ToString().Trim(), out iResult);
                    strConfirm = iResult.ToString();

                    if (strChan_No != strAry[1])
                        strConfirm = "0";

                }
                else
                {
                    strConfirm = "0";
                }


                rtn = string.Format("{0}||{1}||{2}||{3}||{4}||{5}", strChan_No, strChan_Name, strStore_Name, strCommemt, strConfirm, strStoreStateDesc);
                #endregion
            }


            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    if (ObjectFrom == "PMA")
                    {
                        //ROOT
                        rtn = string.Format("{0}", dt.Rows[0][0].ToString());
                    }
                    else if (ObjectFrom == "PATTERN")
                    {
                        //ROOT-PMA
                        rtn = string.Format("{0}-{1}", dt.Rows[0][1].ToString(), dt.Rows[0][0].ToString());
                    }
                    else if (ObjectFrom == "ITEM")
                    {
                        //ROOT-PMA-PATTERN
                        rtn = string.Format("{0}-{1}-{2}", dt.Rows[0][2].ToString(), dt.Rows[0][0].ToString(), dt.Rows[0][1].ToString());
                    }
                }
            }

            //附加相關控制項
            if (ObjectFrom == "PMA")
            {
                strResult = string.Format("{0},{1}", SLP_ROOT.TextBox_Code.ClientID, rtn);
            }
            else if (ObjectFrom == "PATTERN")
            {
                strResult = string.Format("{0}-{1},{2}", SLP_ROOT.TextBox_Code.ClientID, SLP_PMA.TextBox_Code.ClientID, rtn);
            }
            else if (ObjectFrom == "ITEM")
            {
                strResult = string.Format("{0}-{1}-{2},{3}", SLP_ROOT.TextBox_Code.ClientID, SLP_PMA.TextBox_Code.ClientID, SLP_Pattern.TextBox_Code.ClientID, rtn);
            }
            else if (ObjectFrom == "STORE")
            {
                strResult = string.Format("{0}||{1}||{2}||{3}||{4};{5}",
                          ((TextBox)((STM_SLP_StoreChain)FormView1.FindControl("SLP_StoreChain1")).FindControl("TextBoxCode")).ClientID,
                          ((TextBox)FormView1.FindControl("txt_Comment")).ClientID,
                          hiddenCounts.ClientID,
                          hiddenStoreStateDesc.ClientID,
                          ((Button)FormView1.FindControl("btn_EditComment")).ClientID,
                          rtn);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return strResult;
        #endregion
    }
Ejemplo n.º 3
0
    protected void btn_Exec_Click(object sender, EventArgs e)
    {
        try
        {
            if (CheckInputValuesNotNull())
            {
                if (SLP_SKU1.Text.Trim() == SLP_SKU2.Text.Trim())
                {
                    ResultMsgLabel.Text = "品號不可相同";
                    return;
                }

                ALOModel.MaintainStoreOrderItem BCO = new PIC.VDS2G.BSM.ALO.MaintainStoreOrderItem(ConnectionDB);
                bool bResult = BCO.CopyToNewItem(GetInputValues(), null);
                if (bResult)
                {
                    ResultMsgLabel.Text = "複製成功";
                }
                else
                {
                    ResultMsgLabel.Text = "複製失敗";
                }
            }
            else
            {
                ResultMsgLabel.Text = "欄位不可空白";
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            fmStatus = FormStatus.fmBrowse;
        }


    }
Ejemplo n.º 4
0
    private bool CheckStoreOrderItemCanAdd(ArrayList ParameterList)
    {
        #region
        bool bResult = false;

        try
        {
            ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);
            string strErrMsg = "";
            bResult = BCO.CheckStoreOrderItemCanAdd(ParameterList, ref strErrMsg);


            if (!bResult && strErrMsg != "")
            {
                ErrorMsgLabel.Text = strErrMsg;
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", strErrMsg), true);
            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

        return bResult;
        #endregion
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 把值傳到Client端
    /// </summary>
    /// <returns></returns>
    public string GetCallbackResult()
    {
        #region
        string rtn = "", strResult = "";
        ALOModel.MaintinDisPattern BCO = new ALOModel.MaintinDisPattern(ConnectionDB);
        ALOModel.MaintainDisStoreMemo BCO2 = new ALOModel.MaintainDisStoreMemo(ConnectionDB);
        ALOModel.MaintainStoreOrderItem BCO3 = new ALOModel.MaintainStoreOrderItem(ConnectionDB);
        ALOModel.MaintainStoreAssignItem BCO4 = new ALOModel.MaintainStoreAssignItem(ConnectionDB);

        DataTable dt = null;
        DataTable dt2 = null;
        DataTable dt3 = null;

        string strChan_No = "", strChan_Name = "", strStore_Name = "", strCommemt = "", strConfirm = "", strStoreStateDesc = "";
        Int32 iResult = 0;

        if (ObjectFrom.IndexOf("STORE") != -1)
        {
            #region

            string[] strAry = CallServerValue.Split("_".ToCharArray());

            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();
            ParameterList.Add(strAry[0]);//Store

            dt = BCO2.QueryChanNoByStore(ParameterList);
            dt3 = BCO3.CheckSettingStateByStore(ParameterList);

            if (dt != null && dt.Rows.Count > 0)
            {
                strChan_No = dt.Rows[0][0].ToString().Trim();
                strChan_Name = dt.Rows[0][1].ToString().Trim();
                strStore_Name = dt.Rows[0][3].ToString().Trim();

                #region
                ParameterList.Clear();
                ParameterList.Add(strAry[1] != "" ? strAry[1] : strChan_No);//Chan_No
                ParameterList.Add(strAry[0]);//Store
                dt2 = BCO2.QueryMemoByChanAndStore(ParameterList);//get memo
                #endregion


                if (strChan_No != strAry[1] && strAry[1] != "")
                    strStore_Name = "查無資料";

                ParameterList.Clear();
                ParameterList.Add(dt.Rows[0][0].ToString());
                ParameterList.Add(strAry[0]);
                strStoreStateDesc = BCO4.CheckByChanAndStore(ParameterList);

                if (strChan_No != strAry[1] && strAry[1] != "")
                    strStoreStateDesc = "輸入門市不屬於輸入通路";

            }
            else 
            {
                strStore_Name = "查無資料";
                strStoreStateDesc = "輸入門市不屬於輸入通路";

                if(strAry[0]=="" || strAry[1] =="")
                    strStoreStateDesc = "通路、門市必填";
            }

            if (dt2 != null && dt2.Rows.Count > 0)
            {
                strCommemt = dt2.Rows[0][0].ToString().Trim();

                if (strChan_No != strAry[1] && strAry[1] != "")
                    strCommemt = "";

                if (strCommemt == "")
                    strCommemt = "無設定備註";
            }
            else
            {
                strCommemt = "無設定備註";
            }


            if (dt3 != null && dt3.Rows.Count > 0)
            {
                Int32.TryParse(dt3.Rows[0][0].ToString().Trim(), out iResult);
                strConfirm = iResult.ToString();
            }
            else
            {
                strConfirm = "0";
            }


            rtn = string.Format("{0}||{1}||{2}||{3}||{4}||{5}", strChan_No, strChan_Name, strStore_Name, strCommemt, strConfirm, strStoreStateDesc);
            #endregion
        }


        //附加相關控制項
        if (ObjectFrom.IndexOf("STORE") != -1)
        {
            TextBox txtStoreChain1 = (TextBox)SLP_StoreChain1.FindControl("TextBoxCode");
            TextBox txtStoreChain2 = (TextBox)SLP_StoreChain2.FindControl("TextBoxCode");

            if (ObjectFrom.IndexOf("1") != -1)
            {
                strResult = string.Format("{0}||{1}||{2}||{3}||{4};{5}",
                          txtStoreChain1.UniqueID,
                          txt_Comment.UniqueID,
                          hiddenCounts.UniqueID,
                          hiddenStoreStateDesc.UniqueID,
                          btn_EditComment.ClientID,
                          rtn);

            }
            else if (ObjectFrom.IndexOf("2") != -1)
            {
                strResult = string.Format("{0}||{1}||{2}||{3}||{4};{5}",
                          txtStoreChain2.UniqueID,
                          txt_Comment.UniqueID,
                          hiddenCounts.UniqueID,
                          hiddenStoreStateDesc.UniqueID,
                          btn_EditComment.ClientID,
                          rtn);

            }

        }

        return strResult;
        #endregion
    }
Ejemplo n.º 6
0
    protected void SmartGridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        #region
        try
        {
            bool bResult = false;
            #region 取得畫面元件的值

            DateTime processtime = DateTime.Now;

            #endregion

            #region 取得刪除前舊值


            Label lbl_ID = (Label)SmartGridView1.Rows[e.RowIndex].FindControl("lbl_ID");
            SetTmpDataForMaster(lbl_ID.Text.Trim());//將CurrentRow的值塞入暫存master
            DataTable dtTemp = dtForMaster;

            if (dtTemp == null || dtTemp.Rows.Count == 0)
            {
                throw new Exception("抓取不到舊值,更新失敗!");
            }

            #endregion

            #region 加入更新條件

            //master
            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            //舊值
            ParameterList.Add(dtTemp.Rows[0]["ID"]);
            ParameterList.Add(dtTemp.Rows[0]["CODE"]);
            ParameterList.Add(dtTemp.Rows[0]["ENABLE"]);
            ParameterList.Add(dtTemp.Rows[0]["CREATEDATE"]);
            ParameterList.Add(dtTemp.Rows[0]["CREATEUID"]);
            ParameterList.Add(dtTemp.Rows[0]["UPDATEDATE"]);
            ParameterList.Add(dtTemp.Rows[0]["UPDATEUID"]);
            ParameterList.Add(dtTemp.Rows[0]["CHAN_NO"]);
            ParameterList.Add(dtTemp.Rows[0]["STORE"]);
            ParameterList.Add(dtTemp.Rows[0]["ITEM"]);

            ParameterList.Add(dtTemp.Rows[0]["PERIOD_ST"]);
            ParameterList.Add(dtTemp.Rows[0]["PERIOD_END"]);
            ParameterList.Add(dtTemp.Rows[0]["ORDER_QTY"]);
            ParameterList.Add(dtTemp.Rows[0]["BUY_FLAG"]);
            ParameterList.Add(dtTemp.Rows[0]["REASON"]);
            //需要更新值
            ParameterList.Add(processtime);
            ParameterList.Add(Session["UID"].ToString());
            #endregion

            ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);

            bResult = BCO.DeleteMaster(ParameterList, null);
            //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('刪除完成');", true);
            ResultMsgLabel.Text = "刪除完成";
            QueryData();
            CurrentPageMode = PageCurrentMode.Readonly;
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
Ejemplo n.º 7
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void QueryData()
    {
        #region

        if (rBtn_STORE.Checked)
        {
            if (SLP_StoreChain1.Text.Trim() == "" || SLP_Store1.Text.Trim() == "")
            {
                ErrorMsgLabel.Text = "通路門市資料為必填";
                CurrentPageMode = PageCurrentMode.Query;
                return;
            }
        }
        else if (rBtn_ITEM.Checked)
        {
            if (SLP_SKU1.Text == "")
            {
                ErrorMsgLabel.Text = "品號為必填";
                CurrentPageMode = PageCurrentMode.Query;
                return;
            }
        }
        else
        {
            ErrorMsgLabel.Text = "請選擇查詢方式";
            CurrentPageMode = PageCurrentMode.Query;
            return;        
        }


        LabelQueryRecordCount.Text = "";

        string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

        ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);

        //2010/04/13 modified:for performance DataTable Dt = BCO.QueryStoreOrderItemByFind(GetInputValues());
        DataTable Dt = BCO.QueryStoreOrderItemByFind2(GetInputValues());

        Session[SessionIDName] = Dt;

        SmartGridView1.DataSource = Dt;
        
        SmartGridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text);

        if (!(CurrentPageMode == PageCurrentMode.Query || CurrentPageMode == PageCurrentMode.Readonly))
        {
            SmartGridView1.PageIndex = GetPageIndexByParam(SLP_SKU3.Text.Trim());
        }
        else
        {
            SmartGridView1.PageIndex = 0;
        }
        
        SmartGridView1.DataBind();

        LabelQueryRecordCount.Text = string.Format(" {0} Rows ", Dt.Rows.Count.ToString());

        if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
        {

            if (btn_Export.Visible == true)
            {
                btn_Export.Enabled = false;
            }

            //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true);
            ResultMsgLabel.Text = "查無資料";
            CurrentPageMode = PageCurrentMode.Query;
        }
        else 
        {

            if (btn_Export.Visible == true)
            {
                btn_Export.Enabled = true;
            }

            LastPageMode = PageCurrentMode.Query;
            CurrentPageMode = PageCurrentMode.Readonly;
        }

        if (rBtn_STORE.Checked)
        {
            btn_EditComment.Enabled = true;
        }
        else
        {
            btn_EditComment.Enabled = false;
        }

        #endregion
    }
Ejemplo n.º 8
0
    private string GetStoreValueByPageMethod(string CallServerValue)
    {
        #region


        ALOModel.MaintainDisStoreMemo BCO2 = new ALOModel.MaintainDisStoreMemo(ConnectionDB);
        ALOModel.MaintainStoreOrderItem BCO3 = new ALOModel.MaintainStoreOrderItem(ConnectionDB);
        ALOModel.MaintainStoreAssignItem BCO4 = new ALOModel.MaintainStoreAssignItem(ConnectionDB);
        string rtn = "";
        string strChan_No = "", strChan_Name = "", strStore_Name = "", strCommemt = "", strConfirm = "", strStoreStateDesc = "";
        Int32 iResult = 0;
        string[] strAry = CallServerValue.Split("_".ToCharArray());

        try
        {
            DataTable dt = null;
            DataTable dt2 = null;
            DataTable dt3 = null;

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(strAry[0]);//Store

            dt = BCO2.QueryChanNoByStore(ParameterList);
            dt3 = BCO3.CheckSettingStateByStore(ParameterList);

            if (dt != null && dt.Rows.Count > 0)
            {
                strChan_No = dt.Rows[0][0].ToString().Trim();
                strChan_Name = dt.Rows[0][1].ToString().Trim();
                strStore_Name = dt.Rows[0][3].ToString().Trim();

                #region
                ParameterList.Clear();
                ParameterList.Add(strAry[1] != "" ? strAry[1] : strChan_No);//Chan_No
                ParameterList.Add(strAry[0]);//Store
                dt2 = BCO2.QueryMemoByChanAndStore(ParameterList);//get memo
                #endregion

                if (strChan_No != strAry[1] && strAry[1] != "")
                    strStore_Name = "查無資料";

                ParameterList.Clear();
                ParameterList.Add(dt.Rows[0][0].ToString());
                ParameterList.Add(strAry[0]);
                strStoreStateDesc = BCO4.CheckByChanAndStore(ParameterList);

                if (strChan_No != strAry[1] && strAry[1] != "")
                    strStoreStateDesc = "輸入門市不屬於輸入通路";

            }
            else
            {
                strStore_Name = "查無資料";
                strStoreStateDesc = "輸入門市不屬於輸入通路";

                if (strAry[0] == "" || strAry[1] == "")
                    strStoreStateDesc = "通路、門市必填";

            }

            if (dt2 != null && dt2.Rows.Count > 0)
            {
                strCommemt = dt2.Rows[0][0].ToString().Trim();

                if (strChan_No != strAry[1] && strAry[1] != "")
                    strCommemt = "";

                if (strCommemt == "")
                    strCommemt = "無設定備註";
            }
            else
            {
                strCommemt = "無設定備註";
            }


            if (dt3 != null && dt3.Rows.Count > 0)
            {
                Int32.TryParse(dt3.Rows[0][0].ToString().Trim(), out iResult);
                strConfirm = iResult.ToString();
            }
            else
            {
                strConfirm = "0";
            }


            rtn = string.Format("{0}||{1}||{2}||{3}||{4}||{5}", strChan_No, strChan_Name, strStore_Name, strCommemt, strConfirm, strStoreStateDesc);

        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            BCO2.CloseConnection();
            BCO3.CloseConnection();
            BCO4.CloseConnection();
        }

        return rtn;

        #endregion
    }
Ejemplo n.º 9
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        #region
        if (CurrentPageMode == PageCurrentMode.Edit)
        {
            #region
            bool bResult = false;

            try
            {
                #region Master

                #region New
                ArrayList ParameterListNew = new ArrayList();
                ParameterListNew.Clear();
                string strCode = string.Format("{0}_{1}_{2}_{3}_{4}",
                    SLP_StoreChain2.Text.Trim(), SLP_Store2.Text.Trim(), SLP_SKU3.Text.Trim(), SLP_ItemPeriod5.Text.Trim(), SLP_ItemPeriod6.Text.Trim());

                ParameterListNew.Add(strCode);
                ParameterListNew.Add(Session["UID"].ToString());
                ParameterListNew.Add(SLP_StoreChain2.Text.Trim());
                ParameterListNew.Add(SLP_Store2.Text.Trim());
                ParameterListNew.Add(SLP_SKU3.Text.Trim());
                ParameterListNew.Add(SLP_ItemPeriod5.Text.Trim());
                ParameterListNew.Add(SLP_ItemPeriod6.Text.Trim());
                ParameterListNew.Add(SLP_Number1.Text.Trim());
                ParameterListNew.Add(((CheckBox)this.SLP_Boolean1.FindControl("C1")).Checked ? "1" : "0");
                ParameterListNew.Add(strReason.Trim());
                #endregion

                #region Original
                DataTable dtTemp = dtForMaster;

                if (dtTemp == null || dtTemp.Rows.Count == 0)
                {
                    throw new Exception("抓取不到舊值,更新失敗!");
                }

                DateTime processtime = DateTime.Now;
                ArrayList ParameterListOriginal = new ArrayList();
                ParameterListOriginal.Clear();
                //舊值
                ParameterListOriginal.Add(dtTemp.Rows[0]["ID"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["CODE"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["ENABLE"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["CREATEDATE"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["CREATEUID"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["UPDATEDATE"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["UPDATEUID"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["CHAN_NO"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["STORE"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["ITEM"]);

                ParameterListOriginal.Add(dtTemp.Rows[0]["PERIOD_ST"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["PERIOD_END"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["ORDER_QTY"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["BUY_FLAG"]);
                ParameterListOriginal.Add(dtTemp.Rows[0]["REASON"]);
                //需要更新值
                ParameterListOriginal.Add(processtime);
                ParameterListOriginal.Add(Session["UID"].ToString());

                #endregion

                ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);

                if (s_PERIOD_ST == SLP_ItemPeriod5.Text.Trim() && s_PERIOD_END == SLP_ItemPeriod6.Text.Trim())
                {
                    bResult = BCO.UpdateMaster(ParameterListNew, null);
                }
                else
                {
                    bResult = BCO.UpdateMaster_PKEditable(ParameterListOriginal, ParameterListNew, null);
                }

                if (!bResult)
                {
                    throw new Exception("更新0筆資料!");
                }
                else
                {
                    //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('更改完成');", true);
                    ResultMsgLabel.Text = "更改完成";
                    QueryData();
                    CurrentPageMode = PageCurrentMode.Readonly;
                    //PanelMasterAndDetail.Visible = false;
                }
                #endregion
            }
            catch (Exception ex)
            {
                ErrorMsgLabel.Text = ex.Message;
            }
            #endregion
        }
        else if (CurrentPageMode == PageCurrentMode.Insert)
        {
            #region
            Int32 iResult = 0;

            try
            {
                ArrayList ParameterList1 = new ArrayList();
                ParameterList1.Clear();
                ParameterList1.Add(SLP_StoreChain2.Text.Trim());
                ParameterList1.Add(SLP_Store2.Text.Trim());
                ParameterList1.Add(SLP_SKU3.Text.Trim());
                ParameterList1.Add(SLP_ItemPeriod5.Text.Trim());
                ParameterList1.Add(SLP_ItemPeriod6.Text.Trim());


                if (CheckStoreOrderItemCanAdd(ParameterList1))
                {
                    #region

                    #region Master
                    ArrayList ParameterList = new ArrayList();
                    ParameterList.Clear();
                    string strCode = string.Format("{0}_{1}_{2}_{3}_{4}",
                        SLP_StoreChain2.Text.Trim(), SLP_Store2.Text.Trim(), SLP_SKU3.Text.Trim(), SLP_ItemPeriod5.Text.Trim(), SLP_ItemPeriod6.Text.Trim());

                    ParameterList.Add(strCode);
                    ParameterList.Add(Session["UID"].ToString());
                    ParameterList.Add(SLP_StoreChain2.Text.Trim());
                    ParameterList.Add(SLP_Store2.Text.Trim());
                    ParameterList.Add(SLP_SKU3.Text.Trim());
                    ParameterList.Add(SLP_ItemPeriod5.Text.Trim());
                    ParameterList.Add(SLP_ItemPeriod6.Text.Trim());
                    ParameterList.Add(SLP_Number1.Text.Trim());
                    ParameterList.Add(((CheckBox)this.SLP_Boolean1.FindControl("C1")).Checked ? "1" : "0");
                    ParameterList.Add(strReason.Trim());


                    #endregion

                    ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);

                    iResult = BCO.CreateStoreOrderItem(ParameterList, null);

                    if (iResult == 0)
                    {
                        throw new Exception("新增0筆資料!");
                    }
                    else
                    {
                        //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('新增完成');", true);
                        ResultMsgLabel.Text = "新增完成";
                        QueryData();
                        CurrentPageMode = PageCurrentMode.Readonly;
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                ErrorMsgLabel.Text = ex.Message;
            }
            #endregion
        }
        #endregion
    }
Ejemplo n.º 10
0
    protected void btn_PatternSelect_Click(object sender, EventArgs e)
    {
        #region
        try
        {

            dtMultiSaveClassAndItem = dtClassAndItemSelected;// (DataTable)Session["dtClassAndItemSelected"];

            if (dtMultiSaveClassAndItem.Rows.Count > 0)
            {

                #region
                if (!dtMultiSaveClassAndItem.Columns.Contains("chan_no"))
                    dtMultiSaveClassAndItem.Columns.Add("chan_no");
                if (!dtMultiSaveClassAndItem.Columns.Contains("store"))
                    dtMultiSaveClassAndItem.Columns.Add("store");
                if (!dtMultiSaveClassAndItem.Columns.Contains("period_st"))
                    dtMultiSaveClassAndItem.Columns.Add("period_st");
                if (!dtMultiSaveClassAndItem.Columns.Contains("period_end"))
                    dtMultiSaveClassAndItem.Columns.Add("period_end");
                if (!dtMultiSaveClassAndItem.Columns.Contains("order_qty"))
                    dtMultiSaveClassAndItem.Columns.Add("order_qty");
                if (!dtMultiSaveClassAndItem.Columns.Contains("buy_flag"))
                    dtMultiSaveClassAndItem.Columns.Add("buy_flag");
                if (!dtMultiSaveClassAndItem.Columns.Contains("buy_flag_show"))
                    dtMultiSaveClassAndItem.Columns.Add("buy_flag_show");
                if (!dtMultiSaveClassAndItem.Columns.Contains("reason"))
                    dtMultiSaveClassAndItem.Columns.Add("reason");
                if (!dtMultiSaveClassAndItem.Columns.Contains("explain"))
                    dtMultiSaveClassAndItem.Columns.Add("explain");
                #endregion


                ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);
                string strPeriodSt, strPeriodEnd;
                Int32 iPeriodSt, iPeriodEnd;
                string strErrMsg = "", strErrMsgFinal = "";
                ArrayList ParameterList = new ArrayList();//20091112

                //取得其他預設值
                for (Int32 i = dtMultiSaveClassAndItem.Rows.Count - 1; i >= 0; i--)
                {
                    #region
                    strPeriodSt = "";
                    strPeriodEnd = "";
                    strErrMsg = "";
                    iPeriodSt = 0;

                    ParameterList.Clear();
                    ParameterList.Add(dtMultiSaveClassAndItem.Rows[i]["ITEM"]);


                    strPeriodSt = BCO.GetNextPeriodStByItem(ParameterList);

                    Int32.TryParse(strPeriodSt, out iPeriodSt);

                    strPeriodSt = (iPeriodSt + 1000000).ToString().Substring(1, 6);

                    if (rbtn_PeriodNext3.Checked)
                    {
                        strPeriodEnd = (iPeriodSt + 3 + 1000000).ToString().Substring(1, 6);
                    }
                    else if (rbtn_PeriodUnlimited.Checked)
                    {
                        strPeriodEnd = "999999";
                    }

                    dtMultiSaveClassAndItem.Rows[i]["period_st"] = strPeriodSt;
                    dtMultiSaveClassAndItem.Rows[i]["period_end"] = strPeriodEnd;

                    dtMultiSaveClassAndItem.Rows[i]["chan_no"] = SLP_StoreChain1.Text.Trim();
                    dtMultiSaveClassAndItem.Rows[i]["store"] = SLP_Store1.Text.Trim();
                    dtMultiSaveClassAndItem.Rows[i]["order_qty"] = SLP_SLPNumber1.Text;
                    dtMultiSaveClassAndItem.Rows[i]["buy_flag"] = ((CheckBox)this.SLP_Boolean1.FindControl("C1")).Checked ? "1" : "0";
                    dtMultiSaveClassAndItem.Rows[i]["buy_flag_show"] = ((CheckBox)this.SLP_Boolean1.FindControl("C1")).Checked ? "是" : "否";
                    dtMultiSaveClassAndItem.Rows[i]["reason"] = SLP_CodeFile1.Text;
                    dtMultiSaveClassAndItem.Rows[i]["explain"] = ((DropDownList)SLP_CodeFile1.FindControl("D1")).SelectedItem.Text;

                    ParamTemp.Clear();
                    ParamTemp.Add(dtMultiSaveClassAndItem.Rows[i]["chan_no"].ToString().Trim());
                    ParamTemp.Add(dtMultiSaveClassAndItem.Rows[i]["store"].ToString().Trim());
                    ParamTemp.Add(dtMultiSaveClassAndItem.Rows[i]["item"].ToString().Trim());
                    ParamTemp.Add(dtMultiSaveClassAndItem.Rows[i]["period_st"].ToString().Trim());
                    ParamTemp.Add(dtMultiSaveClassAndItem.Rows[i]["period_end"].ToString().Trim());

                    if (!BCO.CheckStoreOrderItemCanAdd(ParamTemp, ref strErrMsg))
                    {
                        //strErrMsgFinal += string.Format("{0}_{1}_{2}_{3}_{4}:{5},",
                        //                    dtMultiSaveClassAndItem.Rows[i]["chan_no"].ToString().Trim(),
                        //                    dtMultiSaveClassAndItem.Rows[i]["store"].ToString().Trim(),
                        //                    dtMultiSaveClassAndItem.Rows[i]["item"].ToString().Trim(),
                        //                    dtMultiSaveClassAndItem.Rows[i]["period_st"].ToString().Trim(),
                        //                    dtMultiSaveClassAndItem.Rows[i]["period_end"].ToString().Trim(),
                        //                    strErrMsg);

                        strErrMsgFinal += string.Format("{0}:{1};\\n", dtMultiSaveClassAndItem.Rows[i]["item"].ToString().Trim(), strErrMsg);
                        //所選擇之商品為 [逾期]或[未生效]資料,不可設定

                        dtMultiSaveClassAndItem.Rows.RemoveAt(i);
                    }

                    #endregion
                }


                if (strErrMsgFinal != "")
                {

                    if (strErrMsgFinal.Substring(strErrMsgFinal.Length - 3, 3) == ";\\n")
                    {
                        strErrMsgFinal = strErrMsgFinal.Substring(0, strErrMsgFinal.Length - 3);
                    }

                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "strErrMsgFinal", string.Format("alert('{0}。');", strErrMsgFinal), true);
                }
            }


            GridView1.DataSource = dtMultiSaveClassAndItem;
            GridView1.DataBind();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
Ejemplo n.º 11
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        #region
        try
        {

            if (dtMultiSaveClassAndItem.Rows.Count > 0)
            {
                ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);
                bool bResult = false;

                bResult = BCO.CreateMultiStoreOrderItems(dtMultiSaveClassAndItem, null);

                if (!bResult)
                {
                    throw new Exception("新增0筆資料!");
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "ClientScript", string.Format("alert('新增完成');location.replace('ALO051.aspx?Code=ALO05&ChanNo={0}&Store={1}');", SLP_StoreChain1.Text, SLP_Store1.Text), true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "ClientScript", "alert('請先加入商品');", true);
            }

        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        #endregion
    }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region

        ErrorMsgLabel.Text = "";

        strReason = SLP_CodeFile1.Text;

        if (!IsPostBack)
        {

            if (Request.QueryString["PageTimeStamp"] != null)
                PageTimeStamp.Value = Request.QueryString["PageTimeStamp"];
            else
                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')
                                );



            if (Request.QueryString["Item"] != null)
            {
                SLP_SKU1.Text = Request.QueryString["Item"].Trim();
            }

            SLP_SKU1.ReadOnly = true;

            ParameterList.Clear();
            ParameterList.Add(Request.QueryString["Item"].Trim());

            ALOModel.MaintainStoreOrderItem BCO = new ALOModel.MaintainStoreOrderItem(ConnectionDB);

            string strPeriodSt = BCO.GetNextPeriodStByItem(ParameterList);

            if (strPeriodSt == string.Empty)
            {
                ErrorMsgLabel.Text = "找不到最新期別";
                btn_StoreSelect.Enabled = false;
                btn_Save.Enabled = false;
                return;
            }
            else
            {
                lbl_Period.Text = strPeriodSt;
            }

            //查詢商品最新期別狀態
            ParameterList.Clear();
            ParameterList.Add(Request.QueryString["Item"].Trim());
            ParameterList.Add(strPeriodSt);

            ALOModel.QueryALOCommon ALO1 = new ALOModel.QueryALOCommon(ConnectionDB);

            string strStstusDesc = ALO1.CheckCurrentItemPeriodState(ParameterList);

            if (strStstusDesc != string.Empty)
            {
                lbl_Status.Text = "(" + strStstusDesc + ")";
            }

            //for POP_StoreSelector
            dtStoreSelected = null;
            btn_StoreSelect.OnClientClick = "checkMultiAddInput_Item();if(Page_IsValid==false){return false;}POP_StoreSelector();";


            ToolBarInit();

            AuthorityControls(this);
        }

        #endregion

    }
Ejemplo n.º 13
0
    /// <summary>
    /// 把值傳到Client端
    /// </summary>
    /// <returns></returns>
    public string GetCallbackResult()
    {
        #region
        string rtn = "", strResult = "";
        ALOModel.MaintinDisPattern BCO = new ALOModel.MaintinDisPattern(ConnectionDB);
        ALOModel.MaintainDisStoreMemo BCO2 = new ALOModel.MaintainDisStoreMemo(ConnectionDB);
        ALOModel.MaintainStoreOrderItem BCO3 = new ALOModel.MaintainStoreOrderItem(ConnectionDB);
        ALOModel.MaintainStoreAssignItem BCO4 = new ALOModel.MaintainStoreAssignItem(ConnectionDB);

        DataTable dt = null;
        DataTable dt2 = null;
        DataTable dt3 = null;

        string strChan_No = "", strChan_Name = "", strStore_Name = "", strCommemt = "", strConfirm = "", strStoreStateDesc = "";
        Int32 iResult = 0;

        if (ObjectFrom.IndexOf("STORE") != -1)
        {
            #region

            string[] strAry = CallServerValue.Split("_".ToCharArray());

            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();
            ParameterList.Add(strAry[0]);//Store

            dt = BCO2.QueryChanNoByStore(ParameterList);
            dt3 = BCO3.CheckSettingStateByStore(ParameterList);

            ParameterList.Clear();
            ParameterList.Add(strAry[1]);//Chan_No
            ParameterList.Add(strAry[0]);//Store

            dt2 = BCO2.QueryMemoByChanAndStore(ParameterList);


            if (dt != null && dt.Rows.Count > 0)
            {
                strChan_No = dt.Rows[0][0].ToString().Trim();
                strChan_Name = dt.Rows[0][1].ToString().Trim();
                strStore_Name = dt.Rows[0][3].ToString().Trim();


                if (strChan_No != strAry[1] && strAry[1] != "")
                    strStore_Name = "查無資料";
            }
            else
            {
                strStore_Name = "查無資料";
            }

            rtn = string.Format("{0}-{1}-{2}", strChan_No, strChan_Name, strStore_Name);
            #endregion
        }


        //附加相關控制項
        if (ObjectFrom.IndexOf("STORE") != -1)
        {
            strResult = string.Format("{0};{1}",
                      SLP_StoreChain3.TextBox_Code.ClientID,
                        rtn);
        }

        return strResult;
        #endregion
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 把值傳到Client端
    /// </summary>
    /// <returns></returns>
    public string GetCallbackResult()
    {
        #region
        string rtn = "", strResult = "";
        ALOModel.MaintinDisPattern BCO = new ALOModel.MaintinDisPattern(ConnectionDB);
        ALOModel.MaintainDisStoreMemo BCO2 = new ALOModel.MaintainDisStoreMemo(ConnectionDB);
        ALOModel.MaintainStoreOrderItem BCO3 = new ALOModel.MaintainStoreOrderItem(ConnectionDB);
        ALOModel.MaintainStoreAssignItem BCO4 = new ALOModel.MaintainStoreAssignItem(ConnectionDB);
        ALOModel.MaintinDisPattern BCO5 = new ALOModel.MaintinDisPattern(ConnectionDB);


        DataTable dt = null;
        DataTable dt2 = null;
        DataTable dt3 = null;

        ArrayList ParameterList = new ArrayList();//20091113

        if (ObjectFrom.IndexOf("STORE") != -1)
        {
            #region
            ParameterList.Clear();
            ParameterList.Add(CallServerValue);
            dt = BCO2.QueryChanNoByStore(ParameterList);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                    rtn = string.Format("{0}", dt.Rows[0][0].ToString());
            }
            #endregion
        }
        else if (ObjectFrom.IndexOf("PMA") != -1)//改由PageMethod執行
        {
            dt = BCO5.QueryRootByPMA(CallServerValue);
            //ROOT
            if (dt != null && dt.Rows.Count > 0)
                rtn = string.Format("{0}", dt.Rows[0][0].ToString());

        }
        else if (ObjectFrom.IndexOf("PATTERN") != -1)//改由PageMethod執行
        {
            dt = BCO5.QueryPMAByPattern(CallServerValue);
            //ROOT-PMA
            if (dt != null && dt.Rows.Count > 0)
                rtn = string.Format("{0}-{1}", dt.Rows[0][1].ToString(), dt.Rows[0][0].ToString());
        }


        TextBox txtStoreChain1 = (TextBox)SLP_StoreChain1.FindControl("TextBoxCode");
        TextBox txtStoreChain2 = (TextBox)SLP_StoreChain2.FindControl("TextBoxCode");


        TextBox txtRootNo1 = (TextBox)SLP_RootNo1.FindControl("TextBoxCode");
        TextBox txtPMA1 = (TextBox)SLP_PMA1.FindControl("TextBoxCode");

        TextBox txtRootNo2 = (TextBox)SLP_RootNo2.FindControl("TextBoxCode");
        TextBox txtPMA3 = (TextBox)SLP_PMA2.FindControl("TextBoxCode");


        //附加相關控制項
        if (ObjectFrom.IndexOf("STORE") != -1)
        {
            if (ObjectFrom.IndexOf("2") != -1)
            {
                strResult = string.Format("{0},{1}",
                    txtStoreChain2.ClientID,
                    rtn);
            }

        }
        else if (ObjectFrom.IndexOf("PMA") != -1)
        {
            if (ObjectFrom.IndexOf("1") != -1)
            {
                strResult = string.Format("{0},{1}", txtRootNo1.ClientID, rtn);
            }
            else if (ObjectFrom.IndexOf("2") != -1)
            {
                strResult = string.Format("{0},{1}", txtRootNo2.ClientID, rtn);
            }
        }
        else if (ObjectFrom.IndexOf("PATTERN") != -1)
        {
            if (ObjectFrom.IndexOf("1") != -1)
            {
                strResult = string.Format("{0}-{1},{2}", txtRootNo1.ClientID, txtPMA1.ClientID, rtn);
            }
            else if (ObjectFrom.IndexOf("2") != -1)
            {
                strResult = string.Format("{0}-{1},{2}", txtRootNo2.ClientID, txtPMA3.ClientID, rtn);
            }
        }



        return strResult;
        #endregion
    }