Exemplo n.º 1
0
        public JsonResult GetMyOrderList(RecipientOrderPagingModel model)
        {
            model.RecordsPerPage = model.RecordsPerPage == 10 ? 12 : model.RecordsPerPage;
            var           modal        = _editorManager.GetMyPostCardOrdersPaggedList(model, LOGGEDIN_USER.UserID);
            List <string> resultString = new List <string>();

            resultString.Add(RenderRazorViewToString("Partials/_myorders", modal));
            resultString.Add(modal.TotalCount.ToString());
            return(JsonResult(resultString));
        }
Exemplo n.º 2
0
        public JsonResult GetPostCardRecipientPagingList(RecipientOrderPagingModel model)
        {
            // model.IsOrderPlaced = 1;
            ViewBag.SelectedTab = SelectedAdminTab.Postcard;
            var           modal        = _editorManager.GetPostCardOrdersPaggedList(model, 0);
            List <string> resultString = new List <string>();

            resultString.Add(RenderRazorViewToString("Partials/_postcardRecipientListing", modal));
            resultString.Add(modal.TotalCount.ToString());
            return(JsonResult(resultString));
        }
Exemplo n.º 3
0
        public HttpResponseMessage MyOrderList(RecipientOrderPagingModel model)
        {
            //model.RecordsPerPage = model.RecordsPerPage == 10 ? 12 : model.RecordsPerPage;
            var modal = _editorManager.GetMyPostCardOrdersPaggedList(model, LOGGED_IN_USER.UserId);

            try
            {
                if (modal.List.Count > 0)
                {
                    return(new JsonContent(modal.Message, modal.Status, modal.List).ConvertToHttpResponseOK());
                }
                else
                {
                    return(new JsonContent(modal.Message, ActionStatus.Successfull, modal.List).ConvertToHttpResponseOK());
                }
            }
            catch (Exception ex)
            {
                return(new JsonContent("Internal Server Error", ActionStatus.Error, null).ConvertToHttpResponseOK());
            }
        }
Exemplo n.º 4
0
        PagingResult <RecipientPostCardListingModel> IEditorManager.GetPostCardOrdersPaggedList(RecipientOrderPagingModel model, int userID)
        {
            var currentTime = DateTime.UtcNow;
            var result      = new PagingResult <RecipientPostCardListingModel>();

            if (string.IsNullOrEmpty(model.SortBy))
            {
                model.SortBy    = "AddedOn";
                model.SortOrder = "Desc";
            }
            var query = Context.UserPostCardRecipients.Where(x => (x.UserPostCard.IsOrderPlaced == true &&
                                                                   DbFunctions.TruncateTime(DbFunctions.AddMinutes(x.UserPostCard.OrderPlacedOn, 15)) <= currentTime)).OrderBy(model.SortBy + " " + model.SortOrder);

            //var query = from o in Context.UserPostCardRecipients
            //            where DbFunctions.TruncateTime(o.UserPostCard.OrderPlacedOn) != null
            //           && DbFunctions.AddMinutes(o.UserPostCard.OrderPlacedOn, 15) <= currentTime
            //            select o;

            if (userID > 0)
            {
                query = query.Where(c => c.UserPostCard.UserID == userID).OrderBy(model.SortBy + " " + model.SortOrder);
            }

            if (userID == 0)
            {
                if (model.shownByStatus == eRecipientOrderStatus.Approved)
                {
                    if (model.shownsBydays == eShownRecipientOrdersByDays.Past)
                    {
                        query = query.OrderBy(model.SortBy + " " + model.SortOrder).Where(j => j.UserPostCard.ShipmentDate < DbFunctions.TruncateTime(DateTime.UtcNow));
                    }
                    else if (model.shownsBydays == eShownRecipientOrdersByDays.Today)
                    {
                        query = query.Where(j => j.UserPostCard.ShipmentDate.Value.Year == DateTime.UtcNow.Year &&
                                            j.UserPostCard.ShipmentDate.Value.Month == DateTime.UtcNow.Month &&
                                            j.UserPostCard.ShipmentDate.Value.Day == DateTime.UtcNow.Day);
                    }
                    else if (model.shownsBydays == eShownRecipientOrdersByDays.Future)
                    {
                        query = query.Where(c => c.UserPostCard.ShipmentDate > DateTime.UtcNow);
                    }
                }

                //if (model.shownByStatus == eRecipientOrderStatus.New)
                //    query = query.Where(c => c.IsApproved == false && c.IsCompleted == false && c.IsError == null);
                //else if (model.shownByStatus == eRecipientOrderStatus.Approved)
                //    query = query.Where(c => c.IsApproved == true);
                //else if (model.shownByStatus == eRecipientOrderStatus.Completed)
                //    query = query.Where(c => c.IsCompleted == true && c.IsRejected != true);
                //else if (model.shownByStatus == eRecipientOrderStatus.Rejected)
                //    query = query.Where(c => c.IsRejected == true);
                //else if (model.shownByStatus == eRecipientOrderStatus.Errors)
                //    query = query.Where(c => c.IsError == true);


                if (model.shownByStatus == eRecipientOrderStatus.New)
                {
                    query = query.Where(c => c.CardStatus == (int)CardStatusTypes.InProgress);
                }
                else if (model.shownByStatus == eRecipientOrderStatus.Approved)
                {
                    query = query.Where(c => c.CardStatus == (int)CardStatusTypes.Approved);
                }
                else if (model.shownByStatus == eRecipientOrderStatus.Completed)
                {
                    query = query.Where(c => c.CardStatus == (int)CardStatusTypes.Completed);
                }
                else if (model.shownByStatus == eRecipientOrderStatus.Rejected)
                {
                    query = query.Where(c => c.CardStatus == (int)CardStatusTypes.Rejected);
                }
                else if (model.shownByStatus == eRecipientOrderStatus.Errors)
                {
                    query = query.Where(c => c.CardStatus == (int)CardStatusTypes.Error);
                }
            }
            if (!string.IsNullOrEmpty(model.Search))
            {
                query = query.Where(z => z.UserPostCard.User.FirstName.Contains(model.Search) || z.UserPostCard.User.Email.Contains(model.Search) || z.ID.ToString().Contains(model.Search));
            }

            var list = query.Skip((model.PageNo - 1) * model.RecordsPerPage).Take(model.RecordsPerPage).ToList();

            result.List       = Mapper.Map <List <UserPostCardRecipient>, List <RecipientPostCardListingModel> >(list.ToList(), result.List);
            result.Status     = ActionStatus.Successfull;
            result.Message    = "Post Card Order List";
            result.TotalCount = query.Count();
            return(result);
        }
Exemplo n.º 5
0
        PagingResult <RecipientPostCardListingModel> IEditorManager.GetMyPostCardOrdersPaggedList(RecipientOrderPagingModel model, int userID)
        {
            var result = new PagingResult <RecipientPostCardListingModel>();

            if (string.IsNullOrEmpty(model.SortBy))
            {
                model.SortBy    = "AddedOn";
                model.SortOrder = "Desc";
            }
            var query = Context.UserPostCardRecipients.Where(c => c.UserPostCard.UserID == userID && c.UserPostCard.IsOrderPlaced == true).OrderBy(model.SortBy + " " + model.SortOrder);

            if (!string.IsNullOrEmpty(model.Search))
            {
                query = query.Where(z => z.UserPostCard.User.FirstName.Contains(model.Search) || z.UserPostCard.User.Email.Contains(model.Search) || z.ID.ToString().Contains(model.Search));
            }

            var list = query.Skip((model.PageNo - 1) * model.RecordsPerPage).Take(model.RecordsPerPage).ToList();

            result.List       = Mapper.Map <List <UserPostCardRecipient>, List <RecipientPostCardListingModel> >(list.ToList(), result.List);
            result.Status     = ActionStatus.Successfull;
            result.Message    = "Post Card Order List";
            result.TotalCount = query.Count();
            return(result);
        }