Ejemplo n.º 1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //INITIALIZE ENTITY OBJECT
                sObj = new Student();
                //ASSIGNING DATA TO sObj PROPERTIES
                sObj.RollNo = Convert.ToInt32(txtRollNo.Text);
                sObj.Name   = txtName.Text;
                sObj.Addr   = txtAddr.Text;

                //calling business layer
                bool res = sbl.AddStudent(sObj);
                if (res)
                {
                    System.Windows.Forms.MessageBox.Show(" Record Added Successfully ");
                }
            }
            catch (StudentException se)
            {
                System.Windows.Forms.MessageBox.Show(se.Message);
            }
            catch (Exception e1)
            {
                System.Windows.Forms.MessageBox.Show(e1.Message);
            }
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                sobj        = new Student();
                sobj.RollNo = Convert.ToInt32(txtRollNo_Copy.Text);
                sobj.Name   = txtName.Text;
                sobj.Addr   = txtAddr.Text;

                bool res = sBl.AddStudent(sobj);
                if (res)
                {
                    System.Windows.Forms.MessageBox.Show("RECORD ADDED");
                }
            }
            catch (StudentException se)
            {
                System.Windows.Forms.MessageBox.Show(se.Message, "Student Management system");
            }
            catch (Exception e1)
            {
                System.Windows.Forms.MessageBox.Show(e1.Message, "student management system");
            }
            //This adds the record to the table
        }
Ejemplo n.º 3
0
 public ActionResult Index(StudentOB student)
 {
     if (ModelState.IsValid)
     {
         StudentBL objstudent = new StudentBL();
         CustomBO  CBO        = objstudent.AddStudent(student);
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
Ejemplo n.º 4
0
        private void btnInsertStudent_Click(object sender, EventArgs e)
        {
            try
            {
                string errMsg = ValidateForm();

                if (errMsg != string.Empty)
                {
                    MessageBox.Show(errMsg, "Missing Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    StudentBL stuBl = new StudentBL();
                    Student   stu2  = new Student();

                    if (stuBl.AddStudent(PopulateStudentObject()))
                    {
                        MessageBox.Show("Insert Successful!");
                        ClearData();
                    }
                    else
                    {
                        string msg = string.Empty;
                        foreach (ValidationError error in stuBl.Errors)
                        {
                            msg += error.Description + Environment.NewLine;
                        }
                        stuBl.Errors.Clear();
                        MessageBox.Show(msg);
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 5
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         sbl         = new StudentBL();
         sobj        = new Student();
         sobj.RollNo = Int32.Parse(txtRollNo.Text);
         sobj.Name   = txtName.Text;
         sobj.Addr   = txtAddress.Text;
         bool res = sbl.AddStudent(sobj);
         if (res)
         {
             System.Windows.Forms.MessageBox.Show("Record Added");
         }
     }
     catch (SMSException se)
     {
         System.Windows.Forms.MessageBox.Show(se.Message, "Student Management System");
     }
     catch (Exception e1)
     {
         System.Windows.Forms.MessageBox.Show(e1.Message, "Student Management System");
     }
 }