Example #1
0
        public void insert_course(
            DateTime createTime,
            int teacher,
            String classTime,
            String place,
            DateTime end_choose_time,
            DateTime start_date,
            DateTime end_date,
            int status,
            int lesson_id

            )
        {
            train_course info = new train_course();

            info.Class_time      = classTime;
            info.Create_time     = createTime;
            info.End_choose_date = end_choose_time;
            info.End_date        = end_date;
            info.Start_date      = start_date;
            info.Status          = status;
            info.Teacher         = teacher;
            info.Place           = place;
            info.Lesson_id       = lesson_id;
            context.train_course.InsertOnSubmit(info);
            context.SubmitChanges();
        }
        /// <summary>
        /// 类型更改相关操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void New_Type(object sender, EventArgs e)
        {
            train_lesson_content_type newType = new train_lesson_content_type();

            newType.TypeName = NewTypeName.Text;
            newType.ParentID = int.Parse(typeTreeView.SelectedNode.Name);
            kkdb.train_lesson_content_type.InsertOnSubmit(newType);
            kkdb.SubmitChanges();
            typeTreeView.RefreshVirtualTree();
        }
        private void SaveInfoAndTab()
        {
            int lessonId = Convert.ToInt32(Request["Id"]);

            train_course info = context.train_course.Single(i => i.Id == lessonId);

            info.Class_time      = Class_time.Text;
            info.End_choose_date = getEndChooseDate();
            info.End_date        = end_date.Date;
            info.Place           = Place.Text;
            info.Teacher         = Convert.ToInt32(Teacher.Value);
            info.Start_date      = start_date.Date;
            context.SubmitChanges();
            Response.Write("<script>window.parent.document.getElementById('mainsplitter_RefreshBtn').click();</script>");
        }
Example #4
0
        public void insert_lesson_basicInfo(
            String number,
            String name,
            int time,
            int type,
            String description
            )
        {
            train_lesson_basicInfo info = new train_lesson_basicInfo();

            info.Name        = name;
            info.Number      = number;
            info.Time        = time;
            info.Type        = type;
            info.Description = description;
            context.train_lesson_basicInfo.InsertOnSubmit(info);
            context.SubmitChanges();
        }
Example #5
0
        private void insert_Employee_Train_Record(int userId)
        {
            Employee_train_record r = new Employee_train_record();

            r.Course_id   = courseId;
            r.Employee_id = userId;
            r.Grade       = 0;

            kkdb.Employee_train_record.InsertOnSubmit(r);
            kkdb.SubmitChanges();
        }
Example #6
0
        //private void insert_Employee_Train_Record(int userId)
        //{
        //    Employee_train_record r = new Employee_train_record();
        //    r.Course_id = Convert.ToInt32(Request["Id"]);
        //    r.Employee_id = userId;
        //    r.Grade = 0;

        //    kkdb.Employee_train_record.InsertOnSubmit(r);
        //    kkdb.SubmitChanges();

        //    ASPxGridView1.DataBind();
        //    ASPxGridView2.DataBind();
        //}

        private void insert_Employee_Train_Record(int userId)
        {
            if (!getUserByUserIdAndCouresId(userId, Convert.ToInt32(Request["Id"])))
            {
                return;
            }
            Employee_train_record r = new Employee_train_record();

            r.Course_id   = Convert.ToInt32(Request["Id"]);
            r.Employee_id = userId;
            r.Remark      = 3;
            //r.Grade = 0;

            kkdb.Employee_train_record.InsertOnSubmit(r);
            kkdb.SubmitChanges();

            //ASPxGridView1.DataBind();
            ASPxGridView2.DataBind();
        }
Example #7
0
        //private void InitControlValuesForEdit(int id)
        //{
        //    train_course_view info = context.train_course_view.Single(i => i.Id == id);
        //    if (info == null) return;
        //    Name.Text = info.Name;
        //    Name.Enabled = false;
        //    Number.Text = info.Number;
        //    Number.Enabled = false;
        //    Time.Text = info.Time.ToString();
        //    Time.Enabled = false;
        //    Description.Text = info.Description;
        //    Description.Enabled = false;

        //    Type.Value = info.Type;

        //    Type.DataBind();
        //    Type.Enabled = false;
        //    lessonType.DataBind();

        //    ContentType.Value = info.ContentTypeId;
        //    ContentType.DataBind();
        //    ContentType.Enabled = false;
        //    LinqContentType.DataBind();

        //    Place.Text = info.Place;
        //    Class_time.Text = info.Class_time;
        //    start_date.Date = info.Start_date;
        //    end_date.Date = info.End_date;
        //    EndChooseDate.Date = info.End_choose_date;

        //    Teacher.Value = info.Teacher;
        //    TeacherType.DataBind();

        //    Status.Value = info.Status;
        //    Status.DataBind();
        //    Status.Enabled = false;
        //    CourseStatus.DataBind();
        //    Create_time.Text = info.Create_time.ToString();
        //    Create_time.Enabled = false;



        //}



        protected void btnDelete_Click(object sender, EventArgs e)
        {
            var courseId = Convert.ToInt32(Request["Id"]);
            // 先判断类型下是否还有类型

            var recordList = context.GetTable <Employee_train_record>();

            if (recordList.Any(i => i.Course_id == courseId))
            {
                showMessage("有学员选课,请先删除学员");
                return;
            }
            else
            {
                train_course info = context.train_course.Single(i => i.Id == courseId);
                context.train_course.DeleteOnSubmit(info);
                context.SubmitChanges();
            }
            // Response.Write("<script>window.parent.document.getElementById('RefreshBtn').click();</script>");
        }
Example #8
0
        protected void ASPxButton1_Click(object sender, EventArgs e)

        {
            int course_id = Convert.ToInt32(HiddenField1.Value);

            int employee_id = Convert.ToInt32(Hidden2.Value);

            // Employee_train_record Info = db.Employee_train_record.Single(i => i.Course_id == (course_id) & i.Employee_id == (employee_id));
            if (contains(course_id, employee_id).Count != 0)
            {
                Response.Write("您已选该课程!");
                return;
            }
            Employee_train_record record = new Employee_train_record();

            record.Employee_id = Convert.ToInt32(Hidden2.Value);
            record.Course_id   = Convert.ToInt32(course_id);
            record.Grade       = null;
            db1.Employee_train_record.InsertOnSubmit(record);
            db1.SubmitChanges();


            Response.Write("<script language=javascript>window.location.href=document.URL;</script>");
        }
Example #9
0
        protected void ASPxButton2_Click(object sender, EventArgs e)
        {
            string course_id           = HiddenField1.Value;
            string employee_id         = Hidden2.Value;
            train_courseDataContext db = new train_courseDataContext();

            if (course_id != null)
            {
                List <Employee_train_record> list = contains(Convert.ToInt32(course_id), Convert.ToInt32(employee_id));
                if (list == null || list.Count == 0)
                {
                    Response.Write("未选择该课程!");
                    return;
                }
                Employee_train_record info = db.Employee_train_record.Single(i => i.Id == list[0].Id);;
                db.Employee_train_record.DeleteOnSubmit(info);
                db.SubmitChanges();
                Response.Write("<script language=javascript>window.location.href=document.URL;</script>");
            }
            else
            {
                Response.Write("请您进行选课!");
            }
        }
Example #10
0
 public void saveLesson()
 {
     kkd.SubmitChanges();
 }