コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            LevelFactory    levelFactory    = new LevelFactory();
            LevelRepository levelRepository = new LevelRepository();

            string error;

            if (!levelFactory.validate(txtName.Text, txtCode.Text, out error))
            {
                lbErrorMsg.Text = error;
                return;
            }

            Level theLevel = levelFactory.Create(txtName.Text, txtCode.Text, txtDescription.Text);

            if (theLevel != null)
            {
                levelRepository.CreatLevel(theLevel);

                Response.Redirect("View.aspx");
            }
        }