private ImportEntity Map(tblProduct item)
 {
     var result = new ImportEntity {MasterDataCollective = MasterDataCollective.SaleProduct.ToString()};
     result.Fields[0] =string.IsNullOrEmpty(item.ProductCode)?"":item.ProductCode.Trim();
     result.Fields[1] = string.IsNullOrEmpty(item.Description) ? "" : item.Description.Trim(); 
     result.Fields[2] = item.ExFactoryPrice.ToString("0.00");
     return result;
 }
 private ConsolidatedProductDTO Map(tblProduct tbl)
 {
     var dto = new ConsolidatedProductDTO
     {
         MasterId = tbl.id,
         DateCreated = tbl.IM_DateCreated,
         DateLastUpdated = tbl.IM_DateLastUpdated,
         StatusId = tbl.IM_Status,
         Description = tbl.Description,
         ProductBrandMasterId = tbl.BrandId ?? Guid.Empty,
         ProductPackagingMasterId = tbl.PackagingId ?? Guid.Empty,
         ProductPackagingTypeMasterId = tbl.PackagingTypeId ?? Guid.Empty,
         ProductCode = tbl.ProductCode,
         ReturnableTypeMasterId = tbl.ReturnableType,
         VatClassMasterId = tbl.VatClassId,
         ExFactoryPrice = tbl.ExFactoryPrice,
         ProductDetails = new List<ConsolidatedProductProductDetailDTO>()
     };
     return dto;
 }
 private SaleProductDTO Map(tblProduct tbl)
 {
     var dto = new SaleProductDTO
                   {
                       MasterId = tbl.id,
                       DateCreated = tbl.IM_DateCreated,
                       DateLastUpdated = tbl.IM_DateLastUpdated,
                       StatusId = tbl.IM_Status,
                       Description = tbl.Description,
                       ProductBrandMasterId = tbl.BrandId ?? Guid.Empty,
                       ProductPackagingMasterId = tbl.PackagingId ?? Guid.Empty,
                       ProductPackagingTypeMasterId = tbl.PackagingTypeId ?? Guid.Empty,
                       ProductCode = tbl.ProductCode,
                       ReturnableTypeMasterId = tbl.ReturnableType,
                       VatClassMasterId = tbl.VatClassId,
                       ExFactoryPrice = tbl.ExFactoryPrice,
                       ProductFlavourMasterId = tbl.FlavourId ?? Guid.Empty,
                       ProductTypeMasterId = tbl.ProductTypeId.HasValue ?tbl.ProductTypeId.Value: Guid.Empty,
                       ReturnableProductMasterId = tbl.Returnable ?? Guid.Empty,
                       
                   };
     if (tbl.Returnable.HasValue)
     {
         string sql =
             string.Format(
                 "select c.Id,c.Capacity  from tblProduct  r join tblProduct c on c.id=r.Returnable where r.id='{0}'",
                 tbl.Returnable.Value);
         var container = _context.ExecuteStoreQuery<ReturnableContainer>(sql).FirstOrDefault();
         if (container != null)
         {
             dto.ContainerCapacity = container.Capacity;
             dto.ReturnableContainerMasterId = container.Id;
         }
     }
     return dto;
 }
示例#4
0
 /// <summary>
 /// Create a new tblProduct object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="domainTypeId">Initial value of the DomainTypeId property.</param>
 /// <param name="productCode">Initial value of the ProductCode property.</param>
 /// <param name="iM_DateCreated">Initial value of the IM_DateCreated property.</param>
 /// <param name="iM_DateLastUpdated">Initial value of the IM_DateLastUpdated property.</param>
 /// <param name="capacity">Initial value of the Capacity property.</param>
 /// <param name="exFactoryPrice">Initial value of the ExFactoryPrice property.</param>
 /// <param name="iM_Status">Initial value of the IM_Status property.</param>
 public static tblProduct CreatetblProduct(global::System.Guid id, global::System.Int32 domainTypeId, global::System.String productCode, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 capacity, global::System.Decimal exFactoryPrice, global::System.Int32 iM_Status)
 {
     tblProduct tblProduct = new tblProduct();
     tblProduct.id = id;
     tblProduct.DomainTypeId = domainTypeId;
     tblProduct.ProductCode = productCode;
     tblProduct.IM_DateCreated = iM_DateCreated;
     tblProduct.IM_DateLastUpdated = iM_DateLastUpdated;
     tblProduct.Capacity = capacity;
     tblProduct.ExFactoryPrice = exFactoryPrice;
     tblProduct.IM_Status = iM_Status;
     return tblProduct;
 }
示例#5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblProduct EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblProduct(tblProduct tblProduct)
 {
     base.AddObject("tblProduct", tblProduct);
 }
 private string GetVatClass(tblProduct product)
 {
     var vat = _ctx.tblVATClass.FirstOrDefault(p => p.id == product.VatClassId);
     if(vat !=null)
     {
         return vat.Name;
     }
     return string.Empty;
 }