using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Adm_RaigiriTitle : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null || int.Parse(Session["UserTypeID"].ToString()) != 1)
            Response.Redirect("ErrorPage.aspx");
    }
    protected void BtnInsert_Click(object sender, EventArgs e)
    {
        try
        {
         Lbl_Massage.Visible = false;
       
            Lsc_EVotingDataContext db = new Lsc_EVotingDataContext();
            tblRaigiriTitle add = new tblRaigiriTitle();
            add.RaigiriName  = Txt_Title.Text;
            add.DateCreation  = Txt_BeginDate.Text;
            add.DateFinish  = Txt_FinishDate .Text;
            add.CloseBit = false;
            db.tblRaigiriTitles .InsertOnSubmit(add);
            db.SubmitChanges();
            Lbl_Massage.Visible = true;
            GridView1.DataBind();
            Lbl_Massage.Text = "عملیات درج انجام شد!";
            Txt_Title.Text="";
            Txt_BeginDate.Text="";
            Txt_FinishDate.Text="";
        }
        catch 
        {
            Lbl_Massage.Visible = true;
            Lbl_Massage.Text = "عملیات درج انجام نشد!";
        }
    }
    }
