public JsonResult Checkb4Promotion(StudentId stud)
        {
            string msg     = "";
            var    manager = Lists4CV.Status.Where(x => x.Name == "Manager").First().Id;
            var    status  = WhoIsWhereLists.HRSupervisor.Where(x => x.Id == stud.id && x.To.Year == 1905).First().StatusId;

            if (status == manager)
            {
                var students = WhoIsWhereLists.HRSupervisor.Where(x => x.ManagerId == stud.id && x.To.Year == 1905).Count();
                if (students > 0)
                {
                    LeftOrTerminated lot = new LeftOrTerminated
                    {
                        Id = stud.id
                    };
                    TempData["Student4Transfer"] = lot;
                    msg = "Transfer";
                }
                else
                {
                    msg = "Promote";
                }
            }
            else
            {
                msg = "Promote";
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public IEnumerable <ViewStudentDto> Get()
        {
            IList <ViewStudentDto> list = new List <ViewStudentDto>();

            list.Add(new ViewStudentDto
            {
                StudentId    = StudentId.New(),
                Name         = "Boris",
                WhenEnrolled = new DateTime(2018, 08, 30)
            });

            list.Add(new ViewStudentDto
            {
                StudentId    = StudentId.New(),
                Name         = "Katharina",
                WhenEnrolled = new DateTime(2019, 09, 3)
            });

            list.Add(new ViewStudentDto
            {
                StudentId    = StudentId.New(),
                Name         = "Erika",
                WhenEnrolled = new DateTime(2018, 08, 28)
            });

            list.Add(new ViewStudentDto
            {
                StudentId    = StudentId.New(),
                Name         = "Sergei",
                WhenEnrolled = new DateTime(2019, 10, 1)
            });

            return(list);
        }
        private async Task ExecuteLoadedAsync(object parameter)
        {
            User user = null;

            if (!IsOfflineMode)
            {
                user = await _usersRepository.GetAsync(nameof(Student), StudentId.ToString());

                _applicationSettingsService.SaveLoggedUserDataInRegistry(nameof(Student), user as Student);
            }
            else
            {
                user = _applicationSettingsService.GetLoggedUserDataFromRegistry(nameof(Student));
                if (user == null)
                {
                    return;
                }
            }

            Student student = user as Student;

            if (!String.IsNullOrWhiteSpace(student.SerializedGrades))
            {
                student.Grades = JsonConvert.DeserializeObject <Dictionary <string, List <Grade> > >(student.SerializedGrades);
                var subjects = new ObservableCollection <WrappedSubject>();
                foreach (var subjectName in student.Grades.Keys)
                {
                    var wrappedGrades = new ObservableCollection <WrappedGrade>();
                    var grades        = student.Grades[subjectName];
                    if (grades.Count > 0)
                    {
                        double sum = 0;
                        foreach (var grade in grades)
                        {
                            wrappedGrades.Add(new WrappedGrade
                            {
                                Value   = grade.Value,
                                Comment = grade.Comment,
                                LastModificationDate = grade.LastModificationDate
                            });

                            sum += grade.Value;
                        }

                        double average = sum / grades.Count;
                        var    subject = new WrappedSubject
                        {
                            Name    = subjectName,
                            Grades  = wrappedGrades,
                            Average = String.Format("{0:0.00}", average)
                        };

                        subjects.Add(subject);
                    }
                }

                Subjects = subjects;
                OnPropertyChanged(nameof(Subjects));
            }
        }
        public JsonResult GetSupervisingHistory(StudentId stud)
        {
            var msg = "";

            TempData["Id"] = stud;
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public void UpdateStudent(StudentId studId, Student student)
        {
            if (student == null)
            {
                _logger.Log(string.Format("You sent a null student:\n {0}", nameof(NullReferenceException)));
            }
            string sql = "Update Students Set " +
                         "firstName = @firstName, secondName = @secondName, phoneNumber = @phoneNumber, email = @email " +
                         "Where studentId = @studentId";

            try
            {
                using (var sqlConnection = new SqlConnection(_connectionString))
                {
                    sqlConnection.Open();
                    using (SqlCommand command = new SqlCommand(sql, sqlConnection))
                    {
                        command.Parameters.AddWithValue("@studentId", studId.Id);
                        command.Parameters.AddWithValue("@firstName", student.firstName);
                        command.Parameters.AddWithValue("@secondName", student.secondName);
                        command.Parameters.AddWithValue("@phoneNumber", student.phoneNumber);
                        command.Parameters.AddWithValue("@email", student.email);
                        command.ExecuteNonQuery();
                    }
                }
            }
            catch (SqlException sqlException)
            {
                _logger.Log(string.Format("You have an error with sql:\n {0}", sqlException));
            }
            catch (ArgumentNullException argException)
            {
                _logger.Log(string.Format("You have a null argument:\n {0}", argException));
            }
        }
Ejemplo n.º 6
0
        public void DeleteStudent(StudentId studId)
        {
            string sql = "Delete from Students " +
                         "Where studentId = @studentId";

            try
            {
                using (var sqlConnection = new SqlConnection(_connectionString))
                {
                    sqlConnection.Open();
                    using (SqlCommand command = new SqlCommand(sql, sqlConnection))
                    {
                        command.Parameters.AddWithValue("@studentId", studId.Id);
                        command.ExecuteNonQuery();
                    }
                }
            }
            catch (SqlException sqlException)
            {
                _logger.Log(string.Format("You have an error with sql:\n {0}", sqlException));
            }
            catch (ArgumentNullException argException)
            {
                _logger.Log(string.Format("You have a null argument:\n {0}", argException));
            }
        }
Ejemplo n.º 7
0
 public override int GetHashCode()
 {
     return(Id.GetHashCode() ^
            StudentId.GetHashCode() ^
            DateCreated.GetHashCode() ^
            Reason.GetHashCode());
 }
        public JsonResult ProcessStaffDetail(StudentId stud)
        {
            var partnerId = Lists4CV.Status.Where(x => x.Name == "Partner").First().Id.ToString();
            var who       = WhoIsWhereLists.Students4WhoIsWhere.Where(x => x.Id == stud.id).First();

            if (who.Status == partnerId)
            {
                TempData["Student"] = who;
                TempData["StudCV"]  = WhoIsWhereLists.GetStudentCV(who.Id);
                //TempData["AllApps"] = Employee.AllApplications(stud.id);
                //TempData["SupHistory"] = Employee.SupervisingHistory(stud.id);
            }
            else
            {
                var students = (IEnumerable <Student4WhoWhere>)TempData["Staffs"];
                TempData.Keep("Staffs");
                if (students.Where(x => x.Id == stud.id).Count() == 0)
                {
                    students = (IEnumerable <Student4WhoWhere>)TempData["OthersStaffs"];
                    TempData.Keep("OthersStaffs");
                }

                TempData["Student"]    = students.Where(x => x.Id == stud.id).First();
                TempData["StudCV"]     = WhoIsWhereLists.GetStudentCV(stud.id);
                TempData["AllApps"]    = Employee.AllApplications(stud.id);
                TempData["SupHistory"] = Employee.SupervisingHistory(stud.id);
            }


            return(Json("Success", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        public JsonResult GetUserInfo(StudentId stud)
        {
            int studid = stud.id;

            TempData["Users"] = SiteUser.Users.Where(x => x.StudentId == studid).First();
            return(Json("Success", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        public void Report(StudentId studentId, string pathToReport)
        {
            if (String.IsNullOrEmpty(pathToReport))
            {
                _logger.Log("You put incorrect path");
            }
            var studentInformationList = _studentsAndLectionsDal.GetAllStudentsAndLections();
            var studentIdList          = studentInformationList.Where(s => s.student.studentId.Id == studentId.Id).ToList();

            using (XmlTextWriter xmlWriter = new XmlTextWriter(pathToReport, Encoding.UTF8))
            {
                xmlWriter.WriteStartElement("List of presence");
                foreach (var l in studentIdList)
                {
                    xmlWriter.WriteElementString("StudentId", l.student.studentId.Id.ToString());
                    xmlWriter.WriteElementString("LectionName", l.lection.lectionName);
                    xmlWriter.WriteElementString("First Name", l.student.firstName);
                    xmlWriter.WriteElementString("Second Name", l.student.secondName);
                    xmlWriter.WriteElementString("LectionDate", l.lection.lectionData.ToString());
                    xmlWriter.WriteElementString("Presence", l.presence.ToString());

                    xmlWriter.Flush();
                }
                xmlWriter.WriteEndElement();
            }
        }
Ejemplo n.º 11
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((StudentId.GetHashCode() * 397) ^ CourseId.GetHashCode());
     }
 }
Ejemplo n.º 12
0
        public Timetable GetTimetable(VulcanAccount account, DateTime date)
        {
            account.SwitchToSymbol(School.SchoolSymbol);
            account.RestClient.BaseUrl = new Uri(new UrlGenerator(account.UrlGenerator.Host, School.SchoolSymbol, School.SchoolId).Generate(UrlGenerator.Site.STUDENT));
            var request = new RestRequest("PlanZajec.mvc/Get/", Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddJsonBody(new { data = date.ToString("s") });

            request.AddCookie("idBiezacyDziennik", Diary.DiaryId.ToString());
            request.AddCookie("idBiezacyDziennikPrzedszkole", Diary.KindergartenDiaryId.ToString());
            request.AddCookie("idBiezacyUczen", StudentId.ToString());

            var result = account.RestClient.Execute(request);

            if (result.IsSuccessful)
            {
                var response = JsonConvert.DeserializeObject <ApiResponse <TimetableResponse> >(result.Content);
                if (response.Success)
                {
                    return(new Timetable(response.Data));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
        //start reviewing from here
        public JsonResult GetRegistrationInfo(StudentId stud)
        {
            var msg = "";

            TempData["Id"] = stud;
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 14
0
        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();

            hash = (hash * 13) ^ StudentId.GetHashCode();
            hash = (hash * 13) ^ ExamSheetId.GetHashCode();
            return(hash);
        }
Ejemplo n.º 15
0
        public virtual void Validate(ValidationResult result)
        {
            ClassId.ValidateRequired(result, nameof(ClassId));

            StudentId.ValidateRequired(result, nameof(StudentId));

            StartedDateTime.ValidateRequired(result, nameof(StartedDateTime));
        }
 public JsonResult ProcessStudentDetail(StudentId stud)
 {
     TempData["StudentId"]  = stud;
     TempData["Student"]    = WhoIsWhereLists.Students4WhoIsWhere.Where(x => x.Id == stud.id).First();
     TempData["StudCV"]     = WhoIsWhereLists.GetStudentCV(stud.id);
     TempData["AllApps"]    = Employee.AllApplications(stud.id);
     TempData["SupHistory"] = Employee.SupervisingHistory(stud.id);
     return(Json("Success", JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 17
0
 public override Task <TransResult> RemoveStudnet(StudentId request, ServerCallContext context)
 {
     using (MYMA.Students.DAL.StudentDbContext dbContext = new MYMA.Students.DAL.StudentDbContext())
     {
         var todelete       = dbContext.Students.FirstOrDefault(s => s.Id == request.Id);
         var entitytoupdate = dbContext.Students.Remove(todelete);
         dbContext.SaveChanges();
     }
     return(default);
Ejemplo n.º 18
0
        public ActionResult UpdateAdvisor(StudentId id)
        {
            UCMModerator advisor = StaticVariables.AdvisorDetails.FirstOrDefault(p => p.Id == id.Id);
            AdvisorData  data    = new AdvisorData();

            populateData(data, advisor);
            TempData["advisor"] = data;
            return(RedirectToAction("UpdateAdvisorData"));
        }
Ejemplo n.º 19
0
        public override bool Equals(object obj)
        {
            var otherStudent = (Student)obj;

            if (otherStudent == null)
            {
                return(false);
            }
            return(StudentId.Equals(otherStudent.StudentId));
        }
Ejemplo n.º 20
0
 public Student(StudentId studId, string fName, string sName, int avgMark, int visiting, string phoneNumber, string email)
 {
     studentId        = studId;
     firstName        = fName;
     secondName       = sName;
     averageMark      = avgMark;
     this.visiting    = visiting;
     this.phoneNumber = phoneNumber;
     this.email       = email;
 }
Ejemplo n.º 21
0
        public override int GetHashCode()
        {
            var hashCode = -480371866;

            hashCode = hashCode * -1521134295 + StudentId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Surname);

            hashCode = hashCode * -1521134295 + DateOfBirth.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 22
0
        public override int GetHashCode()
        {
            var hashCode = -1235398547;

            hashCode = hashCode * -1521134295 + StudentId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Surname);

            hashCode = hashCode * -1521134295 + Age.GetHashCode();
            return(hashCode);
        }
        public PartialViewResult ViewCV()
        {
            var       studentid = SiteUser.Users.Where(x => x.UserName == Session["User"].ToString()).Select(x => x.StudentId).First();
            StudentId s         = new StudentId
            {
                id = studentid
            };

            TempData["Id"] = s;
            //TempData["CV"] = WhoIsWhereLists.GetStudentCV(studentid);
            return(PartialView("StudentCV"));
        }
Ejemplo n.º 24
0
        public override bool Equals(object obj)
        {
            var enrollement = obj as Enrollement;

            if (enrollement == null)
            {
                // If it is null then it is not equal to this instance.
                return(false);
            }

            return(base.Equals(obj) && StudentId.Equals(enrollement.StudentId) && Nullable.Equals(Grade, enrollement.Grade));
        }
        public JsonResult ProcessStudentDetail(StudentId stud)
        {
            var students = (IEnumerable <Student4WhoWhere>)TempData["ManagableStudents"];

            TempData.Keep("ManagableStudents");
            TempData["Student"]    = students.Where(x => x.Id == stud.id).First();
            TempData["StudCV"]     = WhoIsWhereLists.GetStudentCV(stud.id);
            TempData["AllApps"]    = Employee.AllApplications(stud.id);
            TempData["SupHistory"] = Employee.SupervisingHistory(stud.id);

            return(Json("Success", JsonRequestBehavior.AllowGet));
        }
 private void resetFormToolStripMenuItem_Click(object sender, EventArgs e)
 {
     StudentId.Clear();
     StudentName.Clear();
     Std.Clear();
     Div.Clear();
     RollNo.Clear();
     Gender.Clear();
     Category.Clear();
     dob.Clear();
     StudentId.Focus();
 }
Ejemplo n.º 27
0
        public override int GetHashCode()
        {
            var hashCode = -387832195;

            hashCode = hashCode * -1521134295 + StudentId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Surname);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Birthday);

            return(hashCode);
        }
Ejemplo n.º 28
0
        public override int GetHashCode()
        {
            int hashCode = 552405456;

            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + StudentId.GetHashCode();
            hashCode = hashCode * -1521134295 + SubjectId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Result);

            hashCode = hashCode * -1521134295 + WorkTypeId.GetHashCode();
            hashCode = hashCode * -1521134295 + SessionSheduleId.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 29
0
        private async Task ExecuteLoadedAsync(object parameter)
        {
            var user = await _usersRepository.GetAsync(nameof(Student), StudentId.ToString());

            Student = user as Student;
            if (!String.IsNullOrEmpty(Student.SerializedAttendances))
            {
                Student.Attendances = JsonConvert.DeserializeObject <List <Attendance> >(Student.SerializedAttendances);
            }
            else
            {
                Student.Attendances = new List <Attendance>();
            }
        }
 public object GetObjectToSerialize(object obj, Type targetType)
 {
     if (obj != null)
     {
         var type = obj.GetType();
         if (type == typeof(Student) && SerializationFlags.StudentGuidOnly)
         {
             var surrogate = new StudentId
             {
                 Id = ((Student)obj).Id,
             };
             return(surrogate);
         }
     }
     return(obj);
 }