Пример #1
0
        public ActionResult GetProfitsByProductId(int id)
        {
            int memberId = 0;
            EarninisRecordsViewModel model = new EarninisRecordsViewModel();

            if (int.TryParse(SystemSettingsHelper.GetSystemSettingsByKey("show:accountId"), out memberId))
            {
                IContentType           ct     = Services.ContentTypeService.GetContentType("EarningsRecordsElement");
                IEnumerable <IContent> result = Services.ContentService.GetContentOfContentType(ct.Id)
                                                .Where(e => e.GetValue <int>("memberId") == memberId)
                                                .Where(e => e.GetValue <int>("productid") == id);
                if (result != null && result.Count() > 0)
                {
                    var groupkeys = result.OrderByDescending(e => e.CreateDate)
                                    .GroupBy(e => e.CreateDate.ToString("MM/dd"))
                                    .Select(e => new
                    {
                        Key   = e.Key,
                        Value = e.Sum(a => a.GetValue <decimal>("earning"))
                    });

                    foreach (var item in groupkeys.OrderBy(e => Convert.ToDateTime(e.Key)))
                    {
                        model.Times.Add(item.Key);
                        model.Datas.Add(item.Value);
                    }
                }
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        void MemberService_Created(IMemberService sender, Umbraco.Core.Events.NewEventArgs <Umbraco.Core.Models.IMember> e)
        {
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    int tplid;
                    string managerTeplateId               = SystemSettingsHelper.GetSystemSettingsByKey("manager:register:tplid");
                    string rgisterTemplateId              = SystemSettingsHelper.GetSystemSettingsByKey("member:register:tplid:bytefunds");
                    string managerEmail                   = SystemSettingsHelper.GetSystemSettingsByKey("manager:email");
                    Configuration configurationFile       = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
                    MailSettingsSectionGroup mailSettings = (MailSettingsSectionGroup)configurationFile.GetSectionGroup("system.net/mailSettings");
                    if (int.TryParse(managerTeplateId, out tplid))
                    {
                        //用户创建成功给管理员和用户自己发邮件
                        IMedia mediatamplate =
                            ApplicationContext.Current.Services.MediaService.GetById(tplid);
                        string content = mediatamplate.GetValue <string>("bodytext").Replace("{{name}}", e.Entity.Name);
                        library.SendMail(mailSettings.Smtp.Network.UserName, managerEmail, mediatamplate.GetValue <string>("title"), content, true);
                    }
                    if (int.TryParse(rgisterTemplateId, out tplid))
                    {
                        //给用户发邮件
                        IMedia mediatamplate =
                            ApplicationContext.Current.Services.MediaService.GetById(tplid);
                        //string memberbodycontent = Helpers.SendmailHelper.Replace(mediatamplate.GetValue<string>("bodytext"),
                        //    e.Entity.Key, -1);
                        //Helpers.SendmailHelper.SendEmail(membercontent.GetValue<string>("title"), memberbodycontent,
                        //    e.Entity.Email);

                        library.SendMail(mailSettings.Smtp.Network.UserName, e.Entity.Email, mediatamplate.GetValue <string>("title"), mediatamplate.GetValue <string>("bodytext"), true);
                    }
                }
                catch (Exception ex)
                {
                    return;
                }
            });
        }
Пример #3
0
        void ContentService_Created(IContentService sender, Umbraco.Core.Events.NewEventArgs <Umbraco.Core.Models.IContent> e)
        {
            #region 出入金发邮件
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    //给管理员发邮件,用户入金出金操作
                    //File.WriteAllText("d:\\" + Guid.NewGuid().ToString() + ".txt", "contentcreated");
                    if (e.Alias.ToLower().Equals("payrecords") || e.Alias.ToLower().Equals("withdrawelement"))
                    {
                        string tplid        = string.Empty;
                        string title        = string.Empty;
                        string accountbuyId = string.Empty, accountwithdrawId = string.Empty;
                        string managerEmail = SystemSettingsHelper.GetSystemSettingsByKey("manager:email");
                        if (e.Alias.ToLower().Equals("payrecords"))
                        {
                            tplid        = SystemSettingsHelper.GetSystemSettingsByKey("manager:payment:tplid");
                            accountbuyId = SystemSettingsHelper.GetSystemSettingsByKey("account:buy:tplid");

                            int tpl, accounttplid;

                            if (int.TryParse(tplid, out tpl) && int.TryParse(accountbuyId, out accounttplid))
                            {
                                IMedia content       = ApplicationContext.Current.Services.MediaService.GetById(tpl);
                                IMedia accountbuytmp = ApplicationContext.Current.Services.MediaService.GetById(accounttplid);
                                //创建Content的时候Name属性赋值的email
                                IMember member   = ApplicationContext.Current.Services.MemberService.GetById(e.Entity.GetValue <int>("memberPicker"));
                                IContent product = ApplicationContext.Current.Services.ContentService.GetById(e.Entity.GetValue <int>("buyproduct"));
                                if (member == null)
                                {
                                    return;
                                    // throw new CustomException.NotFoundEmailException("邮箱不存在");
                                }
                                Configuration configurationFile       = WebConfigurationManager.OpenWebConfiguration("/");
                                MailSettingsSectionGroup mailSettings = (MailSettingsSectionGroup)configurationFile.GetSectionGroup("system.net/mailSettings");


                                string oldbodycontent = content.GetValue <string>("bodytext")
                                                        .Replace("{{name}}", member.Name)
                                                        .Replace("{{product}}", product.GetValue <string>("title"))
                                                        .Replace("{{orderid}}", e.Entity.GetValue <string>("payBillno"))
                                                        .Replace("{{amount}}", e.Entity.GetValue <double>("amountCny").ToString("N2"));
                                //发送邮件到管理员
                                library.SendMail(mailSettings.Smtp.Network.UserName, managerEmail, content.GetValue <string>("title"), oldbodycontent, true);
                                //发送邮件到用户
                                string accountContent = accountbuytmp.GetValue <string>("bodytext")
                                                        .Replace("{{name}}", member.Name)
                                                        .Replace("{{product}}", product.GetValue <string>("title"))
                                                        .Replace("{{rate}}", product.GetValue <string>("rate"))
                                                        .Replace("{{amount}}", e.Entity.GetValue <double>("amountCny").ToString("N2"));
                                Common.CustomLog.WriteLog(member.Username + "\r\n" + accountbuytmp.GetValue <string>("title"));
                                library.SendMail(mailSettings.Smtp.Network.UserName, member.Username, accountbuytmp.GetValue <string>("title"), accountContent, true);
                            }
                        }
                        else if (e.Alias.ToLower().Equals("withdrawelement"))
                        {
                            IMember member = ApplicationContext.Current.Services.MemberService.GetById(e.Entity.GetValue <int>("memberId"));
                            Dictionary <string, string> managerdir = new Dictionary <string, string>();
                            managerdir.Add("{{name}}", member.Name);
                            managerdir.Add("{{bankOpenName}}", e.Entity.GetValue <string>("memberName"));
                            managerdir.Add("{{amount}}", e.Entity.GetValue <string>("amount"));
                            managerdir.Add("{{bankNumber}}", e.Entity.GetValue <string>("bankNumber"));
                            managerdir.Add("{{bankName}}", e.Entity.GetValue <string>("bankName"));
                            //发送给管理员
                            SendmailHelper.SendEmail(managerEmail, "manager:withdraw:tplid", managerdir);
                            Dictionary <string, string> accountdir = new Dictionary <string, string>();
                            accountdir.Add("{{name}}", member.Name);
                            accountdir.Add("{{amount}}", e.Entity.GetValue <string>("amount"));
                            //发送给用户
                            SendmailHelper.SendEmail(member.Username, "member:withdraw:tplId", accountdir);
                        }
                    }
                    else if (e.Alias.ToLower().Equals("ChipsDepositDocument", StringComparison.OrdinalIgnoreCase))
                    {
                        IMember member = ApplicationContext.Current.Services.MemberService.GetById(e.Entity.GetValue <int>("member"));
                        //DOTO
                    }
                }
                catch (Exception ex)
                {
                    Common.CustomLog.WriteLog(ex.ToString());
                    return;
                }
            });
            #endregion
        }
Пример #4
0
        public ActionResult RenewalFund([Bind(Prefix = "renewalViewModel")] RenewalFundViewModel model)
        {
            ResponseModel response = new ResponseModel();
            IMember       member   = Services.MemberService.GetById(Members.GetCurrentMemberId());

            //旧的交易记录
            IContent oldContent = Services.ContentService.GetById(model.CurrentPayId);
            //旧的产品
            IContent oldProduct = Services.ContentService.GetById(oldContent.GetValue <int>("buyproduct"));

            if (model.RenewalFundId == -1)
            {
                response.Success     = true;
                response.Msg         = "恭喜您已经成功解约,到期将余额返回到您账户余额";
                response.RedirectUrl = "/memberinfo";
                System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    //member:ter:tplid
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("{{name}}", member.Name);
                    dic.Add("{{product}}", oldProduct.GetValue <string>("title"));
                    dic.Add("{{start}}", oldContent.GetValue <DateTime>("rechargeDateTime").ToString("yyyy-MM-dd HH:mm:ss"));
                    dic.Add("{{end}}", oldContent.GetValue <DateTime>("expirationtime").ToString("yyyy-MM-dd HH:mm:ss"));
                    Helpers.SendmailHelper.SendEmail(member.Username, "member:ter:tplid", dic);
                    dic.Add("{{option}}", "到期解约");
                    string manageremail = SystemSettingsHelper.GetSystemSettingsByKey("manager:email");
                    Helpers.SendmailHelper.SendEmail(manageremail, "manager:ter:tplid", dic);
                });
            }
            else
            {
                //续约的产品
                IContent product = Services.ContentService.GetById(model.RenewalFundId);
                //新的交易记录
                DateTime     start   = oldContent.GetValue <DateTime>("expirationtime").AddDays(1);
                DateTime     end     = start.AddMonths(product.GetValue <int>("cycle"));
                IContentType ct      = ApplicationContext.Services.ContentTypeService.GetContentType("PayRecords");
                IContent     content = ApplicationContext.Services.ContentService.CreateContent("无用户名", ct.Id, "PayRecords");

                content.SetValue("username", member.Name);
                content.Name = member.Email;
                content.SetValue("email", member.Email);
                content.SetValue("memberPicker", member.Id);
                content.SetValue("buyproduct", product.Id);
                content.SetValue("mobilePhone", member.GetValue <string>("tel"));
                content.SetValue("memberPicker", member.Id.ToString());
                content.SetValue("amountCny", oldContent.GetValue <string>("amountCny"));
                content.SetValue("rechargeDateTime", start.ToString("yyyy-MM-dd HH:mm:ss"));
                content.SetValue("expirationtime", end.ToString("yyyy-MM-dd HH:mm:ss"));
                content.SetValue("payBillno", "续约订单:" + oldContent.GetValue <string>("payBillno"));
                content.SetValue("isdeposit", true);
                content.SetValue("isexpired", false);
                Services.ContentService.Save(content);

                response.Success     = true;
                response.Msg         = "恭喜你已经完成自动续约!请查收邮件";
                response.IsRedirect  = true;
                response.RedirectUrl = "/memberinfo";
                //发送邮件
                System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    //member:renewal:tplid
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("{{name}}", member.Name);
                    dic.Add("{{oldproduct}}", oldProduct.GetValue <string>("title"));
                    dic.Add("{{newproduct}}", product.GetValue <string>("title"));
                    dic.Add("{{start}}", start.ToString("yyyy-MM-dd HH:mm:ss"));
                    dic.Add("{{end}}", end.ToString("yyyy-MM-dd HH:mm:ss"));
                    Helpers.SendmailHelper.SendEmail(member.Username, "member:renewal:tplid", dic);
                    dic.Add("{{option}}", "自动续约");
                    string manageremail = SystemSettingsHelper.GetSystemSettingsByKey("manager:email");
                    Helpers.SendmailHelper.SendEmail(manageremail, "manager:renewal:tplid", dic);
                });
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }