//********************************************************************************************
        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            DirectTeach drt = new DirectTeach();

            drt.DirectTeachId = Convert.ToInt32(((HiddenField)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["CourseName"], "hidId")).Value);
            drt.CourseName = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["CourseName"], "txtEditCourseName")).Text;
            drt.StudentGroup = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["StudentGroup"], "txtEditStdGroup")).Text;
            drt.StudentCount = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["StudentCount"], "txtEditStdCount")).Text);
            drt.TheoryCredit = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["TheoryCredit"], "txtEditTheoryCredit")).Text);
            drt.TheoryHours = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["TheoryHours"], "txtEditTheoryHours")).Text);
            drt.PracticeCredit = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PracticeCredit"], "txtEditPracticeCredit")).Text);
            drt.PracticeHours = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PracticeHours"], "txtEditPracticeHours")).Text);

            dll_DirectTeach dt = new dll_DirectTeach(username, dr.getDurationId());
            dt.updateData(drt);
            this.ASPxGridView1.CancelEdit();
            e.Cancel = true;
            FillGridView();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DirectTeach dTeach = new DirectTeach();

            dTeach.UserName = username;
            dTeach.DurationId = dm.getDurationId();

            dTeach.CourseName = txtCourseName.Text;
            dTeach.StudentGroup = txtStuName.Text;
            dTeach.StudentCount = Convert.ToInt32(txtStdCount.Text);
            dTeach.TheoryCredit = Convert.ToInt32(txtTheoryCredits.Text);
            dTeach.TheoryHours = Convert.ToInt32(txtTheoryHours.Text);
            dTeach.PracticeCredit = Convert.ToInt32(txtPracticeCredit.Text);
            dTeach.PracticeHours = Convert.ToInt32(txtPracticeHours.Text);

            dTeach.Description = txtDesc.Text;

            db.DirectTeaches.InsertOnSubmit(dTeach);
            db.SubmitChanges();
        }
        protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            DirectTeach drt = new DirectTeach();

            drt.UserName = username;
            drt.DurationId = durationId;

            drt.CourseName = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["CourseName"], "txtEditCourseName")).Text;
            drt.StudentGroup = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["StudentGroup"], "txtEditStdGroup")).Text;
            drt.StudentCount = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["StudentCount"], "txtEditStdCount")).Text);
            drt.TheoryCredit = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["TheoryCredit"], "txtEditTheoryCredit")).Text);
            drt.TheoryHours = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["TheoryHours"], "txtEditTheoryHours")).Text);
            drt.PracticeCredit = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PracticeCredit"], "txtEditPracticeCredit")).Text);
            drt.PracticeHours = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PracticeHours"], "txtEditPracticeHours")).Text);

            dll_DirectTeach dt = new dll_DirectTeach(username, durationId);
            dt.insertData(drt);
            e.Cancel = true;
            ASPxGridView1.CancelEdit();
            FillGridView();
        }
 partial void DeleteDirectTeach(DirectTeach instance);
 partial void UpdateDirectTeach(DirectTeach instance);
 partial void InsertDirectTeach(DirectTeach instance);
		private void detach_DirectTeaches(DirectTeach entity)
		{
			this.SendPropertyChanging();
			entity.DurationDirectTeach = null;
		}