Exemplo n.º 1
0
        public ActionResult ContactList(RelationshipSearchFilter searchFilter)
        {
            Logger.Info(_logMsg.Clear().SetPrefixMsg("Search Contact").Add("Status", searchFilter.Status)
                        .Add("RelationshipName", searchFilter.RelationshipName).Add("RelationshipDesc", searchFilter.RelationshipDesc));
            try
            {
                if (ModelState.IsValid)
                {
                    _commonFacade   = new CommonFacade();
                    _customerFacade = new CustomerFacade();
                    ContactViewModel contactVM = new ContactViewModel();
                    contactVM.SearchFilter = searchFilter;

                    contactVM.RelationshipList = _customerFacade.GetAllRelationships(searchFilter);
                    ViewBag.PageSize           = contactVM.SearchFilter.PageSize;
                    ViewBag.PageSizeList       = _commonFacade.GetPageSizeList();

                    return(PartialView("~/Views/Contact/_ContactList.cshtml", contactVM));
                }

                return(Json(new
                {
                    Valid = false,
                    Error = string.Empty,
                    Errors = GetModelValidationErrors()
                }));
            }
            catch (Exception ex)
            {
                Logger.Error("Exception occur:\n", ex);
                Logger.Info(_logMsg.Clear().SetPrefixMsg("Search Contact").Add("Error Message", ex.Message).ToFailLogString());
                return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                 this.ControllerContext.RouteData.Values["action"].ToString())));
            }
        }
Exemplo n.º 2
0
        //public RelationshipFilterDTO GetRelationshipFilter(int RelationshipFiltersID)
        //{
        //    List<RelationshipFilterDTO> result = new List<RelationshipFilterDTO>();
        //    using (var projectContext = new DataAccess.MyProjectEntities())
        //    {
        //        var RelationshipFilters = projectContext.RelationshipSearchFilter.First(x => x.ID == RelationshipFiltersID);
        //        return ToRelationshipFilterDTO(RelationshipFilters);
        //    }
        //}
        public RelationshipFilterDTO ToRelationshipFilterDTO(RelationshipSearchFilter item)
        {
            RelationshipFilterDTO result = new RelationshipFilterDTO();

            result.ID = item.ID;
            //result.Enabled = item.Enabled;
            BizEntityRelationshipTail bizEntityRelationshipTail = new BizEntityRelationshipTail();

            //if (item.SearchRelationshipTailID != null)
            //{
            //    result.SearchRelationshipTailID = item.SearchRelationshipTailID.Value;
            //    result.SearchRelationshipTail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail);
            //}
            result.RelationshipID          = item.RelationshipID;
            result.SearchColumnID          = item.SearchColumnID;
            result.ValueColumnID           = item.ValueColumnID;
            result.ValueRelationshipTailID = item.ValueRelationshipTailID ?? 0;
            if (item.EntityRelationshipTail != null)
            {
                result.ValueRelationshipTail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail);
            }

            //          result.SearchRelationshipTailID = item.SearchRelationshipTailID ?? 0;
            //if (item.EntityRelationshipTail != null)
            //    result.SearchRelationshipTail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(item.EntityRelationshipTail);

            //foreach (var column in item.RelationshipFilterColumns)
            //{
            //    result.RelationshipFilterColumns.Add(new RelationshipFilterColumnDTO() { SearchColumnID = column.SearchColumnID, ValueColumnID = column.ValueColumnID });
            //}
            return(result);
        }
Exemplo n.º 3
0
 public IEnumerable <RelationshipEntity> GetAllRelationships(RelationshipSearchFilter searchFilter)
 {
     _customerDataAccess = new CustomerDataAccess(_context);
     return(_customerDataAccess.GetAllRelationships(searchFilter));
 }