Пример #1
0
        /// <summary>
        /// 添加答辩小组
        /// </summary>
        private void insert()
        {
            string leaderId = Request["leaderId"];
            string memberId = Request["memberId"];
            string recordId = Request["recordId"];
            string planId = Request["planId"];
            Teacher teaLeader = teacherBll.GetModel(leaderId);
            Teacher teaMember = teacherBll.GetModel(memberId);
            Teacher tearecord = teacherBll.GetModel(recordId);
            string leaderName = teaLeader.TeaName;
            string memberName = teaMember.TeaName;
            string recordName = tearecord.TeaName;

            DefenceGroup defenceGroup = new DefenceGroup();
            defenceGroup.leader = leaderId;
            defenceGroup.member = memberId;
            defenceGroup.recorder = recordId;
            defenceGroup.leaderName = leaderName;
            defenceGroup.memberName = memberName;
            defenceGroup.recordName = recordName;
            Plan plan = new Plan();
            plan.PlanId = Convert.ToInt32(planId);
            defenceGroup.plan = plan;
            //添加过的教师不显示
            Result result, row1, row2, row3;
            teaLeader.state = 1;
            row1 = teacherBll.Updata(teaLeader);
            teaMember.state = 1;
            row2 = teacherBll.Updata(teaMember);
            tearecord.state = 1;
            row3 = teacherBll.Updata(tearecord);
            if (row1 == Result.更新失败 || row2 == Result.更新失败 || row3 == Result.更新失败)
            {
                teaLeader.state = 0;
                row1 = teacherBll.Updata(teaLeader);
                teaMember.state = 0;
                row2 = teacherBll.Updata(teaMember);
                tearecord.state = 0;
                row3 = teacherBll.Updata(tearecord);
                result = Result.添加失败;
            }
            else {
                result = defenceBll.InsertGroup(defenceGroup);
            }
            if (result == Result.添加成功)
            {
                LogHelper.Info(this.GetType(), teacher.TeaAccount + " - " + teacher.TeaName + " - 分配" + plan.PlanId + "批次答辩小组");
                Response.Write("分配成功");
                Response.End();
            }
            else
            {
                Response.Write("分配失败");
                Response.End();
            }
        }
Пример #2
0
        private void isTeacher()
        {
            Teacher tea = teacherBll.GetModel(account);

            if (!teacherBll.selectByteaId(account))
            {
                Response.Write("账号不存在,请检查用户类型");
                Response.End();
            }
            else if (email != tea.Email)
            {
                Response.Write("邮箱错误");
                Response.End();
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //TODO 改成从session里获取值
            teacher = (Teacher)Session["loginuser"];
            TeacherBll tbll = new TeacherBll();

            teacher = tbll.GetModel(teacher.TeaAccount);
            string op = Request.QueryString["op"];

            if (op == "update")
            {
                string  phone   = Context.Request["phone"].ToString();
                string  Email   = Context.Request["Email"].ToString();
                Teacher newTea  = new Teacher();
                College college = new College();
                try
                {
                    newTea.TeaAccount = teacher.TeaAccount;
                    newTea.TeaName    = teacher.TeaName;
                    newTea.TeaPwd     = teacher.TeaPwd;
                    newTea.Sex        = teacher.Sex;
                    newTea.college    = teacher.college;
                    newTea.TeaType    = teacher.TeaType;
                    newTea.Phone      = phone;
                    newTea.Email      = Email;
                    updata(newTea);
                }
                catch (Exception ex)
                {
                    LogHelper.Error(this.GetType(), ex);
                }
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            stu        = (Student)Session["loginuser"];
            stuAccount = stu.StuAccount.ToString();
            ds         = titleRecordBll.Select();
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count != 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        int    j       = ds.Tables[0].Rows.Count - 1;
                        string account = ds.Tables[0].Rows[i]["stuAccount"].ToString();
                        if (stuAccount == ds.Tables[0].Rows[i]["stuAccount"].ToString())
                        {
                            string tId = ds.Tables[0].Rows[i]["titleId"].ToString();
                            title     = titleBll.GetTitle(int.Parse(tId));
                            showTitle = title.title.ToString();
                            if (showTitle == "")
                            {
                                Response.Write("<a href='paperList.aspx'>你还没有选题,请点击跳转到选题界面  </a>");
                                Response.End();
                            }
                            showTitleContent = title.TitleContent.ToString();
                            //
                            teaAccount = title.teacher.TeaAccount;
                            teacher    = tbll.GetModel(teaAccount);
                            teaName    = teacher.TeaName;
                            sex        = teacher.Sex;
                            college    = teacher.college.ColName;
                            phone      = teacher.Phone;
                            email      = teacher.Email;
                            teaAccount = teacher.TeaAccount;
                            //
                            showTeaName = title.teacher.TeaName.ToString();
                            break;
                        }
                    }
                }
            }
            string op = Context.Request.QueryString["op"];

            if (op == "selectTitle")
            {
                StusecltTitle();
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string op = Request["op"];
                if (op == "login")
                {
                    account  = Request["userName"].Trim();
                    pwd      = Request["pwd"].Trim();
                    captcha  = Request["captcha"].ToLower();
                    usertype = Request["type"].Trim();
                    string Verification = vildata();
                    string roles        = "";
                    if (Verification.Length == 0)
                    {
                        int loginstate       = 0;
                        RSACryptoService rsa = new RSACryptoService();
                        switch (usertype)
                        {
                        case "teacher":
                            TeacherBll teaBll = new TeacherBll();
                            if (teaBll.GetModel(account).TeaType == 1)
                            {
                                Teacher tea = teaBll.Login(account, rsa.Decrypt(pwd));
                                if (tea == null)
                                {
                                    loginstate = 0;
                                }
                                else
                                {
                                    loginstate           = 1;
                                    Session["loginuser"] = tea;
                                    Session["state"]     = 1;
                                    Response.Cookies[FormsAuthentication.FormsCookieName].Value = null;
                                    roles = "teacher";
                                    FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, account, DateTime.Now, DateTime.Now.AddMinutes(30), true, roles); //建立身份验证票对象
                                    string HashTicket = FormsAuthentication.Encrypt(Ticket);                                                                              //加密序列化验证票为字符串
                                    //Session["HashTicket"] = HashTicket;
                                    HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket);                                              //生成Cookie
                                    Context.Response.Cookies.Add(UserCookie);                                                                                             //票据写入Cookie
                                    isLogined(account);
                                }
                            }
                            else
                            {
                                Response.Write("管理员");
                                Response.End();
                            }
                            break;

                        case "student":
                            StudentBll sdao = new BLL.StudentBll();
                            Student    stu  = sdao.Login(account, rsa.Decrypt(pwd));

                            if (stu == null)
                            {
                                loginstate = 0;
                            }
                            else
                            {
                                loginstate           = 1;
                                Session["loginuser"] = stu;
                                Session["state"]     = 3;
                                Response.Cookies[FormsAuthentication.FormsCookieName].Value = null;
                                roles = "student";
                                FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, account, DateTime.Now, DateTime.Now.AddMinutes(30), true, roles); //建立身份验证票对象
                                string HashTicket = FormsAuthentication.Encrypt(Ticket);                                                                              //加密序列化验证票为字符串
                                //Session["HashTicket"] = HashTicket;
                                HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket);                                              //生成Cookie
                                Context.Response.Cookies.Add(UserCookie);                                                                                             //票据写入Cookie
                                isLogined(account);
                            }
                            break;
                        }
                        if (loginstate == 0)
                        {
                            Response.Write("用户名或密码错误");
                            Response.End();
                        }
                        else if (loginstate == 1)
                        {
                            if (Convert.ToInt32(Session["state"]) == 1)
                            {
                                Teacher tea = (Teacher)Session["loginuser"];
                                LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 登录");
                            }
                            else if (Convert.ToInt32(Session["state"]) == 3)
                            {
                                Student stu = (Student)Session["loginuser"];
                                LogHelper.Info(this.GetType(), stu.StuAccount + " - " + stu.RealName + " - 登录");
                            }
                            Response.Write("登录成功");
                            Response.End();
                        }
                        else
                        {
                            Response.Write("登录失败");
                            Response.End();
                        }
                    }
                    else
                    {
                        LogHelper.Error(this.GetType(), account + " - " + Verification);
                        Response.Write(Verification);
                        Response.End();
                    }
                }
            }
            catch
            {
            }
        }
Пример #6
0
        /// <summary>
        /// 添加学院管理员
        /// </summary>
        public void insertAdmin()
        {
            string account = Context.Request["account"].ToString();
            string name    = Context.Request["name"].ToString();
            string sex     = Context.Request["sex"].ToString();
            string college = Context.Request["college"].ToString();
            string email   = Context.Request["email"].ToString();
            string phone   = Context.Request["phone"].ToString();

            try
            {
                if (teaBll.selectByColl(Convert.ToInt32(college)))
                {
                    Response.Write("该学院已设置过分院管理员");
                    Response.End();
                }
                else if (teaBll.selectByteaId(account))
                {
                    if (teaBll.GetModel(account).TeaType == 2)
                    {
                        Response.Write("该教师已为分院管理员");
                        Response.End();
                    }
                }
                else if (teaBll.selectByEmail(email))
                {//根据输入的邮箱查找是否已存在
                    Response.Write("此邮箱已存在");
                    Response.End();
                }
                else if (teaBll.selectByPhone(phone))
                {//根据输入的联系电话查找是否已存在
                    Response.Write("此联系电话已存在");
                    Response.End();
                }
                else
                {
                    tea.TeaAccount = account;
                    tea.TeaName    = name;
                    tea.Sex        = sex;
                    coll.ColID     = int.Parse(college);
                    tea.college    = coll;
                    tea.Email      = email;
                    tea.Phone      = phone;
                    RSACryptoService rsa = new RSACryptoService();
                    tea.TeaPwd  = rsa.Encrypt("000000");
                    tea.TeaType = 2;
                    result      = teaBll.Insert(tea);
                    if (result == Result.添加成功)
                    {
                        LogHelper.Info(this.GetType(), admin.TeaAccount + " - " + admin.TeaName + " - 添加分院管理员");
                        Response.Write("添加成功");
                        Response.End();
                    }
                    else
                    {
                        Response.Write("添加失败");
                        Response.End();
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(this.GetType(), ex);
            }
        }
Пример #7
0
        public void insert()
        {
            //获取评定及成绩
            double score         = Convert.ToDouble(Request["score"]);
            string investigation = Request["investigation"];
            string practice      = Request["practice"];
            string solveProblem  = Request["solveProblem"];
            string workAttitude  = Request["workAttitude"];
            string quality       = Request["quality"];
            string evaluate      = Request["evaluate"];
            string innovate      = Request["innovate"];
            string crossTea      = Request["crossTea"];
            //添加评定及成绩
            Student student = new Student();
            Plan    plan    = new Plan();

            try
            {
                student.StuAccount       = stuAccount;
                plan.PlanId              = planId;
                scoreModel.student       = student;
                scoreModel.plan          = plan;
                scoreModel.guideScore    = score;
                scoreModel.investigation = investigation;
                scoreModel.practice      = practice;
                scoreModel.solveProblem  = solveProblem;
                scoreModel.workAttitude  = workAttitude;
                scoreModel.paperDesign   = quality;
                scoreModel.innovate      = innovate;
                scoreModel.evaluate      = evaluate;
                //添加交叉指导教师
                CrossBll    crossBll    = new CrossBll();
                PathBll     pathBll     = new PathBll();
                TitleRecord titleRecord = new TitleRecord();
                Cross       cross       = new Cross();
                Path        path        = new Path();
                Teacher     teacher     = new Teacher();
                titleRecord.TitleRecordId = titleRecordId;
                cross.titleRecord         = titleRecord;
                teacher.TeaAccount        = crossTea;
                cross.teacher             = teacher;

                path.titleRecord = titleRecord;
                path.state       = 3;
                path.type        = 0;
                Result state = pathBll.updateState(path);
                if (state == Result.更新成功)
                {
                    Result recordState = titlebll.updateState(titleRecord.TitleRecordId);
                    if (recordState == Result.更新成功)
                    {
                        Result result = crossBll.Insert(cross);
                        if (result == Result.添加成功)
                        {
                            StudentBll studentBll = new StudentBll();
                            Student    stu        = studentBll.GetModel(stuAccount);
                            TeacherBll teacherBll = new TeacherBll();
                            Teacher    tea        = teacherBll.GetModel(crossTea);
                            LogHelper.Info(this.GetType(), teacher.TeaAccount + " - " + teacher.TeaName + " - 教师指定 - " + stuAccount + " - " + stu.RealName + " - 学生的交叉指导教师 - " + teacher + " - " + tea.TeaName);
                            Result row = sbll.insertInstructorsComments(scoreModel);
                            if (row == Result.添加成功)
                            {
                                LogHelper.Info(this.GetType(), teacher.TeaAccount + " - " + teacher.TeaName + " - 教师添加 - " + stuAccount + " - " + stu.RealName + " - 学生的指导成绩及评定");
                                Response.Write("提交成功");
                                Response.End();
                            }
                            else
                            {
                                Response.Write("提交失败");
                                Response.End();
                            }
                        }
                        else
                        {
                            Response.Write("提交失败");
                            Response.End();
                        }
                    }
                    else
                    {
                        Response.Write("提交失败");
                        Response.End();
                    }
                }
                else
                {
                    Response.Write("提交失败");
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(this.GetType(), ex);
            }
        }
Пример #8
0
        /// <summary>
        /// 编辑批次
        /// </summary>
        public void EditorPlan()
        {
            string   planName  = Context.Request["editorPlanName"].ToString();
            DateTime startTime = Convert.ToDateTime(Context.Request["editorStartTime"].ToString()),
                     endTime   = Convert.ToDateTime(Context.Request["editorEndTime"].ToString());
            int state          = int.Parse(Context.Request["editorState"].ToString()),
                planId         = int.Parse(Context.Request["editorPlanId"].ToString());
            //collegeId = int.Parse(Context.Request["planCollegeId"].ToString());

            //获取院系id
            Teacher    teacher    = (Teacher)Session["user"];
            string     account    = teacher.TeaAccount;
            TeacherBll teacherBll = new TeacherBll();

            loginUser = teacherBll.GetModel(account);
            College ColID = loginUser.college;

            Plan plan = new Plan()
            {
                PlanId    = planId,
                PlanName  = planName,
                StartTime = startTime,
                EndTime   = endTime,
                State     = state,
                college   = ColID
            };

            try
            {
                PlanBll pBll         = new PlanBll();
                Result  EditorResult = pBll.Update(plan);
                //字符串转日期
                string   start   = Convert.ToDateTime(startTime).ToString("yyyy-MM-dd HH:mm:ss");
                DateTime startdt = Convert.ToDateTime(start);
                string   end     = Convert.ToDateTime(endTime).ToString("yyyy-MM-dd HH:mm:ss");
                DateTime enddt   = Convert.ToDateTime(end);
                TimeSpan ts      = enddt - startdt;
                //间隔天数小于1则不能
                if (ts.Days >= 1)
                {
                    if (EditorResult == Result.更新成功)
                    {
                        LogHelper.Info(this.GetType(), loginUser.TeaAccount + " - " + loginUser.TeaName + " - 编辑" + planId + "批次");
                        Response.Write("更新成功");
                        //Response.End();
                    }
                    else
                    {
                        Response.Write("更新失败");
                        //Response.End();
                    }
                }
                else
                {
                    Response.Write("开始与结束时间间隔必须大于1天");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(this.GetType(), ex);
            }
            finally
            {
                Response.End();
            }
        }
Пример #9
0
        /// <summary>
        /// 添加批次
        /// </summary>
        public void savePlan()
        {
            //获取参数
            string planName  = Context.Request["planName"].ToString(),
                   startTime = Context.Request["startTime"].ToString(),
                   endTime   = Context.Request["endTime"].ToString(),
            //college = Context.Request["college"].ToString(),
                   planstate = Context.Request["state"].ToString();

            try
            {
                //获取院系id
                Teacher    teacher    = (Teacher)Session["user"];
                string     account    = teacher.TeaAccount;
                TeacherBll teacherBll = new TeacherBll();
                loginUser = teacherBll.GetModel(account);
                College ColID = loginUser.college;

                if (planName != "" && startTime != "" && endTime != "" && state.ToString() != "")
                {
                    //int collegeId = int.Parse(college),
                    int state = int.Parse(planstate);
                    //字符串转日期
                    string   start   = Convert.ToDateTime(startTime).ToString("yyyy-MM-dd HH:mm:ss");
                    DateTime startdt = Convert.ToDateTime(start);
                    string   end     = Convert.ToDateTime(endTime).ToString("yyyy-MM-dd HH:mm:ss");
                    DateTime enddt   = Convert.ToDateTime(end);

                    //判断当开始时间在结束时间之后时,不能执行添加
                    TimeSpan ts = enddt - startdt;
                    if (ts.Days >= 1)
                    {
                        Plan plan = new Plan()
                        {
                            PlanName  = planName,
                            StartTime = startdt,
                            EndTime   = enddt,
                            State     = state,
                            college   = ColID
                        };
                        PlanBll pBll   = new PlanBll();
                        Result  result = pBll.Insert(plan);
                        if (result == Result.添加成功)
                        {
                            LogHelper.Info(this.GetType(), loginUser.TeaAccount + loginUser.TeaName + "-添加批次");
                            Response.Write("添加成功");
                            Response.End();
                        }
                        else
                        {
                            Response.Write("添加失败");
                            Response.End();
                        }
                    }
                    else
                    {
                        Response.Write("开始与结束时间间隔必须大于1天");
                        Response.End();
                    }
                }
                else
                {
                    Response.Write("以上内容不能出现未填项");
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(this.GetType(), ex);
            }
        }
Пример #10
0
        /// <summary>
        /// 添加教师
        /// </summary>
        public void saveTeacher()
        {
            string teaAccount = Context.Request["TeaAccount"].ToString();

            if (!teabll.selectByteaId(teaAccount))
            {
                try
                {
                    int collegeId = Convert.ToInt32(Context.Request["CollegeId"]);
                    //int teaType = Convert.ToInt32(Context.Request["TeaType"]);
                    //string pwd = Context.Request["Pwd"].ToString();
                    string teaName = Context.Request["TeaName"].ToString();
                    string sex     = Context.Request["Sex"].ToString();
                    string email   = Context.Request["Email"].ToString();
                    string tel     = Context.Request["Tel"].ToString();
                    if (teabll.selectByEmail(email))
                    {//根据输入的邮箱查找是否已存在
                        Response.Write("此邮箱已存在");
                        Response.End();
                    }
                    else if (teabll.selectByPhone(tel))
                    {//根据输入的联系电话查找是否已存在
                        Response.Write("此联系电话已存在");
                        Response.End();
                    }
                    else
                    {
                        Teacher tea     = new Teacher();
                        College college = new College();
                        Teacher teacher = teabll.GetModel(tealogin.TeaAccount);
                        if (state == 0)
                        {
                            college.ColID = collegeId;
                        }
                        else
                        {
                            college.ColID = tealogin.college.ColID;
                        }
                        tea.college    = college;
                        tea.TeaType    = 1;
                        tea.TeaAccount = teaAccount;
                        RSACryptoService rsa = new RSACryptoService();
                        tea.TeaPwd  = rsa.Encrypt("000000");
                        tea.TeaName = teaName;
                        tea.Sex     = sex;
                        tea.Email   = email;
                        tea.Phone   = tel;
                        OpResult result = teabll.Insert(tea);
                        if (result == OpResult.添加成功)
                        {
                            LogHelper.Info(this.GetType(), tealogin.TeaAccount + " - " + tealogin.TeaName + " - 添加教师账号");
                            Response.Write("添加成功");
                            Response.End();
                        }
                        else
                        {
                            Response.Write("添加失败");
                            Response.End();
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.Error(this.GetType(), ex);
                }
            }
            else
            {
                Response.Write("此账号已存在");
                Response.End();
            }
        }