Ejemplo n.º 1
0
    private void Save()
    {
        studentBusiness  = new StudentBusiness(studentDataAccess);
        CurrentOperation = (Operation)ViewState["CurrentOperation"];
        Student student = new Student();

        if (CurrentOperation != Operation.ADD)
        {
            student.ID = Convert.ToInt32(txtStudentID.Text);
        }
        student.StudFirstName  = txtStudentFirstName.Text;
        student.StudMiddleName = txtStudentMiddleName.Text;
        student.StudLastName   = txtStudentLastName.Text;
        student.Department     = new Department();
        student.Department.ID  = Convert.ToInt32(ddlDepartments.SelectedValue);
        studentDataAccess      = new StudentDataAccess();
        studentBusiness        = new StudentBusiness(studentDataAccess);

        try
        {
            bool success = false;
            if (CurrentOperation == Operation.ADD)
            {
                success = studentBusiness.AddStudent(student);
                lblSuccessMessage.Text = "Student was added successfully";
            }
            else if (CurrentOperation == Operation.UPDATE)
            {
                success = studentBusiness.UpdateStudent(student);
                lblSuccessMessage.Text = "Student was updated successfully";
            }
            else if (CurrentOperation == Operation.DELETE)
            {
                success = studentBusiness.DeleteStudent(Convert.ToInt32(txtStudentID.Text));
                lblSuccessMessage.Text = "Student was delete successfully";
            }
            if (success)
            {
                divSuccess.Visible = true;
                BindData();
            }
            else
            {
                divError.Visible = true;
            }
        }
        catch (Exception ex)
        {
            lblError.Text    = ex.Message;
            divError.Visible = true;
        }
        txtStudentID.Text             = string.Empty;
        txtStudentFirstName.Text      = string.Empty;
        txtStudentMiddleName.Text     = string.Empty;
        txtStudentLastName.Text       = string.Empty;
        ddlDepartments.SelectedIndex  = 0;
        CurrentOperation              = Operation.ADD;
        ViewState["CurrentOperation"] = CurrentOperation;
    }
Ejemplo n.º 2
0
 public StudentResultsController(IDepartmentBusiness departmentBusiness, IStudentResultBusiness studentResultBusiness, IStudentBusiness studentBusiness, ICourseBusiness courseBusiness, ISemesterBusiness semesterBusiness)
 {
     _departmentBusiness    = departmentBusiness;
     _studentResultBusiness = studentResultBusiness;
     _studentBusiness       = studentBusiness;
     _courseBusiness        = courseBusiness;
     _semesterBusiness      = semesterBusiness;
 }
Ejemplo n.º 3
0
 public AccountController(ApplicationUserManager userManager,
                          ISecureDataFormat <AuthenticationTicket> accessTokenFormat,
                          IStudentBusiness iStudentBusiness)
 {
     UserManager       = userManager;
     AccessTokenFormat = accessTokenFormat;
     _iStudentBusiness = iStudentBusiness;
 }
Ejemplo n.º 4
0
 public DiscenteController(IPersonBusiness person,
                           IStudentBusiness student, ICourseBusiness course, IUserBusiness user, ICityBusiness city,
                           IStateBusiness state)
 {
     _servicoPerson  = person;
     _servicoStudent = student;
     _servicoUser    = user;
     _servicoCity    = city;
     _servicoState   = state;
 }
 public DiscenteController(IPersonBusiness person,
     IStudentBusiness student, ICourseBusiness course, IUserBusiness user, ICityBusiness city,
     IStateBusiness state)
 {
     _servicoPerson = person;
     _servicoStudent = student;
     _servicoUser = user;
     _servicoCity = city;
     _servicoState = state;
 }
Ejemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         studentDataAccess = new StudentDataAccess();
         studentBusiness   = new StudentBusiness(studentDataAccess);
         BindData();
         CurrentOperation = Operation.ADD;
         ViewState["CurrentOperation"] = CurrentOperation;
         divError.Visible   = false;
         divSuccess.Visible = false;
     }
 }
Ejemplo n.º 7
0
    private void BindData()
    {
        studentDataAccess = new StudentDataAccess();
        studentBusiness   = new StudentBusiness(studentDataAccess);
        List <Student> students = studentBusiness.GetStudents();

        rptStudents.DataSource = students;
        rptStudents.DataBind();

        //gvStudents.DataSource = students;
        //gvStudents.DataBind();
        //gvStudents.UseAccessibleHeader = true;
        //gvStudents.HeaderRow.TableSection = TableRowSection.TableHeader;
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Student s = new Student();

        //s.ID = Convert.ToInt32(txtID.Text);
        s.StudFirstName   = txtFirstName.Text;
        s.StudMiddleName  = txtMiddleName.Text;
        s.StudLastName    = txtLastName.Text;
        s.Department.ID   = Convert.ToInt32(ddlDepartments.SelectedValue);
        studentDataAccess = new StudentDataAccess();
        studentBusiness   = new StudentBusiness(studentDataAccess);
        bool success = studentBusiness.AddStudent(s);

        BindData();
        divAdd.Visible = false;
    }
    protected void dlStudents_UpdateCommand(object source, DataListCommandEventArgs e)
    {
        Student      s              = new Student();
        TextBox      txtID          = e.Item.FindControl("txtID") as TextBox;
        TextBox      txtFirstName   = e.Item.FindControl("txtFirstName") as TextBox;
        TextBox      txtMiddleName  = e.Item.FindControl("txtMiddleName") as TextBox;
        TextBox      txtLastName    = e.Item.FindControl("txtLastName") as TextBox;
        DropDownList ddlDepartments = e.Item.FindControl("ddlDepartments") as DropDownList;

        s.ID              = Convert.ToInt32(txtID.Text);
        s.StudFirstName   = txtFirstName.Text;
        s.StudMiddleName  = txtMiddleName.Text;
        s.StudLastName    = txtLastName.Text;
        s.Department.ID   = Convert.ToInt32(ddlDepartments.SelectedValue);
        studentDataAccess = new StudentDataAccess();
        studentBusiness   = new StudentBusiness(studentDataAccess);
        bool success = studentBusiness.UpdateStudent(s);

        dlStudents.EditItemIndex = -1;
        BindData();
    }
Ejemplo n.º 10
0
 public StudentController(IStudentBusiness studentBusiness)
 {
     _studentBusiness = studentBusiness;
 }
 public StudentsController(IStudentBusiness _Business, IMapper mapper)
 {
     Business    = _Business;
     this.mapper = mapper;
 }
Ejemplo n.º 12
0
 public StudentsController(IStudentBusiness studentBusiness, ICourseBusiness courseBusiness)
 {
     _studentBusiness = studentBusiness;
     _courseBusiness  = courseBusiness;
 }
Ejemplo n.º 13
0
 public DisciplinesController(IDisciplineBusiness disciplineBusiness, ICourseBusiness courseBusiness, IStudentBusiness studentBusiness)
 {
     _disciplineBusiness = disciplineBusiness;
     _courseBusiness     = courseBusiness;
     _studentBusiness    = studentBusiness;
 }
Ejemplo n.º 14
0
 public DepartmentsController(IDepartmentBusiness departmentBusiness, IStudentBusiness studentBusiness)
 {
     _departmentBusiness = departmentBusiness;
     _studentBusiness    = studentBusiness;
 }
Ejemplo n.º 15
0
 public StudentController(IStudentBusiness business)
 {
     _stuentbusiness = business;
 }
Ejemplo n.º 16
0
        public async Task <IActionResult> GetClassesByDisciplineIDsTaskAsync([FromServices] IDisciplineBusiness disciplineBusiness, [FromServices] IStudentBusiness studentBusiness)
        {
            var studentId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);

            if (!(await studentBusiness.FindByStudentIdTaskAsync(studentId) is StudentDisciplineVO student))
            {
                return(NotFound("Não existe nenhum aluno com Id fornecido!"));
            }

            if (!(await disciplineBusiness.FindAllByDisciplineIdsTaskAsync(student.Disciplines.Select(x => x.DisciplineId).ToList()) is List <DisciplineVO> disciplines))
            {
                return(NotFound("Não foi possivel encontrar as disciplinas do aluno!"));
            }

            if (!(await _classBusiness.FindByRangeClassIdTaskAsync(disciplines.Select(x => x.ClassId).ToHashSet()) is List <ClassVO> classes))
            {
                return(NotFound("Não foi possivel encontrar as salsas do aluno"));
            }

            return(Ok(classes));
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public ReportController(IReportBusiness reportBusiness, IStudentBusiness studentBusiness, IFeeBusiness feeBusiness)
 {
     _reportBusiness  = reportBusiness;
     _studentBusiness = studentBusiness;
     _feeBusiness     = feeBusiness;
 }
Ejemplo n.º 18
0
 public TurmaController(IClassBusiness negocio, IStudentBusiness student, ITeacherBusiness teacher)
 {
     _servicoClass   = negocio;
     _servicoStudent = student;
     _servicoTeacher = teacher;
 }
 public TurmaController(IClassBusiness negocio, IStudentBusiness student, ITeacherBusiness teacher)
 {
     _servicoClass = negocio;
     _servicoStudent = student;
     _servicoTeacher = teacher;
 }
Ejemplo n.º 20
0
        //public static readonly IDialog<string> dialog = Chain.PostToChain()
        //        .Select(msg => msg.Text)
        //        .Switch(
        //             new RegexCase<IDialog<string>>(new Regex("^hi", RegexOptions.IgnoreCase), (context, txt) =>
        //             {
        //                 return Chain.ContinueWith(new IntroduceDialog(), AfterGreetingContinuationAsync);
        //             }),
        //             new DefaultCase<string, IDialog<string>>((context, txt) =>
        //             {
        //                 return Chain.ContinueWith(FormDialog.FromForm(StudentServey.BuildForm, FormOptions.PromptInStart), AfterGreetingContinuationAsync);
        //             }))
        // .Unwrap()
        // .PostToUser();

        //private static async Task<IDialog<string>> AfterGreetingContinuationAsync(IBotContext context, IAwaitable<object> item)
        //{
        //    var token = await item;
        //    var name = "User";
        //    context.UserData.TryGetValue<string>("Name", out name);
        //    return Chain.Return($"Thank you for using the bot: {name}");
        //}

        public RootDialog(IStudentBusiness studentBusiness)
        {
            // Dependency injection
            _studentBusiness = studentBusiness;
        }
Ejemplo n.º 21
0
 public AuthController(ICoordinatorBusiness accountBusiness, IStudentBusiness studentBusiness)
 {
     _coordinatorBusiness = accountBusiness;
     _studentBusiness     = studentBusiness;
 }
Ejemplo n.º 22
0
 public StudentController(IStudentBusiness _studentBusiness)
 {
     studentBusiness = _studentBusiness;
 }
Ejemplo n.º 23
0
 public StudentViewModel(IStudentBusiness studentBusiness, IDepartmentBusiness departmentBusiness)
 {
     _studentBusiness    = studentBusiness;
     _departmentBusiness = departmentBusiness;
 }
 public StudentController(IStudentBusiness StudentBusiness)
 {
     _StudentBusiness = StudentBusiness;
 }
Ejemplo n.º 25
0
 public StatusController(ILessonBusiness lessonBusiness, IDisciplineBusiness disciplineBusiness, IClassBusiness classBusiness, IStudentBusiness studentBusiness)
 {
     _lessonBusiness     = lessonBusiness;
     _disciplineBusiness = disciplineBusiness;
     _classBusiness      = classBusiness;
     _studentBusiness    = studentBusiness;
 }
Ejemplo n.º 26
0
 public AccountController(IStudentBusiness studentBusiness, ApplicationUserManager userManager, ApplicationSignInManager signInManager)
 {
     _studentBusiness = studentBusiness;
     _userManager     = userManager;
     _signInManager   = signInManager;
 }