Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            BusinessEntities.Students objStudents = new BusinessEntities.Students();
            if (lblStudentID.Text == "")
            {
                objStudents.StudentID = 0;
            }
            else
            {
                objStudents.StudentID = Convert.ToInt16(lblStudentID.Text);
            }

            if (drpGender.SelectedIndex == 0)
            {
                objStudents.Gender = true;
            }
            else
            {
                objStudents.Gender = false;
            }

            objStudents.StudentName = txtStudentName.Text;
            objStudents.FatherName  = txtfatherName.Text;
            objStudents.DOB         = Convert.ToDateTime(txtDob.Text);
            objStudents.CNIC        = txtCNIC.Text;
            objStudents.Email       = txtEmail.Text;
            objStudents.ContactNo   = txtContactNo.Text;
            objStudents.Address     = txtAddress.Text;
            objStudents.Image       = txtImage.Text;
            objStudents.IsEnabled   = chkIsEnabled.Checked;
            objStudents.Disability  = chkDisability.Checked;
            objStudents.Discounted  = chkDiscounted.Checked;
            objStudents.DateCreated = System.DateTime.Now;
            objStudents.Remarks     = txtRemarks.Text;
            objStudents.UserID      = LogicKernal.Users.LoginInfo.UserID;
            if (LogicKernal.Students.InsertUpdateStudents(objStudents).Rows.Count > 0)
            {
                MessageBox.Show("Insered");
                Students();
                lblStudentID.Text       = "";
                txtCNIC.Text            = "";
                chkDiscounted.Checked   = false;
                chkDisability.Checked   = false;
                drpGender.SelectedIndex = 0;
                txtStudentName.Text     = "";
                txtfatherName.Text      = "";
                txtDob.Text             = "";
                txtEmail.Text           = "";
                txtContactNo.Text       = "";
                txtAddress.Text         = "";
                txtImage.Text           = "";
                SelectedImage.Image     = Image.FromFile("D:\\SMS\\SMS\\SMS\\Images\\ClassStudents.png");
                chkIsEnabled.Checked    = false;
                txtRemarks.Text         = "";
            }
        }
Exemple #2
0
 public static DataTable InsertUpdateStudents(BusinessEntities.Students objStudents)
 {
     try
     {
         DataKernal.Students objDStudents = new DataKernal.Students();
         return(objDStudents.InsertUpdateStudents(objStudents.StudentID, objStudents.StudentName, objStudents.FatherName, objStudents.Gender, objStudents.CNIC, objStudents.DOB, objStudents.Email, objStudents.ContactNo, objStudents.Address, objStudents.Image, objStudents.Disability, objStudents.Discounted, objStudents.IsEnabled, objStudents.DateCreated, objStudents.Remarks, objStudents.UserID).Tables[0]);
     }
     catch (System.Exception ex)
     {
         return(null);
     }
 }