private void MenuByStatus() { Users users1 = base._User; DataTable table = new Tables.T_Sites().Open("Opt_Promotion_Status_ON", "", ""); if ((table != null) && (table.Rows.Count > 0)) { bool.Parse(table.Rows[0]["Opt_Promotion_Status_ON"].ToString()); } }
private void BindData() { DataTable dt = new DAL.Tables.T_Sites().Open("[ID], [Name]", "", "[Level], [ID]"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_UserAddMoney"); return; } Shove.ControlExt.FillDropDownList(ddlSites, dt, "Name", "ID"); }
public string GetSchemeBonusScalec(int lotteryId) { string bScalec; //获得站点选项中的佣金比率 DataTable dt = new DAL.Tables.T_Sites().Open("Opt_InitiateSchemeBonusScale,Opt_InitiateSchemeLimitLowerScaleMoney,Opt_InitiateSchemeLimitLowerScale,Opt_InitiateSchemeLimitUpperScaleMoney,Opt_InitiateSchemeLimitUpperScale", "", ""); //把佣金比率换成整数 bScalec = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeBonusScale"].ToString(), 0) * 100).ToString(); //发起方案条件 string Opt_InitiateSchemeLimitLowerScaleMoney = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeLimitLowerScaleMoney"].ToString(), 100)).ToString(); string Opt_InitiateSchemeLimitLowerScale = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeLimitLowerScale"].ToString(), 0.2)).ToString(); string Opt_InitiateSchemeLimitUpperScaleMoney = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeLimitUpperScaleMoney"].ToString(), 10000)).ToString(); string Opt_InitiateSchemeLimitUpperScale = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeLimitUpperScale"].ToString(), 0.05)).ToString(); string lotteryName = DataCache.Lotteries[lotteryId]; return bScalec + "|" + Opt_InitiateSchemeLimitLowerScaleMoney + "|" + Opt_InitiateSchemeLimitLowerScale + "|" + Opt_InitiateSchemeLimitUpperScaleMoney + "|" + Opt_InitiateSchemeLimitUpperScale + "|" + lotteryId.ToString() + "|" + lotteryName; }
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 { } } } }
protected void btnReg_Click(object sender, EventArgs e) { string str = ""; if (!PF.CheckUserName(this.tbUserName.Text)) { str = str + "对不起用户名中含有禁止使用的字符.\r\n"; } if ((_String.GetLength(this.tbUserName.Text) < 5) || (_String.GetLength(this.tbUserName.Text) > 0x10)) { str = str + "用户名长度在 5-16 个英文字符或数字、中文 3-8 之间.\r\n"; } if ((this.tbPassword.Text.Length < 6) || (this.tbPassword.Text.Length > 0x10)) { str = str + "密码长度必须在 6-16 位之间.\r\n"; } if (this.tbSiteName.Text.Trim().Length == 0) { str = str + "网站名称不能为空.\r\n"; } if (this.tbSiteURL.Text.Trim().Length == 0) { str = str + "网站地址不能为空.\r\n"; } if (!_String.Valid.isEmail(this.tbEmail.Text)) { str = str + "电子邮件地址格式不正确.\r\n"; } if (!this.ckbAgree.Checked) { str = str + "必须同意本站会员注册协议才能注册会员。\r\n"; } if (this.CheckCode2.Visible) { if (this.tbCheckCode.Text.Trim() == "") { str = str + "请输入验证码!\n"; } else if (!this.ShoveCheckCode1.Valid(this.tbCheckCode.Text.Trim())) { str = str + "验证码输入有误!\n"; } } if (str != "") { this.lblInputError.Visible = true; this.lblInputError.Text = "输入资料错误:\r\n" + str; } else { long num = -1L; long num2 = -1L; if (this.Session[this.KeyPromotionUserID] != null) { num2 = _Convert.StrToLong(this.Session[this.KeyPromotionUserID].ToString(), -1L); } object obj2 = MSSQL.ExecuteScalar("select ID from T_Cps where OwnerUserID=" + num2, new MSSQL.Parameter[0]); if (obj2 != null) { num = _Convert.StrToLong(obj2.ToString(), -1L); } Thread.Sleep(500); string str2 = this.tbUserName.Text.Trim(); string str3 = this.tbPassword.Text.Trim(); string str4 = this.tbEmail.Text.Trim(); string str5 = this.tbTel.Text.Trim(); string str6 = this.tbQQ.Text.Trim(); Users users = new Users(base._Site.ID) { Name = str2, Password = str3, Email = str4, Mobile = str5, QQ = str6, UserType = 2 }; if (num > 0L) { users.CommenderID = -1L; users.CpsID = num; } else { users.CommenderID = num2; users.CpsID = -1L; } string returnDescription = ""; if (users.Add(ref returnDescription) < 0) { JavaScript.Alert(this, returnDescription); } else { double num4 = 0.0; DataTable table = new Tables.T_Sites().Open("Opt_CpsBonusScale", "", ""); if ((table != null) && (table.Rows.Count > 0)) { num4 = double.Parse(table.Rows[0]["Opt_CpsBonusScale"].ToString()); } users.cps.SiteID = 1L; users.cps.CommendID = num2; users.cps.Name = this.tbSiteName.Text; users.cps.Url = this.tbSiteURL.Text; users.cps.BonusScale = num4; users.cps.ON = true; users.cps.Telephone = this.tbTel.Text.Trim(); users.cps.Email = str4; users.cps.QQ = str6; users.cps.Type = 2; users.cps.DomainName = users.GetPromotionURL(0); if (users.cps.Add(ref returnDescription) < 0) { JavaScript.Alert(this, returnDescription); } else if (users.Login(ref returnDescription) < 0) { JavaScript.Alert(this, returnDescription); } else { base.Response.Redirect("../../Default.aspx"); } } } }
private void GetSchemeBonusScalec() { string bScalec; //获得站点选项中的佣金比率 DataTable dt = new DAL.Tables.T_Sites().Open("Opt_InitiateSchemeBonusScale,Opt_InitiateSchemeLimitLowerScaleMoney,Opt_InitiateSchemeLimitLowerScale,Opt_InitiateSchemeLimitUpperScaleMoney,Opt_InitiateSchemeLimitUpperScale", "", ""); //把佣金比率换成整数 bScalec = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeBonusScale"].ToString(), 0) * 100).ToString(); //发起方案条件 string Opt_InitiateSchemeLimitLowerScaleMoney = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeLimitLowerScaleMoney"].ToString(), 100)).ToString(); string Opt_InitiateSchemeLimitLowerScale = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeLimitLowerScale"].ToString(), 0.2)).ToString(); string Opt_InitiateSchemeLimitUpperScaleMoney = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeLimitUpperScaleMoney"].ToString(), 10000)).ToString(); string Opt_InitiateSchemeLimitUpperScale = (Shove._Convert.StrToDouble(dt.Rows[0]["Opt_InitiateSchemeLimitUpperScale"].ToString(), 0.05)).ToString(); SchemeSchemeBonusScalec.Value = "{'bScalec': '" + bScalec + "','LScaleMoney': '" + Opt_InitiateSchemeLimitLowerScaleMoney + "','LScale': '" + Opt_InitiateSchemeLimitLowerScale + "' ,'UScaleMoney': '" + Opt_InitiateSchemeLimitUpperScaleMoney + "', 'UpperScale': '" + Opt_InitiateSchemeLimitUpperScale + "'}"; }
private void MenuByStatus() { bool isLogin = _User == null ? false : true; bool isAllowPromotion = false; DataTable dt = new DAL.Tables.T_Sites().Open("Opt_Promotion_Status_ON", "", ""); if (dt != null && dt.Rows.Count > 0) { isAllowPromotion = bool.Parse(dt.Rows[0]["Opt_Promotion_Status_ON"].ToString()); } }
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 + "|时时彩"); }
public OptionValue this[string Key] { get { //if (Site == null) //{ // throw new Exception("没有初始化 SiteOptions 类的 Site 变量"); //} string SystemPreFix = "SiteOptions_"; DataTable dt = null; bool InApplication = true; try { dt = (DataTable)System.Web.HttpContext.Current.Application[SystemPreFix + this.Site.ID.ToString()]; } catch { } if ((dt == null) || (dt.Rows.Count < 1)) { InApplication = false; dt = new DAL.Tables.T_Sites().Open("", "[ID] = " + Site.ID.ToString(), ""); } if (dt == null) { throw new Exception("T_Sites 表读取发生错误,请检查数据连接或者数据库是否完整"); } if (dt.Rows.Count < 1) { throw new Exception("没有读到站点 ID 为 " + Site.ID.ToString() + " 的站点信息"); } if (!InApplication) { try { System.Web.HttpContext.Current.Application.Lock(); System.Web.HttpContext.Current.Application.Add(SystemPreFix + this.Site.ID.ToString(), dt); } catch { } finally { try { System.Web.HttpContext.Current.Application.UnLock(); } catch { } } } return new OptionValue(dt.Rows[0][Key]); } set { if ((Site == null) || (Site.ID < 1)) { throw new Exception("没有初始化 SiteOptions 类的 Site 变量"); } DataTable dt = new DAL.Tables.T_Sites().Open(Key, "[ID] = " + Site.ID.ToString(), ""); if (dt == null) { throw new Exception("T_Sites 表读取发生错误,请检查数据连接或者是否该表拥有 " + Key + " 字段"); } if (dt.Rows.Count < 1) { throw new Exception("没有读到站点 ID 为 " + Site.ID.ToString() + " 的站点信息"); } switch (dt.Columns[0].DataType.Name) { case "Byte[]": if (MSSQL.ExecuteNonQuery("update T_Sites set " + Key + " = @Value where [ID] = " + Site.ID.ToString(), 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] = " + Site.ID.ToString(), 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] = " + Site.ID.ToString(), 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] = " + Site.ID.ToString(), 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] = " + Site.ID.ToString(), 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] = " + Site.ID.ToString(), 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] = " + Site.ID.ToString(), 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] = " + Site.ID.ToString(), new MSSQL.Parameter("Value", SqlDbType.Float, 0, ParameterDirection.Input, value.Value)) < 0) { throw new Exception("设置站点属性 " + Key + " 发生异常"); } break; default: throw new Exception("设置站点属性 " + Key + " 发生异常"); } string SystemPreFix = "SiteOptions_"; try { System.Web.HttpContext.Current.Application.Lock(); System.Web.HttpContext.Current.Application.Remove(SystemPreFix + this.Site.ID.ToString()); } catch { } finally { try { System.Web.HttpContext.Current.Application.UnLock(); } catch { } } } }
protected void btnReg_Click(object sender, EventArgs e) { //检查输入 string inputErrorInfo = ""; if (!PF.CheckUserName(tbUserName.Text)) { inputErrorInfo += "对不起用户名中含有禁止使用的字符.\r\n"; } if (Shove._String.GetLength(tbUserName.Text) < 5 || Shove._String.GetLength(tbUserName.Text) > 16) { inputErrorInfo += "用户名长度在 5-16 个英文字符或数字、中文 3-8 之间.\r\n"; } if (tbPassword.Text.Length < 6 || tbPassword.Text.Length > 16) { inputErrorInfo += "密码长度必须在 6-16 位之间.\r\n"; } if (tbSiteName.Text.Trim().Length ==0 ) { inputErrorInfo += "网站名称不能为空.\r\n"; } if (tbSiteURL.Text.Trim().Length == 0) { inputErrorInfo += "网站地址不能为空.\r\n"; } if (!Shove._String.Valid.isEmail(tbEmail.Text)) { inputErrorInfo += "电子邮件地址格式不正确.\r\n"; } if (!ckbAgree.Checked) { inputErrorInfo += "必须同意本站会员注册协议才能注册会员。\r\n"; } if (CheckCode2.Visible) { if (tbCheckCode.Text.Trim() == "") { inputErrorInfo += "请输入验证码!\n"; } else { if (!ShoveCheckCode1.Valid(tbCheckCode.Text.Trim())) { inputErrorInfo += "验证码输入有误!\n"; } } } if (inputErrorInfo != "") { lblInputError.Visible = true; lblInputError.Text = "输入资料错误:\r\n" + inputErrorInfo; return; } long CpsID = -1; long CommenderID = -1; if (Session[KeyPromotionUserID] != null) { CommenderID = Shove._Convert.StrToLong(Session[KeyPromotionUserID].ToString(), -1); } //检查推荐人是否为CPS商家,是就把此会员标记CSPID object tempOjb = Shove.Database.MSSQL.ExecuteScalar("select ID from T_Cps where OwnerUserID=" + CommenderID, new Shove.Database.MSSQL.Parameter[0]); if (tempOjb != null) { CpsID = Shove._Convert.StrToLong(tempOjb.ToString(), -1); } System.Threading.Thread.Sleep(500); string Name = tbUserName.Text.Trim(); string Password = tbPassword.Text.Trim(); string Email = tbEmail.Text.Trim(); string Mobile = tbTel.Text.Trim(); string QQ = tbQQ.Text.Trim(); Users user = new Users(_Site.ID); user.Name = Name; user.Password = Password; user.Email = Email; user.Mobile = Mobile; user.QQ = QQ; user.UserType = 2; if (CpsID > 0)//推荐人为cps商家就填CpsID字段 { user.CommenderID = -1; user.CpsID = CpsID; } else { user.CommenderID = CommenderID; user.CpsID = -1; } string ReturnDescription = ""; int Result = user.Add(ref ReturnDescription); if (Result < 0) { Shove._Web.JavaScript.Alert(this, ReturnDescription); return; } else //注册成功,加入CPS站长商家 { double cpsBonusScale = 0.00; DataTable dtTemp = new DAL.Tables.T_Sites().Open("Opt_CpsBonusScale", "", ""); if (dtTemp != null && dtTemp.Rows.Count > 0) cpsBonusScale = double.Parse(dtTemp.Rows[0]["Opt_CpsBonusScale"].ToString()); user.cps.SiteID = 1; user.cps.CommendID = CommenderID; user.cps.Name = tbSiteName.Text; user.cps.Url = tbSiteURL.Text; user.cps.BonusScale = cpsBonusScale; user.cps.ON = true; user.cps.Telephone = tbTel.Text.Trim(); user.cps.Email = Email; user.cps.QQ = QQ; user.cps.Type = 2; user.cps.DomainName = user.GetPromotionURL(0); if (user.cps.Add(ref ReturnDescription) < 0) { Shove._Web.JavaScript.Alert(this, ReturnDescription); return; } } Result = user.Login(ref ReturnDescription); if (Result < 0) { Shove._Web.JavaScript.Alert(this, ReturnDescription); return; } Response.Redirect("../../Default.aspx"); }
public string this[string Manner, string NotificationType] { get { if ((Site == null) || (Site.ID < 1)) { throw new Exception("没有初始化 SiteNotificationTemplates 类的 Site 变量"); } if ((Manner != "SMS") && (Manner != "Email") && (Manner != "StationSMS")) { throw new Exception("SiteNotificationTemplates 类的通知方式 Manner 变量的值超出的范围,它的范围是:1 (SMS)手机短信 2 Email 3 (StationSMS)站内信"); } string SystemPreFix = "SiteOptions_"; DataTable dt = null; bool InApplication = true; try { dt = (DataTable)System.Web.HttpContext.Current.Application[SystemPreFix + this.Site.ID.ToString()]; } catch { } if ((dt == null) || (dt.Rows.Count < 1)) { InApplication = false; dt = new DAL.Tables.T_Sites().Open("", "[ID] = " + Site.ID.ToString(), ""); } if (dt == null) { throw new Exception("SiteNotificationTemplates 类读取数据错误,请检查数据库连接设置"); } if (dt.Rows.Count < 1) { throw new Exception("SiteNotificationTemplates 类的 Site 变量值不在有效范围之内"); } if (!InApplication) { try { System.Web.HttpContext.Current.Application.Lock(); System.Web.HttpContext.Current.Application.Add(SystemPreFix + this.Site.ID.ToString(), dt); } catch { } finally { try { System.Web.HttpContext.Current.Application.UnLock(); } catch { } } } string Result = dt.Rows[0]["Template" + Manner + "_" + NotificationType].ToString().Replace("[SiteName]", Site.Name).Replace("[SiteUrl]", Site.Url); return Result; } set { if ((Site == null) || (Site.ID < 1)) { throw new Exception("没有初始化 SiteNotificationTemplates 类的 Site 变量"); } string sql = @"update T_Sites set [Template" + Manner + "_" + NotificationType + "] = @Value where [ID]=@ID"; int Result = MSSQL.ExecuteNonQuery(sql, new MSSQL.Parameter("Value", SqlDbType.VarChar, 0, ParameterDirection.Input, value), new MSSQL.Parameter("ID", SqlDbType.BigInt, 0, ParameterDirection.Input, Site.ID)); if (Result < 0) { throw new Exception("SiteNotificationTemplates 类读取数据错误,请检查数据库连接设置。如果数据库连接设置没有问题,可能是 NotificationType 变量的值不在有效范围之内"); } //if (DAL.Procedures.P_SetSiteNotificationTemplate(Site.ID, iManner, NotificationType, value) < 0) //{ // throw new Exception("SiteNotificationTemplates 类读取数据错误,请检查数据库连接设置。如果数据库连接设置没有问题,可能是 NotificationType 变量的值不在有效范围之内"); //} string SystemPreFix = "SiteOptions_"; try { System.Web.HttpContext.Current.Application.Lock(); System.Web.HttpContext.Current.Application.Remove(SystemPreFix + this.Site.ID.ToString()); } catch { } finally { try { System.Web.HttpContext.Current.Application.UnLock(); } catch { } } } }
private void BindData() { DataTable dt = new Tables.T_Sites().Open("[ID], [Name]", "", "[Level], [ID]"); if (dt == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_UserAddMoney"); } else { ControlExt.FillDropDownList(this.ddlSites, dt, "Name", "ID"); } }
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 { } } } }