示例#1
0
        public static void SaveData(WebSite site)
        {
            int           rowsAffected = 0;
            SqlConnection connection   = ConnectionManager.GetDatabaseConnection();
            string        procedure    = "UpdateSiteData";
            SqlCommand    cmd          = new SqlCommand(procedure, connection);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@Theme", SqlDbType.NVarChar, 20).Value            = site.Theme;
            cmd.Parameters.Add("@Lang", SqlDbType.NVarChar, 20).Value             = site.Lang;
            cmd.Parameters.Add("@SmtpServer", SqlDbType.VarChar, 50).Value        = site.SmtpServer;
            cmd.Parameters.Add("@SmtpUser", SqlDbType.NVarChar, 50).Value         = site.SmtpUser;
            cmd.Parameters.Add("@SmtpPassword", SqlDbType.NVarChar, 50).Value     = site.SmtpPassword;
            cmd.Parameters.Add("@SmtpDomain", SqlDbType.VarChar, 50).Value        = site.SmtpDomain;
            cmd.Parameters.Add("@MailSenderAddress", SqlDbType.VarChar, 50).Value = site.MailSenderAddress;
            cmd.Parameters.Add("@FooterText", SqlDbType.NVarChar, 100).Value      = site.FooterText;
            cmd.Parameters.Add("@WebSiteTitle", SqlDbType.NVarChar, 50).Value     = site.WebSiteTitle;
            cmd.Parameters.Add("@Keywords", SqlDbType.NVarChar, 1000).Value       = site.Keywords;
            cmd.Parameters.Add("@Description", SqlDbType.NVarChar, 500).Value     = site.Description;

            rowsAffected = cmd.ExecuteNonQuery();
            connection.Close();
        }
示例#2
0
 protected override void OnPreInit(EventArgs e)
 {
     base.OnPreInit(e);
     website = SiteDataManage.LoadData();
     Theme   = website.Theme;
 }