Beispiel #1
0
        private void LoadLesson()
        {
            LessonDAO d   = new LessonDAO();
            DataSet   set = d.GetAllLesson();

            DataRow newRow;

            foreach (DataRow r in set.Tables[0].Rows)
            {
                newRow                  = tabLesson.NewRow();
                newRow["Id"]            = r["Id"];
                newRow["Name"]          = r["Name"];
                newRow["Price"]         = r["Price"];
                newRow["Count"]         = 0;
                newRow["PriceDiscount"] = 0;

                tabLesson.Rows.Add(newRow);
            }

            gridControl.DataSource = tabLesson;

            CustomerDAO cd = new CustomerDAO();

            set = cd.GetAllCustomer();
            lookUpEdit.Properties.DataSource = set.Tables[0];
        }
Beispiel #2
0
        private void simpleButtonAdd_Click(object sender, EventArgs e)
        {
            if (!CheckData())
            {
                return;
            }
            if (tabLesson != null)
            {
                DataRow[] matchs = tabLesson.Select("Name='" + name + "'");
                if (matchs.Length > 0)
                {
                    MessageBox.Show("课程名称已经存在", "信息提示", MessageBoxButtons.OK);
                    return;
                }
            }
            LessonBean b = new LessonBean();

            b.Name        = name;
            b.Price       = price;
            b.TimeLength  = timeLength;
            b.Description = description;


            LessonDAO d = new LessonDAO();

            d.AddLesson(b);
        }
Beispiel #3
0
        private void LoadData()
        {
            LessonDAO d   = new LessonDAO();
            DataSet   set = d.GetAllLesson();

            tabLesson           = set.Tables[0];
            gridCtrl.DataSource = tabLesson;
        }
        public MsgBox lessonAdd(Lesson ls)
        {
            //建立主键
            ls.ID = Guid.NewGuid().ToString();
            //传到Dao层处理
            MsgBox mb = new LessonDAO().insertLesson(ls);

            return(mb);
        }
Beispiel #5
0
        public ControllerClass()
        {
            classDAO       = new ClassDAO();
            teacherDAO     = new TeacherDAO();
            pupilDAO       = new PupilDAO();
            lessonDAO      = new LessonDAO();
            junctionDAO    = new JunctionDAO();
            fullTextSearch = new FullTextSearch();
            view           = new ViewClass(classDAO.GetList(), lessonDAO.GetList());

            //DAO<Junction>.RandomDB(classDAO, teacherDAO, lessonDAO, pupilDAO, junctionDAO);
        }
Beispiel #6
0
        private void simpleButtonDelete_Click(object sender, EventArgs e)
        {
            if (id == -1)
            {
                MessageBox.Show("未选择课程", "信息提示", MessageBoxButtons.OK);
                return;
            }

            LessonBean b = new LessonBean();

            b.Id = id;
            LessonDAO d = new LessonDAO();

            d.DeleteLesson(b);

            LoadData();
        }
Beispiel #7
0
        private void LoadData()
        {
            LessonDAO d   = new LessonDAO();
            DataSet   set = d.GetAllLesson();

            DataRow newRow;

            foreach (DataRow r in set.Tables[0].Rows)
            {
                newRow                  = tabData.NewRow();
                newRow["Id"]            = r["Id"];
                newRow["Name"]          = r["Name"];
                newRow["Price"]         = r["Price"];
                newRow["Count"]         = 0;
                newRow["PriceDiscount"] = 0;

                tabData.Rows.Add(newRow);
            }

            gridCtrl.DataSource = tabData;
        }
        public void setTopic(int lessonID)
        {
            int topicID = new LessonDAO().GetTopicID(lessonID);

            this.topic = new TopicDAO().GetByTopicID(topicID);
        }
Beispiel #9
0
        public Lesson GetLessonById(string id)
        {
            LessonDAO dao = new LessonDAO();

            return(dao.GetLessonById(id));
        }
Beispiel #10
0
        public List <Lesson> RetrieveAllLessons()
        {
            LessonDAO dao = new LessonDAO();

            return(dao.RetrieveAllLessons());
        }
Beispiel #11
0
        public int GetLengthOfDB()
        {
            LessonDAO dao = new LessonDAO();

            return(dao.GetLengthOfDB());
        }
Beispiel #12
0
 public LessonService()
 {
     lessonDAO = new LessonDAO();
 }