private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            SetUpContainer();
            var studentsView = new StudentsView(new StudentsViewModel());

            studentsView.Show();
        }
        protected void Fill_Students_Email()
        {
            NewBDcon();
            dbcon.StudentTables.Load();
            dbcon.UserTables.Load();
            dbcon.AdvisorTables.Load();
            dbcon.AppointmentTables.Load();
            dbcon.MessagesTables.Load();
            string userName = User.Identity.Name;

            var students = from advisors in dbcon.AdvisorTables.Local
                           where advisors.AdvisorUserName == userName
                           join student in dbcon.StudentTables.Local on advisors.AdvisorID equals student.StudentAdvisorID
                           join user in dbcon.UserTables.Local on student.StudentUserName equals user.UserName

                           select new
            {
                StudentID    = student.StudentID,
                StudentName  = student.StudentFirstName + " " + student.StudentLastName,
                StudentEmail = user.UserEmail
            };

            StudentsView.DataSource = students;
            StudentsView.DataBind();
            if (StudentsView.Rows.Count != 0)
            {
                StudentsView.SelectRow(0);
                messageLb.Text = "New Message To " + StudentsView.SelectedRow.Cells[2].Text;
            }
        }
Beispiel #3
0
        private void OnChangeStatus()
        {
            Status = string.Empty;
            try
            {
                SelectedItem.IsActive = !SelectedItem.IsActive;
                using (var unitOfWork = kernel.Get <IUnitOfWork>())
                {
                    unitOfWork.StudentRepository.Update(SelectedItem);
                    var updated = unitOfWork.Save() > 0;

                    if (updated)
                    {
                        Status       = $"El alumno {SelectedItem.FullName} se actualizó correctamente.";
                        SelectedItem = null;
                        StudentsView.Refresh();
                    }
                    else
                    {
                        Status = $"El alumno {SelectedItem.FullName} no pudo ser actualizado.";
                    }
                }
            }
            catch (Exception ex)
            {
                Status = $"Error: {ex.Message}";
            }
        }
Beispiel #4
0
        private string Object2Line(StudentsView obj)
        {
            var text       = "";
            var properties = obj.GetType().GetProperties();

            foreach (var property in properties)
            {
                text += property == properties.Last()
                    ? property.GetValue(obj, null).ToString()
                    : property.GetValue(obj, null).ToString() + ",";
            }

            return(text);
        }
Beispiel #5
0
        public void CreateList()
        {
            if (student_layout.Controls.Count > 0)
            {
                student_layout.Controls.Clear();
            }
            AspireDB       db      = new AspireDB();
            List <Student> stulist = db.Students.ToList();

            foreach (Student s in stulist)
            {
                StudentsView sv = new StudentsView(s);
                student_layout.Controls.Add(sv);
            }
            db.Database.Connection.Close();
        }
Beispiel #6
0
        private XElement Object2Tag(StudentsView obj)
        {
            var properties = typeof(StudentsView).GetProperties();
            var children   = new List <XElement>();

            foreach (var property in properties)
            {
                children.Add(new XElement(
                                 property.Name,
                                 property.GetValue(obj, null).ToString()
                                 ));
            }

            var result = new XElement(
                "Estudiante",
                new XAttribute("Matricula", obj.Matricula),
                children
                );

            return(result);
        }
Beispiel #7
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            var studentsView = new StudentsView();

            studentsView.Show();
        }
Beispiel #8
0
 private void OnSearching()
 {
     StudentsView.Refresh();
 }