using System; using System.Globalization; using System.Collections; using System.ComponentModel; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace AeroNet.ops { /// /// Ââîä íîâîñòåé /// public class ops_NewsAdd : Common { protected System.Web.UI.WebControls.TextBox tbData; protected System.Web.UI.WebControls.RadioButtonList rblType; protected System.Web.UI.WebControls.TextBox tbAuthor; protected System.Web.UI.WebControls.TextBox tbTitle; protected System.Web.UI.WebControls.TextBox tbText; protected System.Web.UI.WebControls.Button DelBtn; protected System.Web.UI.WebControls.Button CancelBtn; protected int type; protected System.Web.UI.WebControls.Button AddBtn; private void AddBtn_Click(object sender, System.EventArgs e) { System.Collections.Specialized.NameValueCollection colForm = Request.Form; SqlConnection myConnection = new SqlConnection(connString); SqlCommand myCommand = new SqlCommand("ops_AddNews", myConnection); myCommand.CommandType = CommandType.StoredProcedure; SqlParameter parameterNewsData = new SqlParameter("@Date", SqlDbType.VarChar, 50); parameterNewsData.Value = tbData.Text; myCommand.Parameters.Add(parameterNewsData); SqlParameter parameterType = new SqlParameter("@Type", SqlDbType.Int, 4); parameterType.Value = Convert.ToInt32(rblType.SelectedItem.Value); myCommand.Parameters.Add(parameterType); SqlParameter parameterAuthor = new SqlParameter("@Author", SqlDbType.NVarChar, 50); parameterAuthor.Value = tbAuthor.Text; myCommand.Parameters.Add(parameterAuthor); SqlParameter parameterTitle = new SqlParameter("@Title", SqlDbType.NVarChar, 255); parameterTitle.Value = tbTitle.Text; myCommand.Parameters.Add(parameterTitle); SqlParameter parameterText = new SqlParameter("@Text", SqlDbType.NText); parameterText.Value = tbText.Text; myCommand.Parameters.Add(parameterText); myConnection.Open(); myCommand.ExecuteNonQuery(); myConnection.Close(); } private void Page_Load(object sender, System.EventArgs e) { Session["exit"]="/ops/ops_NewsAdd.aspx"; OpsLogin(); OpsMenu(); System.Collections.Specialized.NameValueCollection colForm = Request.Form; } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.AddBtn.Click += new System.EventHandler(this.AddBtn_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion } }