public void Edit_Type(object sender, EventArgs e)
        {
            var typeList = kkdb.GetTable <train_lesson_content_type>();
            train_lesson_content_type editType = typeList.Single(d => d.ID == int.Parse(typeTreeView.SelectedNode.Name));

            editType.TypeName = EditTypeName.Text;
            kkdb.SubmitChanges();
            typeTreeView.RefreshVirtualTree();
            // 还没有对产品表里进行过更改 后期加上
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //string course_id = "";

                login_name = Session["login_user_name"].ToString();
                //  login_name = "admin";
                ASPxGridView1.KeyFieldName = "Course_id";
                ASPxGridView1.SettingsBehavior.ProcessSelectionChangedOnServer = true;

                //查询用户id
                var EmployeeInfo = db1.GetTable <S_User_Info>();
                var employee_id  = from t in EmployeeInfo
                                   where t.LoginName == login_name
                                   select t.id;
                foreach (var i in employee_id)
                {
                    Hidden2.Value = i.ToString();
                }
                id = Convert.ToInt32(Hidden2.Value);
                //  var GradeInfo = db1.GetTable<train_personal_record_view>();

                int year = DateTime.Now.Year;// 取当前时间年
                int j    = 0;
                for (int i = year; i > year - 20; i--)
                {
                    ASPxComboBox1.Items.Add((year - j).ToString());
                    j++;
                }
                ASPxComboBox2.Items.Add("上半年");
                ASPxComboBox2.Items.Add("下半年");
            }
        }
Пример #3
0
        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('mainsplitter_RefreshBtn').click();</script>");
            }

            // Response.Write("<script>alert(window.parent.location);</script>");

            // Response.Write()
            //Response.Write(123);
            //Course.test();
            //  Response.Write("<script language=javascript>window.location.href=document.URL;</script>");
            // ASPxGridView1.DataBind();
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            login_name = Session["login_user_name"].ToString();
            // login_name = "admin";


            ASPxGridView2.KeyFieldName = "Course_id";

            string date = DateTime.Now.ToString();

            Hidden.Value = date;
            //string login_name = Session["login_user_name"].ToString();

            // Hidden2.Value = Session["Employee_Id"].ToString();
            //查询用户id

            var EmployeeInfo = db1.GetTable <S_User_Info>();
            var employee_id  = from t in EmployeeInfo
                               where t.LoginName == login_name
                               select t.id;

            foreach (var i in employee_id)
            {
                //Response.Write(i);
                Hidden2.Value = i.ToString();
            }
            var recordsInfo = db1.GetTable <Employee_train_record>();
            var courseInfo  = db1.GetTable <train_course_view>();


            var selectedInfo = from t in courseInfo
                               where (
                from t1 in recordsInfo
                where   t1.Employee_id == Convert.ToInt32(Hidden2.Value)
                select t1.Course_id
                ).Contains(t.Lesson_id)
                               select t.Lesson_id;

            foreach (var i in selectedInfo)
            {
                //   Response.Write(i.ToString());

                //LinqDataSource1.Where += " and  Lesson_id  != (16)";
                //Hidden3.Value = i.ToString();
            }
            //LinqDataSource1.Where += " and  Lesson_id in selectedInfo";
        }
Пример #5
0
        // 2. 建立相应的方法
        // 3. 建立treeview
        public void newCreateTree(TreeViewVirtualModeCreateChildrenEventArgs e, int root_type_ID)
        {
            List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>();
            var lesson_content_type_table       = kkd.GetTable <train_lesson_content_type>();

            if (string.IsNullOrEmpty(e.NodeName))
            {
                // 查询节点信息
                train_lesson_content_type root_type = lesson_content_type_table.Single(d => d.ID == root_type_ID);
                // 建立节点
                TreeViewVirtualNode childNode = new TreeViewVirtualNode(root_type.ID.ToString(), root_type.TypeName);
                childNode.IsLeaf = lesson_content_type_table.Any(d => d.ParentID == root_type.ID) ? false : true;
                children.Add(childNode);
            }
            else
            {
                this.tree_view_child(children, int.Parse(e.NodeName), lesson_content_type_table);
            }
            e.Children = children;
        }
Пример #6
0
        // 产品表的相关操作
        public void New_By_Department(object sender, EventArgs e)
        {
            int departmentId            = Convert.ToInt32(Department.Value);
            List <S_User_Info> userList = new List <S_User_Info>();
            var UserArray = kkdb.GetTable <S_User_Info>();
            var users     = from t in UserArray
                            where t.DepartmentId == departmentId
                            select t;

            List <int> allUsrId = getIds(allUser);

            if (users != null)
            {
                foreach (var t in users)
                {
                    if (!allUsrId.Contains(t.id))
                    {
                        insert_Employee_Train_Record(t.id);
                    }
                }
            }
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //   int lessonid =   Convert.ToInt32(Request["Lesson_id"]);
            //    Response.Write(lessonid);
            int courseid = Convert.ToInt32(Request.QueryString["Course_id"].ToString());

            hidden.Value = courseid.ToString();
            InitControlValuesForEdit(courseid);
            if (HttpContext.Current.Request.UrlReferrer.PathAndQuery.ToString() == "/train/train_course_select.aspx")
            {
                ASPxPageControl1.Visible = false;
            }
            else
            {
                ASPxPageControl1.Visible = true;
                var EmployeeInfo = db1.GetTable <train_record_view>();
                //统计学员总人数
                var allInfo1 = from t in EmployeeInfo
                               where t.Course_id == Convert.ToInt32(courseid)
                               select t;
                int count1 = 0;
                foreach (var i in allInfo1)
                {
                    count1++;
                }

                Students_num.Text = count1.ToString();
                //统计成绩合格的总人数
                var allInfo2 = from t in allInfo1
                               where t.Grade >= 60
                               select t;
                int count2 = 0;
                foreach (var i in allInfo2)
                {
                    count2++;
                }
                pass_num.Text = count2.ToString();
                //统计成绩不合格的总人数
                var allInfo3 = from t in allInfo1
                               where t.Grade >= 0 & t.Grade < 60
                               select t;
                int count3 = 0;
                foreach (var i in allInfo3)
                {
                    count3++;
                }
                notpass_num.Text = count3.ToString();
            }
        }
Пример #8
0
        //public void New_By_Department(object sender, EventArgs e)
        //{
        //    int departmentId = Convert.ToInt32(Department.Value);
        //    List<S_User_Info> userList = new List<S_User_Info>();
        //    var UserArray = kkdb.GetTable<S_User_Info>();
        //    var users = from t in UserArray
        //                where t.DepartmentId == departmentId
        //                select t;
        //    List<Train_Employee_User_view> allUser = findAllUser(Convert.ToInt32(Request["Id"]));
        //    List<int> allUsrId = getIds(allUser);
        //    if (users != null)
        //    {
        //        foreach (var t in users)
        //        {
        //            if (!allUsrId.Contains(t.id))
        //            {
        //                insert_Employee_Train_Record(t.id);
        //            }
        //        }
        //    }
        //    ASPxGridView2.DataBind();

        //}

        //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();

        //}

        // 查找符合类型的所有产品
        public List <Train_Employee_User_view> findAllUser(int courseId)
        {
            List <Train_Employee_User_view> userList = new List <Train_Employee_User_view>();

            var UserArray = kkdb.GetTable <Train_Employee_User_view>();
            var users     = from t in UserArray
                            where t.Course_id == courseId
                            select t;

            foreach (var i in users)
            {
                userList.Add(i);
            }

            return(userList);
        }
Пример #9
0
        private List <Employee_train_record> contains(int courseId, int employeeId)
        {
            train_courseDataContext      kkdb     = new train_courseDataContext();
            List <Employee_train_record> userList = new List <Employee_train_record>();
            var UserArray = kkdb.GetTable <Employee_train_record>();
            var users     = from t in UserArray
                            where t.Course_id == courseId
                            where t.Employee_id == employeeId
                            select t;

            foreach (var i in users)
            {
                userList.Add(i);
            }

            return(userList);
        }
Пример #10
0
        protected bool isGradeRight(int id)
        {
            //List<Employee_train_record> res = new List<Employee_train_record>();
            train_courseDataContext kkdb = new train_courseDataContext();
            var UserArray = kkdb.GetTable <Employee_train_record>();
            var users     = from t in UserArray
                            where t.Course_id == id
                            select t;

            foreach (var i in users)
            {
                if (i.Grade == null && i.Remark == null)
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #11
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>");
        }