Пример #1
0
        private void getdropdownData()
        {
            BLLStudent objBLLStudent = new BLLStudent();

            ViewBag.dpClass   = objBLLStudent.GetClassDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));
            ViewBag.dpSection = objBLLStudent.GetClassSectionDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));
        }
Пример #2
0
        }//deleting record

        private void loadStudent()//string pagesize,int pageindex)
        {
            try
            {
                EntityStudent es = new EntityStudent();
                es.Task     = 4;
                es.pagesize = grdStudent.PageSize;
                if (ViewState["OBJ"] != null)
                {
                    es.PageIndex = int.Parse(ViewState["OBJ"].ToString());
                }
                else
                {
                    es.PageIndex = 1;
                }
                DataSet ds = new DataSet();
                ds = BLLStudent.getStudentData(es);
                if (ds.Tables.Count > 0)
                {
                    grdStudent.DataSource = ds;
                    grdStudent.DataBind();
                }
                else
                {
                    ltrlerror.Text   = "No Records Found";
                    btnclose.Visible = true;
                }
            }
            catch (Exception ex)
            {
                ltrlerror.Text   = "Error .. Could not Load data";
                btnclose.Visible = true;
            }
        }//fetching all record
Пример #3
0
        private void assignvaluesToControl(int id)
        {
            EntityStudent es = new EntityStudent();

            btnsave.Text = "Update";
            DataSet ds = new DataSet();

            es.Task = 5;
            es.Id   = id;
            ds      = BLLStudent.getSingeStudentData(es);
            if (ds.Tables.Count > 0)
            {
                txtName.Text    = ds.Tables[0].Rows[0]["Name"].ToString();
                txtEmail.Text   = ds.Tables[0].Rows[0]["EmailId"].ToString();
                txtcntnum.Text  = ds.Tables[0].Rows[0]["ContactNum"].ToString();
                txtAge.Text     = ds.Tables[0].Rows[0]["Age"].ToString();
                txtaddress.Text = ds.Tables[0].Rows[0]["Addresses"].ToString();
                if (ds.Tables[0].Rows[0]["Gender"].ToString().Equals("0"))
                {
                    rdMale.Checked = true;
                }
                else
                {
                    rdFemale.Checked = true;
                }
                clddate.Text = ds.Tables[0].Rows[0]["DOB"].ToString();
            }
        }//assigning values to Control
Пример #4
0
 private void deleteStudent(int id)
 {
     try
     {
         EntityStudent es = new EntityStudent();
         es.Task = 3;
         es.Id   = id;
         bool b = BLLStudent.deleteStudent(es);
         if (b == true)
         {
             //  Response.Write("<script language=javascript>alert('Deleted Successfully');</script>");
             ltrlerror.Text   = "Deleted Successfully";
             btnclose.Visible = true;
         }
         else
         {
             ltrlerror.Text   = "Error while deletion";
             btnclose.Visible = true;
             // Response.Write("<script language=javascript>alert('Error');</script>");
         }
     }
     catch (Exception ex)
     {
         ltrlerror.Text   = "Error while deletion";
         btnclose.Visible = true;
     }
 }//deleting record
Пример #5
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());
            }
        }
Пример #6
0
        public ActionResult Search1()
        {
            BLLStudent objBLLStudent = new BLLStudent();

            ViewBag.dpClass   = objBLLStudent.GetClassDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));
            ViewBag.dpSection = objBLLStudent.GetClassSectionDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));

            return(PartialView(customview("_SearchFormPartial", "Student")));
        }
Пример #7
0
        //
        // GET: /Add/

        public void BindDropdownlist()
        {
            BLLStudent objBLLStudent = new BLLStudent();

            ViewBag.dpClass = objBLLStudent.GetClassDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));

            ViewBag.dpSection   = objBLLStudent.GetClassSectionDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));
            ViewBag.dpFeeMonths = objBLLStudent.GetFeeMonthDropdown(Convert.ToInt32(Session[DALVariables.SchoolAccountId]));
        }
Пример #8
0
        protected void btnsearch_Click(object sender, EventArgs e)
        {
            try
            {
                EntityStudent es = new EntityStudent();
                es.Task = 7;
                if (!string.IsNullOrEmpty(txtname.Text) || !string.IsNullOrEmpty(txtcntnum.Text) || !string.IsNullOrEmpty(txtEID.Text) || !string.IsNullOrEmpty(txtID.Text))
                {
                    if (!string.IsNullOrEmpty(txtID.Text))
                    {
                        es.Id = int.Parse(txtID.Text);
                    }
                    es.Name = txtname.Text;
                    if (!string.IsNullOrEmpty(txtcntnum.Text))
                    {
                        es.Contactnumb = double.Parse(txtcntnum.Text);
                    }

                    es.Emailid  = txtEID.Text;
                    es.pagesize = grdStudent.PageSize;
                    if (ViewState["OBJ"] != null)
                    {
                        es.PageIndex = int.Parse(ViewState["OBJ"].ToString());
                    }
                    else
                    {
                        es.PageIndex = 1;
                    }
                    DataSet ds = new DataSet();
                    ds = BLLStudent.getStudentData(es);
                    if (ds.Tables.Count > 0)
                    {
                        grdStudent.DataSource = ds;
                        grdStudent.DataBind();
                    }
                    else
                    {
                        ltrlerror.Text   = "No Records Found";
                        btnclose.Visible = true;
                    }
                }
                else
                {
                    loadStudent();
                }
            }

            catch (Exception ex)
            {
                ltrlerror.Text   = "Error .. Could not Load data";
                btnclose.Visible = true;
            }
        }
Пример #9
0
        public ActionResult GetStudentInfoWithBarCode(string strStudentId)
        {
            BLLStudent objBLLStudent = new BLLStudent();
            DataTable  aStudentInfo  = new DataTable();
            string     _StudentName  = String.Empty;

            aStudentInfo = objBLLStudent.GetStudentInfoWithBarCode(Convert.ToDecimal(strStudentId));
            if (aStudentInfo.Rows.Count > 0)
            {
                _StudentName = Convert.ToString(aStudentInfo.Rows[0]["StudentName"].ToString());
            }

            return(Json(new { studentName = _StudentName }));
        }
        private void ShowAllInfo()
        {
            string   className = this.tvwClass.SelectedNode.Text;   //获取选中节点的名称(班级名称)
            DataView dataview  = new DataView(dtClass);             //通过班级表new一个DataView

            dataview.RowFilter = "className = '" + className + "'"; //根据班级名称筛选数据
            DataTable dt      = dataview.ToTable();                 //获取筛选后的班级表
            int       classID = int.Parse(dt.Rows[0][0].ToString());

            lstViewStudent.Items.Clear();
            bllstudent = new BLLStudent();
            dtStudent  = bllstudent.GetStudentInfoClassID(classID);//查询所在班级的学生信息
            if (dtStudent == null)
            {
                MessageBox.Show("該班級才剛剛建立,還沒有學生!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                for (int i = 0; i < dtStudent.Rows.Count; i++)
                {
                    listview      = new ListViewItem();
                    listview.Text = dtStudent.Rows[i][2].ToString();
                    listview.SubItems.Add(dtStudent.Rows[i][1].ToString());
                    listview.SubItems.Add(dtStudent.Rows[i][3].ToString());
                    listview.SubItems.Add(dtStudent.Rows[i][4].ToString());
                    listview.SubItems.Add(className);
                    listview.SubItems.Add(dtStudent.Rows[i][5].ToString());
                    lstViewStudent.Items.Add(listview);
                }
            }

            tvwCourse.Nodes.Clear();
            dtCourse  = new DataTable();
            bllcourse = new BLLCourse();
            dtCourse  = bllcourse.GetCourseInfoClassID(classID);//點擊班级列表時顯示課程訊息
            if (dtStudent == null)
            {
                MessageBox.Show("該班級才剛剛建立,還沒有學生!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                for (int i = 0; i < dtCourse.Rows.Count; i++)
                {
                    TreeNode tn = new TreeNode(className + "-" + dtCourse.Rows[i]["CourseName"].ToString());
                    tvwCourse.Nodes.Add(tn);
                }
                tvwCourse.SelectedNode = tvwCourse.Nodes[0];
            }
        }
Пример #11
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));
        }
Пример #12
0
        public ActionResult GetAllStudentData()
        {
            try
            {
                List <ModelStudent> lstModelStudent = new List <ModelStudent>();

                BLLStudent objBLLStudent = new BLLStudent();

                lstModelStudent = objBLLStudent.GetStudentList();
                return(PartialView(customview("_GetStudentList", "Student"), lstModelStudent));
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #13
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());
            }
        }
Пример #14
0
        //
        // GET: /StudentReport/
        //Test Report PDF Download
        public ActionResult PrintStudentList()
        {
            objBLLStudent   = new BLLStudent();
            lstModelStudent = new List <ModelStudent>();
            string SearchCriteria = "Students.ClassId = 1 AND Students.SectionId = 1";

            lstModelStudent = objBLLStudent.GetStudentList(SearchCriteria, Convert.ToInt32(Session[DALVariables.SchoolAccountId].ToString()));
            ReportDocument rd = new ReportDocument();

            rd.Load(Path.Combine(Server.MapPath("~/Reports/ReportStudentsInfo.rpt")));
            rd.SetDataSource(lstModelStudent);
            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();
            Stream objStream = rd.ExportToStream(
                CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            objStream.Seek(0, SeekOrigin.Begin);
            return(File(objStream, "application/pdf", "StudentList-" + DateTime.Now.ToString() + ".pdf"));
        }
Пример #15
0
        public ActionResult Search1(string ComputerCode, string RegNo, string StudentName, string FatherName, string StudentStatus, string dropDownClass, string dropDownSection)
        {
            StringBuilder strSearchCriteria = new StringBuilder();
            string        searchCriteria    = "";

            //If Computer Code Is Not Empty
            if ((!string.IsNullOrEmpty(RegNo.Trim())))
            {
                strSearchCriteria.Append(" Students.RegNo =" + RegNo.Trim() + " AND ");
            }

            //If Computer Code Is Not Empty
            if ((!string.IsNullOrEmpty(ComputerCode.Trim())))
            {
                strSearchCriteria.Append(" Students.ComputerCode =" + ComputerCode.Trim() + " AND ");
            }

            //If Student Name Is Not Empty
            if ((!string.IsNullOrEmpty(StudentName.Trim())))
            {
                strSearchCriteria.Append(" (Students.StudentName LIKE '%" + StudentName.Trim() + "%') AND ");
            }

            //If Father Name Is Not Empty
            if ((!string.IsNullOrEmpty(FatherName.Trim())))
            {
                strSearchCriteria.Append(" (Students.FatherName LIKE '%" + FatherName.Trim() + "%') AND ");
            }

            //If Student Statuse Is Not Empty
            if ((!string.IsNullOrEmpty(StudentStatus.Trim())))
            {
                int _studentStaus = Convert.ToInt32(StudentStatus.Trim());
                if (_studentStaus > 0)
                {
                    strSearchCriteria.Append(" Students.Status = " + _studentStaus + " AND ");
                }
            }

            //If Selected Class Is Not Empty
            if ((!string.IsNullOrEmpty(dropDownClass.Trim())))
            {
                int _selectedClass = Convert.ToInt32(dropDownClass.Trim());
                if (_selectedClass > 0)
                {
                    strSearchCriteria.Append(" Students.ClassId = " + _selectedClass + " AND ");
                }
            }

            //If Class Section Is Not Empty
            if ((!string.IsNullOrEmpty(dropDownSection.Trim())))
            {
                int _selectedSection = Convert.ToInt32(dropDownSection.Trim());
                if (_selectedSection > 0)
                {
                    strSearchCriteria.Append(" Students.SectionId = " + _selectedSection + " AND ");
                }
            }

            //strSearchCriteria.Append(" ServiceTypeCategoryId = " + CategoryId + " AND ");

            //If Filter Expression Is Not Null Or Empty
            if ((!string.IsNullOrEmpty(strSearchCriteria.ToString())))
            {
                //Set Filter Expression
                searchCriteria = strSearchCriteria.ToString().Remove(strSearchCriteria.ToString().Length - 4, 4);

                //User Log
                DALUtility.InsertUserLog("Search Manage Short Code. Search Criteria - " + searchCriteria, "Student/Search", Convert.ToInt32(Session[DALVariables.UserAccountId].ToString()));
            }
            else
            {
                //User Log
                DALUtility.InsertUserLog("Search Manage Short Code. Search Criteria - Nothing", "Student/Search", Convert.ToInt32(Session[DALVariables.UserAccountId].ToString()));
            }

            try
            {
                List <ModelStudent> lstModelStudent = new List <ModelStudent>();

                BLLStudent objBLLStudent = new BLLStudent();

                lstModelStudent = objBLLStudent.GetStudentList(searchCriteria, Convert.ToInt32(Session[DALVariables.SchoolAccountId].ToString()));
                return(PartialView(customview("_SearchResultsPartial", "Student"), lstModelStudent));
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "StudentController, Search1");
            }
            return(PartialView("Error"));
        }
Пример #16
0
        }//assigning values to Control

        private void insertStudent()
        {
            try
            {
                if (!string.IsNullOrEmpty(txtName.Text) && !string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtcntnum.Text) && !string.IsNullOrEmpty(txtAge.Text) && !string.IsNullOrEmpty(txtaddress.Text))
                {
                    EntityStudent es = new EntityStudent();

                    es.Name        = txtName.Text;
                    es.Address     = txtaddress.Text;
                    es.Age         = Convert.ToInt16(txtAge.Text);
                    es.DOB1        = DateTime.Parse(clddate.Text);
                    es.Emailid     = txtEmail.Text;
                    es.Contactnumb = Convert.ToDouble(txtcntnum.Text);
                    if (rdMale.Checked == true)
                    {
                        es.Gender = false;
                    }
                    else
                    {
                        es.Gender = true;
                    }
                    if (btnsave.Text.Equals("Save"))
                    {
                        es.Task = 1;
                        bool b = BLLStudent.insertStudent(es);
                        clearControls();
                        if (b == true)
                        {
                            Response.Redirect("StudentView.aspx?stud={0}");
                            clearControls();
                        }
                        else
                        {
                            btnclose.Visible = true;
                            ltrlerror.Text   = "Error while insertion";
                        }
                    }
                    if (btnsave.Text.Equals("Update"))
                    {
                        es.Task = 2;
                        es.Id   = int.Parse(ViewState["Id"].ToString());
                        bool b = BLLStudent.updateStudent(es);
                        if (b == true)
                        {
                            Response.Redirect("StudentView.aspx?stud1={1}");
                            clearControls();
                        }
                        else
                        {
                            btnclose.Visible = true;
                            ltrlerror.Text   = "Error while Updation";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ltrlerror.Text   = "Error";
                btnclose.Visible = true;
            }
        }//insertion and updation