Exemple #1
0
        public ActionResult UpdateStudentInfo(ViewModelStudent objModelStudent)
        {
            try
            {
                BindDropdownlist();
                BLLStudent objBLLStudent = new BLLStudent();
                if (ModelState.IsValid)
                {
                    objModelStudent.Status = 1;

                    decimal result = objBLLStudent.UpdateStudent(objModelStudent);
                    if (result > 0)
                    {
                        Success("Update Record at" + DateTime.Now);
                        ModelState.Clear();
                        return(View());
                    }
                    else
                    {
                        Error("Data Submition Error, Plz Correct All Fields and Try Again");
                    }
                }
                Error("Plz Fill out All Fields");
                return(PartialView(customview("_EditFormStudent", "Student"), objModelStudent));
            }
            catch
            {
                return(View());
            }
        }
Exemple #2
0
 public ActionResult Index()
 {
     try
     {
         BindDropdownlist();
         var objStudentModel = new ViewModelStudent();
         GetAllStudentData();
         return(PartialView(customview("_StudentInformation", "Student"), objStudentModel));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #3
0
        public ActionResult EditStudent(string studentID)
        {
            ViewModelStudent objModelStudent = new ViewModelStudent();

            if (!String.IsNullOrEmpty(studentID.Trim()))
            {
                BLLStudent objBLLStudent = new BLLStudent();

                objModelStudent = objBLLStudent.GetStudentInfoById(Convert.ToDecimal(studentID));

                ViewBag.dpClass   = objBLLStudent.GetClassDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));
                ViewBag.dpSection = objBLLStudent.GetClassSectionDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));
            }
            return(PartialView(customview("_EditFormStudent", "Student"), objModelStudent));
        }
Exemple #4
0
        public ActionResult AddObject(ViewModelStudent student)
        {
            if (ModelState.IsValid)
            {
                Student tst = new Student
                {
                    Name = student.Name,
                    Age  = student.Fail ? 1 : 0
                };
                students.Add(tst);
                return(View("Index", students));
            }


            return(RedirectToAction("Index", "Home"));
        }
Exemple #5
0
        public ActionResult CreateStudentInfo(ViewModelStudent objModelStudent)
        {
            try
            {
                BindDropdownlist();
                BLLStudent objBLLStudent = new BLLStudent();
                if (ModelState.IsValid)
                {
                    objModelStudent.Status = 1;

                    objModelStudent.P = "N/A";

                    if (Request.Files.Count > 0)
                    {
                        if (Request.Files["Simage"].ContentLength > 0)
                        {
                            var image = System.Drawing.Image.FromStream(Request.Files["Simage"].InputStream);
                            var rName = SecureRandomString(15) + System.IO.Path.GetExtension(Request.Files["Simage"].FileName);
                            image.Save(Server.MapPath("/StudentImage/" + rName + ""));
                            objModelStudent.Simage = rName;
                        }
                    }
                    else
                    {
                        Error("Student Image not found");
                        return(PartialView(customview("_StudentInformation", "Student"), objModelStudent));
                    }
                    decimal result = objBLLStudent.AddStudentInfo(objModelStudent);
                    if (result > 0)
                    {
                        Success("Record Added at" + DateTime.Now);
                        return(PartialView(customview("_StudentInformation", "Student"), objModelStudent));
                    }
                    else
                    {
                        Error("Data Submition Error, Plz Correct All Fields and Try Again");
                    }
                }
                Error("Plz Fill out All Fields");
                return(PartialView(customview("_StudentInformation", "Student"), objModelStudent));
            }
            catch
            {
                return(View());
            }
        }
Exemple #6
0
        public ViewModelStudent GetStudentInfoById(decimal StudentID)
        {
            ViewModelStudent objViewModelStudent = new ViewModelStudent();
            DataTable        tblStudentInfo      = new DataTable();

            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@StudentId", StudentID);

            tblStudentInfo = DALCommon.GetDataUsingDataTable("[sp_Admin_GetStudentInfoByStudentId]", param);
            if (tblStudentInfo.Rows.Count > 0)
            {
                objViewModelStudent.StudentId = Convert.ToInt32(tblStudentInfo.Rows[0]["StudentId"].ToString());


                //   MoblieNumber, AdmissionClass, Status, StudentClasses.ClassName,ClassSection.SectionName,(CASE WHEN Religon =0 THEN 'Muslim' WHEN Status = 1 THEN 'Non-Muslim' END)Gender, isnull(FatherCnic,0)FatherCnic, isnull(Email,Null)Email,ISNULL(MobileNo,Null)MobileNo
                objViewModelStudent.StudentName = Convert.ToString(tblStudentInfo.Rows[0]["StudentName"].ToString());
                objViewModelStudent.FatherName  = Convert.ToString(tblStudentInfo.Rows[0]["FatherName"].ToString());
                objViewModelStudent.MonthlyFee  = Convert.ToInt32(tblStudentInfo.Rows[0]["MonthlyFee"].ToString());
                objViewModelStudent.Profession  = Convert.ToString(tblStudentInfo.Rows[0]["Profession"].ToString());
                objViewModelStudent.Reference   = Convert.ToString(tblStudentInfo.Rows[0]["Reference"].ToString());
                // objViewModelStudent.Sex = Convert.ToInt32(tblStudentInfo.Rows[0]["Gender"].ToString());
                objViewModelStudent.DateOfBirth     = Convert.ToDateTime(tblStudentInfo.Rows[0]["DateOfBirth"].ToString());
                objViewModelStudent.DateOfAdmission = Convert.ToDateTime(tblStudentInfo.Rows[0]["DateOfAdmission"].ToString());
                objViewModelStudent.Address         = Convert.ToString(tblStudentInfo.Rows[0]["Address"].ToString());
                objViewModelStudent.HomeNumber      = Convert.ToString(tblStudentInfo.Rows[0]["HomeNumber"].ToString());
                objViewModelStudent.OfficeNumber    = Convert.ToString(tblStudentInfo.Rows[0]["OfficeNumber"].ToString());
                objViewModelStudent.MoblieNumber    = Convert.ToString(tblStudentInfo.Rows[0]["MoblieNumber"].ToString());
                objViewModelStudent.Status          = Convert.ToInt32(tblStudentInfo.Rows[0]["Status"].ToString());
                objViewModelStudent.ClassId         = Convert.ToInt32(tblStudentInfo.Rows[0]["ClassId"].ToString());
                objViewModelStudent.SectionId       = Convert.ToInt32(tblStudentInfo.Rows[0]["SectionId"].ToString());
                objViewModelStudent.FatherCNIC      = Convert.ToString(tblStudentInfo.Rows[0]["FatherCNIC"].ToString());
                objViewModelStudent.Email           = Convert.ToString(tblStudentInfo.Rows[0]["Email"].ToString());
                //objViewModelStudent.Religon = Convert.ToInt32(tblStudentInfo.Rows[0]["Religon"].ToString());
                // objViewModelStudent.CampusId = Convert.ToInt32(tblStudentInfo.Rows[0]["CampusId"].ToString());
                ///  objViewModelStudent.OtherMobNo = Convert.ToInt32(tblStudentInfo.Rows[0]["MobileNo"].ToString());
                // objViewModelStudent.Simage = Convert.ToString(tblStudentInfo.Rows[0]["StudentImage"].ToString());
            }
            return(objViewModelStudent);
        }
Exemple #7
0
        public decimal AddStudentInfo(ViewModelStudent aStudent)
        {
            aStudent.AddedBy = Convert.ToInt32(HttpContext.Current.Session[DALVariables.SchoolAccountId]);

            SqlParameter[] param = new SqlParameter[23];
            SqlCommand     cmd   = new SqlCommand();

            // cmd.CommandType = CommandType.StoredProcedure;

            param[0] = new SqlParameter("@StudentName", aStudent.StudentName);
            param[1] = new SqlParameter("@FatherName", aStudent.FatherName);
            param[2] = new SqlParameter("@ClassId", aStudent.ClassId);

            param[3] = new SqlParameter("@SectionId", aStudent.SectionId);
            param[4] = new SqlParameter("@MonthlyFee", aStudent.MonthlyFee);

            param[5]  = new SqlParameter("@Profession", aStudent.Profession);
            param[6]  = new SqlParameter("@P", aStudent.P);
            param[7]  = new SqlParameter("@Reference", aStudent.Reference);
            param[8]  = new SqlParameter("@Gender", aStudent.Sex);
            param[9]  = new SqlParameter("@DateOfAdmission", aStudent.DateOfAdmission);
            param[10] = new SqlParameter("@DateOfBirth", aStudent.DateOfBirth);
            param[11] = new SqlParameter("@Address", aStudent.Address);
            param[12] = new SqlParameter("@HomeNumber", aStudent.HomeNumber);
            param[13] = new SqlParameter("@OfficeNumber", aStudent.OfficeNumber);
            param[14] = new SqlParameter("@MoblieNumber", aStudent.MoblieNumber);
            param[15] = new SqlParameter("@FatherCnic", aStudent.FatherCNIC);
            param[16] = new SqlParameter("@Email", aStudent.Email);
            //param[17] = new SqlParameter("@AdmissionClass", aStudent.AdmissionClass);
            param[17] = new SqlParameter("@MobileNo", aStudent.OtherMobNo);
            param[18] = new SqlParameter("@CampusID", aStudent.CampusId);
            param[19] = new SqlParameter("@Religon", aStudent.Religon);
            param[20] = new SqlParameter("@StudentImage", aStudent.Simage);
            param[21] = new SqlParameter("@AddedBy", aStudent.AddedBy);
            param[22] = new SqlParameter("@Status", aStudent.Status);


            return(DALCommon.ExecuteNonQueryReturnIdentity("[InsertUpdateStudentInfo]", param));
        }
Exemple #8
0
        public ActionResult AddObject()
        {
            ViewModelStudent student = new ViewModelStudent();

            return(View(student));
        }