예제 #1
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
    }
예제 #2
0
    private void CheckByChanAndStore()
    {
        #region
        try
        {
            STM_SLP_StoreChain SLP_StoreChain1 = ((STM_SLP_StoreChain)FormView1.FindControl("SLP_StoreChain1"));
            PIC.VDS2G.WebUI.SLP.SLP_Store SLP_Store1 = (PIC.VDS2G.WebUI.SLP.SLP_Store)FormView1.FindControl("SLP_Store1");
            RadioButton rBtn_Active = (RadioButton)FormView1.FindControl("rBtn_Active");
            RadioButton rBtn_Inactive = (RadioButton)FormView1.FindControl("rBtn_Inactive");
            Label lbl_StoreStatus = (Label)FormView1.FindControl("lbl_StoreStatus");
            Button btn_Check = (Button)FormView1.FindControl("btn_Check");
            TextBox txt_Comment = (TextBox)FormView1.FindControl("txt_Comment");

            ArrayList ParameterList = new ArrayList();//20091112

            if (SLP_StoreChain1.Text.Trim() != "" && SLP_Store1.Text.Trim() != "")
            {
                ALOModel.MaintainStoreAssignItem BCO = new ALOModel.MaintainStoreAssignItem(ConnectionDB);

                ParameterList.Clear();
                ParameterList.Add(SLP_StoreChain1.Text.Trim());
                ParameterList.Add(SLP_Store1.Text.Trim());

                string strResult = BCO.CheckByChanAndStore(ParameterList);

                vStoreStateDesc = strResult;

                if (vStoreStateDesc != "")
                {
                    rBtn_Active.Checked = false;
                    rBtn_Inactive.Checked = true;
                    boolStoreStateActive = false;
                    lbl_StoreStatus.ForeColor = System.Drawing.Color.Red;
                    btn_Check.Enabled = true;
                }
                else
                {
                    rBtn_Active.Checked = true;
                    rBtn_Inactive.Checked = false;
                    boolStoreStateActive = true;
                    lbl_StoreStatus.ForeColor = System.Drawing.Color.Empty;
                    btn_Check.Enabled = false;
                }


                //////////////////////////////////
                txt_Comment.Text = GetMemoByChanAndStore();
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
예제 #3
0
    private DataTable GetTempDataTableByCurrentMode()
    {
        #region
        DataTable dtTemp = null;
        ALOModel.MaintainStoreAssignItem BCO = new ALOModel.MaintainStoreAssignItem(ConnectionDB);
        string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

        if (FormView1.CurrentMode == FormViewMode.Edit)
        {
            dtTemp = (DataTable)Session[SessionIDName];
        }
        else if (Session[SessionIDName] == null && FormView1.CurrentMode == FormViewMode.Insert)
        {
            dtTemp = BCO.QueryStoreassignDetlTableSchema();
            dtTemp.Rows.RemoveAt(0);
        }
        else if (Session[SessionIDName] != null && FormView1.CurrentMode == FormViewMode.Insert)
        {
            dtTemp = (DataTable)Session[SessionIDName];
        }

        if (dtTemp.Columns.Contains("rownum") == false)
        {
            dtTemp.Columns.Add("rownum");
        }

        return dtTemp;
        #endregion
    }
예제 #4
0
    protected void btn_AddCurrent_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
            ALOModel.MaintainStoreAssignItem BCO = new ALOModel.MaintainStoreAssignItem(ConnectionDB);

            string strPrefixed = "POP_StoreCurrentDisItem";

            DataTable dtStoreCurrentDisItem = (DataTable)Session[string.Format("{0}_dtStoreCurrentDisItem_{1}_{2}", strPrefixed, PageTimeStamp.Value, Session["UID"].ToString())];

            DataTable dtTemp = GetTempDataTableByCurrentMode();
            STM_SLP_StoreChain SLP_StoreChain1 = (STM_SLP_StoreChain)FormView1.FindControl("SLP_StoreChain1");
            PIC.VDS2G.WebUI.SLP.SLP_Store SLP_Store1 = (PIC.VDS2G.WebUI.SLP.SLP_Store)FormView1.FindControl("SLP_Store1");
            DataRow dr;
            DataTable dtTempForNewRecord;

            if (dtStoreCurrentDisItem != null && dtStoreCurrentDisItem.Rows.Count > 0)
            {

                for (Int32 i = dtStoreCurrentDisItem.Rows.Count - 1; i >= 0; i--)
                {
                    for (Int32 k = 0; k <= dtTemp.Rows.Count - 1; k++)
                    {
                        if (dtStoreCurrentDisItem.Rows[i]["ROOT_NO"].ToString().Trim() == dtTemp.Rows[k]["ROOT_NO"].ToString().Trim() && //20120813 rika insert
                            dtStoreCurrentDisItem.Rows[i]["PMA"].ToString().Trim() == dtTemp.Rows[k]["PMA"].ToString().Trim() &&
                            dtStoreCurrentDisItem.Rows[i]["PATTERN"].ToString().Trim() == dtTemp.Rows[k]["PATTERN"].ToString().Trim() &&
                            dtStoreCurrentDisItem.Rows[i]["ITEM"].ToString().Trim() == dtTemp.Rows[k]["ITEM"].ToString().Trim())
                        {

                            dtStoreCurrentDisItem.Rows.RemoveAt(i);
                            break;
                        }
                    }
                }

                if (dtStoreCurrentDisItem.Rows.Count > 0)
                {
                    for (Int32 i = dtStoreCurrentDisItem.Rows.Count - 1; i >= 0; i--)
                    {
                        dtTempForNewRecord = GetInfoForNewRecord(SLP_StoreChain1.Text.Trim(), SLP_Store1.Text.Trim(),
                            dtStoreCurrentDisItem.Rows[i]["root_no"].ToString().Trim(), //20120813 rika insert
                            dtStoreCurrentDisItem.Rows[i]["PMA"].ToString().Trim(),
                            dtStoreCurrentDisItem.Rows[i]["PATTERN"].ToString().Trim(),
                            dtStoreCurrentDisItem.Rows[i]["ITEM"].ToString().Trim());

                        dr = dtTemp.NewRow();
                        dr["rownum"] = dtTemp.Rows.Count + 1;
                        dr["ROOT_NO"] = dtStoreCurrentDisItem.Rows[i]["root_no"].ToString().Trim();
                        dr["ROOT_NAME"] = dtStoreCurrentDisItem.Rows[i]["root_name"].ToString().Trim();
                        dr["pma"] = dtStoreCurrentDisItem.Rows[i]["PMA"].ToString().Trim();
                        dr["pma_name"] = dtStoreCurrentDisItem.Rows[i]["PMA_NAME"].ToString().Trim();
                        dr["pattern"] = dtStoreCurrentDisItem.Rows[i]["PATTERN"].ToString().Trim();
                        dr["pattern_name"] = dtStoreCurrentDisItem.Rows[i]["PATTERN_NAME"].ToString().Trim();
                        dr["item"] = dtStoreCurrentDisItem.Rows[i]["ITEM"].ToString().Trim();
                        dr["item_name"] = dtStoreCurrentDisItem.Rows[i]["ITEM_NAME"].ToString().Trim();
                        dr["CHAIN_CODE"] = SLP_StoreChain1.Text.Trim();
                        dr["STORE_CODE"] = SLP_Store1.Text.Trim();

                        if (dtTempForNewRecord != null && dtTempForNewRecord.Rows.Count > 0)
                        {
                            dr["period"] = dtTempForNewRecord.Rows[0]["period"];
                            dr["st_accept_qty"] = dtTempForNewRecord.Rows[0]["st_accept_qty"];
                            dr["backward_qty"] = dtTempForNewRecord.Rows[0]["backward_qty"];
                            dr["realsale_qty"] = dtTempForNewRecord.Rows[0]["realsale_qty"];
                        }


                        SetCommonDataForDataRow(dtTemp, dr);

                    }
                }
            }

            SetMasterInfoData(dtTemp);

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

            Session[SessionIDName] = dtTemp;
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
예제 #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);

            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
    }
예제 #6
0
    private DataTable GetInfoForNewRecord(string strStoreChain, string strStore, string strROOT, string strPMA, string strPattern, string strItem)
    {
        #region
        ArrayList ParameterList = new ArrayList();//20091112
        ParameterList.Clear();
        ParameterList.Add(strStoreChain);
        ParameterList.Add(strStore);
        ParameterList.Add(strROOT);
        ParameterList.Add(strPMA);
        ParameterList.Add(strPattern);
        ParameterList.Add(strItem);

        DataTable dtTemp = null;

        ALOModel.MaintainStoreAssignItem BCO = new ALOModel.MaintainStoreAssignItem(ConnectionDB);
        dtTemp = BCO.QueryNewRecordInfoByFind(ParameterList);//取得細項資料

        return dtTemp;
        #endregion
    }
예제 #7
0
    private void CheckByChanAndStore()
    {
        #region
        try
        {
            if (SLP_StoreChain1.Text.Trim() != "" && SLP_Store1.Text.Trim() != "")
            {
                ALOModel.MaintainStoreAssignItem BCO = new ALOModel.MaintainStoreAssignItem(ConnectionDB);

                ArrayList ParameterList = new ArrayList();//20091112
                ParameterList.Clear();
                ParameterList.Add(SLP_StoreChain1.Text.Trim());
                ParameterList.Add(SLP_Store1.Text.Trim());

                string strResult = BCO.CheckByChanAndStore(ParameterList);

                vStoreStateDesc = strResult;
                if (vStoreStateDesc != "")
                {
                    rBtn_Active.Checked = false;
                    rBtn_Inactive.Checked = true;
                    boolStoreStateActive = false;
                    lbl_StoreStatus.ForeColor = System.Drawing.Color.Red;
                    btn_Check.Enabled = true;
                }
                else
                {
                    rBtn_Active.Checked = true;
                    rBtn_Inactive.Checked = false;
                    boolStoreStateActive = true;
                    lbl_StoreStatus.ForeColor = System.Drawing.Color.Empty;
                    btn_Check.Enabled = false;
                }



                //////////////////////////////////
                txt_Comment.Text = GetMemoByChanAndStore();
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
예제 #8
0
    }//end EditCancelButton_Click

    /// <summary>
    ///  編輯模式,按下更新確認鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void EditCommitButton_Click(object sender, EventArgs e)
    {
        #region
        bool bResult = false;

        try
        {
            #region 取得畫面元件的值


            DateTime processtime = DateTime.Now;
            #endregion

            #region 取得更新前舊值

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

            DataTable dtTemp = (DataTable)Session[SessionIDName];

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


            #endregion
            DataTable dtForUpdate = dtTemp.GetChanges();
            DataTable dtAdded = dtTemp.GetChanges(DataRowState.Added);
            DataTable dtDeleted = dtTemp.GetChanges(DataRowState.Deleted);

            DataTable dtMaster = dtForMaster2;
            string strUID = Session["UID"].ToString();


            Int32 nREC_COUNT = 0;
            if (dtForMaster != null && dtForMaster.Rows.Count > 0)
            {
                nREC_COUNT = int.Parse(dtForMaster.Rows[0]["REC_COUNT"].ToString());
            }

            //2009-06-22 cyhsu
            if (dtAdded != null && dtAdded.Rows.Count > 0)
            {
                nREC_COUNT = nREC_COUNT + dtAdded.Rows.Count;
            }

            if (dtDeleted != null && dtDeleted.Rows.Count > 0)
            {
                nREC_COUNT = nREC_COUNT - dtForDetailDeleted.Rows.Count;
            }
            if (nREC_COUNT <= 0)
            {
                throw new Exception("明細未設定,請先設定明細");
            }

            #region Master
            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();

            if (dtMaster != null)
            {
                for (Int32 i = 0; i <= dtMaster.Rows.Count - 1; i++)
                {
                    if (dtMaster.Rows[i].RowState != DataRowState.Deleted)
                    {
                        ParameterList.Add(dtMaster.Rows[i]["ID"]);
                        ParameterList.Add(dtMaster.Rows[i]["CODE"]);
                        ParameterList.Add(dtMaster.Rows[i]["NAME"]);
                        ParameterList.Add(dtMaster.Rows[i]["ENABLE"]);
                        ParameterList.Add(dtMaster.Rows[i]["CREATEDATE"]);
                        ParameterList.Add(dtMaster.Rows[i]["CREATEUID"]);
                        ParameterList.Add(dtMaster.Rows[i]["UPDATEDATE"]);
                        ParameterList.Add(dtMaster.Rows[i]["UPDATEUID"]);
                        ParameterList.Add(dtMaster.Rows[i]["CHAIN_CODE"]);
                        ParameterList.Add(dtMaster.Rows[i]["STORE_CODE"]);
                        ParameterList.Add(processtime);
                        ParameterList.Add(strUID);
                        ParameterList.Add(dtMaster.Rows[i]["REC_COUNT"]);
                        ParameterList.Add(nREC_COUNT);
                        break;
                    }
                }
            }



            #endregion

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

            bResult = BCO.UpdateMasterAndDetail(ParameterList, dtForUpdate, strUID, dtForDetailDeleted, null);

            if (!bResult)
            {
                throw new Exception("更新0筆資料!");
            }
            else
            {
                if (dtForUpdate != null)
                    dtForUpdate.AcceptChanges();
                Session[SessionIDName] = dtForUpdate;

                ResultMsgLabel.Text = "更改完成";
                //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('更改完成');", true);
            }

            SwitchFormviewMode(FormViewMode.ReadOnly);

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }//end EditCommitButton_Click
예제 #9
0
        public bool CheckPATTERNSPECCanAdd(Hashtable htParams,ref string strErrMsg)
        {
            #region
            try
            {
                bool bResult = false;
                Int32 iErrCounts = 0;

                VDS_ALO_PATTERNSPEC_MAIN_DBO ALOM = new VDS_ALO_PATTERNSPEC_MAIN_DBO(ref USEDB);

                MaintainStoreAssignItem BCO = new MaintainStoreAssignItem(strConn);

                #region
                DataTable dt1 = ALOM.doGetValidationDataForCheck(htParams);


                if (dt1 != null && dt1.Rows.Count > 0) 
                {
                    //是否存在於通路主檔
                    if (dt1.Rows[0][0].ToString().Trim() == "0") 
                    {
                        strErrMsg += "通路不存在,";
                        iErrCounts++;
                    }

                    //是否存在於門市主檔
                    if (dt1.Rows[0][1].ToString().Trim() == "0")
                    {
                        strErrMsg += "門市不存在,";
                        iErrCounts++;
                    }
                }
                #endregion

                if (strErrMsg.Trim().Length > 0)
                {
                    if (strErrMsg.Substring(strErrMsg.Length - 1, 1) == ",")
                    {
                        strErrMsg = strErrMsg.Substring(0, strErrMsg.Length - 1);
                    }
                }


                if (iErrCounts == 0)
                    bResult = true;
                else
                    bResult = false;

                return bResult;
            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
            #endregion
        }
예제 #10
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
    }
예제 #11
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
    }
예제 #12
0
    private bool CheckByChanAndStore(string strChanNo, string strStore)
    {
        #region

        bool bResult = false;
        try
        {
            ALOModel.MaintainStoreAssignItem BCO = new ALOModel.MaintainStoreAssignItem(ConnectionDB);
            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(strChanNo);
            ParameterList.Add(strStore);
            string strResult = BCO.CheckByChanAndStore(ParameterList);

            if (strResult.Trim() == "")
            {
                bResult = true;
            }
            else
            {
                bResult = false;
            }

            return bResult;

        }
        catch (Exception ex)
        {
            throw ex;
        }

        #endregion
    }
예제 #13
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    private void QueryData()
    {
        #region
        string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

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

        //string strWhere = "";
        //strWhere = GetQuerySQLStatement();
        //ParameterList.Clear();
        //ParameterList.Add(strWhere);
        //DataTable dt = BCO.QuerySwitch(ALOModel.MaintainStoreAssignItem.QueryType.Custom, ParameterList);

        DataTable dt = BCO.QueryMasterByFind2(GetQueryParams());
        Session[SessionIDName] = dt;
        GridView1.DataSource = dt;
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();

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

        aryParamsPKey.Clear();

        if (dt != null && dt.Rows.Count > 0)
        {
            if (btn_Export.Visible == true)
            {
                btn_Export.Enabled = true;
            }

            foreach (DataRow dr in dt.Rows)
            {
                #region
                aryParamsPKey.Add(dr["ID"]);
                #endregion
            }
        }
        else
        {
            if (btn_Export.Visible == true)
            {
                btn_Export.Enabled = false;
            }

            ResultMsgLabel.Text = "查無資料";
        }

        Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)] = aryParamsPKey;
        #endregion
    }//QueryData
예제 #14
0
    }//SwitchFormviewMode

    /// <summary>
    /// 繫結資料到畫面控制項
    /// </summary>
    private void QueryData()
    {
        #region
        try
        {
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

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

            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();
            ParameterList.Add(s_ID);
            this.hiddenID.Value = s_ID;

            DataTable dtTemp = BCO.QuerySwitch(ALOModel.MaintainStoreAssignItem.QueryType.ID, ParameterList);
            DataTable Dt2 = BCO.QueryDetailSwitch(ALOModel.MaintainStoreAssignItem.QueryType.ID, ParameterList);

            dtForMaster = Dt2;
            dtForMaster2 = Dt2;

            Session[SessionIDName] = Dt2;

            FormView1.DataSource = dtTemp;
            FormView1.DataBind();

            iDetlRowsCount = Dt2.Rows.Count;
            GridView2.DataSource = Dt2;
            //GridView2.PageIndex = 0;
            GridView2.DataBind();


            if ((dtTemp == null || dtTemp.Rows.Count <= 0) && InsertButtonClick)
            {
                throw new Exception("查無此筆資料或已被其他使用者刪除,請點選上一筆/下一筆鈕或回查詢頁重新查詢!");
            }

            if (FormView1.CurrentMode == FormViewMode.ReadOnly)
            {
                if (dtTemp != null && dtTemp.Rows.Count > 0)
                {
                    if (btn_Export.Visible == true)
                    {
                        btn_Export.Enabled = true;
                    }
                }
                else
                {
                    if (btn_Export.Visible == true)
                    {
                        btn_Export.Enabled = false;
                    }
                }
            }


            if (InsertButtonClick)
            {
                aryParamsPKey.Clear();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            InsertButtonClick = false;
        }

        #endregion
    }
예제 #15
0
    }//end EditCommitButton_Click

    /// <summary>
    /// 於檢視模式,按下刪除鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void DeleteButton_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            bool bResult = false;
            #region 取得畫面元件的值

            DateTime processtime = DateTime.Now;

            #endregion

            #region 取得刪除前舊值


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

            DataTable dtTemp = (DataTable)Session[SessionIDName];

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

            #endregion

            #region 加入更新條件

            //master
            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();
            //舊值
            ParameterList.Add(dtTemp.Rows[0]["ID"]);
            ParameterList.Add(dtTemp.Rows[0]["CODE"]);
            ParameterList.Add(dtTemp.Rows[0]["NAME"]);
            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]["CHAIN_CODE"]);
            ParameterList.Add(dtTemp.Rows[0]["STORE_CODE"]);

            //需要更新值
            ParameterList.Add(processtime);
            ParameterList.Add(Session["UID"].ToString());


            ParameterList.Add(dtTemp.Rows[0]["REC_COUNT"]);

            //detail
            ParameterList1.Clear();
            ParameterList1.Add(dtTemp.Rows[0]["ID"]);
            ParameterList1.Add(dtTemp.Rows[0]["CREATEUID"]);

            #endregion

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

            bResult = BCO.DeleteMasterAndDetail(ParameterList, ParameterList1, null);
            ResultMsgLabel.Text = "刪除完成";
            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "location.replace('ALO041.aspx?Code=ALO04&Requery=true');", true);//alert('刪除完成');
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }//DeleteButton_Click
예제 #16
0
    }//end InsertCancelButton_Click

    /// <summary>
    /// 由新增模式,確認新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        #region
        Int32 iResult = 0;

        try
        {

            #region 取得更新前舊值

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

            DataTable dtTemp = (DataTable)Session[SessionIDName];

            if ((FormView1.CurrentMode != FormViewMode.Insert) && (dtTemp == null || dtTemp.Rows.Count == 0))
            {
                throw new Exception("未輸入資料,更新失敗!");
            }


            #endregion
            DataTable dtForUpdate = null;

            if (dtTemp != null)
            {
                dtForUpdate = dtTemp.GetChanges(DataRowState.Added);
            }
            //2009-06-22 cyhsu add for複製
            if (this.CopyNewStore.Value == "1")
            {
                dtForUpdate = dtTemp;
            }
            #region Master
            //string strCode = string.Format("{0}_{1}", dtForUpdate.Rows[0]["CHAIN_CODE"].ToString().Trim(), dtForUpdate.Rows[0]["STORE_CODE"].ToString().Trim());

            //ParameterList.Clear();
            //ParameterList.Add(strCode);
            //ParameterList.Add(dtForUpdate.Rows[0]["NAME"]);
            //ParameterList.Add(dtForUpdate.Rows[0]["CREATEDATE"]);
            //ParameterList.Add(dtForUpdate.Rows[0]["CREATEUID"]);
            //ParameterList.Add(dtForUpdate.Rows[0]["UPDATEDATE"]);
            //ParameterList.Add(dtForUpdate.Rows[0]["UPDATEUID"]);
            //ParameterList.Add(dtForUpdate.Rows[0]["CHAIN_CODE"]);
            //ParameterList.Add(dtForUpdate.Rows[0]["STORE_CODE"]);

            DateTime processtime = DateTime.Now;
            string strUserID = Session["UID"].ToString();
            string strCHAN_NO = ((STM_SLP_StoreChain)FormView1.FindControl("SLP_StoreChain1")).Text.Trim();
            string strSTORE = ((WUI.SLP.SLP_Store)FormView1.FindControl("SLP_Store1")).Text.Trim();
            string strCode = string.Format("{0}_{1}", strCHAN_NO, strSTORE);

            Int32 nREC_COUNT = 0;

            if (dtForUpdate != null && dtForUpdate.Rows.Count > 0)
            {
                nREC_COUNT = dtForUpdate.Rows.Count;
            }
            if (nREC_COUNT <= 0)
            {
                throw new Exception("明細未設定,請先設定明細");
            }

            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();
            ParameterList.Add(strCode);
            ParameterList.Add(strCode);
            ParameterList.Add(processtime);
            ParameterList.Add(strUserID);
            ParameterList.Add(processtime);
            ParameterList.Add(strUserID);
            ParameterList.Add(strCHAN_NO);
            ParameterList.Add(strSTORE);
            ParameterList.Add(nREC_COUNT);

            #endregion

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

            iResult = BCO.CreateMasterAndDetail(ParameterList, dtForUpdate, null);


            if (iResult == 0)
            {
                throw new Exception("新增0筆資料!");
            }
            else
            {
                s_ID = iResult.ToString();
                if (dtForUpdate != null)
                    dtForUpdate.AcceptChanges();
                Session[SessionIDName] = dtForUpdate;
                ResultMsgLabel.Text = "新增完成";
                //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('新增完成');", true);
            }


            InsertButtonClick = true;


            SwitchFormviewMode(FormViewMode.ReadOnly);


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

    }//end InsertButton_Click
예제 #17
0
    protected void btn_UpdateRecord_Click(object sender, EventArgs e)
    {
        #region

        try
        {

            string v_ROOT_no = SLP_ROOT.Text.Trim() == "" ? null : SLP_ROOT.Text.Trim();
            string v_PMA = SLP_PMA.Text.Trim() == "" ? null : SLP_PMA.Text.Trim();
            string v_Pattern = SLP_Pattern.Text.Trim() == "" ? null : SLP_Pattern.Text.Trim();
            string v_Item = SLP_Item.Text.Trim() == "" ? null : SLP_Item.Text.Trim();


            #region 存檔前檢查分類正確性
            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();
            ParameterList.Add(v_ROOT_no);
            ParameterList.Add(v_PMA);
            ParameterList.Add(null); //category
            ParameterList.Add(null); //sort_out
            ParameterList.Add(v_Pattern);
            ParameterList.Add(v_Item);
            string vLevel = "1";
            if (v_Pattern != null)
            {
                vLevel = "P";
            }
            if (v_Item != null)
            {
                vLevel = "I";
            }
            ParameterList.Add(vLevel);

            ALOModel.QueryALOCommon alo_comm = new ALOModel.QueryALOCommon(ConnectionDB);
            bool bCheck = alo_comm.CheckItemClassValid(ParameterList);
            if (!bCheck)
            {
                throw new Exception("所輸入的品號/Pattern/大分類/群分類有誤,請確認後重新輸入");
            }
            #endregion


            DataTable dtTemp = null;
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
            ALOModel.MaintainStoreAssignItem BCO = new ALOModel.MaintainStoreAssignItem(ConnectionDB);
            STM_SLP_StoreChain SLP_StoreChain1 = (STM_SLP_StoreChain)FormView1.FindControl("SLP_StoreChain1");
            PIC.VDS2G.WebUI.SLP.SLP_Store SLP_Store1 = (PIC.VDS2G.WebUI.SLP.SLP_Store)FormView1.FindControl("SLP_Store1");


            dtTemp = GetTempDataTableByCurrentMode();
            if (dtTemp != null)
            {
                for (Int32 i = 0; i <= dtTemp.Rows.Count - 1; i++)
                {
                    if (dtTemp.Rows[i].RowState != DataRowState.Deleted)
                    {
                        if (dtTemp.Rows[i]["ROOT_NO"].ToString().Trim() == SLP_ROOT.Text.Trim() && //20120813 rika insert
                            dtTemp.Rows[i]["PMA"].ToString().Trim() == SLP_PMA.Text.Trim() &&
                            dtTemp.Rows[i]["PATTERN"].ToString().Trim() == SLP_Pattern.Text.Trim() &&
                            dtTemp.Rows[i]["ITEM"].ToString().Trim() == SLP_Item.Text.Trim())
                        {
                            ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "ClientScript", "alert('此資料存在於該門市');", true);
                            return;
                        }
                    }
                }

                DataRow dr = dtTemp.NewRow();
                dr["rownum"] = dtTemp.Rows.Count + 1;
                dr["ROOT_NO"] = SLP_ROOT.Text.Trim();
                dr["pma"] = SLP_PMA.Text.Trim();
                dr["pattern"] = SLP_Pattern.Text.Trim();
                dr["item"] = SLP_Item.Text.Trim();
                dr["CHAIN_CODE"] = SLP_StoreChain1.Text.Trim();
                dr["STORE_CODE"] = SLP_Store1.Text.Trim();

                #region
                DataTable dtTempForNewRecord = GetInfoForNewRecord(SLP_StoreChain1.Text.Trim(), SLP_Store1.Text.Trim(),
                    SLP_ROOT.Text.Trim(), SLP_PMA.Text.Trim(), SLP_Pattern.Text.Trim(), SLP_Item.Text.Trim());

                if (dtTempForNewRecord != null && dtTempForNewRecord.Rows.Count > 0)
                {
                    dr["ROOT_NAME"] = dtTempForNewRecord.Rows[0]["ROOT_NAME"];
                    dr["PMA_NAME"] = dtTempForNewRecord.Rows[0]["PMA_NAME"];
                    dr["Pattern_Name"] = dtTempForNewRecord.Rows[0]["Pattern_Name"];
                    dr["item_name"] = dtTempForNewRecord.Rows[0]["item_name"];
                    dr["period"] = dtTempForNewRecord.Rows[0]["period"];
                    dr["st_accept_qty"] = dtTempForNewRecord.Rows[0]["st_accept_qty"];
                    dr["backward_qty"] = dtTempForNewRecord.Rows[0]["backward_qty"];
                    dr["realsale_qty"] = dtTempForNewRecord.Rows[0]["realsale_qty"];
                }

                #endregion


                SetCommonDataForDataRow(dtTemp, dr);

                SetMasterInfoData(dtTemp);

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

                Session[SessionIDName] = dtTemp;
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            Panel_AddSingle.Visible = false;
        }
        #endregion
    }
예제 #18
0
        public bool CheckStoreSpecCanAdd(Hashtable htParams,ref string strErrMsg)
        {
            #region
            try
            {
                bool bResult = false, bResultTemp = false;
                Int32 iErrCounts = 0;

                VDS_ALO_STORESPEC_MAIN_DBO ALOM = new VDS_ALO_STORESPEC_MAIN_DBO(ref USEDB);

                MaintainStoreAssignItem BCO = new MaintainStoreAssignItem(strConn);

                #region
                DataTable dt1 = ALOM.doGetValidationDataForCheck(htParams);


                if (dt1 != null && dt1.Rows.Count > 0) 
                {
                    //是否存在於通路主檔
                    if (dt1.Rows[0][0].ToString().Trim() == "0") 
                    {
                        strErrMsg += "通路不存在,";
                        iErrCounts++;
                    }

                    //是否存在於門市主檔
                    if (dt1.Rows[0][1].ToString().Trim() == "0")
                    {
                        strErrMsg += "門市不存在,";
                        iErrCounts++;
                    }

                    //是否存在於品號主檔
                    if (dt1.Rows[0][2].ToString().Trim() == "0")
                    {
                        strErrMsg += "品號不存在,";
                        iErrCounts++;
                    }

                    //驗證該通路是否可進貨
                    if (dt1.Rows[0][3].ToString().Trim() == "0")
                    {
                        strErrMsg += "期別通路未建,";
                        iErrCounts++;
                    }
                }
                #endregion

                #region 檢查是否逾期
                bResultTemp = CheckOverDu(htParams, ref strErrMsg);

                if (!bResultTemp)
                {
                    iErrCounts++;
                }
                #endregion

                #region [門市指定商品]檢查
                bResultTemp = BCO.CheckStoreAssignItemInclude(htParams);

                if (!bResultTemp)
                {
                    strErrMsg += "不符合門市指定商品設定,";
                    iErrCounts++;
                }
                #endregion


                if (strErrMsg.Trim().Length > 0)
                {
                    if (strErrMsg.Substring(strErrMsg.Length - 1, 1) == ",")
                    {
                        strErrMsg = strErrMsg.Substring(0, strErrMsg.Length - 1);
                    }
                }


                if (iErrCounts == 0)
                    bResult = true;
                else
                    bResult = false;

                return bResult;
            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
            #endregion
        }
예제 #19
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
    }