Пример #1
0
        public DataTable GetExistingStudentFromBL()
        {
            StudentDA StudentDAobj = new StudentDA();
            DataTable dt           = StudentDAobj.GetExistingStudentFromDB();

            return(dt);
        }
Пример #2
0
        public static bool Save(Student student)
        {
            bool isValid = ValidateModel(student);

            if (isValid)
            {
                return(StudentDA.Save(student));
            }

            return(isValid);
        }
Пример #3
0
        //Prints the Table of the Request, has to be set for each Request
        static void PrintStudents()
        {
            var studentDA        = new StudentDA(_iconfiguration);
            var listStudentModel = studentDA.GetList("Faculty_Subjekt_Teacher");

            listStudentModel.ForEach(item => //Item is the given List by StudentDA
            {
                //This is the Output, can be used in any way you want
                Console.WriteLine(item.Fac_FacultyName + "\t || " + item.Sub_SubjektName + "\t|| " + item.Tea_TeacherName);
            });
            Console.WriteLine("Press any key to stop.");
            Console.ReadKey();
        }
Пример #4
0
 public bool DeleteAStudentandSendFromDA(Student aStudent)
 {
     if (aStudent.Id == " ")
     {
         this.Message = "Id is incorrect";
         return(false);
     }
     else
     {
         StudentDA StudentDAOBj = new StudentDA();
         bool      result       = StudentDAOBj.DeleteAStudentFromDB(aStudent);
         return(result);
     }
 }
 public IActionResult AssignMark(int userId)
 {
     try
     {
         int Logged = Convert.ToInt32(HttpContext.Session.GetInt32("Logged"));
         int User   = Convert.ToInt32(HttpContext.Session.GetInt32("User"));
         if (Logged == 1 && User == 2)
         {
             StudentDA student = new StudentDA();
             examMark = student.GetMark(userId);
             return(View(examMark));
         }
         else
         {
             return(RedirectToAction("Login", "Home"));
         }
     }
     catch (Exception ex)
     {
         string exMessage = "oops! There is a problem in loading the page for assigning marks.";
         return(RedirectToAction("Index", "ExeptionHandler", new { Exeption = exMessage }));
     }
 }
Пример #6
0
 public IActionResult Home(UserInfo userInfo)
 {
     try
     {
         int Logged = Convert.ToInt32(HttpContext.Session.GetInt32("Logged"));
         if (Logged == 1)
         {
             StudentDA student = new StudentDA();
             examMark          = student.GetMark(userInfo.UserID);
             ViewBag.StudentId = userInfo.UserID;
             return(View(examMark));
         }
         else
         {
             return(RedirectToAction("Login", "Home"));
         }
     }
     catch (Exception ex)
     {
         string exMessage = "oops! There is a problem in loading the home page.";
         return(RedirectToAction("Index", "ExeptionHandler", new { Exeption = exMessage }));
     }
 }
Пример #7
0
 //Loading the teacher record based on the Teacher's Id Card no
 public static Student Load(string idCardNo)
 {
     return(StudentDA.Load(idCardNo));
 }
Пример #8
0
        private void StudentPrint(String id)
        {
            IWorkbook workbook = spreadsheetControl1.Document;
            //string printsuffixs = CRMPublicDA.GetGlobalPrintSuffixs();
            //if (printsuffixs == "xinlicheng")
            //{
            DataTable dt = StudentDA.getStudents(id);

            workbook.LoadDocument("Resources/PrintTemplate/student.xlsx");
            int maxcolornum = 28;    //每页最大行数
            int pagnum      = ((dt.Rows.Count - 1) / maxcolornum) + 1;

            for (int p = 0; p < pagnum; p++)    //遍历页
            {
                Worksheet sheet = workbook.Worksheets["Sheet" + (p + 1)];

                if (pagnum > p + 1)    //打完本页之后,还有其他页需要打印,先把本页模板拷贝到下一页
                {
                    workbook.Worksheets.Add("Sheet" + (p + 2));

                    workbook.Worksheets["Sheet" + (p + 2)].CopyFrom(sheet);
                }
                sheet.Cells["b3"].Value = dt.Rows[0]["name"].ToString();
                sheet.Cells["e3"].Value = dt.Rows[0]["id"].ToString();

                //sheet.Cells["h3"].Value = dt.Rows[0]["pbly"].ToString();
                //sheet.Cells["e4"].Value = dt.Rows[0]["ht"].ToString();
                //sheet.Cells["h4"].Value = dt.Rows[0]["cler"].ToString();
                //sheet.Cells["A24"].Value = dt.Rows[0]["dre"].ToString();
                //sheet.Cells["e6"].Value = dt.Rows[0]["tpzl"].ToString();
                //sheet.Cells["B28"].Value = dt.Rows[0]["FullName"].ToString();
                //sheet.Cells["e5"].Value = Convert.ToDateTime(dt.Rows[0]["cjrq"]).ToString("yyyy-MM-dd");
                //sheet.Cells["b4"].Value = Convert.ToDateTime(dt.Rows[0]["jhrq"]).ToString("yyyy-MM-dd");
                int    startno     = 8;
                string saleorderno = "a";
                string cellcardno  = "b";
                string cellpinming = "c";
                string cellsehao   = "d";
                string cellseming  = "e";
                string cellpishu   = "f";
                string cellnewpro  = "g";
                string cellrmk     = "h";
                int    k           = 0;
                int    sumjs       = 0;
                //decimal summs = 0;
                //decimal sumjz = 0;
                //decimal summz = 0;
                for (int j = 0; j < maxcolornum; j++)
                {
                    int a = p * maxcolornum + j;
                    if (a < dt.Rows.Count)
                    {
                        sheet.Cells[saleorderno + (startno + k)].Value = dt.Rows[(p * maxcolornum) + j]["name"].ToString();
                        sheet.Cells[cellcardno + (startno + k)].Value  = dt.Rows[(p * maxcolornum) + j]["id"].ToString();
                        sheet.Cells[cellpinming + (startno + k)].Value = dt.Rows[(p * maxcolornum) + j]["sex"].ToString();
                        //sheet.Cells[cellsehao + (startno + k)].Value = dt.Rows[(p * maxcolornum) + j]["ep_ColorOrColorway"].ToString();
                        //sheet.Cells[cellseming + (startno + k)].Value = dt.Rows[(p * maxcolornum) + j]["ep_quantity"].ToString();
                        //sheet.Cells[cellpishu + (startno + k)].Value = dt.Rows[(p * maxcolornum) + j]["unit"].ToString();
                        //sheet.Cells[cellnewpro + (startno + k)].Value = dt.Rows[(p * maxcolornum) + j]["fsize"].ToString();
                        //sheet.Cells[cellrmk + (startno + k)].Value = dt.Rows[(p * maxcolornum) + j]["clre"].ToString();
                        k++;
                        //  sumjs += Convert.ToInt32(dt.Rows[(p * maxcolornum) + j]["ep_quantity"]);
                        //summs += Convert.ToDecimal(dt.Rows[(p * maxcolornum) + j]["ms"]);
                        //// summz += Convert.ToDecimal(dt.Rows[(p * maxcolornum) + j]["mzh"]);
                        //sumjz += Convert.ToDecimal(dt.Rows[(p * maxcolornum) + j]["zl"]);
                        //   sheet.Cells["e23"].Value = sumjs.ToString();
                        //sheet.Cells["d18"].Value = summs.ToString();
                        ////sheet.Cells["f18"].Value = summz.ToString();
                        //sheet.Cells["h18"].Value = sumjz.ToString();
                    }
                }
                //}
            }
        }
Пример #9
0
 public static bool Delete(string sid)
 {
     return(StudentDA.Delete(sid));
 }
Пример #10
0
 public static int Save(Student myStudent)
 {
     return(StudentDA.Save(myStudent));
 }
Пример #11
0
 public StudentBL()
 {
     objStudentDA = new StudentDA();
 }
Пример #12
0
 public static Student GetItem(string sid)
 {
     return(StudentDA.GetItem(sid));
 }
Пример #13
0
 public bool ValidateNewStudentandSendToDA(Student aStudent)
 {
     if (aStudent.Id == " ")
     {
         this.Message = "Id is incorrect";
         return(false);
     }
     else
     {
         if (aStudent.Name == " ")
         {
             this.Message = "Name is Incorrect";
             return(false);
         }
         else
         {
             if (aStudent.Age <= 0 || aStudent.Age > 100)
             {
                 this.Message = "Age is unmatched";
                 return(false);
             }
             else
             {
                 if (aStudent.Faculty == " ")
                 {
                     this.Message = "Faculty is incorrect";
                     return(false);
                 }
                 else
                 {
                     if (aStudent.ParmanentAdress == " ")
                     {
                         this.Message = "Parmanent Adress is Incorrect";
                         return(false);
                     }
                     else
                     {
                         if (aStudent.PresentAdress == " ")
                         {
                             this.Message = "Present Adress is Incorrect";
                             return(false);
                         }
                         else
                         {
                             if (aStudent.Gender == " ")
                             {
                                 this.Message = "Gender is Incorrect";
                                 return(false);
                             }
                             else
                             {
                                 if (aStudent.ContactNo == " ")
                                 {
                                     this.Message = "Contact Number is Incorrect";
                                     return(false);
                                 }
                                 else
                                 {
                                     if (aStudent.Bloodgroup == " ")
                                     {
                                         this.Message = "Bloodgroup is Incorrect";
                                         return(false);
                                     }
                                     else
                                     {
                                         StudentDA StudentDAOBj = new StudentDA();
                                         bool      result       = StudentDAOBj.SaveNewStudentToDB(aStudent);
                                         return(result);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #14
0
 public StudentController()
 {
     studentDA = new StudentDA();
 }
Пример #15
0
 public static List <Student> Load()
 {
     return(StudentDA.Load());
 }
Пример #16
0
 public static StudentList GetItem()
 {
     return(StudentDA.GetItem());
 }
Пример #17
0
        public double GetClassAverageScore(string _classID, string _subjectID = "", int _semester = 3)
        {
            double result = -1.0;

            if (string.IsNullOrEmpty(_subjectID))
            {
                if (_semester == 3)
                {
                    scoreDA.GetClassAverageScore(_classID, out result, _semester, _subjectID);
                }
                else
                {
                    studentDA = new StudentDA();
                    List <Student> students = new List <Student>();
                    students = studentDA.GetStudents(_classID);
                    foreach (Student student in students)
                    {
                        List <AverageScore> averageScores = new List <AverageScore>();
                        scoreDA.GetAverageScore(student.ID, Int32.Parse(student.GetGrade), averageScores);
                        if (averageScores[_semester - 1].Value > 0)
                        {
                            result += averageScores[_semester - 1].Value;
                        }
                        else
                        {
                            result = -1.0;
                            break;
                        }
                    }
                    if (students.Count < 1)
                    {
                        return(-1.0);
                    }
                    result = result / students.Count;
                }
            }
            else
            {
                studentDA = new StudentDA();
                List <Student> students = new List <Student>();
                students = studentDA.GetStudents(_classID);
                if (_semester == 3)
                {
                    foreach (Student student in students)
                    {
                        double score;
                        scoreDA.GetAverageYearSubjectScore(student.ID, _subjectID, Int32.Parse(student.GetGrade), out score);
                        result += score;
                    }
                }
                else
                {
                    foreach (Student student in students)
                    {
                        double score;
                        scoreDA.GetAverageSubjectScore(student.ID, Int32.Parse(student.GetGrade), _semester, _subjectID, out score);
                        result += score;
                    }
                }
                if (students.Count < 1)
                {
                    return(-1.0);
                }
                result = result / students.Count;
            }
            return(result);
        }