Beispiel #1
0
        /// <summary>
        /// 存入保證金預設資料
        /// </summary>
        /// <param name="ActType">修改狀態</param>
        /// <param name="AccessType">存入 or 取出</param>
        /// <param name="AplyNo">單號</param>
        private void resetMarginpViewModel(string AccessType, string AplyNo = null, bool ActType = true)
        {
            Cache.Invalidate(CacheList.MarginpData);
            var data = (TreasuryAccessViewModel)Cache.Get(CacheList.TreasuryAccessViewData);

            if (AplyNo.IsNullOrWhiteSpace())
            {
                if (AccessType == Ref.AccessProjectTradeType.P.ToString())
                {
                    Cache.Set(CacheList.MarginpData, new List <MarginpViewModel>());
                }
                if (AccessType == Ref.AccessProjectTradeType.G.ToString())
                {
                    Cache.Set(CacheList.MarginpData, Marginp.GetDbDataByUnit(data.vAplyUnit, AplyNo));//只抓庫存
                }
            }
            else
            {
                if (AccessType == Ref.AccessProjectTradeType.P.ToString())
                {
                    Cache.Set(CacheList.MarginpData, Marginp.GetDataByAplyNo(AplyNo));//抓單號
                }
                if (AccessType == Ref.AccessProjectTradeType.G.ToString())
                {
                    if (ActType && Aply_Appr_Type.Contains(TreasuryAccess.GetStatus(AplyNo)))              //可以修改
                    {
                        Cache.Set(CacheList.MarginpData, Marginp.GetDbDataByUnit(data.vAplyUnit, AplyNo)); //抓庫存+單號
                    }
                    else
                    {
                        Cache.Set(CacheList.MarginpData, Marginp.GetDataByAplyNo(AplyNo));//抓單號
                    }
                }
            }
        }