public JsonResult Get(int pageIndex, int pageSize, string pageOrder)
        {
            var list = StaticContents.Get(pageIndex,
                                          pageSize,
                                          pageOrder);

            int total     = StaticContents.Count();
            int totalPage = (int)Math.Ceiling((decimal)total / pageSize);

            if (pageSize > total)
            {
                pageSize = total;
            }

            if (list.Count < pageSize)
            {
                pageSize = list.Count;
            }

            JsonResult result = new JsonResult()
            {
                Data = new
                {
                    TotalPages = totalPage,
                    PageIndex  = pageIndex,
                    PageSize   = pageSize,
                    Rows       = list
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };

            return(result);
        }
        public ActionResult Edit(EditStaticContent staticContent)
        {
            try
            {
                var content = Mapper.Map <StaticContent>(staticContent);

                switch (content.StaticContentType)
                {
                case OnlineStore.Models.Enums.StaticContentType.Text:
                    content.Content = staticContent.SimpleContent;
                    break;

                case OnlineStore.Models.Enums.StaticContentType.Editor:
                    content.Content = staticContent.EditorContent;
                    break;
                }

                content.LastUpdate = DateTime.Now;

                ViewBag.Success = true;

                StaticContents.Update(content);
            }
            catch (Exception ex)
            {
                SetErrors(ex);
            }

            return(RedirectToAction("Index"));
        }
        public static void ProductAvailable(string productName, string[] emails)
        {
            var emailMessage = StaticContents.GetContentByName("ProductAvailable");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", productName);

                List <EmailSend> list = new List <EmailSend>();

                foreach (var item in emails)
                {
                    var emailSend = new EmailSend
                    {
                        EmailSendStatus = EmailSendStatus.NotChecked,
                        FromID          = SaleMail.ID,
                        LastUpdate      = DateTime.Now,
                        Priority        = Priority.Medium,
                        Subject         = "دعوت به خرید",
                        Text            = emailMessage,
                        To = item
                    };

                    list.Add(emailSend);
                }

                EmailSends.InsertGroup(list);
            }
        }
Example #4
0
        public ActionResult Index()
        {
            var content = StaticContents.GetByName("Rules");

            content.Content = HttpUtility.HtmlDecode(content.Content);

            return(View(model: content));
        }
Example #5
0
        public ActionResult Index()
        {
            ContactUsInfo model = new ContactUsInfo();

            var desc = StaticContents.GetByName("ContactUs").Content;

            model.Content = HttpUtility.HtmlDecode(desc);

            return(View(model: model));
        }
        public static void DliverProduct(string firstname, string lastname, string email, string userID)
        {
            var emailMessage = StaticContents.GetContentByName("DliverProduct");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", firstname + " " + lastname);

                SendEmail(SaleMail, email, "تحویل کالا", emailMessage, userID);
            }
        }
        public static void ProductRequest(string email, string userID, string productName, string productLink)
        {
            var emailMessage = StaticContents.GetContentByName("ProductRequest");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{ProductLink}}", String.Format("<a href='{0}' target='_blank'>{1}</a>", productLink, productName));

                SendEmail(SaleMail, email, "درخواست محصول", emailMessage, userID);
            }
        }
        public static void DeliveryColleagueRequest(string email, string name, string userID)
        {
            var emailMessage = StaticContents.GetContentByName("DeliveryColleagueRequest");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", name);

                SendEmail(SaleMail, email, "دریافت اطلاعات همکاری", emailMessage, userID);
            }
        }
        public static void DeliveryEmploymentInfo(string email, string name, string userID)
        {
            var emailMessage = StaticContents.GetContentByName("DeliveryEmploymentInfo");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", name);

                SendEmail(InfoMail, email, "پیام استخدام", emailMessage, userID);
            }
        }
        public StaticContents GetStaticContents(StaticContents staticContents)
        {
            staticContents.StartDate = Convert.ToDateTime("2015-02-17 00:00:00.000");
            staticContents.EndDate = Convert.ToDateTime("2015-03-30 00:00:00.000");

            var predicateGroup = new PredicateGroup { Operator = GroupOperator.And, Predicates = new List<IPredicate>() };
            predicateGroup.Predicates.Add(Predicates.Field<StaticContents>(f => f.Guid, Operator.Eq, staticContents.Guid));
            predicateGroup.Predicates.Add(Predicates.Field<StaticContents>(f => f.IsActive, Operator.Eq, true));
            //predicateGroup.Predicates.Add(Predicates.Field<StaticContents>(f => f.EndDate, Operator.Lt, DateTime.Now.AddDays(1)));
            return SqlHelper.Find<StaticContents>(predicateGroup);
        }
Example #11
0
        public static void DeliveryContactUsMessage(string email, string name, string userID)
        {
            var emailMessage = StaticContents.GetContentByName("DeliveryContactUsMessage");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", name);

                SendEmail(SaleMail, email, "پیام تماس با ما", emailMessage, userID);
            }
        }
Example #12
0
        public static void FinancialConfirmation(string firstname, string lastname, string email, string userID)
        {
            var emailMessage = StaticContents.GetContentByName("FinancialConfirmation");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", firstname + " " + lastname);

                SendEmail(SaleMail, email, "تایید مالی", emailMessage, userID);
            }
        }
Example #13
0
        public static void SuccessfullPayment(string firstname, string lastname, string saleReferenceID, string email, string userID)
        {
            var emailMessage = StaticContents.GetContentByName("SuccessfullPaymentEmail");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", firstname + " " + lastname)
                               .Replace("{{SaleReferenceID}}", saleReferenceID);

                SendEmail(SaleMail, email, "از خرید شما متشکریم", emailMessage, userID);
            }
        }
Example #14
0
        public static void SendProduct(string firstname, string lastname, string email, string userID, string billNumber)
        {
            var emailMessage = StaticContents.GetContentByName("SendProduct");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", firstname + " " + lastname)
                               .Replace("{{BillNumber}}", billNumber);

                SendEmail(SaleMail, email, "ارسال کالا", emailMessage, userID);
            }
        }
Example #15
0
        public static void Register(string firstname, string lastname, string username, string password, string email, string userID)
        {
            var emailMessage = StaticContents.GetContentByName("RegisterEmail");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                emailMessage = emailMessage.Replace("{{Name}}", firstname + " " + lastname)
                               .Replace("{{Username}}", username)
                               .Replace("{{Password}}", password);

                SendEmail(RegisterMail, email, "به آنلاین استور خوش آمدید", emailMessage, userID);
            }
        }
Example #16
0
        public static void ForgotPassword(string firstname, string lastname, string callbackUrl, string email, string userID)
        {
            var emailMessage = StaticContents.GetContentByName("ForgotPassword");

            if (emailMessage != null && emailMessage != "نا مشخص")
            {
                callbackUrl = "<a href=" + callbackUrl + ">لینک بازیابی کلمه عبور</a>";

                emailMessage = emailMessage.Replace("{{Name}}", firstname + " " + lastname)
                               .Replace("{{CallBackUrl}}", callbackUrl);

                SendEmail(InfoMail, email, "بازیابی کلمه عبور", emailMessage, userID);
            }
        }
        public ActionResult Edit(int id)
        {
            StaticContent content;

            content = StaticContents.GetByID(id);

            var staticContent = Mapper.Map <EditStaticContent>(content);

            switch (content.StaticContentType)
            {
            case OnlineStore.Models.Enums.StaticContentType.Text:
                staticContent.SimpleContent = content.Content;
                break;

            case OnlineStore.Models.Enums.StaticContentType.Editor:
                staticContent.EditorContent = HttpUtility.HtmlDecode(content.Content);
                break;
            }

            return(View(model: staticContent));
        }
Example #18
0
        public static void Configure()
        {
            StaticValues.WebsiteTitle  = StaticContents.GetContentByName("CompanyName");
            StaticValues.Email         = StaticContents.GetContentByName("Email");
            StaticValues.Address       = StaticContents.GetContentByName("Address");
            StaticValues.Phone         = StaticContents.GetContentByName("Phone");
            StaticValues.PostalCode    = StaticContents.GetContentByName("PostalCode");
            StaticValues.Tax           = StaticContents.GetContentByName("Tax");
            StaticValues.WebsiteUrl    = StaticContents.GetContentByName("Website");
            StaticValues.Logo          = StaticContents.GetContentByName("Logo");
            StaticValues.Writer        = UserRoles.GetByRoleName("Writer");
            StaticValues.Accountant    = UserRoles.GetByRoleName("Accountant");
            StaticValues.Administrator = UserRoles.GetByRoleName("Administrator");

            #region Emails

            var infoEmail = Emails.GetByID(1);
            EmailServices.InfoMail = Mapper.Map <ViewEmail>(infoEmail);

            var saleEmail = Emails.GetByID(2);
            EmailServices.SaleMail = Mapper.Map <ViewEmail>(saleEmail);

            var registerEmail = Emails.GetByID(3);
            EmailServices.RegisterMail = Mapper.Map <ViewEmail>(registerEmail);

            var newsletterEmail = Emails.GetByID(4);
            EmailServices.NewsletterMail = Mapper.Map <ViewEmail>(newsletterEmail);

            #endregion Emails

            var deliveryPrice = 0;
            int.TryParse(StaticContents.GetContentByName("DeliveryPrice"), out deliveryPrice);
            StaticValues.DeliveryPrice = deliveryPrice;

            StaticValues.GroupOptions = AttributeValues.GetOptionIDsByGroup();
        }
 public bool DeleteStaticContents(StaticContents staticContents)
 {
     var predicateGroup = new PredicateGroup { Operator = GroupOperator.And, Predicates = new List<IPredicate>() };
     predicateGroup.Predicates.Add(Predicates.Field<StaticContents>(f => f.Guid, Operator.Eq, staticContents.Guid));
     return SqlHelper.Delete<StaticContents>(predicateGroup);
 }
 public bool UpdateStaticContents(StaticContents staticContents)
 {
     return SqlHelper.Update(staticContents);
 }
 public bool InsertStaticContents(StaticContents staticContents)
 {
     return SqlHelper.Insert(staticContents);
 }
        public ActionResult Index()
        {
            var content = StaticContents.GetByName("TrackOrder").Content;

            return(View(model: content));
        }