private void FixupRETURN(RETURN previousValue) { if (previousValue != null && previousValue.RETURN_DETAILS.Contains(this)) { previousValue.RETURN_DETAILS.Remove(this); } if (RETURN != null) { if (!RETURN.RETURN_DETAILS.Contains(this)) { RETURN.RETURN_DETAILS.Add(this); } if (ReturnID != RETURN.ID) { ReturnID = RETURN.ID; } } else if (!_settingFK) { ReturnID = null; } }
public void Update(RETURN upReturn) { Context.RETURN.Attach(upReturn); Context.ObjectStateManager.ChangeObjectState(upReturn, System.Data.EntityState.Modified); }
public void Insert(RETURN Return) { Context.RETURN.AddObject(Return); }
public List<RETURN> Search(RETURN Return, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, SortDirection SortDirection) { var result = Context.RETURN.Include("ORDERS").Include("ORDERS.CUSTOMER").AsQueryable(); if (Return != null) { if (Return.ID != 0) { result = result.Where(b => b.ID == Return.ID); } if (!String.IsNullOrEmpty(Return.Comments)) { result = result.Where(b => b.Comments.Contains(Return.Comments)); } if (Return.OrderID.HasValue) { result = result.Where(b => b.OrderID == Return.OrderID.Value); } if (Return.ORDERS != null) { result = result.Where(b => b.ORDERS == Return.ORDERS); } if (Return.ReceivedDate.HasValue) { result = result.Where(b => b.ReceivedDate == Return.ReceivedDate); } if (Return.RequestDate.HasValue) { result = result.Where(b => b.RequestDate == Return.RequestDate); } if (!string.IsNullOrEmpty(Return.CustomerName)) { result = result.Where(r => (r.ORDERS.CUSTOMER.Name + " " + r.ORDERS.CUSTOMER.Surname).Contains(Return.CustomerName)); } if (!string.IsNullOrEmpty(Return.VerificationNumber)) { result = result.Where(r => r.VerificationNumber == Return.VerificationNumber); } } TotalRecords = result.Count(); if (!String.IsNullOrEmpty(OrderExp)) { if (SortDirection == SortDirection.Ascending) result = result.OrderBy(c => c.ID).ThenBy(c => c.OrderID); else result = result.OrderByDescending(c => c.ID).ThenBy(c => c.OrderID); } else { var sorter = new GenericSorterCaller<RETURN>(); result = sorter.Sort(result, string.IsNullOrEmpty(OrderExp) ? DEFAULT_ORDER_EXP : OrderExp, SortDirection); } // pagination return result.Skip(PageIndex * PageSize).Take(PageSize).ToList(); }
public void Delete(RETURN delReturn) { Context.RETURN.Attach(delReturn); Context.DeleteObject(delReturn); }
public void Delete(RETURN Return) { _returnDAO.Delete(Return); Context.SaveChanges(); }
public void Update(RETURN Return) { _returnDAO.Update(Return); Context.SaveChanges(); }
public void Insert(RETURN Return) { _returnDAO.Insert(Return); Context.SaveChanges(); }
public List<RETURN> Search(RETURN Return, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection) { return _returnDAO.Search(Return, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection); }