Exemple #1
0
    public static int SendEmail(Sites Site, string MailTo, string Subject, string Body)
    {
        SendEmailTask sendemailtask = new SendEmailTask(Site, MailTo, Subject, Body);
        sendemailtask.Run();

        return 0;
    }
Exemple #2
0
 public SiteOptions()
 {
     Site = null;
     _connStr = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
     if (string.IsNullOrEmpty(_connStr))
         _connStr = PF.ConnectString;
 }
Exemple #3
0
    public static int SendSMS(Sites Site, long UserID, string Mobile, string Content)  // UserID 付费用户, < 0 则系统付费
    {
        if ((Site == null) || (Site.ID < 0))
        {
            return -1;
        }

        SLS.Dal.Tables.T_SMS sms = new SLS.Dal.Tables.T_SMS();

        sms.SiteID.Value = Site.ID;
        sms.SMSID.Value = -1;
        sms.From.Value = "";
        sms.To.Value = Mobile;
        sms.Content.Value = Content;
        sms.IsSent.Value = false;

        sms.Insert(ConnectString);

        return 0;

        //SendSMSTask sendsmstask = new SendSMSTask(Site, UserID, Mobile, Content);
        //sendsmstask.Run();

        //return 0;
    }
Exemple #4
0
        public SendEmailTask(Sites site, string mailto, string subject, string body)
        {
            Site = site;

            MailTo = mailto;
            Subject = subject;
            Body = body;
        }
Exemple #5
0
    public static int SendStationSMS(Sites Site, long SourceUserID, long AimUserID, short StationSMSType, string Content)  // UserID 付费用户, < 0 则系统付费
    {
        SLS.Dal.Tables.T_StationSMS T_StationSMS = new SLS.Dal.Tables.T_StationSMS();

        T_StationSMS.SiteID.Value = Site.ID;
        T_StationSMS.SourceID.Value = SourceUserID;
        T_StationSMS.AimID.Value = AimUserID;
        T_StationSMS.Type.Value = StationSMSType;
        T_StationSMS.Content.Value = Content;
        T_StationSMS.isRead.Value = false;
        T_StationSMS.Insert(ConnectString);

        return 0;
    }
Exemple #6
0
        public Sites this[long siteid]
        {
            get
            {
                Sites site = new Sites();

                site.ID = siteid;

                string ReturnDescription = "";

                if (site.GetSiteInformationByID(ref ReturnDescription) < 0)
                {
                    return null;
                }

                return site;
            }
        }
Exemple #7
0
 public SiteOptions(Sites site)
 {
     Site = site;
 }
 public SiteNotificationTemplates(Sites site)
 {
     Site = site;
     _connStr = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
 }
Exemple #9
0
    // 中奖的记录,发送通知
    public static void SendWinNotification(DataSet ds,string connStr)
    {
        if (ds == null)
        {
            return;
        }

        for (int i = 0; i < ds.Tables.Count; i++)
        {
            DataTable dt = ds.Tables[i];

            if (dt.Rows.Count < 1)
            {
                continue;
            }

            long SiteID = long.Parse(dt.Rows[0]["SiteID"].ToString());

            bool isWinSendEmail = (SLS.Dal.Functions.F_GetSiteSendNotificationTypes(connStr,SiteID, NotificationManners.Email).IndexOf("[" + NotificationTypes.Win + "]") >= 0);
            bool isWinSendSMS = (SLS.Dal.Functions.F_GetSiteSendNotificationTypes(connStr,SiteID, NotificationManners.SMS).IndexOf("[" + NotificationTypes.Win + "]") >= 0);
            bool isWinSendStationSMS = (SLS.Dal.Functions.F_GetSiteSendNotificationTypes(connStr,SiteID, NotificationManners.StationSMS).IndexOf("[" + NotificationTypes.Win + "]") >= 0);

            if (!isWinSendEmail && !isWinSendSMS && !isWinSendStationSMS)
            {
                continue;
            }

            Sites ts = new Sites()[SiteID];

            if (ts == null)
            {
                continue;
            }

            string Old_EmailSubject = "", Old_EmailBody = "";

            if (isWinSendEmail)
            {
                ts.SiteNotificationTemplates.SplitEmailTemplate(ts.SiteNotificationTemplates[NotificationManners.Email, NotificationTypes.Win], ref Old_EmailSubject, ref Old_EmailBody);
            }

            string Old_SMSBody = "";

            if (isWinSendSMS)
            {
                Old_SMSBody = ts.SiteNotificationTemplates[NotificationManners.SMS, NotificationTypes.Win];
            }

            string Old_StationSMSBody = "";

            if (isWinSendStationSMS)
            {
                Old_StationSMSBody = ts.SiteNotificationTemplates[NotificationManners.StationSMS, NotificationTypes.Win];
            }

            if (((Old_EmailSubject == "") || (Old_EmailBody == "")) && (Old_SMSBody == "") && (Old_StationSMSBody == ""))
            {
                continue;
            }

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                DataRow dr = dt.Rows[j];

                Users tu = new Users(ts.ID)[ts.ID, long.Parse(dr["UserID"].ToString())];

                if (tu == null)
                {
                    continue;
                }

                //Send Email
                if (isWinSendEmail && (Old_EmailSubject != "") && (Old_EmailBody != "") && (tu.Email != "") && (SLS.Dal.Functions.F_GetIsSendNotification(connStr,ts.ID, NotificationManners.Email, NotificationTypes.Win, tu.ID)))
                {
                    string EmailSubject = Old_EmailSubject.Replace("[UserName]", tu.Name);
                    string EmailBody = Old_EmailBody.Replace("[UserName]", tu.Name).
                                                    Replace("[SchemeID]", dr["SchemeID"].ToString()).
                                                    Replace("[Money]", double.Parse(dr["WinMoney"].ToString()).ToString("N"));

                    PF.SendEmail(ts, tu.Email, EmailSubject, EmailBody);
                }

                //Send SMS
                if (isWinSendSMS && (Old_StationSMSBody != "") && (tu.Mobile != "") && tu.isMobileValided && (SLS.Dal.Functions.F_GetIsSendNotification(connStr,ts.ID, NotificationManners.SMS, NotificationTypes.Win, tu.ID)))
                {
                    string Body = Old_StationSMSBody.Replace("[UserName]", tu.Name).
                                                Replace("[SchemeID]", dr["SchemeID"].ToString()).
                                                Replace("[Money]", double.Parse(dr["WinMoney"].ToString()).ToString("N"));

                    PF.SendSMS(ts, tu.ID, tu.Mobile, Body);
                }

                //Send StationSMS
                if (isWinSendStationSMS && (Old_StationSMSBody != "") && SLS.Dal.Functions.F_GetIsSendNotification(connStr,ts.ID, NotificationManners.StationSMS, NotificationTypes.Win, tu.ID))
                {
                    string Body = Old_StationSMSBody.Replace("[UserName]", tu.Name).
                        Replace("[SchemeID]", dr["SchemeID"].ToString()).
                        Replace("[Money]", double.Parse(dr["WinMoney"].ToString()).ToString("N"));

                    PF.SendStationSMS(ts, ts.AdministratorID, tu.ID, StationSMSTypes.SystemMessage, Body);
                }
            }
        }
    }
Exemple #10
0
 // 检验彩种是否有效
 public static bool ValidLotteryID(Sites Site, int LotteryID)
 {
     return (("," + Site.UseLotteryList + ",").IndexOf("," + LotteryID.ToString() + ",") >= 0);
 }
Exemple #11
0
        public Sites this[string url]
        {
            get
            {
                string SystemPreFix = "Site_";
                Sites site = null;

                try
                {
                    site = (Sites)System.Web.HttpContext.Current.Application[SystemPreFix + url];
                }
                catch { }

                if (site != null)
                {
                    return site;
                }

                site = new Sites();

                site.Url = url;
                string ReturnDescription = "";

                if (site.GetSiteInformationByUrl(ref ReturnDescription) < 0)
                {
                    return null;
                }

                try
                {
                    System.Web.HttpContext.Current.Application.Lock();
                    System.Web.HttpContext.Current.Application.Add(SystemPreFix + url, site);
                }
                catch { }
                finally
                {
                    try
                    {
                        System.Web.HttpContext.Current.Application.UnLock();
                    }
                    catch { }
                }

                return site;
            }
        }
Exemple #12
0
        public void Clone(Sites site)
        {
            site.ID = ID;
            site.ParentID = ParentID;
            site.OwnerUserID = OwnerUserID;
            site.Name = Name;
            site.LogoUrl = LogoUrl;
            site.Company = Company;
            site.Address = Address;
            site.PostCode = PostCode;
            site.ResponsiblePerson = ResponsiblePerson;
            site.ContactPerson = ContactPerson;
            site.Telephone = Telephone;
            site.Fax = Fax;
            site.Mobile = Mobile;
            site.Email = Email;
            site.QQ = QQ;
            site.ServiceTelephone = ServiceTelephone;
            site.ICPCert = ICPCert;
            site.Level = Level;
            site.ON = ON;
            site.BonusScale = BonusScale;
            site.MaxSubSites = MaxSubSites;
            site.UseLotteryListRestrictions = UseLotteryListRestrictions;
            site.UseLotteryList = UseLotteryList;
            site.UseLotteryListQuickBuy = UseLotteryListQuickBuy;
            site.AdministratorID = AdministratorID;

            site._urls = _urls;
            site.Url = Url;

            site.SiteNotificationTemplates = SiteNotificationTemplates;
            site.SiteOptions = SiteOptions;

            site.PageTitle = PageTitle;
            site.PageKeywords = PageKeywords;
        }
Exemple #13
0
        public int GetSiteInformationByUrl(ref string ReturnDescription)
        {
            if ((Url == null) || (Url == ""))
            {
                throw new Exception("Sites 尚未初始化 Url 变量,无法获取信息");
            }

            int ReturnValue = -1;
            ReturnDescription = "";

            Sites ts = new Sites();
            Clone(ts);

            int Result = SLS.Dal.Procedures.P_GetSiteInformationByUrl(_connStr,Url, ref ID, ref ParentID, ref OwnerUserID, ref Name, ref LogoUrl, ref Company, ref Address, ref PostCode,
                ref ResponsiblePerson, ref ContactPerson, ref Telephone, ref Fax, ref Mobile, ref Email, ref QQ, ref ServiceTelephone, ref ICPCert, ref Level, ref ON,
                ref BonusScale, ref MaxSubSites, ref UseLotteryListRestrictions, ref UseLotteryList, ref UseLotteryListQuickBuy, ref _urls, ref AdministratorID, ref PageTitle, ref PageKeywords,
                ref ReturnValue, ref ReturnDescription);

            if (Result < 0)
            {
                ts.Clone(this);

                ReturnDescription = "数据库读写错误";

                return -1;
            }

            if (ReturnValue < 0)
            {
                ts.Clone(this);

                return ReturnValue;
            }

            Urls = _urls;

            return 0;
        }