コード例 #1
0
 public void Mod()
 {
     if (CheckAjax())
     {
         if (CheckRight())
         {
             if (IsPost)
             {
                 M.Sms attr = new M.Sms()
                 {
                     Id      = Request["Id"],
                     Account = Request["Account"],
                     Token   = Request["Token"],
                     AppId   = Request["AppId"],
                     Enabled = Types.GetBooleanFromString(Request["Enabled"])
                 };
                 SetResult(attr.UpdateEnable(DataSource), () =>
                 {
                     WritePostLog("MOD");
                 });
             }
             else
             {
                 NotFound();
             }
         }
     }
 }
コード例 #2
0
        public void SendImpl(string name, long mobile, string body, params string[] args)
        {
            SmsProvider provider = SmsProvider.Create(name);

            M.Sms sms = M.Sms.GetById(DataSource, provider.Key);
            if (!sms.Enabled)
            {
                throw new Exception();
            }
            provider.Account = sms.Account;
            provider.Token   = sms.Token;
            provider.AppId   = sms.AppId;
            provider.Log     = new SmsSqlLog(DataSource);
            provider.Send(mobile, body, args);
        }
コード例 #3
0
        private static void SendTemplateImpl(string name, long mobile, string temp, DataSource ds, params string[] args)
        {
            SmsProvider provider = SmsProvider.Create(name);

            M.Sms sms = M.Sms.GetById(ds, provider.Key);
            if (!sms.Enabled)
            {
                throw new Exception();
            }
            provider.Account = sms.Account;
            provider.Token   = sms.Token;
            provider.AppId   = sms.AppId;
            provider.Log     = new Cnaws.Sms.SmsSqlLog(ds);
            provider.SendTemplate(mobile, temp, args);
        }
コード例 #4
0
        public static Sms GetById(DataSource ds, string id)
        {
            if (id == null)
            {
                return(null);
            }
            id = id.ToLower();
            string[] key    = GetCacheName(id);
            Sms      result = CacheProvider.Current.Get <Sms>(key);

            if (result == null)
            {
                result = ExecuteSingleRow <Sms>(ds, P("Id", id));
                CacheProvider.Current.Set(key, result);
            }
            return(result);
        }