using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Data.SqlClient; public partial class Service_Agencies_Add : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CMSConnectionString"].ToString()); protected void Page_Load(object sender, EventArgs e) { } protected void btnAdd2_Click(object sender, EventArgs e) { try { string xadmin = Session["admin"].ToString(); if (xadmin == "True") { SqlCommand cmdInsert = new SqlCommand("insert into Service_Agencies (Name,Service_Way,Service_Country,Service_City," + "Service_Address,Service_Mobile,Service_Phone,Service_Email,Service_Note,Service_User ) " + " Values(N'" + txtName.Text + "' , N'" + RBLWay.SelectedValue + "'," + DrpCountry.SelectedValue + "," + DrpCity.SelectedValue + "," + " N'" + txtaddress.Text + "',N'" + txtMobile.Text + "' ,N'" + txtPhone.Text + "' ," + " N'" + txtEmail.Text + "',N'" + txtNote.Text + "'," + " " + Session["User"].ToString() + ")", con); if (con.State == ConnectionState.Closed) con.Open(); //Response.Write(cmdInsert.CommandText.ToString()); cmdInsert.ExecuteNonQuery(); con.Close(); lblerror2.Text = "تم إضافة الجهة الخيرية أو الخدمية"; txtName.Text = ""; txtPhone.Text = ""; txtNote.Text = ""; txtMobile.Text = ""; txtaddress.Text = ""; txtEmail.Text = ""; DrpCity.ClearSelection(); DrpCountry.ClearSelection(); RBLWay.ClearSelection(); } else Response.Redirect("Home.aspx"); } catch (Exception ex) { //Response.Write(ex.ToString()); lblerror2.Text = "حدث خطأ حاول مرة أخري"; return; } } protected void btnShowCity_Click(object sender, EventArgs e) { DrpCity.DataBind(); } protected void btnreturn_Click(object sender, EventArgs e) { Response.Redirect("Service_Agencies.aspx"); } }