Esempio n. 1
0
        public ActionResult Edit(string StudentID)
        {
            Student             student             = studentService.GetStudentById(StudentID);
            StudentPersonalInfo studentPersonalInfo = studentService.GetStudentPersonalInfo(StudentID);
            StudentViewModel    studentViewModel    = new StudentViewModel()
            {
                StudentID  = student.StudentID,
                FirstName  = student.FirstName,
                MiddleName = student.MiddleName,
                LastName   = student.LastName,
                //Department = student.DepartmentId,
                //Level = student.LevelId,
                Contact           = studentPersonalInfo.Contact,
                Gender            = studentPersonalInfo.Gender,
                Address           = studentPersonalInfo.Address,
                GuardianName      = studentPersonalInfo.GuardianName,
                GuardianContact   = studentPersonalInfo.GuardianContact,
                GuardianRelation  = studentPersonalInfo.GuardianRelation,
                Email             = studentPersonalInfo.Email,
                CitizenshipNumber = studentPersonalInfo.CitizenshipNumber,
                DateOfBirth       = studentPersonalInfo.DateOfBirth,
                AdmissionDate     = studentPersonalInfo.AdmissionDate
            };

            return(View(studentViewModel));
        }
Esempio n. 2
0
        public ActionResult SaveStudent(StudentViewModel studentData)
        {
            Department department = departmentService.GetDepartmentByName(studentData.Department);
            Level      level      = levelService.GetLevelBySemester(studentData.Level);

            StudentPersonalInfo StudentPersonalInfo = new StudentPersonalInfo()
            {
                StudentID         = studentData.StudentID,
                Contact           = studentData.Contact,
                Address           = studentData.Address,
                GuardianName      = studentData.GuardianName,
                GuardianContact   = studentData.GuardianContact,
                GuardianRelation  = studentData.GuardianRelation,
                Gender            = studentData.Gender,
                Email             = studentData.Email,
                CitizenshipNumber = studentData.CitizenshipNumber,
                DateOfBirth       = studentData.DateOfBirth,
                AdmissionDate     = studentData.AdmissionDate,
                InsertedDate      = DateTime.Now
            };

            Student Student = new Student()
            {
                StudentID    = studentData.StudentID,
                FirstName    = studentData.FirstName,
                MiddleName   = studentData.MiddleName,
                LastName     = studentData.LastName,
                LevelID      = level.LevelID,
                DepartmentID = department.DepartmentID,
                InsertedDate = DateTime.Now,
            };

            studentService.SaveStudent(Student);
            return(View(studentData));
        }
Esempio n. 3
0
        public ActionResult UpdateStudent(StudentViewModel newStudentData)
        {
            Department department = departmentService.GetDepartmentByName(newStudentData.Department);
            Level      level      = levelService.GetLevelBySemester(newStudentData.Level);
            Student    Student    = new Student()
            {
                StudentID    = newStudentData.StudentID,
                FirstName    = newStudentData.FirstName,
                MiddleName   = newStudentData.MiddleName,
                LastName     = newStudentData.LastName,
                DepartmentID = department.DepartmentID,
                LevelID      = level.LevelID,
                InsertedDate = DateTime.Now,
            };
            StudentPersonalInfo StudentPersonalInfo = new StudentPersonalInfo()
            {
                Address           = newStudentData.Address,
                Contact           = newStudentData.Contact,
                GuardianName      = newStudentData.GuardianName,
                GuardianContact   = newStudentData.GuardianContact,
                GuardianRelation  = newStudentData.GuardianRelation,
                DateOfBirth       = newStudentData.DateOfBirth,
                Email             = newStudentData.Email,
                Gender            = newStudentData.Gender,
                AdmissionDate     = newStudentData.AdmissionDate,
                CitizenshipNumber = newStudentData.CitizenshipNumber,
                InsertedDate      = DateTime.Now
            };

            studentService.UpdateStudent(Student);
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
    ///////////////////////////////////////////////////////////////////////////////////////////

    //Private Methods///////////////////////////////////////////////////////////////////////////

    //DB to Model//
    private void GenerateModelList()
    {
        StudentPersonalInfoList.Clear();
        foreach (DataRow drStudentPersonalInfo in dsStudentPersonalInfo.Tables[0].Rows)
        {
            StudentPersonalInfo objStudentPersonalInfo = new StudentPersonalInfo();
            objStudentPersonalInfo.StudentID          = Convert.ToInt64(drStudentPersonalInfo["StudentID"]);
            objStudentPersonalInfo.SudentName         = Convert.ToString(drStudentPersonalInfo["SudentName"]);
            objStudentPersonalInfo.StudentCNIC        = Convert.ToString(drStudentPersonalInfo["StudentCNIC"]);
            objStudentPersonalInfo.StudentDateOfBrith = Convert.ToDateTime(drStudentPersonalInfo["StudentDateOfBrith"]);
            objStudentPersonalInfo.StudentEmail       = Convert.ToString(drStudentPersonalInfo["StudentEmail"]);
            objStudentPersonalInfo.StudentContactNo   = Convert.ToString(drStudentPersonalInfo["StudentContactNo"]);
            objStudentPersonalInfo.StudentReligionID  = Convert.ToInt64(drStudentPersonalInfo["StudentReligionID"]);
            objStudentPersonalInfo.StudentAddress     = Convert.ToString(drStudentPersonalInfo["StudentAddress"]);
            objStudentPersonalInfo.IsEnabled          = Convert.ToBoolean(drStudentPersonalInfo["IsEnabled"]);
            objStudentPersonalInfo.StudentPicture     = Convert.ToString(drStudentPersonalInfo["StudentPicture"]);
            objStudentPersonalInfo.Remarks            = Convert.ToString(drStudentPersonalInfo["Remarks"]);
            objStudentPersonalInfo.AddByID            = Convert.ToInt64(drStudentPersonalInfo["AddByID"]);
            objStudentPersonalInfo.AddByDateTime      = Convert.ToDateTime(drStudentPersonalInfo["AddByDateTime"]);
            objStudentPersonalInfo.LastUpdateID       = Convert.ToInt64(drStudentPersonalInfo["LastUpdateID"]);
            objStudentPersonalInfo.LastUpdateDateTime = Convert.ToDateTime(drStudentPersonalInfo["LastUpdateDateTime"]);

            StudentPersonalInfoList.Add(objStudentPersonalInfo);
        }
    }
Esempio n. 5
0
 //Delete StudentPersonalInfo
 public void RemoveStudentPersonalInfo(StudentPersonalInfo studentPersonalInfoToBeDeleted)
 {
     using (var dataContext = new DataContext())
     {
         dataContext.Entry(studentPersonalInfoToBeDeleted).State = EntityState.Deleted;
         dataContext.SaveChanges();
     }
 }
Esempio n. 6
0
 //Update StudentPersonalInfo
 public void UpdateStudentPersonalInfo(StudentPersonalInfo newStudentPersonalInfo)
 {
     using (var dataContext = new DataContext())
     {
         dataContext.Entry(newStudentPersonalInfo).State = EntityState.Modified;
         dataContext.SaveChanges();
     }
 }
Esempio n. 7
0
 //Create StudentPersonalInfo
 public void SaveStudent(StudentPersonalInfo studentPersonalInfo)
 {
     using (var dataContext = new DataContext())
     {
         dataContext.studentPersonalInfo.Add(studentPersonalInfo);
         dataContext.SaveChanges();
     }
 }
        public IActionResult EditPersonalInfo(long id, [FromBody] StudentPersonalInfo dto)
        {
            var command = new EditPersonalInfoCommand(id, dto.Name, dto.Email);

            Result result = _messages.Dispatch(command);

            return(result.IsSuccess ? Ok() : Error(result.Error));
        }
Esempio n. 9
0
 //Read StudentPersonalInfo
 public StudentPersonalInfo GetStudentPersonalInfo(string studentId)
 {
     using (var dataContext = new DataContext())
     {
         StudentPersonalInfo StudentPersonalInfo = (from studentPersonalInfo in dataContext.studentPersonalInfo
                                                    where studentPersonalInfo.StudentID == studentId
                                                    select studentPersonalInfo).First();
         return(StudentPersonalInfo);
     }
 }
Esempio n. 10
0
        private void btnStudentSave_Click(object sender, EventArgs e)
        {
            try
            {
                Image admin_pic = picStudent.Image;
                admin_pic.Save("image//student//" + txtStudentCNIC.Text + ".jpg");
                StudentPersonalInfo studentPersonal = new StudentPersonalInfo();

                // Inser student personal record in Database..
                studentPersonal.StudentID          = Convert.ToInt32(txtStudentName.Tag);
                studentPersonal.SudentName         = txtStudentName.Text;
                studentPersonal.StudentCNIC        = txtStudentCNIC.Text;
                studentPersonal.StudentDateOfBrith = dtpStudentDOB.Value;
                studentPersonal.StudentEmail       = txtStudentEmail.Text;
                studentPersonal.StudentContactNo   = txtStudentPhone.Text;
                studentPersonal.StudentReligionID  = Convert.ToInt32(cmbRligion.SelectedValue);
                studentPersonal.StudentAddress     = txtStudentAddress.Text;
                studentPersonal.IsEnabled          = true;
                studentPersonal.StudentPicture     = "image//student//" + txtStudentCNIC.Text + ".jpg";
                studentPersonal.Remarks            = txtStudentRemarks.Text;
                studentPersonal.AddByID            = Convert.ToInt32(this.Tag);
                studentPersonal.AddByDateTime      = System.DateTime.Now;
                studentPersonal.LastUpdateID       = Convert.ToInt32(this.Tag);
                studentPersonal.LastUpdateDateTime = System.DateTime.Now;
                Int64 student_id = StudentPersonalInfoController.InsertUpdateStudentPersonalInfo(studentPersonal);

                StudentAdmissionInfoInsertUpdate(student_id);
                StudentAssingedSubjectInsertUpdate(student_id);
                StudentGurdianInsertUpdate(student_id);
                StudentGraduationSubjectInsertUpdate(student_id);
                StudentMAstertInsertUpdate(student_id);
                StudentMatricRecordInserUpdate(student_id);
                StudentMatricSubjectInsertUpdate(student_id);
                StudentInterMediateRecordInsertUpdate(student_id);
                StudentInterMediateSubjectInsertUpdate(student_id);
                StudentFeeRecordInsertUpdate(student_id);
                StudentGurdianInsertUpdate(student_id);
                GeneratingStudentRollNumber();
                if (student_id > 0)
                {
                    MessageBox.Show("Record enter successfully");
                }
                else
                {
                    MessageBox.Show("Record not entered successfully");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 11
0
    }     //end function

    public StudentPersonalInfo StudentPersonalInfoSelectByID(int intStudentID)
    {
        try
        {
            string sp_name = "StudentPersonalInfoSelectByID";
            comStudentPersonalInfo.Parameters.AddWithValue("StudentID", intStudentID);
            ConnectAndExecute(sp_name); //no parameter will send to stored procedure
            if (dsStudentPersonalInfo.Tables[0].Rows.Count == 1)
            {
                DataRow             drStudentPersonalInfo  = dsStudentPersonalInfo.Tables[0].Rows[0];
                StudentPersonalInfo objStudentPersonalInfo = new StudentPersonalInfo();
                objStudentPersonalInfo.StudentID          = Convert.ToInt64(drStudentPersonalInfo["StudentID"]);
                objStudentPersonalInfo.SudentName         = Convert.ToString(drStudentPersonalInfo["SudentName"]);
                objStudentPersonalInfo.StudentCNIC        = Convert.ToString(drStudentPersonalInfo["StudentCNIC"]);
                objStudentPersonalInfo.StudentDateOfBrith = Convert.ToDateTime(drStudentPersonalInfo["StudentDateOfBrith"]);
                objStudentPersonalInfo.StudentEmail       = Convert.ToString(drStudentPersonalInfo["StudentEmail"]);
                objStudentPersonalInfo.StudentContactNo   = Convert.ToString(drStudentPersonalInfo["StudentContactNo"]);
                objStudentPersonalInfo.StudentReligionID  = Convert.ToInt64(drStudentPersonalInfo["StudentReligionID"]);
                objStudentPersonalInfo.StudentAddress     = Convert.ToString(drStudentPersonalInfo["StudentAddress"]);
                objStudentPersonalInfo.IsEnabled          = Convert.ToBoolean(drStudentPersonalInfo["IsEnabled"]);
                objStudentPersonalInfo.StudentPicture     = Convert.ToString(drStudentPersonalInfo["StudentPicture"]);
                objStudentPersonalInfo.Remarks            = Convert.ToString(drStudentPersonalInfo["Remarks"]);
                objStudentPersonalInfo.AddByID            = Convert.ToInt64(drStudentPersonalInfo["AddByID"]);
                objStudentPersonalInfo.AddByDateTime      = Convert.ToDateTime(drStudentPersonalInfo["AddByDateTime"]);
                objStudentPersonalInfo.LastUpdateID       = Convert.ToInt64(drStudentPersonalInfo["LastUpdateID"]);
                objStudentPersonalInfo.LastUpdateDateTime = Convert.ToDateTime(drStudentPersonalInfo["LastUpdateDateTime"]);

                return(objStudentPersonalInfo);
            }
            return(null);
        }
        catch (Exception ex)
        {
            SetError(ex.Message);
            return(null);
        } //end try
    }     //end function
    public static Int64 InsertUpdateStudentPersonalInfo(StudentPersonalInfo objIUStudentPersonalInfo)
    {
        Int64 new_id = objIUStudentPersonalInfo.InsertUpdateStudentPersonalInfo();

        return(new_id);
    }
Esempio n. 13
0
        public void DeleteStudentPersonalInfo(string StudentID)
        {
            StudentPersonalInfo studentToBeDeleted = studentpersonalinfoTableActions.GetStudentPersonalInfo(StudentID);

            studentpersonalinfoTableActions.RemoveStudentPersonalInfo(studentToBeDeleted);
        }
Esempio n. 14
0
 public void SaveStudent(StudentPersonalInfo studentData)
 {
     studentpersonalinfoTableActions.SaveStudent(studentData);
 }