Exemple #1
0
        /// <summary>
        /// ALO03_1報表_到貨配本記錄EXCEL
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable ALO03_1(ArrayList ParameterList,
                                 ref ReportList.ExcelOtherType EOT)
        {
            #region
            ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConntionDB);
            DataTable Dt = BCO.QueryStorRankForExcel2_2(GetInputValues(ParameterList));

            if (Dt != null && Dt.Rows.Count > 0)
            {
                #region 表頭:如要指定表頭必設定

                #endregion

                EOT = ReportList.ExcelOtherType.Normal;//如要匯出EXCEL此為必要設定

                return Dt;
            }
            else
            {
                throw new Exception("查無資料!!");
            }
            #endregion
        }
Exemple #2
0
        /// <summary>
        /// 計算門市等級
        /// </summary>
        /// <param name="ParameterList">變數集</param>
        /// <param name="ErrMsg">錯誤訊息</param>
        /// <returns>回傳計算成功或失敗</returns>
        private bool CalculateStoreRank(ArrayList ParameterList,
                                        ref string ErrMsg
                                        )
        {
            #region

            bool bResult = false;
            Hashtable ht = GetInputValues(ParameterList);
            ht.Add("Module", "ALO");
            ht.Add("FlagName", "SET_STORERANK_YN");
            ht.Add("InProcess", "Y");
            DataTable dtTemp;

            ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConntionDB);

            try
            {

                dtTemp = BCO.CheckSysProcFlag();//檢查是否可進行計算

                if (dtTemp != null && dtTemp.Rows.Count > 0)
                {
                    #region
                    if (dtTemp.Rows[0]["errStoreRank"].ToString().Trim() != "")
                    {
                        ErrMsg = dtTemp.Rows[0]["errStoreRank"].ToString().Trim();
                        return bResult;
                    }

                    if (dtTemp.Rows[0]["errDisRec"].ToString().Trim() != "")
                    {
                        ErrMsg = dtTemp.Rows[0]["errDisRec"].ToString().Trim();
                        return bResult;
                    }

                    if (dtTemp.Rows[0]["errMultiDisRec"].ToString().Trim() != "")
                    {
                        ErrMsg = dtTemp.Rows[0]["errMultiDisRec"].ToString().Trim();
                        return bResult;
                    }
                    #endregion

                    #region

                    bResult = BCO.ProcessCalculateStoreRank(ht);

                    #endregion
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return bResult;
            #endregion
        }
Exemple #3
0
    protected void btn_Exec_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";

            if (CheckInputValuesNotNull())
            {
                ALOModel.MaintainStoreRank BCO = new PIC.VDS2G.BSM.ALO.MaintainStoreRank(ConnectionDB);
                bool bResult = false;
                Hashtable ht = GetInputValues();

                #region 檢查是否可進行複製

                #region STEP 1:SYS_PROC_FLAG
                ht.Add("Module", "ALO");
                ht.Add("FlagName", "SET_STORERANK_YN");
                ht.Add("InProcess", "Y");

                DataTable dtTemp;
                dtTemp = BCO.CheckSysProcFlag();//檢查是否可進行複製

                if (dtTemp != null && dtTemp.Rows.Count > 0)
                {
                    #region
                    if (dtTemp.Rows[0]["errStoreRank"].ToString().Trim() != "")
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errStoreRank"].ToString().Trim().Replace("請稍後再計算", "請稍後再複製")), true);
                        return;
                    }

                    if (dtTemp.Rows[0]["errDisRec"].ToString().Trim() != "")
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errDisRec"].ToString().Trim().Replace("請稍後再計算", "請稍後再複製")), true);
                        return;
                    }

                    if (dtTemp.Rows[0]["errMultiDisRec"].ToString().Trim() != "")
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errMultiDisRec"].ToString().Trim().Replace("請稍後再計算", "請稍後再複製")), true);
                        return;
                    }
                    #endregion
                }
                #endregion

                #region STEP 2:VDS_ALO_STORERANK_MAIN & VDS_ALO_STORERANK_DETL

                bool bTMP = BCO.CheckCanCopy(ht);
                if (!bTMP)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", "查無資料可複製"), true);
                    return;
                }

                #endregion

                #endregion

                #region 進行複製

                try
                {
                    BCO.SetSYS_PROC_FLAG(ht, null);//設定複製執行中

                    if (rbtn_CopyStore.Checked)
                    {
                        bResult = BCO.CopyStoreRankByStore(ht, null);
                    }
                    else if (rbtn_CopyPattern.Checked)
                    {
                        bResult = BCO.CopyStoreRankByPattern(ht, null);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    ht["InProcess"] = null;
                    BCO.SetSYS_PROC_FLAG(ht, null);//複製完畢
                }

                if (bResult)
                {
                    ResultMsgLabel.Text = "複製成功";
                }
                else
                {
                    ResultMsgLabel.Text = "複製失敗";
                }
                #endregion
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            fmStatus = FormStatus.fmBrowse;
            UpdatePanel1.Update();
        }
        #endregion
    }
Exemple #4
0
    private void TempDataToDataBase()
    {
        #region

        try
        {
            #region 檢查是否可進行匯入
            Hashtable ht = new Hashtable();
            ht.Add("Module", "ALO");
            ht.Add("FlagName", "SET_STORERANK_YN");
            ht.Add("InProcess", "Y");
            ALOModel.MaintainStoreRank BCO1 = new ALOModel.MaintainStoreRank(ConnectionDB);
            ALOModel.ImportStoreRank BCO2 = new ALOModel.ImportStoreRank(ConnectionDB);

            DataTable dtTemp;
            dtTemp = BCO1.CheckSysProcFlag();//檢查是否可進行匯入

            if (dtTemp != null && dtTemp.Rows.Count > 0)
            {
                #region
                if (dtTemp.Rows[0]["errStoreRank"].ToString().Trim() != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errStoreRank"].ToString().Trim().Replace("請稍後再計算", "請稍後再匯入")), true);
                    return;
                }

                if (dtTemp.Rows[0]["errDisRec"].ToString().Trim() != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errDisRec"].ToString().Trim().Replace("請稍後再計算", "請稍後再匯入")), true);
                    return;
                }

                if (dtTemp.Rows[0]["errMultiDisRec"].ToString().Trim() != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errMultiDisRec"].ToString().Trim().Replace("請稍後再計算", "請稍後再匯入")), true);
                    return;
                }
                #endregion
            }
            #endregion

            #region 進行匯入

            ArrayList arl_Return = null;
            string s_LoginUser = string.Empty;
            string s_UploadPath_File = string.Empty;
            string s_BackPath_File = string.Empty;

            s_LoginUser = Session["UID"].ToString();//登入人員


            if (s_AP_FileName != string.Empty)
            {
                try
                {
                    BCO1.SetSYS_PROC_FLAG(ht, null);//設定匯入執行中
                    arl_Return = BCO2.TmpToDB(s_AP_FileName, s_LoginUser, PageTimeStamp.Value);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally 
                {
                    ht["InProcess"] = null;
                    BCO1.SetSYS_PROC_FLAG(ht, null);//匯入完畢
                }
            }
            else
            { this.Response.Write("請重新匯入 EXCEL 檔"); }

            if (arl_Return[0].ToString() == "TEMPTODB 正確")
            {
                #region 設定 UploadStatusPanel 的值

                //匯入結果
                UploadStatusPanel1.ImportSum = iProcessingCounts;
                UploadStatusPanel1.ImportOK = iProcessingCounts;
                UploadStatusPanel1.ImportNG = 0;

                #endregion
            }
            else if (arl_Return[0].ToString() == "CHECKDATA 不正確")
            {
                #region 設定 UploadStatusPanel 的值

                //匯入結果
                UploadStatusPanel1.ImportSum = iProcessingCounts;
                UploadStatusPanel1.ImportOK = 0;
                UploadStatusPanel1.ImportNG = iProcessingCounts;

                #endregion
            }
            #endregion
        }
        catch (Exception ex)
        {
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            this.but_Temp_To_DB.Enabled = false;
            this.but_File_To_Temp.Enabled = true;
            this.but_Unusual_Report.Enabled = true;
            this.ButtonQuery.Enabled = true;
            this.btn_Back.Enabled = true;
        }
        #endregion
    }
Exemple #5
0
    protected void txt_RankLevel_TextChanged(object sender, EventArgs e)
    {
        #region
        try
        {
            ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConnectionDB);
            Hashtable ht = new Hashtable();
            ht.Add("RankCode", strRankCode2);
            ht.Add("RankLevel", txt_RankLevel.Text.Trim());

            bool bResult = BCO.CheckRankLevel(ht);

            if (!bResult)
            {
                txt_RankLevel.Text = GetDefaultRankLevel(strRankCode2);
                hiddenFocusCtrlID.Value = txt_RankLevel.ClientID;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", "資料庫無此RANK等級"), true);
            }
            else
            {
                hiddenFocusCtrlID.Value = txt_Memo.ClientID;
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion

    }
Exemple #6
0
    protected void btn_Confirm_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            if (GetStringLen(txt_Memo.Text.Trim()) > 200)
            {
                hiddenFocusCtrlID.Value = txt_Memo.ClientID;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", "alert('備註限制100中文字');", true);
            }
            else
            {
                #region
                DateTime dtProcessing = DateTime.Now;
                string strUID = Session["UID"].ToString();

                string strChan = SLP_StoreChain3.Text.Trim();
                string strStore = SLP_Store3.Text.Trim();
                string strPattern = SLP_Pattern3.Text.Trim();
                string strChanName = "";
                string strStoreName = "";
                string strPatternName = "";

                ArrayList ParameterList = new ArrayList();//20091112

                int iRowIndex = 0;


                ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConnectionDB);
                ParameterList.Clear();
                ParameterList.Add(strChan);
                ParameterList.Add(strStore);
                ParameterList.Add(strPattern);
                ParameterList.Add(dtProcessing);
                ParameterList.Add(strUID);
                ParameterList.Add(dtProcessing);
                ParameterList.Add(strUID);
                ParameterList.Add(null);
                ParameterList.Add(strRankCode2);
                ParameterList.Add(SLP_SLPNumber1.Text.Trim());
                ParameterList.Add(txt_RankLevel.Text.Trim());
                ParameterList.Add(txt_Memo.Text.Trim());
                ParameterList.Add(s_PROCNO);
                BCO.ADD_STORERANK_AFTERQUERY(ParameterList, null);

                //todo gridview binding


                #region
                //chan_name
                ParameterList.Clear();
                ParameterList.Add(strChan);
                STMModel.MaintainStoreChain BCO_STM1 = new STMModel.MaintainStoreChain(ConnectionDB);
                DataTable dt_stm1 = BCO_STM1.QueryStoreChainByCode(ParameterList);
                strChanName = ((dt_stm1 != null &&  dt_stm1.Rows.Count > 0) ? dt_stm1.Rows[0]["NAME"].ToString() : "查無資料");

                //store_name
                ParameterList.Clear();
                ParameterList.Add(strStore);
                ParameterList.Add(strChan);
                ParameterList.Add(null);

                STMModel.MaintainStoreUnique BCO_STM2 = new STMModel.MaintainStoreUnique(ConnectionDB);
                DataTable dt_stm2 = BCO_STM2.QueryForSLP2(ParameterList);
                strStoreName = ((dt_stm2 != null && dt_stm2.Rows.Count > 0) ? dt_stm2.Rows[0]["STORE_NAME"].ToString() : "查無資料");

                //pattern_name
                ParameterList.Clear();
                ParameterList.Add(strPattern);
                ParameterList.Add(null);
                ParameterList.Add(null);
                ParameterList.Add(null);
                ParameterList.Add(null);

                ITMModel.MaintainItemClassify BCO_ITM1 = new ITMModel.MaintainItemClassify(ConnectionDB);
                DataTable dt_itm1 = BCO_ITM1.QueryPatternForSLP(ParameterList);
                strPatternName = ((dt_itm1 != null && dt_itm1.Rows.Count > 0) ? dt_itm1.Rows[0]["PATTERN_NAME"].ToString() : "查無資料");

                #endregion

                #region Insert New Row
                string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

                DataTable dt1 = (DataTable)Session[SessionIDName];
                DataView dv = dt1.DefaultView;

                if (ViewState["SortingCondition"] != null)
                {
                    dv.Sort = ViewState["SortingCondition"].ToString();
                }

                DataTable dt2 = dv.ToTable();

                //判斷是否已存在目前DataTable中
                if (CheckDataIsExistedInCurrentDataTable(strChan, strStore, strPattern, dt2, out iRowIndex))
                {
                    #region 如存在則刪除畫面上舊資料
                    dt2.Rows.RemoveAt(iRowIndex);
                    #endregion
                }

                #region 新增一筆
                DataRow dr = dt2.NewRow();
                dr["PATTERN_NO"] = strPattern;
                dr["PATTERN_NAME"] = strPatternName;
                dr["CHAN_NO"] = strChan;
                dr["CHAN_NAME"] = strChanName;
                dr["STORE"] = strStore;
                dr["STORE_NAME"] = strStoreName;
                dr["RANK_CODE"] = ((DropDownList)SLP_Rank2.FindControl("D1")).SelectedItem.Value;
                dr["RANK_NAME"] = ((DropDownList)SLP_Rank2.FindControl("D1")).SelectedItem.Text;
                dr["RANK_VALUE"] = SLP_SLPNumber1.Text.Trim();
                dr["RANK_LEVEL"] = txt_RankLevel.Text.Trim();
                dr["MEMO"] = txt_Memo.Text.Trim();

                //2010/09/20 added 
                //dr["c_start_date"] = SLP_SLPDate1.Text.Trim();//暫不顯示
                //dr["c_end_date"] = SLP_SLPDate2.Text.Trim();//暫不顯示
                dr["update_date"] = DateTime.Now.ToString("yyyy/MM/dd");
                dr["user_name"] = ((DataTable)Session["UserInfo"]).Rows[0]["Name"].ToString();


                
                dt2.Rows.InsertAt(dr, 0);
                #endregion

                Session[SessionIDName] = dt2;
                GridView1.DataSource = dt2;
                GridView1.DataBind();

                #endregion

                PanelG3.Visible = false;
                hiddenFocusCtrlID.Value = "";


                ResultMsgLabel.Text = "新增成功";
                #endregion
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
Exemple #7
0
    private string GetDefaultRankLevel(string s_RankCode)
    {
        #region
        string strResult = "";
        try
        {
            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();
            ParameterList.Add(s_RankCode);
            ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConnectionDB);
            strResult = BCO.GetMinRankLevel(ParameterList);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return strResult;
        #endregion
    }
Exemple #8
0
    /// <summary>
    /// 輸出為EXCEL
    /// </summary>
    public void WriteToXls()
    {
        #region

        GridView gvExcel = new GridView();
        gvExcel.RowDataBound += new GridViewRowEventHandler(gvExcel_RowDataBound);
        try
        {
            ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConnectionDB);
            DataTable dtExcel = null;
            string SessionIDName = string.Format("{0}_{1}_EXCELDATA", PAGE_DT_01, PageTimeStamp.Value);

            //匯出筆數上限
            Int32 iLimitedRowsCounts = 65535;

            if (BCO.CheckExcelOutCount(GetInputValues(), iLimitedRowsCounts))
            {

                dtExcel = BCO.QueryStorRankForExcel2_2(GetInputValues());

                if (dtExcel != null && dtExcel.Rows.Count > 0)
                {
                    Response.Clear();
                    Response.AddHeader("content-disposition", "attachment;filename=" +
                        HttpUtility.UrlEncode(txt_ExportFileName.Text.Trim().ToLower().Replace(".xls", ""), System.Text.UTF8Encoding.UTF8) + ".xls");
                    Response.ContentType = "application/vnd.ms-excel;charset='utf-8'";
                    Response.ContentEncoding = System.Text.Encoding.GetEncoding("BIG5");
                    this.EnableViewState = false;

                    System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
                    System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);

                    gvExcel.AllowPaging = false;
                    gvExcel.AllowSorting = false;
                    gvExcel.DataSource = dtExcel;
                    gvExcel.DataBind();

                    gvExcel.RenderControl(oHtmlTextWriter);
                    Response.Write(oStringWriter.ToString());
                    Response.Flush();
                    Response.End();
                }
                else
                {
                    ResultMsgLabel.Text = "無匯出資料";
                }
            }
            else
            {
                throw new Exception("匯出筆數超過上限" + iLimitedRowsCounts.ToString() + "筆");
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally 
        {
            gvExcel.DataSource = null;
            gvExcel.Dispose();
        }

        #endregion
    }
Exemple #9
0
    private bool CalculateStoreRank()
    {
        #region

        bool bResult = false;
        Hashtable ht = GetInputValues();
        ht.Add("Module", "ALO");
        ht.Add("FlagName", "SET_STORERANK_YN");
        ht.Add("InProcess", "Y");
        DataTable dtTemp;

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

        try
        {

            dtTemp = BCO.CheckSysProcFlag();//檢查是否可進行計算

            if (dtTemp != null && dtTemp.Rows.Count > 0)
            {
                #region
                if (dtTemp.Rows[0]["errStoreRank"].ToString().Trim() != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errStoreRank"].ToString().Trim()), true);
                    return bResult;
                }

                if (dtTemp.Rows[0]["errDisRec"].ToString().Trim() != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errDisRec"].ToString().Trim()), true);
                    return bResult;
                }

                if (dtTemp.Rows[0]["errMultiDisRec"].ToString().Trim() != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", dtTemp.Rows[0]["errMultiDisRec"].ToString().Trim()), true);
                    return bResult;
                }
                #endregion

                #region

                bResult = BCO.ProcessCalculateStoreRank(ht);

                #region deleted
                //try
                //{
                //    BCO.SetSYS_PROC_FLAG(ht, null);//設定計算執行中
                //    BCO.BackupStoreRankDetl(ht, null);//備份明細檔
                //    BCO.Add_ALO_STORERANK_MainDetl2(ht, null);//新增主檔明細檔
                //    BCO.SetStoreRankValueLevel2(ht, null);//計算Rank_Value Rank_Level
                //    BCO.SetProcNoIsNullInDetl(ht, null);//設定明細檔計算處理批號欄位
                //    bResult = true;

                //    //DBT.Commit();//交易成功
                //}
                //catch (Exception ex)
                //{
                //    BCO.RollBackupStoreRankDetl(ht, null);//還原明細檔  
                //    //DBT.Rollback();//交易失敗
                //    throw ex;
                //}
                //finally
                //{
                //    ht["InProcess"] = null;
                //    BCO.SetSYS_PROC_FLAG(ht, null);//計算完畢
                //}
                #endregion

                #endregion
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return bResult;
        #endregion
    }
Exemple #10
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void QueryData()
    {
        #region

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

        ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConnectionDB);
        DataTable Dt = null;


        if (Session[SessionIDName] == null)
        {
            //2010/07/13 modified
            Dt = BCO.QueryStorRankByFind3(GetInputValues());
        }
        else 
        {
            Dt = (DataTable)Session[SessionIDName];
        }


        if (Dt != null)
        {
            Session[SessionIDName] = Dt;

            DataView dv = Dt.DefaultView;

            if (ViewState["SortingCondition"] != null)
            {
                dv.Sort = ViewState["SortingCondition"].ToString();
            }

            GridView1.DataSource = dv;


            //設定分頁大小
            GridView1.PageSize = iCurrentGvPageSize;
            GridView1.PageIndex = iCurrentGvPageIndex;
            GridView1.DataBind();

            LabelQueryRecordCount.Text = string.Format(" {0} Rows ", Dt.Rows.Count.ToString());
        }
        if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
        {
            ResultMsgLabel.Text = "查無資料";
            //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true);
        }

        #endregion
    }//QueryData
Exemple #11
0
    protected void txt_RankLevel_E_TextChanged(object sender, EventArgs e)
    {
        #region

        Label lbl_Rank_Code = (Label)GridView1.Rows[iCurrentRowIndex].FindControl("lbl_Rank_Code");
        TextBox txt_RankLevel = (TextBox)GridView1.Rows[iCurrentRowIndex].FindControl("txt_RankLevel_E");
        TextBox txt_Remark_E = (TextBox)GridView1.Rows[iCurrentRowIndex].FindControl("txt_Remark_E");


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

        Hashtable ht = new Hashtable();
        ht.Add("RankCode", lbl_Rank_Code.Text.Trim());
        ht.Add("RankLevel", txt_RankLevel.Text.Trim());

        bool bResult = BCO.CheckRankLevel(ht);

        if (!bResult)
        {
            hiddenFocusCtrlID.Value = txt_RankLevel.ClientID;
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ClientScript", string.Format("alert('{0}');", "資料庫無此RANK等級"), true);
            //GridView1.EditIndex = -1;
            QueryData();
        }
        else
        {
            hiddenFocusCtrlID.Value = txt_Remark_E.ClientID;
        }

        #endregion
    }
Exemple #12
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        #region
        Label lbl_ID = (Label)GridView1.Rows[e.RowIndex].FindControl("lbl_ID");
        Label lbl_PID = (Label)GridView1.Rows[e.RowIndex].FindControl("lbl_PID");
        TextBox txt_RankLevel = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_RankLevel_E");
        TextBox txt_Remark = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_Remark_E");

        try
        {
            ALOModel.MaintainStoreRank BCO = new ALOModel.MaintainStoreRank(ConnectionDB);

            Hashtable ht = new Hashtable();
            ht.Add("ID", lbl_ID.Text.Trim());
            ht.Add("PID", lbl_PID.Text.Trim());
            ht.Add("RankLevel", txt_RankLevel.Text.Trim());
            ht.Add("Memo", txt_Remark.Text.Trim());
            ht.Add("UserID", Session["UID"].ToString());

            BCO.UpdateStoreRankDetail(ht, null);

            ResultMsgLabel.Text = "更新成功";

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

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            GridView1.EditIndex = -1;
            QueryData();
        }

        #endregion
    }