public static EF6.ProductPriceType Get(Guid id)
        {
            EF6.ProductPriceType result = null;

            using (var ctx = new EF6.RT2020Entities())
            {
                result = ctx.ProductPriceType.Where(x => x.PriceTypeId == id).AsNoTracking().FirstOrDefault();
            }

            return(result);
        }
        public static Guid GetIdByPriceType(string type)
        {
            Guid result = Guid.Empty;

            using (var ctx = new EF6.RT2020Entities())
            {
                var item = ctx.ProductPriceType.Where(x => x.PriceType == type).FirstOrDefault();
                if (item == null)
                {   //* 點解冇就 create ?
                    item                 = new EF6.ProductPriceType();
                    item.PriceTypeId     = Guid.NewGuid();
                    item.PriceType       = type;
                    item.CurrencyCode    = "HKD";
                    item.CoreSystemPrice = false;

                    ctx.ProductPriceType.Add(item);
                    ctx.SaveChanges();
                }
                result = item.PriceTypeId;
            }

            return(result);
        }
        private Guid GetPriceType(string priceType)
        {
            Guid result = Guid.Empty;

            using (var ctx = new EF6.RT2020Entities())
            {
                string sql   = "PriceType = '" + priceType + "'";
                var    oType = ctx.ProductPriceType.Where(x => x.PriceType == priceType).FirstOrDefault();
                if (oType == null)
                {
                    oType                 = new EF6.ProductPriceType();
                    oType.PriceTypeId     = Guid.NewGuid();
                    oType.PriceType       = priceType;
                    oType.CurrencyCode    = "HKD";
                    oType.CoreSystemPrice = false;

                    ctx.ProductPriceType.Add(oType);
                    ctx.SaveChanges();

                    result = oType.PriceTypeId;
                }
            }
            return(result);
        }