Esempio n. 1
0
 public GW(FastGroup pFG)
 {
     Type = 1;
     Name = pFG.Name;
     Code = pFG.CodeFastGroup;
     //Pictures = $"{PathPicture}0000{Code}.jpg";
 }
Esempio n. 2
0
        public override List <ProductViewModel> GetProductsByCategoryId(Guid pTerminalId, Guid pCategoryId)
        {
            var Res = new List <ProductViewModel>();

            try
            {
                var ct = new FastGroup {
                    FastGroupId = pCategoryId
                };
                var wr = Bl.db.GetWaresFromFastGroup(ct.CodeFastGroup);
                if (wr != null)
                {
                    foreach (var el in wr)
                    {
                        Res.Add(GetProductViewModel(el));
                    }
                }
                FileLogger.WriteLogMessage($"ApiPSU.GetProductsByCategoryId =>( pTerminalId=>{pTerminalId},pCategoryId=>{pCategoryId}) => ({Res?.ToJSON()})", eTypeLog.Full);
            }
            catch (Exception e)
            {
                FileLogger.WriteLogMessage($"ApiPSU.GetProductsByCategoryId Exception =>(pTerminalId=>{pTerminalId},pCategoryId=>{pCategoryId}) => (){Environment.NewLine}Message=>{e.Message}{Environment.NewLine}StackTrace=>{e.StackTrace}", eTypeLog.Error);
                throw new Exception("ApiPSU.GetProductsByCategoryId", e);
            }
            return(Res);
        }
Esempio n. 3
0
        public virtual IEnumerable <FastGroup> GetFastGroup(int parCodeUpFastGroup)
        {
            var FG = new FastGroup {
                CodeUp = parCodeUpFastGroup
            };

            return(db.Execute <FastGroup, FastGroup>(SqlGetFastGroup, FG));
        }
Esempio n. 4
0
        private ProductCategory GetProductCategory(FastGroup parFG)
        {
            if (parFG == null)
            {
                return(null);
            }
            var Parrent = new FastGroup {
                CodeFastGroup = parFG.CodeUp
            };

            return(new ProductCategory
            {
                Id = parFG.FastGroupId,
                ParentId = null,
                Name = parFG.Name,
                Language = null,
                CustomId = null,
                Description = parFG.Name,
                Image = "",
                HasChildren = false,
                HasProducts = true,
                Tags = null
            });
        }
Esempio n. 5
0
        public override IEnumerable <ProductViewModel> GetProductsByName(Guid pTerminalId, string pName, int pPageNumber = 0, bool pExcludeWeightProduct = false, Guid?pCategoryId = null, int pLimit = 10)
        {
            IEnumerable <ProductViewModel> Res = null;

            try
            {
                FastGroup fastGroup = (pCategoryId == null ? new FastGroup() : new FastGroup(pCategoryId.Value));

                var receiptId = GetCurrentReceiptByTerminalId(pTerminalId);
                //int Limit = 10;
                var res = Bl.GetProductsByName(receiptId, pName.Replace(' ', '%').Trim(), pPageNumber * pLimit, pLimit, fastGroup.CodeFastGroup);
                if (res != null)
                {
                    Res = res.Select(r => (GetProductViewModel(r)));
                }
                FileLogger.WriteLogMessage($"ApiPSU.GetProductsByName =>( pTerminalId=>{pTerminalId},pName=>{pName},pPageNumber=>{pPageNumber},pExcludeWeightProduct=>{pExcludeWeightProduct},pCategoryId=>{pCategoryId},pLimit={pLimit}) => ({Res?.ToJSON()})", eTypeLog.Full);
            }
            catch (Exception e)
            {
                FileLogger.WriteLogMessage($"ApiPSU.GetProductsByName Exception =>( pTerminalId=>{pTerminalId},pName=>{pName},pPageNumber=>{pPageNumber},pExcludeWeightProduct=>{pExcludeWeightProduct},pCategoryId=>{pCategoryId},pLimit={pLimit}) => (){Environment.NewLine}Message=>{e.Message}{Environment.NewLine}StackTrace=>{e.StackTrace}", eTypeLog.Error);
                throw new Exception("ApiPSU.GetProductsByName", e);
            }
            return(Res);
        }