public int GetCycledTimes() { BizParamsBLL bizParamsBLL = new BizParamsBLL(Context); BizParams paramCycledTimes = bizParamsBLL.GetBizParamByKey(new BizParams { ParamKey = Consts.BIZ_PARAMS_CYCLEDTIMES }); int cycledTimes = int.Parse(paramCycledTimes.ParamValue); return(cycledTimes);//this.QueryRequest(new ViewStockTakeRequest { IsCycleCount = true }, null, null).Count(); }
public StocktakeRequest CreateCycleCount(User user, List <View_StocktakeDetails> deletedDetails, List <View_StocktakeDetails> updatedDetails) { PartBLL partBll = new PartBLL(); IQueryable <ViewPart> partQry = partBll.GetPartsByPlantToCycleCount();//partBll.GetPartsToCycleCount(); NewStocktakeRequest request = new NewStocktakeRequest { IsStatic = true, IsCycleCount = true }; request.RequestBy = user.UserID; request.Details = new List <NewStocktakeDetails>(); foreach (var item in partQry) { NewStocktakeDetails details = new NewStocktakeDetails { PartID = item.PartID.ToString(), StocktakeTypeID = 90, StocktakePriority = 1 }; View_StocktakeDetails deletedItem = deletedDetails.Find(d => d.PartID == int.Parse(details.PartID)); if (deletedItem == null) { View_StocktakeDetails updatedItem = updatedDetails.Find(d => d.PartID == int.Parse(details.PartID)); if (updatedItem != null) { details.Description = updatedItem.DetailsDesc; } request.Details.Add(details); } } StocktakeRequest result = CreateStocktakeRequest(request); BizParamsBLL bizParamsBLL = new BizParamsBLL(); BizParams param = bizParamsBLL.GetBizParamByKey(new BizParams { ParamKey = Consts.BIZ_PARAMS_CYCLECOUNTED }); param.ParamValue = "True"; bizParamsBLL.UpdateBizParams(param); BizParams paramCycledTimes = bizParamsBLL.GetBizParamByKey(new BizParams { ParamKey = Consts.BIZ_PARAMS_CYCLEDTIMES }); int cycledTimes = int.Parse(paramCycledTimes.ParamValue); paramCycledTimes.ParamValue = (cycledTimes + 1).ToString(); bizParamsBLL.UpdateBizParams(paramCycledTimes); return(result); }