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 Activity_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) { AddRecord(); } private void AddRecord() { int Act_Design = 0, Act_Montag = 0, Act_Prepair = 0, Act_Cat = 0, Act_Review = 0, Act_Search = 0, Act_Edit = 0, Act_Write = 0, Act_Select = 0, Act_other = 0, Act_Meeting = 0, Act_Visitor = 0; string xadmin = Session["AddNew"].ToString(); if (xadmin == "True") { try { if (txtYear.Text == "") { txtYear.Text = "1435"; } if (txtDesc.Text == "") { txtDesc.Text = "لم يتم اضافة وصف"; } if (RBAct_Design.Checked==true) { Act_Design = 1; } if (RBAct_Montag.Checked == true) { Act_Montag = 1; } if (RBAct_Prepair.Checked == true) { Act_Prepair = 1; } if (RBAct_Cat.Checked == true) { Act_Cat = 1; } if (RBAct_Review.Checked == true) { Act_Review = 1; } if (RBAct_Search.Checked == true) { Act_Search = 1; } //Act_Edit = 0, Act_Write = 0, Act_Select = 0, Act_other = 0; if (RBAct_Edit.Checked == true) { Act_Edit = 1; } if (RBAct_Write.Checked == true) { Act_Write = 1; } if (RBAct_Select.Checked == true) { Act_Select = 1; } if (RBAct_other.Checked == true) { Act_other = 1; } if (RBAct_Meeting.Checked == true) { Act_Meeting = 1; } if (RBAct_Visitor.Checked == true) { Act_Visitor = 1; } // = , == " + SqlCommand cmdInsert = new SqlCommand("insert into tbl_Activity(Act_Design,Act_Montag,Act_Prepair,Act_Cat,Act_Review,Act_Search,Act_Edit,"+ "Act_Write,Act_Select,Act_other,Act_Desc,Le_Month,Le_Year,Le_User,Act_Meeting,Act_Visitor)" + " Values(" + Act_Design + "," + Act_Montag + "," + Act_Prepair + "," + Act_Cat + "," + Act_Review + "," + Act_Search + "," + Act_Edit + "," + " " + Act_Write + "," + Act_Select + "," + Act_other + ",N'" + txtDesc.Text + "',N'" + DrpMonth.SelectedValue + "',"+ "N'" + txtYear.Text + "'," + Session["User"].ToString() + "," + Act_Meeting + "," + Act_Visitor + ")", con); if (con.State == ConnectionState.Closed) con.Open(); cmdInsert.ExecuteNonQuery(); con.Close(); lblerror2.Text = "تم إضافة البيان الجديد"; txtYear.Text = ""; DrpMonth.ClearSelection(); } catch (Exception ex) { lblerror2.Text = "حدث خطأ كالتالي " + ex.ToString(); return; } } else lblerror2.Text="ليس لك الصلاحية في هذا الاجراء"; } protected void btnreturn_Click(object sender, EventArgs e) { Response.Redirect("Activity.aspx"); } }