コード例 #1
0
        public int SendOrderUserCantPayToAdmin(Order order)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            var domain = _Context.EntityContext.SettingsAll.Select(x => x.AdminEmail).FirstOrDefault();
            var shop   = LS.Get <Shop>().FirstOrDefault(x => x.ID == order.ShopID);

            if (shop == null)
            {
                shop = new Shop();
            }
            var virtualUser = new User()
            {
                Email     = order.Email,
                FirstName = order.FullName != null ? order.FullName : "",
                ID        = order.UserID,
                Phone     = order.Phone,
                UserName  = order.Email
            };
            var res = Tokenize(templateSystemName, domain, new List <object>()
            {
                order, shop
                , virtualUser
            });

            return(res);
        }
コード例 #2
0
        public int SendNewOrderSMSToMember(Order order, Shop shop)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            if (shop.Phone != null || _isGetTokensOnly)
            {
                if (shop.Phone == null)
                {
                    shop.Phone = "";
                }
                var virtualUser = new User()
                {
                    Email     = order.Email,
                    FirstName = order.FullName != null ? order.FullName : "",
                    ID        = order.UserID,
                    Phone     = order.Phone,
                    UserName  = order.Email
                };
                var res = Tokenize(templateSystemName, (shop.Phone2 ?? shop.Phone).Replace(" ", "").Replace("-", "") + _SMSGateway, new List <object>()
                {
                    order,
                    virtualUser,
                    shop
                });
                return(res);
            }
            return(0);
        }
コード例 #3
0
        public int SendOrderChangedEmailToUser(Order order, List <OrderItem> changed, List <OrderItem> outOfStock)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            var productChangeds = new OrderChangedProductTable(changed);
            var productRemoved  = new OrderRemovedProductTable(outOfStock);
            var shop            = LS.Get <Shop>().FirstOrDefault(x => x.ID == order.ShopID);
            var virtualUser     = new User()
            {
                Email     = order.Email,
                FirstName = order.FullName != null ? order.FullName : "",
                ID        = order.UserID,
                Phone     = order.Phone,
                UserName  = order.Email
            };
            var res = Tokenize(templateSystemName, order.Email, new List <object>()
            {
                order
                , shop
                , virtualUser
                , productChangeds
                , productRemoved
            });

            return(res);
        }
コード例 #4
0
        public int SendNewOrderEmailToMember(Order order, Shop shop)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            var virtualUser = new User()
            {
                Email     = order.Email,
                FirstName = order.FullName != null ? order.FullName : "",
                ID        = order.UserID,
                Phone     = order.Phone,
                UserName  = order.Email
            };
            var products = new OrderProductTable(order.ID);

            var res = Tokenize(templateSystemName, shop.Email, new List <object>()
            {
                order,
                virtualUser,
                shop,
                products
            });

            return(res);
        }
コード例 #5
0
        public int SendOrderPayedEmailToMember(Order order, Shop shop)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            var virtualUser = new User()
            {
                Email     = order.Email,
                FirstName = order.FullName != null ? order.FullName : "",
                ID        = order.UserID,
                Phone     = order.Phone,
                UserName  = order.Email
            };
            var ordernote = _Context.EntityContext.OrderNotes.FirstOrDefault(o => o.OrderID == order.ID);

            var res = Tokenize(templateSystemName, shop.Email, new List <object>()
            {
                order,
                virtualUser,
                shop,
                ordernote
            });

            return(res);
        }
コード例 #6
0
        public int SendQuestionsDeliveredToUser(Order order, Shop shop)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            //http://localhost:23416/poll/index?OrderID=30&ShopID=3
            PollPageModel model  = new PollPageModel();
            var           domain = _Context.EntityContext.SettingsAll.Select(x => x.Domain).FirstOrDefault();

            model.PollUrl = string.Format("{0}://{1}/poll/index?OrderID={2}&ShopID={3}",
                                          "http",
                                          domain,
                                          order.ID.ToString(),
                                          shop.ID.ToString());
            var virtualUser = new User()
            {
                Email     = order.Email,
                FirstName = order.FullName != null ? order.FullName : "",
                ID        = order.UserID,
                Phone     = order.Phone,
                UserName  = order.Email
            };
            var res = Tokenize(templateSystemName, order.Email, new List <object>()
            {
                order,
                virtualUser,
                shop,
                model
            });

            return(res);
        }
コード例 #7
0
        public int OrderQuestionedToMember(Order order, Shop shop, List <PollAnswer> Answers)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            var virtualUser = new User()
            {
                Email     = order.Email,
                FirstName = order.FullName != null ? order.FullName : "",
                ID        = order.UserID,
                Phone     = order.Phone,
                UserName  = order.Email
            };
            var mailparams = new List <object>()
            {
                order,
                virtualUser,
                shop
            };

            mailparams.AddRange(Answers);
            var res = Tokenize(templateSystemName, shop.Email, mailparams);

            return(res);
        }
コード例 #8
0
        public int SendUserPasswordEmailToUser(User user)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            var res = Tokenize(templateSystemName, user.Email, new List <object>()
            {
                user
            });

            return(res);
        }
コード例 #9
0
        public int OrderCanceledSmsToUser(Order order, User user)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            if (user != null && user.Phone != null || _isGetTokensOnly)
            {
                if (user.Phone == null)
                {
                    user.Phone = "";
                }
                var res = Tokenize(templateSystemName, user.Phone.Replace(" ", "").Replace("-", "") + _SMSGateway, new List <object>()
                {
                    order,
                    user
                });
                return(res);
            }
            return(0);
        }
コード例 #10
0
        public int CheckoutSmsConfirmSmsToUser(CheckoutData checkooutData, User user)
        {
            MethodBase            method = MethodBase.GetCurrentMethod();
            MailTemplateAttribute attr   = (MailTemplateAttribute)method.GetCustomAttributes(typeof(MailTemplateAttribute), true)[0];
            string templateSystemName    = attr.TemplateSystemName;

            if (user != null && checkooutData.Phone != null || _isGetTokensOnly)
            {
                if (checkooutData.Phone == null)
                {
                    checkooutData.Phone = "";
                }
                var res = Tokenize(templateSystemName, checkooutData.Phone.Replace(" ", "").Replace("-", "") + _SMSGateway, new List <object>()
                {
                    user,
                    checkooutData
                });
                return(res);
            }
            return(0);
        }