Example #1
0
 /// <summary>
 /// Create a new tblOutletCategory 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 tblOutletCategory CreatetblOutletCategory(global::System.Guid id, global::System.String name, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status)
 {
     tblOutletCategory tblOutletCategory = new tblOutletCategory();
     tblOutletCategory.id = id;
     tblOutletCategory.Name = name;
     tblOutletCategory.IM_DateCreated = iM_DateCreated;
     tblOutletCategory.IM_DateLastUpdated = iM_DateLastUpdated;
     tblOutletCategory.IM_Status = iM_Status;
     return tblOutletCategory;
 }
Example #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblOutletCategory EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblOutletCategory(tblOutletCategory tblOutletCategory)
 {
     base.AddObject("tblOutletCategory", tblOutletCategory);
 }
        private tblOutletCategory GetOutletCategory(string outletcategorycode)
        {
            using (var ctx = new CokeDataContext(Con))
            {
                tblOutletCategory outletcategory = null;
                if (!string.IsNullOrEmpty(outletcategorycode))
                {
                    outletcategory = ctx
                        .tblOutletCategory.FirstOrDefault(
                            p => p.Code != null &&
                                 p.Code.ToLower() == outletcategorycode.ToLower() ||
                                 p.Name != null && p.Name.ToLower() == outletcategorycode.ToLower());
                }
                if (outletcategory == null)
                    outletcategory = ctx.tblOutletCategory.FirstOrDefault(p => p.Code == "default");

                if (outletcategory == null)
                {
                    var item = new tblOutletCategory()
                    {
                        Code = "default",
                        Name = "default",
                        id = Guid.NewGuid(),
                        Description = "default",
                        IM_DateCreated = DateTime.Now,
                        IM_DateLastUpdated = DateTime.Now,
                        IM_Status = (int)EntityStatus.Active

                    };
                    ctx.tblOutletCategory.AddObject(item);
                    ctx.SaveChanges();
                }
                return outletcategory;
            }
        }