public static DataTable InsertUpdateSubjects(BusinessEntities.Subjects objSubjects) { try { DataKernal.Subjects objDSubjects = new DataKernal.Subjects(); return(objDSubjects.InsertUpdateSubjects(objSubjects.SubjectID, objSubjects.SubjectName, objSubjects.ClassID, objSubjects.IsEnabled, objSubjects.DateCreated, objSubjects.Remarks, objSubjects.UserID).Tables[0]); } catch (System.Exception ex) { return(null); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtSubjectName.Text != "") { BusinessEntities.Subjects objSubject = new BusinessEntities.Subjects(); if (lblSubjectID.Text == "") { objSubject.SubjectID = 0; } else { objSubject.SubjectID = Convert.ToInt16(lblSubjectID.Text); } objSubject.SubjectName = txtSubjectName.Text; objSubject.ClassID = Convert.ToInt16(cmbClass.SelectedValue); objSubject.DateCreated = System.DateTime.Now; objSubject.IsEnabled = chkISEnabled.Checked; objSubject.Remarks = txtRemarks.Text; objSubject.UserID = LogicKernal.Users.LoginInfo.UserID; if (LogicKernal.Subjects.InsertUpdateSubjects(objSubject).Rows.Count > 0) { MessageBox.Show("Section Inserted"); Subjects(); lblSubjectID.Text = ""; txtSubjectName.Text = ""; txtRemarks.Text = ""; chkISEnabled.Checked = false; } else { MessageBox.Show("Try Again "); } } else { MessageBox.Show("Please Enter Subject Name..."); } }