Exemplo n.º 1
0
        protected void insertdata()
        {
            Expenses_Type newobject = new Expenses_Type();

            newobject.Expenses_Type_Name    = TextBoxContacttype.Text;
            newobject.Rectime               = DateTime.Now;
            newobject.Expenses_Type_Rectime = DateTime.Now;
            newobject.UserId    = Convert.ToInt32(Session["userid"]);
            newobject.IsDisable = false;

            DB.Expenses_Types.InsertOnSubmit(newobject);
            DB.SubmitChanges();
        }
        protected void btnSumbitcontact_Click(object sender, EventArgs e)
        {
            Expenses_Type newobject = new Expenses_Type();

            newobject.Expenses_Type_Name = Convert.ToString(TextBoxContactName.Text);

            newobject.Expenses_Type_Rectime = DateTime.Now;

            newobject.IsDisable = false;
            newobject.Rectime   = DateTime.Now;
            newobject.UserId    = Convert.ToInt32(Session["userid"]);

            DB.Expenses_Types.InsertOnSubmit(newobject);
            DB.SubmitChanges();

            DropDownListExpenseType.DataSource = DB.Expenses_Types.Where(a => a.IsDisable.Equals(false)).Select(a => new { ID = a.Expenses_Type_Id, name = a.Expenses_Type_Name }).OrderByDescending(a => a.ID);
            DropDownListExpenseType.DataBind();
        }