コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //PowerUser.UserHasPower(PowerUser._SearchCourseList);
            AddCoursePresenter presenter = new AddCoursePresenter(CourseView1, LoginUser);

            CourseView1.ChoseEmployeeView.AccountRightViewStateName = "ChoosedEmployeeRight";
            CourseView1.ChoseEmployeeView.AccountLeftViewStateName  = "ChoosedEmployeeLeft";
            CourseView1.ChooseSkillView.SkillRightSessionName       = "ChoosedSkillRight";
            CourseView1.ChooseSkillView.SkillLeftSessionName        = "ChoosedSkillLeft";
            ChoseEmployeePresenter Mailpresenter = new ChoseEmployeePresenter(CourseView1.ChoseEmployeeView, LoginUser);

            Mailpresenter.PowerID = HrmisPowers.A801;
            if (!IsPostBack)
            {
                Mailpresenter.Init(this, EventArgs.Empty);
            }
            ChooseSkillPresenter Skillpresenter = new ChooseSkillPresenter(CourseView1.ChooseSkillView);

            if (!IsPostBack)
            {
                Skillpresenter.Init(this, EventArgs.Empty);
            }

            presenter.InitView(Page.IsPostBack, false);
            if (!IsPostBack)
            {
                if (Request.QueryString["ApplicationId"] != null)
                {
                    presenter.SetApplicationBind(SecurityUtil.DECDecrypt(Request.QueryString["ApplicationId"]));
                }
            }
        }
コード例 #2
0
        public void EditCourseControllerTest()
        {
            string oldTitle    = "SA";
            string newTitle    = "New SA";
            string description = "none";
            string suitable    = "CS student";
            string price       = "10000";
            string notice      = "none";
            string other       = "none";


            CourseRepository courseRepository = new CourseRepositoryImpl();
            AddCourse        addCourse        = new AddCourseImpl(courseRepository);

            AddCourseInput  input = (AddCourseInput)addCourse;
            AddCourseOutput addCoursePresneter = new AddCoursePresenter();

            input.setTitle(oldTitle);
            input.setDescription(description);
            input.setSuitable(suitable);
            input.setPrice(price);
            input.setNotice(notice);
            input.setOther(other);

            AddCourseOutput output = addCoursePresneter;

            addCourse.execute(input, output);

            EditCourse editCourse = new EditCourseImpl(courseRepository);

            EditCourseInput  _input = (EditCourseInput)editCourse;
            EditCourseOutput editCoursePresneter = new EditCoursePresenter();

            _input.setOldTitle(oldTitle);
            _input.setTitle(newTitle);
            _input.setDescription(description);
            _input.setSuitable(suitable);
            _input.setPrice(price);
            _input.setNotice(notice);
            _input.setOther(other);

            EditCourseOutput _output = editCoursePresneter;

            editCourse.execute(_input, _output);
            Assert.AreEqual(_output.getNewTitle(), "New SA");

            DeleteCourse deleteCourse = new DeleteCourseImpl(courseRepository);

            DeleteCourseInput  __input = (DeleteCourseInput)deleteCourse;
            DeleteCourseOutput deleteCoursePresneter = new DeleteCoursePresenter();

            __input.setTitle(newTitle);

            DeleteCourseOutput __output = deleteCoursePresneter;

            deleteCourse.execute(__input, __output);
        }
コード例 #3
0
        private void buttonAdd_click(object sender, EventArgs e)
        {
            AddCoursePresenter addCoursePresenter = new AddCoursePresenter(this);

            if (addCoursePresenter.onPressingAddingCourseButton(textCourseName.Text, textCourseCode.Text, textCourseCredit.Text) == false)
            {
                MessageBox.Show("Something went wrong");
            }
        }
        public void GetCourseByTitleControllerTest()
        {
            string title       = "SA";
            string description = "none";
            string suitable    = "CS student";
            string price       = "10000";
            string notice      = "none";
            string other       = "none";

            CourseRepository courseRepository = new CourseRepositoryImpl();
            AddCourse        addCourse        = new AddCourseImpl(courseRepository);

            AddCourseInput  input = (AddCourseInput)addCourse;
            AddCourseOutput addCoursePresneter = new AddCoursePresenter();

            input.setTitle(title);
            input.setDescription(description);
            input.setSuitable(suitable);
            input.setPrice(price);
            input.setNotice(notice);
            input.setOther(other);

            AddCourseOutput output = addCoursePresneter;

            addCourse.execute(input, output);
            GetCourseByTitle getCourseByTitle = new GetCourseByTitleImpl(courseRepository);

            GetCourseByTitleInput  _input = (GetCourseByTitleInput)getCourseByTitle;
            GetCourseByTitleOutput getCourseByTitlePresneter = new GetCourseByTitlePresenter();

            _input.setTitle(title);


            GetCourseByTitleOutput _output = getCourseByTitlePresneter;

            getCourseByTitle.execute(_input, _output);
            Assert.AreEqual(_output.getDescription(), "none");

            DeleteCourse deleteCourse = new DeleteCourseImpl(courseRepository);

            DeleteCourseInput  __input = (DeleteCourseInput)deleteCourse;
            DeleteCourseOutput deleteCoursePresneter = new DeleteCoursePresenter();

            __input.setTitle(title);

            DeleteCourseOutput __output = deleteCoursePresneter;

            deleteCourse.execute(__input, __output);
        }
コード例 #5
0
 public AddCourse()
 {
     _presenter = new AddCoursePresenter(this);
 }