private ProductFlavourDTO Map(tblProductFlavour tbl)
 {
     var dto = new ProductFlavourDTO
                   {
                       MasterId = tbl.id,
                       DateCreated = tbl.IM_DateCreated,
                       DateLastUpdated = tbl.IM_DateLastUpdated,
                       StatusId = tbl.IM_Status,
                       Name = tbl.name,
                       Code = tbl.code,
                       Description = tbl.description,
                       ProductBrandMasterId = tbl.BrandId ?? Guid.Empty
                   };
     return dto;
 }
Пример #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblProductFlavour EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblProductFlavour(tblProductFlavour tblProductFlavour)
 {
     base.AddObject("tblProductFlavour", tblProductFlavour);
 }
Пример #3
0
 /// <summary>
 /// Create a new tblProductFlavour object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="name">Initial value of the name 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 tblProductFlavour CreatetblProductFlavour(global::System.Guid id, global::System.String name, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status)
 {
     tblProductFlavour tblProductFlavour = new tblProductFlavour();
     tblProductFlavour.id = id;
     tblProductFlavour.name = name;
     tblProductFlavour.IM_DateCreated = iM_DateCreated;
     tblProductFlavour.IM_DateLastUpdated = iM_DateLastUpdated;
     tblProductFlavour.IM_Status = iM_Status;
     return tblProductFlavour;
 }
Пример #4
0
 private tblProductFlavour GetProductFlavour(string itemName,tblProductBrand brand)
 {
     using (var ctx = new CokeDataContext(Con))
     {
         tblProductFlavour pitem = null;
         if (!string.IsNullOrEmpty(itemName))
         {
             pitem = ctx
                         .tblProductFlavour.FirstOrDefault(
                             p =>
                             p.name.ToLower() == itemName.ToLower() ||
                             p.code != null &&
                             p.code.ToLower() == itemName.ToLower()) ?? ctx.tblProductFlavour.FirstOrDefault(
                                 p => p.name.ToLower() == "default");
         }
         if(pitem==null)
         {
             var date = DateTime.Now;
                 pitem = new tblProductFlavour()
                 {
                     BrandId = brand.id,
                     id = Guid.NewGuid(),
                     code = string.IsNullOrEmpty(itemName) ? "default" : itemName,
                     description = string.IsNullOrEmpty(itemName) ? "default" : itemName,
                     IM_DateCreated = date,
                     IM_DateLastUpdated = date,
                     name = string.IsNullOrEmpty(itemName) ? "default" : itemName,
                 };
                 ctx.tblProductFlavour.AddObject(pitem);
                 ctx.SaveChanges();
         }
         return pitem;
     }
 }