Exemplo n.º 1
0
 public string GetSchemeBonusScalec(int lotteryId)
 {
     DataTable table = new Tables.T_Sites().Open("Opt_InitiateSchemeBonusScale,Opt_InitiateSchemeLimitLowerScaleMoney,Opt_InitiateSchemeLimitLowerScale,Opt_InitiateSchemeLimitUpperScaleMoney,Opt_InitiateSchemeLimitUpperScale", "", "");
     string str = (_Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeBonusScale"].ToString(), 0.0) * 100.0).ToString();
     string str2 = _Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeLimitLowerScaleMoney"].ToString(), 100.0).ToString();
     string str3 = _Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeLimitLowerScale"].ToString(), 0.2).ToString();
     string str4 = _Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeLimitUpperScaleMoney"].ToString(), 10000.0).ToString();
     string str5 = _Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeLimitUpperScale"].ToString(), 0.05).ToString();
     string str6 = DataCache.Lotteries[lotteryId];
     int num6 = 0;
     return (str + "|" + str2 + "|" + str3 + "|" + str4 + "|" + str5 + "|" + lotteryId.ToString() + "|" + str6 + "|" + num6.ToString());
 }
 public string this[string Manner, string NotificationType]
 {
     get
     {
         if ((this.Site == null) || (this.Site.ID < 1L))
         {
             throw new Exception("没有初始化 SiteNotificationTemplates 类的 Site 变量");
         }
         if (((Manner != "SMS") && (Manner != "Email")) && (Manner != "StationSMS"))
         {
             throw new Exception("SiteNotificationTemplates 类的通知方式 Manner 变量的值超出的范围,它的范围是:1 (SMS)手机短信 2 Email 3 (StationSMS)站内信");
         }
         string str = "SiteOptions_";
         DataTable table = null;
         bool flag = true;
         try
         {
             table = (DataTable)HttpContext.Current.Application[str + this.Site.ID.ToString()];
         }
         catch
         {
         }
         if ((table == null) || (table.Rows.Count < 1))
         {
             flag = false;
             table = new Tables.T_Sites().Open("", "[ID] = " + this.Site.ID.ToString(), "");
         }
         if (table == null)
         {
             throw new Exception("SiteNotificationTemplates 类读取数据错误,请检查数据库连接设置");
         }
         if (table.Rows.Count < 1)
         {
             throw new Exception("SiteNotificationTemplates 类的 Site 变量值不在有效范围之内");
         }
         if (!flag)
         {
             try
             {
                 HttpContext.Current.Application.Lock();
                 HttpContext.Current.Application.Add(str + this.Site.ID.ToString(), table);
             }
             catch
             {
             }
             finally
             {
                 try
                 {
                     HttpContext.Current.Application.UnLock();
                 }
                 catch
                 {
                 }
             }
         }
         return table.Rows[0]["Template" + Manner + "_" + NotificationType].ToString().Replace("[SiteName]", this.Site.Name).Replace("[SiteUrl]", this.Site.Url);
     }
     set
     {
         if ((this.Site == null) || (this.Site.ID < 1L))
         {
             throw new Exception("没有初始化 SiteNotificationTemplates 类的 Site 变量");
         }
         if ((!(Manner == "SMS") && !(Manner == "Email")) && !(Manner == "StationSMS"))
         {
             throw new Exception("SiteNotificationTemplates 类的通知方式 Manner 变量的值超出的范围,它的范围是:1 (SMS)手机短信 2 Email 3 (StationSMS)站内信");
         }
         if (MSSQL.ExecuteNonQuery("update T_Sites set [Template" + Manner + "_" + NotificationType + "] = @Value where [ID]=@ID", new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.VarChar, 0, ParameterDirection.Input, value), new MSSQL.Parameter("ID", SqlDbType.BigInt, 0, ParameterDirection.Input, this.Site.ID) }) < 0)
         {
             throw new Exception("SiteNotificationTemplates 类读取数据错误,请检查数据库连接设置。如果数据库连接设置没有问题,可能是 NotificationType 变量的值不在有效范围之内");
         }
         string str2 = "SiteOptions_";
         try
         {
             HttpContext.Current.Application.Lock();
             HttpContext.Current.Application.Remove(str2 + this.Site.ID.ToString());
         }
         catch
         {
         }
         finally
         {
             try
             {
                 HttpContext.Current.Application.UnLock();
             }
             catch
             {
             }
         }
     }
 }
Exemplo n.º 3
0
 public string GetSchemeBonusScalec()
 {
     DataTable table = new Tables.T_Sites().Open("Opt_InitiateSchemeBonusScale,Opt_InitiateSchemeLimitLowerScaleMoney,Opt_InitiateSchemeLimitLowerScale,Opt_InitiateSchemeLimitUpperScaleMoney,Opt_InitiateSchemeLimitUpperScale", "", "");
     string str = (_Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeBonusScale"].ToString(), 0.0) * 100.0).ToString();
     string str2 = _Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeLimitLowerScaleMoney"].ToString(), 100.0).ToString();
     string str3 = _Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeLimitLowerScale"].ToString(), 0.2).ToString();
     string str4 = _Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeLimitUpperScaleMoney"].ToString(), 10000.0).ToString();
     string str5 = _Convert.StrToDouble(table.Rows[0]["Opt_InitiateSchemeLimitUpperScale"].ToString(), 0.05).ToString();
     return (str + "|" + str2 + "|" + str3 + "|" + str4 + "|" + str5 + "|时时乐");
 }
Exemplo n.º 4
0
        public OptionValue this[string Key]
        {
            get
            {
                string str = "SiteOptions_";
                DataTable table = null;
                bool flag = true;
                try
                {
                    table = (DataTable)HttpContext.Current.Application[str + this.Site.ID.ToString()];
                }
                catch
                {
                }
                if ((table == null) || (table.Rows.Count < 1))
                {
                    flag = false;
                    table = new Tables.T_Sites().Open("", "[ID] = " + this.Site.ID.ToString(), "");
                }
                if (table == null)
                {
                    throw new Exception("T_Sites 表读取发生错误,请检查数据连接或者数据库是否完整");
                }
                if (table.Rows.Count < 1)
                {
                    throw new Exception("没有读到站点 ID 为 " + this.Site.ID.ToString() + " 的站点信息");
                }
                if (!flag)
                {
                    try
                    {
                        HttpContext.Current.Application.Lock();
                        HttpContext.Current.Application.Add(str + this.Site.ID.ToString(), table);
                    }
                    catch
                    {
                    }
                    finally
                    {
                        try
                        {
                            HttpContext.Current.Application.UnLock();
                        }
                        catch
                        {
                        }
                    }
                }
                return new OptionValue(table.Rows[0][Key]);
            }
            set
            {
                if ((this.Site == null) || (this.Site.ID < 1L))
                {
                    throw new Exception("没有初始化 SiteOptions 类的 Site 变量");
                }
                DataTable table = new Tables.T_Sites().Open(Key, "[ID] = " + this.Site.ID.ToString(), "");
                if (table == null)
                {
                    throw new Exception("T_Sites 表读取发生错误,请检查数据连接或者是否该表拥有 " + Key + " 字段");
                }
                if (table.Rows.Count < 1)
                {
                    throw new Exception("没有读到站点 ID 为 " + this.Site.ID.ToString() + " 的站点信息");
                }
                switch (table.Columns[0].DataType.Name)
                {
                    case "Byte[]":
                        if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + this.Site.ID.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.VarChar, 0, ParameterDirection.Input, value.Value.ToString()) }) < 0)
                        {
                            throw new Exception("设置站点属性 " + Key + " 发生异常");
                        }
                        break;

                    case "String":
                        if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + this.Site.ID.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.VarChar, 0, ParameterDirection.Input, value.Value) }) < 0)
                        {
                            throw new Exception("设置站点属性 " + Key + " 发生异常");
                        }
                        break;

                    case "Int16":
                        if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + this.Site.ID.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.SmallInt, 0, ParameterDirection.Input, value.Value) }) < 0)
                        {
                            throw new Exception("设置站点属性 " + Key + " 发生异常");
                        }
                        break;

                    case "Int32":
                        if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + this.Site.ID.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.Int, 0, ParameterDirection.Input, value.Value) }) < 0)
                        {
                            throw new Exception("设置站点属性 " + Key + " 发生异常");
                        }
                        break;

                    case "Int64":
                        if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + this.Site.ID.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.BigInt, 0, ParameterDirection.Input, value.Value) }) < 0)
                        {
                            throw new Exception("设置站点属性 " + Key + " 发生异常");
                        }
                        break;

                    case "Decimal":
                        if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + this.Site.ID.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.Money, 0, ParameterDirection.Input, value.Value) }) < 0)
                        {
                            throw new Exception("设置站点属性 " + Key + " 发生异常");
                        }
                        break;

                    case "Boolean":
                        if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + this.Site.ID.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.Bit, 0, ParameterDirection.Input, value.Value) }) < 0)
                        {
                            throw new Exception("设置站点属性 " + Key + " 发生异常");
                        }
                        break;

                    case "Double":
                        if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + this.Site.ID.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("Value", SqlDbType.Float, 0, ParameterDirection.Input, value.Value) }) < 0)
                        {
                            throw new Exception("设置站点属性 " + Key + " 发生异常");
                        }
                        break;

                    default:
                        throw new Exception("设置站点属性 " + Key + " 发生异常");
                }
                string str2 = "SiteOptions_";
                try
                {
                    HttpContext.Current.Application.Lock();
                    HttpContext.Current.Application.Remove(str2 + this.Site.ID.ToString());
                }
                catch
                {
                }
                finally
                {
                    try
                    {
                        HttpContext.Current.Application.UnLock();
                    }
                    catch
                    {
                    }
                }
            }
        }