public LogicResult <ProductInvoiceModel> GetInvoiceForDownload(Guid productId, Guid userId)
 {
     try
     {
         var invoice = (from userToProduct in _userToProductQueryService.GetAll()
                        join product in _productQueryService.GetAll() on userToProduct.ProductId equals product.Id
                        join productType in _productTypeServiceFacade.Data on product.TypeId equals productType.Id
                        where userToProduct.UserId == userId && userToProduct.ProductId == productId
                        select new ProductInvoiceModel
         {
             Day = userToProduct.Day,
             UserId = userToProduct.UserId,
             Point = userToProduct.Point,
             Id = userToProduct.ProductId,
             PaymentDetail = SerializerHelper.DeserializeObject <PaymentDetail>(userToProduct.PaymentDetail),
             Name = product.Name,
             Type = productType.Type
         }).FirstOrDefault();
         return(LogicResult <ProductInvoiceModel> .Succeed(invoice));
     }
     catch
     {
         return(LogicResult <ProductInvoiceModel> .Failure(Validation.UnSuccessfullOperation));
     }
 }
Example #2
0
        public void EntityDeserializerHasCorrectId()
        {
            var em = new EntityMock();

            var em2 = SerializerHelper.DeserializeObject <EntityMock>(SerializerHelper.SerializeObject(em));

            Assert.Equal(em.Id, em2.Id);
        }
Example #3
0
        public void GetRestrictGenes(HttpRequest Request, HttpResponse Response)
        {
            TrialReq trialReq     = new TrialReq();
            string   JsonTrialReq = Request.Form["JsonTrialReq"];

            if (string.IsNullOrEmpty(JsonTrialReq))
            {
                Response.Write("strTrialReq不能为空");
            }
            trialReq = SerializerHelper.DeserializeObject <TrialReq>(JsonTrialReq);
            TrialResp trialResp = new TrialResp();

            trialResp = baoxianBLL.GetOrderTrial(trialReq);
            //string strEncode = Utils.base64Encode(SerializerHelper.ToJson(trialResp.priceArgs.genes));
            //string strRusult = "{\"respstat\":\"" + trialResp.respstat + "\", \"priceArgsId\":\"" + trialResp.priceArgsId + "\",\"strEncode\":\"" + strEncode + "\"}";
            Response.Write(SerializerHelper.ToJson(trialResp));
        }
 public LogicResult <IEnumerable <ProductCartModel> > GetProductsByUser(Guid userId)
 {
     try
     {
         var userProducts = from userToProduct in _userToProductQueryService.GetAll()
                            join product in _productQueryService.GetAll() on userToProduct.ProductId equals product.Id
                            join productType in _productTypeServiceFacade.Data on product.TypeId equals productType.Id
                            where userToProduct.UserId == userId select new ProductCartModel
         {
             Day           = userToProduct.Day,
             UserId        = userToProduct.UserId,
             Point         = userToProduct.Point,
             Id            = userToProduct.ProductId,
             PaymentDetail = SerializerHelper.DeserializeObject <PaymentDetail>(userToProduct.PaymentDetail),
             Name          = product.Name,
             Type          = productType.Type
         };
         return(LogicResult <IEnumerable <ProductCartModel> > .Succeed(userProducts));
     }
     catch
     {
         return(LogicResult <IEnumerable <ProductCartModel> > .Failure(Validation.UnSuccessfullOperation));
     }
 }
 public void LoadFromFile(string filePath)
 {
     this._generalContext = SerializerHelper.DeserializeObject <LContext>(filePath);
 }