protected void btnAddNewSub_Click(object sender, EventArgs e)
        {
            iSubject sj = new iSubject();
            int resultName;
            int resultID;

            if (txtSubName.Text.Trim().Length > 0 && txtSubID.Text.Trim().Length > 0)
            {
                if (txtSubID.Text.Trim().Length == 7)
                {
                    resultID = data.st_CheckAvailableSubID(Convert.ToInt32(txtSubID.Text.Trim()));
                    resultName = data.st_CheckAvailableSubName(txtSubName.Text.Trim());

                    if (resultID != 1 && resultName != 1)
                        lbError.Text = "This Subject Had Exits";
                    else if (resultName != 1)
                        lbError.Text = "This Subject Name Had Exits";
                    else if (resultID != 1)
                        lbError.Text = "This Subject ID Had Exits";
                    else if (resultName == 1 && resultID == 1)
                    {
                        sj.iSubjectID = Convert.ToInt32(txtSubID.Text.Trim());
                        sj.iSubjectName = txtSubName.Text.Trim();
                        data.iSubjects.InsertOnSubmit(sj);
                        data.SubmitChanges();
                        Response.Write("<script>alert('Added Successful');</script>");
                    }
                }
                else
                    lbError.Text = "Incorrect Subject ID, Correct ID like [0-9][0-9][0-9][0-9][0-9][0-9][0-9]";

            }
            else
                lbError.Text = "Please Enter Full Informations";
        }
Beispiel #2
0
        public Controller(Game game, iSubject game_observer)
        {
            this.game_model = game;
            //form_view.count[0]=new int();
            //form_view.count[1] = new int();
            form_view = new Form1(this, game);
            game_observer.registerObserver(form_view);

            Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(form_view);
        }
        protected void btnAddNewSub_Click(object sender, EventArgs e)
        {
            iSubject sj = new iSubject();
            int resultName;
            //int resultID;

            if (txtSubName.Text.Trim().Length > 0 /*&& txtSubID.Text.Trim().Length > 0*/)
            {
                //if (txtSubID.Text.Trim().Length == 7)
                {
                    //resultID = data.st_CheckAvailableSubID(Convert.ToInt32(txtSubID.Text.Trim()));
                    resultName = data.st_CheckAvailableSubName(txtSubName.Text.Trim());

                    //if (resultID != 1 && resultName != 1)
                    //    lbError.Text = "This Subject Had Exits";
                    //else
                    if (resultName != 1)
                    {
                        lbError.Text = "Tên chủ đề đã tồn tại !";
                    }
                    //else if (resultID != 1)
                    //    lbError.Text = "This Subject ID Had Exits";
                    else if (resultName == 1 /*&& resultID == 1*/)
                    {
                        //sj.iSubjectID = Convert.ToInt32(txtSubID.Text.Trim());
                        sj.iSubjectName = txtSubName.Text.Trim();
                        data.iSubjects.InsertOnSubmit(sj);
                        data.SubmitChanges();
                        Response.Write("<script>alert('Thêm chủ đề thành công !');</script>");
                    }
                }
                //else
                //    lbError.Text = "Incorrect Subject ID, Correct ID like [0-9][0-9][0-9][0-9][0-9][0-9][0-9]";

            }
            else
                lbError.Text = "Vui lòng nhập tên chủ đề !";
        }
Beispiel #4
0
 public CurrentConditionsDisplay(iSubject weatherData)
 {
     this.weatherData = weatherData;
     weatherData.RegisterObserver(this);
 }
Beispiel #5
0
 public void RegisterLongTermWeatherData(iSubject weatherData)
 {
     longTermWeatherData.Add(weatherData);
 }
Beispiel #6
0
 public StatisticsDisplay(iSubject weatherData)
 {
     weatherData.RegisterObserver(this);
     this.weatherData = weatherData;
     RegisterLongTermWeatherData(this.weatherData);
 }
Beispiel #7
0
 public ThirdPartyDisplay(iSubject weatherData)
 {
     this.weatherData = weatherData;
     weatherData.RegisterObserver(this);
 }
Beispiel #8
0
 public Subject()
 {
     context = new EFContext();
     _item   = new CSubject(context);
 }
Beispiel #9
0
 public CurrentCondition(iSubject iSub)
 {
     weatherData = iSub;
     weatherData.registerObserver(this);
 }
 public ForcastDisplay(iSubject weatherData)
 {
     weatherData.RegisterObserver(this);
     this.weatherData = weatherData;
 }
Beispiel #11
0
 public PeogressBar(iSubject iSub)
 {
     weatherData = iSub;
     weatherData.registerObserver(this);
 }