public IEnumerable <shProductSet> DanhSachSection() { shSectionService _section = new shSectionService(); return(_section.FindList() .Where(x => x.Status == true) .OrderBy(m => m.SectionId)); }
public shProductSet Insert_UpdateSection(string SectionGuid, int?SectionId, string ProductGuid, string SectionName, int?SortOrder, int?ItemStatus, bool?Status, DateTime?CreateDate, string ParentId) { shSectionService _section = new shSectionService(); shProductSet section = new shProductSet(); try { // Your code... // Could also be before try if you know the exception occurs in SaveChanges if (!string.IsNullOrWhiteSpace(SectionGuid)) { section = _section.FindByKey(SectionGuid); } else { SectionGuid = GuidUnique.getInstance().GenerateUnique(); } section.SectionGuid = SectionGuid; //section.SectionId = SectionId; section.ProductGuid = ProductGuid; section.SectionName = SectionName; section.SortOrder = SortOrder; section.ItemStatus = ItemStatus; section.Status = Status; section.CreateDate = CreateDate; section.MetaTitle = "/" + StringHelper.ToUnsignString(section.SectionName).ToLower(); section.ParentId = ParentId; if (section.SectionId > 0) { _section.Update(section); } else { _section.Insert(section); } } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } return(section); }
public string SectionName(string SectionGuid) { if (!String.IsNullOrWhiteSpace(SectionGuid)) { shSectionService _section = new shSectionService(); shProductSet section = _section.FindByKey(SectionGuid); if (section != null) { return(section.SectionName); } } return(string.Empty); }
public IEnumerable <shSetSize> DanhSachSection_Size(string ProductGuid) { shSizeService _size = new shSizeService(); shSectionService _section = new shSectionService(); IEnumerable <shProductSet> dsParent = _section.DanhSachSection_TheoProductGuid(ProductGuid); IEnumerable <shSetSize> dsChild = new List <shSetSize>(); List <shSetSize> dsSize = new List <shSetSize>(); foreach (var parent in dsParent) { dsChild = _size.DanhSachSize_BySectionGuid_ParentNull(parent.SectionGuid, ProductGuid, null); foreach (var child in dsChild) { child.SizeName = parent.SectionName + " - " + child.SizeName + " - " + child.Stuff; dsSize.Add(child); } } return(dsSize); }