public static DataTable InsertUpdateClassSections(BusinessEntities.ClassSections objClassSections) { try { DataKernal.ClassSections objDClassSections = new DataKernal.ClassSections(); return(objDClassSections.InsertUpdateClassSections(objClassSections.SectionID, objClassSections.SectionName, objClassSections.ClassID, objClassSections.DateCreated, objClassSections.IsEnabled, objClassSections.Remarks, objClassSections.UserID).Tables[0]); } catch (System.Exception ex) { return(null); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtSectionName.Text != "") { BusinessEntities.ClassSections objSection = new BusinessEntities.ClassSections(); if (lblSectionID.Text == "") { objSection.SectionID = 0; } else { objSection.SectionID = Convert.ToInt16(lblSectionID.Text); } objSection.SectionName = txtSectionName.Text; objSection.ClassID = Convert.ToInt16(cmbClass.SelectedValue); objSection.DateCreated = System.DateTime.Now; objSection.IsEnabled = chkISEnabled.Checked; objSection.Remarks = txtRemarks.Text; objSection.UserID = LogicKernal.Users.LoginInfo.UserID; if (LogicKernal.ClassSections.InsertUpdateClassSections(objSection).Rows.Count > 0) { MessageBox.Show("Section Inserted"); Sections(); lblSectionID.Text = ""; txtSectionName.Text = ""; txtRemarks.Text = ""; chkISEnabled.Checked = false; } else { MessageBox.Show("Try Again "); } } else { MessageBox.Show("Please Enter Section Name..."); } }