private void AddEditPage(Pages model)
        {
            if (model != null)
            {
                model.ParentID     = WBHelper.ToInt((string.IsNullOrEmpty(Request.Form["ddlParentID"]) ? "0" : Request.Form["ddlParentID"].Split('|')[0]));
                model.PageStatusID = Convert.ToInt16(Request.Form["ddlPageStatus"]);
                model.SiteID       = Site.ID;


                var pagerepo = DependencyResolver.Current.GetService <IRepository <Pages> >();
                if (model.ID == 0)
                {
                    model.DisplayOrder = model.ID;
                    model.BrandID      = -1;
                    pagerepo.Add(model);
                    _unitOfWork.Commit();

                    //update display order for newly added page
                    model.DisplayOrder = model.ID;
                    pagerepo.Update(model);
                    _unitOfWork.Commit();
                }
                else
                {
                    var objPage = pagerepo.Find(pg => pg.ID == model.ID && pg.SiteID == Site.ID).FirstOrDefault();
                    if (objPage != null)
                    {
                        objPage.ParentID     = model.ParentID;
                        objPage.PageStatusID = model.PageStatusID;
                        objPage.Caption      = model.Caption;
                        objPage.slug         = model.slug;
                        objPage.URLTargetID  = model.URLTargetID;
                        objPage.StartDate    = model.StartDate;
                        objPage.EndDate      = model.EndDate;

                        pagerepo.Update(objPage);
                        _unitOfWork.Commit();
                    }
                }

                WBSSLStore.Web.Helpers.Caching.SiteCacher.ClearCache(Site.ID);
            }
        }
Пример #2
0
        public ViewResult Search(FormCollection collection, int?page)
        {
            ViewBag.StartDate       = collection["txtFromDate"] ?? Request.QueryString["txtFromDate"];
            ViewBag.EndDate         = collection["txtToDate"] ?? Request.QueryString["txtToDate"];
            ViewBag.OrderStatus     = collection["ddlStatus"] ?? Request.QueryString["ddlStatus"];
            ViewBag.AuthCode        = collection["txtAuthCode"] ?? Request.QueryString["txtAuthCode"];
            ViewBag.ExternalOrderID = collection["txtOrderNumber"] ?? Request.QueryString["txtOrderNumber"];
            ViewBag.DomainName      = collection["txtDomainName"] ?? Request.QueryString["txtDomainName"];
            ViewBag.Product         = collection["ddlProduct"] ?? Request.QueryString["ddlProduct"];
            ViewBag.InvoiceID       = collection["txtInvoiceID"] ?? Request.QueryString["txtInvoiceID"];



            BindProducts();

            if (ViewBag.StartDate != null)
            {
                OrderStatus?eOrderStatus = null;
                if (!string.IsNullOrEmpty(ViewBag.OrderStatus))
                {
                    eOrderStatus = (OrderStatus?)Enum.Parse(typeof(OrderStatus), ViewBag.OrderStatus.ToString(), true);
                }


                //var d = DateTime.ParseExact(Convert.ToString(ViewBag.StartDate), "d", System.Globalization.CultureInfo.InvariantCulture);

                ViewBag.EndDate   = !string.IsNullOrEmpty(ViewBag.EndDate) ? Convert.ToString(ViewBag.EndDate).Trim() : ViewBag.EndDate;
                ViewBag.StartDate = !string.IsNullOrEmpty(ViewBag.StartDate) ? Convert.ToString(ViewBag.StartDate).Trim() : ViewBag.StartDate;


                DateTime dtStart = ViewBag.StartDate == null ? DateTimeWithZone.Now.Month + "/01/" + DateTimeWithZone.Now.Year : DateTime.ParseExact(ViewBag.StartDate, "d", System.Globalization.CultureInfo.InvariantCulture);
                DateTime dtEnd   = ViewBag.EndDate == null ? DateTimeWithZone.Now : DateTime.ParseExact(ViewBag.EndDate, "d", System.Globalization.CultureInfo.InvariantCulture);

                string DomainName = ViewBag.DomainName;
                DomainName = string.IsNullOrEmpty(DomainName) ? "" : DomainName.Trim();

                int    product   = string.IsNullOrEmpty(ViewBag.Product) ? 0 : Convert.ToInt16(ViewBag.Product);
                string InvoiceID = ViewBag.InvoiceID;
                InvoiceID = string.IsNullOrEmpty(InvoiceID) ? "-2" : InvoiceID.ToLower().Replace(InvoicePrefix.ToLower(), string.Empty);
                int invoiceid = WBHelper.ToInt(InvoiceID, -1);

                string strExternalOrderID = ViewBag.ExternalOrderID, strAuthCode = ViewBag.AuthCode;


                ViewBag.StartDate = Convert.ToDateTime(dtStart).ToString("MM/dd/yyyy");
                ViewBag.EndDate   = Convert.ToDateTime(dtEnd).ToString("MM/dd/yyyy");

                ViewBag.DomainName  = DomainName;
                ViewBag.OrderStatus = eOrderStatus.ToString();

                if (!PagingInputValidator.IsPagingInputValid(ref page))
                {
                    return(View());
                }

                var orderInfo = _service.SearchOrder(Site.ID, invoiceid, strExternalOrderID, DomainName, dtStart, dtEnd, product, eOrderStatus, strAuthCode)
                                .OrderByDescending(od => od.OrderDate)
                                .ToPagedList(page.HasValue ? page.Value - 1 : 0, PageSize);
                orderInfo.ActionName     = "Search";
                orderInfo.ControllerName = "orders";

                if (!PagingInputValidator.IsPagingInputValid(ref page, orderInfo))
                {
                    return(View());
                }

                ViewBag.Message = (orderInfo != null && orderInfo.Count > 0 ? string.Empty : "No order found.");
                return(View(orderInfo));
            }
            return(View());
        }
Пример #3
0
        //
        // GET: /Admin/Support/
        public ActionResult Index(FormCollection collection, int?page)
        {
            ViewBag.StartDate = collection["txtFromDate"] ?? Request.QueryString["txtFromDate"];
            ViewBag.EndDate   = collection["txtToDate"] ?? Request.QueryString["txtToDate"];
            ViewBag.Status    = collection["ddlStatus"] ?? Request.QueryString["ddlStatus"];
            ViewBag.Keyword   = collection["txtKeyword"] ?? Request.QueryString["txtKeyword"];

            if (!PagingInputValidator.IsPagingInputValid(ref page))
            {
                return(View());
            }

            DateTime dtStart = ViewBag.StartDate == null?DateTimeWithZone.Now.AddYears(-1) : Convert.ToDateTime(ViewBag.StartDate);

            DateTime dtEnd = ViewBag.EndDate == null ? DateTimeWithZone.Now : Convert.ToDateTime(ViewBag.EndDate);

            bool?bIsOpen = null;

            if (ViewBag.Status == null && string.IsNullOrEmpty(Request.QueryString["txtFromDate"]))
            {
                bIsOpen = true;
            }
            else if (!string.IsNullOrEmpty(ViewBag.Status))
            {
                bIsOpen = Convert.ToBoolean(ViewBag.Status);
            }


            string strKeyword = ViewBag.Keyword;
            int    intID      = string.IsNullOrEmpty(strKeyword) ? 0 : WBHelper.ToInt(strKeyword.Replace(InvoicePrefix, string.Empty).Replace("SSL-", string.Empty), 999999999);

            UserType eUserType;

            ViewBag.StartDate = dtStart.ToShortDateString();
            ViewBag.EndDate   = dtEnd.ToShortDateString();
            ViewBag.Status    = bIsOpen;

            ViewBag.Keyword = strKeyword;

            if (!string.IsNullOrEmpty(Request.QueryString[SettingConstants.QS_USER_TYPE]) && Request.QueryString[SettingConstants.QS_USER_TYPE].ToUpper() == "ALL")
            {
                var supportrequests = _repository.Find(s => s.User.UserTypeID == s.User.UserTypeID && s.SiteID == Site.ID &&
                                                       (System.Data.Entity.DbFunctions.DiffDays(dtStart, s.AuditDetails.DateCreated) >= 0 &&
                                                        System.Data.Entity.DbFunctions.DiffDays(s.AuditDetails.DateCreated, dtEnd) >= 0) &&
                                                       s.isOpen == (bIsOpen == null ? s.isOpen : bIsOpen) &&
                                                       (s.ID.Equals(intID > 0 ? intID : s.ID) || s.OrderDetail.OrderID.Equals(intID > 0 ? intID : s.OrderDetail.OrderID) ||
                                                        (s.OrderDetail.ExternalOrderID ?? "-").Equals(intID > 0 ? strKeyword : (s.OrderDetail.ExternalOrderID ?? "-"))))
                                      .EagerLoad(s => s.AuditDetails, s => s.OrderDetail, s => s.OrderDetail.CertificateRequest)
                                      .OrderByDescending(ord => ord.AuditDetails.DateModified).ThenByDescending(ord => ord.AuditDetails.DateCreated)
                                      .ToPagedList(page.HasValue ? page.Value - 1 : 0, PageSize);

                if (!PagingInputValidator.IsPagingInputValid(ref page, supportrequests))
                {
                    return(View());
                }

                return(View(supportrequests));
            }
            else if (!string.IsNullOrEmpty(Request.QueryString[SettingConstants.QS_USER_TYPE]) && Enum.TryParse <UserType>(Request.QueryString[SettingConstants.QS_USER_TYPE].ToUpper(), out eUserType))
            {
                if (Enum.IsDefined(typeof(UserType), eUserType))
                {
                    var supportrequests = _repository.Find(s => s.User.UserTypeID == (int?)eUserType && s.SiteID == Site.ID &&
                                                           (System.Data.Entity.DbFunctions.DiffDays(dtStart, s.AuditDetails.DateCreated) >= 0 &&
                                                            System.Data.Entity.DbFunctions.DiffDays(s.AuditDetails.DateCreated, dtEnd) >= 0) &&
                                                           s.isOpen == (bIsOpen == null ? s.isOpen : bIsOpen) &&
                                                           (s.ID.Equals(intID > 0 ? intID : s.ID) || s.OrderDetail.OrderID.Equals(intID > 0 ? intID : s.OrderDetail.OrderID) ||
                                                            (s.OrderDetail.ExternalOrderID ?? "-").Equals(intID > 0 ? strKeyword : (s.OrderDetail.ExternalOrderID ?? "-"))))
                                          .EagerLoad(s => s.AuditDetails, s => s.OrderDetail, s => s.OrderDetail.CertificateRequest)
                                          .OrderByDescending(ord => ord.AuditDetails.DateModified).ThenByDescending(ord => ord.AuditDetails.DateCreated)
                                          .ToPagedList(page.HasValue ? page.Value - 1 : 0, PageSize);

                    if (!PagingInputValidator.IsPagingInputValid(ref page, supportrequests))
                    {
                        return(View());
                    }

                    return(View(supportrequests));
                }
            }

            return(View());
        }