示例#1
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
        }
示例#2
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
    }
示例#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
    }
示例#4
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
    }