private CommodityDTO Map(tblCommodity tbl,DateTime from)
 {
     var dto = new CommodityDTO
     {
         MasterId = tbl.Id,
         DateCreated = tbl.IM_DateCreated,
         DateLastUpdated = tbl.IM_DateLastUpdated,
         StatusId = tbl.IM_Status,
         Name = tbl.Name,
         CommodityTypeId = tbl.CommodityTypeId,
         Code = tbl.Code,
         Description = tbl.Description,
         CommodityGrades = new List<CommodityGradeDTO>(),
     };
     var items = tbl.tblCommodityGrade.Where(s => 
         s.IM_Status == (int)EntityStatus.Active && s.CommodityId == dto.MasterId);
     foreach( var item in items)
     {
         var grade = new CommodityGradeDTO
         {   
             MasterId = item.Id,
             DateCreated = item.IM_DateCreated,
             DateLastUpdated = item.IM_DateLastUpdated,
             StatusId = item.IM_Status,
             Name = item.Name,
             UsageTypeId = item.UsageTypeId,
             Code = item.Code,
             Description = item.Description,
             CommodityId = item.CommodityId
         };
         dto.CommodityGrades.Add(grade);
     }
     dto.DeletedCommodityGradesItem = tbl.tblCommodityGrade.Where(n => n.IM_Status == (int)EntityStatus.Deleted && n.CommodityId==tbl.Id && n.IM_DateLastUpdated > from).Select(s => s.Id).ToList();
     return dto;
 }
Esempio n. 2
0
 /// <summary>
 /// Create a new tblCommodity object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="commodityTypeId">Initial value of the CommodityTypeId 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="iM_Status">Initial value of the IM_Status property.</param>
 public static tblCommodity CreatetblCommodity(global::System.Guid id, global::System.String name, global::System.Guid commodityTypeId, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status)
 {
     tblCommodity tblCommodity = new tblCommodity();
     tblCommodity.Id = id;
     tblCommodity.Name = name;
     tblCommodity.CommodityTypeId = commodityTypeId;
     tblCommodity.IM_DateCreated = iM_DateCreated;
     tblCommodity.IM_DateLastUpdated = iM_DateLastUpdated;
     tblCommodity.IM_Status = iM_Status;
     return tblCommodity;
 }
Esempio n. 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblCommodity EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblCommodity(tblCommodity tblCommodity)
 {
     base.AddObject("tblCommodity", tblCommodity);
 }