Esempio n. 1
0
        private void btLogin_Click(object sender, EventArgs e)
        {
            string username = tbAccount.Text.Trim();
            string password = tbPassword.Text.Trim();

            if (username == "")
            {
                MessageBox.Show("账号不能为空!");
            }
            else if (password == "")
            {
                MessageBox.Show("密码不能为空!");
            }
            else
            {
                TeacherBll teabll = new TeacherBll();
                Teacher    tea    = teabll.GetUserInfoModel(username, password);
                if (tea != null)
                {
                    Main t = new Main(tbAccount.Text.Trim());
                    t.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("登录失败,账号或密码错误", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
0
        private void Btn_DeleteQuestion(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(QuestionIdTextBox.Text))
            {
                MessageBox.Show("Id field is empty");
                return;
            }
            var teacher = new TeacherBll();

            if (teacher.DeleteQuestionById(int.Parse(QuestionIdTextBox.Text)))
            {
                QStatemenTextBox.Text = "";
                OptionATextBox.Text   = "";
                OptionBTextBox.Text   = "";
                OptionCTextBox.Text   = "";
                OptionDTextBox.Text   = "";
                OptionBox.Text        = "";
                MessageBox.Show("Question deleted");
                myQuestion = null;
            }
            else
            {
                MessageBox.Show("Something went wrong,Question already deleted or Does not exist");
            }
        }
        private void GetData()
        {
            var             teacherBll = new TeacherBll();
            List <Question> list       = teacherBll.GetQuestionsList();

            QuizDataGrid.ItemsSource = list;
        }
Esempio n. 5
0
        public IEnumerable <TeachersWorkloadBll> GetTWOfCurrentTeacher()
        {
            TeacherBll teacher = GetCurrentTeacherId();
            IEnumerable <TeachersWorkload>    teacherWorkloads = db.TeachersWorkloads.Get(tw => tw.TeacherId == teacher.Id).ToList();
            IEnumerable <TeachersWorkloadBll> workloadBlls     = mapper.Map <IEnumerable <TeachersWorkloadBll> >(teacherWorkloads);

            return(workloadBlls);
        }
        public CourseViewEditPresenter(CourseEditView courseEditView, CourseBll courseBll, TeacherBll teacherBll)
        {
            _courseEditView = courseEditView;
            _courseBll      = courseBll;
            _teacherBll     = teacherBll;

            UpdateForm();
        }
Esempio n. 7
0
        public TeacherFormPresenter(TeacherEditView teacherEditView, StudentBll studentBll, TeacherBll teacherBll)
        {
            _teacherEditView = teacherEditView;
            _studentBll      = studentBll;
            _teacherBll      = teacherBll;

            UpdateForm();
        }
Esempio n. 8
0
        public IEnumerable <TeachersWorkloadBll> GetTWOfCurrentTeacher(int groupId, int subjectId)
        {
            TeacherBll teacher = GetCurrentTeacherId();
            IEnumerable <TeachersWorkload> teacherWorkloads = db.TeachersWorkloads.Get(tw =>
                                                                                       (tw.TeacherId == teacher.Id) &&
                                                                                       (tw.Group.Id == groupId) &&
                                                                                       (tw.Subject.Id == subjectId)).ToList();
            IEnumerable <TeachersWorkloadBll> workloadBlls = mapper.Map <IEnumerable <TeachersWorkloadBll> >(teacherWorkloads);

            return(workloadBlls);
        }
Esempio n. 9
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="strWhere">搜索条件</param>
        public void getdata(String strWhere)
        {
            string currentPage = Request.QueryString["currentPage"];
            if (currentPage == null || currentPage.Length <= 0)
            {
                currentPage = "1";
            }
            string userType = Session["state"].ToString();
            string userCollege = "";
            //usertype=2 为分院管理员登录
            TeacherBll teaBll = new TeacherBll();
            if (userType == "2")
            {
                int userCollegeId = teacher.college.ColID;
                if (strWhere == null || strWhere == "")
                {
                    userCollege = "collegeId=" + userCollegeId + "";
                }
                else
                {
                    userCollege = "collegeId=" + userCollegeId + "and" + "(" + strWhere + ")";
                }
                TableBuilder tabuilder = new TableBuilder()
                {
                    StrTable = "V_Defence",
                    StrWhere = userCollege,
                    IntColType = 0,
                    IntOrder = 0,
                    IntPageNum = int.Parse(currentPage),
                    IntPageSize = pagesize,
                    StrColumn = "defenGroupId",
                    StrColumnlist = "*"
                };
                getCurrentPage = int.Parse(currentPage);
                ds = teaBll.SelectBypage(tabuilder, out count);

            }
            else
            {
                TableBuilder tabuilder = new TableBuilder()
                {
                    StrTable = "V_Defence",
                    StrWhere = strWhere == null || strWhere == "" ? "" : strWhere,
                    IntColType = 0,
                    IntOrder = 0,
                    IntPageNum = int.Parse(currentPage),
                    IntPageSize = pagesize,
                    StrColumn = "defenGroupId",
                    StrColumnlist = "*"
                };
                getCurrentPage = int.Parse(currentPage);
                ds = teaBll.SelectBypage(tabuilder, out count);
            }
        }
Esempio n. 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try {
         string     teaAccount = Request.QueryString["userName"].ToString();
         string     pwd        = Request.QueryString["pwd"].ToString();
         TeacherBll bll        = new TeacherBll();
         //int row = bll.Login(teaAccount, pwd);
         // Response.Write("<script>alert(" + row + ");</script>");
     } catch {
     }
 }
Esempio n. 11
0
        private void Btn_AddQuestion(object sender, RoutedEventArgs e)
        {
            var teacherBll = new TeacherBll();

            if (string.IsNullOrEmpty(BrowseFile))
            {
                if (string.IsNullOrEmpty(OptionComboBox.Text) ||
                    string.IsNullOrEmpty(OptionATextBox.Text) ||
                    string.IsNullOrEmpty(OptionBTextBox.Text) ||
                    string.IsNullOrEmpty(OptionCTextBox.Text) ||
                    string.IsNullOrEmpty(OptionDTextBox.Text) ||
                    string.IsNullOrEmpty(QStatemenTextBox.Text))
                {
                    MessageBox.Show("One of the text field is empty.");
                    return;
                }
            }
            else
            {
                if (teacherBll.AddQuestionsFromFile(BrowseFile))
                {
                    MessageBox.Show("Questions Added Succlessfully");
                    Close();
                    return;
                }
                else
                {
                    MessageBox.Show("Something went Wrong");
                    return;
                }
            }
            var question = new Question()
            {
                QuestionStatement = QStatemenTextBox.Text,
                Answer            = OptionComboBox.Text,
                OptionA           = OptionATextBox.Text,
                OptionB           = OptionBTextBox.Text,
                OptionC           = OptionCTextBox.Text,
                OptionD           = OptionDTextBox.Text
            };

            if (teacherBll.AddQuestion(question))
            {
                MessageBox.Show("Question Added");
                Close();
            }
            else
            {
                MessageBox.Show("Sorry. Something went wrong.");
            }
        }
Esempio n. 12
0
        private void Button_PostAnnouncement(object sender, RoutedEventArgs e)
        {
            var announcement = new BusinessObjects.Announcement()
            {
                Title    = TitleAnnouncemenTextBox.Text,
                Comments = CommentsTextBox.Text
            };

            var teacher = new TeacherBll();

            if (teacher.AddAnouncement(announcement))
            {
                MessageBox.Show("Announcement Added");
            }
        }
Esempio n. 13
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            var    teacherBll = new TeacherBll();
            string userName   = TxtBoxUserName.Text;
            string password   = TxtBoxPassword.Password;

            if (RBtnTeacher.IsChecked == true)
            {
                var teacher = new Teacher()
                {
                    UserName = userName,
                    Password = password
                };

                if (teacherBll.Login(teacher))
                {
                    var teacherDashboard = new TeacherDashboard();
                    //Close();
                    teacherDashboard.Show();
                }
                else
                {
                    MessageBox.Show("Invalid Credentials");
                }
            }
            else if (RBtnStudent.IsChecked == true)
            {
                var studentBll = new StudentBll();
                var student    = new Student()
                {
                    UserName = userName,
                    Password = password
                };
                if (studentBll.Login(student))
                {
                    var studentDashboard = new StudentDashboard();
                    //Close();
                    studentDashboard.Show();
                }
                else
                {
                    MessageBox.Show("Invalid Credentials");
                }
            }
        }
Esempio n. 14
0
        public void updata(Teacher teacher)
        {
            TeacherBll bll = new TeacherBll();

            Enums.OpResult enums = bll.Updata(teacher);
            if (enums.Equals(Enums.OpResult.更新成功))
            {
                LogHelper.Info(this.GetType(), teacher.TeaAccount + " - " + teacher.TeaName + " - 管理员修改个人信息");
                Response.Write("修改成功");
                Session["user"] = teacher;
                Response.End();
            }
            else
            {
                Response.Write("修改失败");
                Response.End();
            }
        }
Esempio n. 15
0
        public void getdata(String strWhere, int IntPageNum)
        {
            BLL.TeacherBll      sdao      = new TeacherBll();
            Dao.PublicProcedure pro       = new Dao.PublicProcedure();
            TableBuilder        tabuilder = new TableBuilder()
            {
                StrTable      = "V_Teacher",
                StrWhere      = strWhere,
                IntColType    = 0,
                IntOrder      = 0,
                IntPageNum    = IntPageNum,
                IntPageSize   = 2,
                StrColumn     = "teaAccount",
                StrColumnlist = "*"
            };
            int count;

            ds = pro.SelectBypage(tabuilder, out count);
        }
Esempio n. 16
0
        private void btn_changePassword(object sender, RoutedEventArgs e)
        {
            string oldPassword     = OldPassword.Password;
            string newPassword     = NewPassword.Password;
            string confirmPassword = ConfirmPassword.Password;
            var    teacherBll      = new TeacherBll();

            if (!newPassword.Equals(confirmPassword))
            {
                MessageBox.Show("Passwords donot match.");
            }
            else if (teacherBll.ChangePassword(oldPassword, newPassword))
            {
                MessageBox.Show("Password Changed.");
                this.Close();
            }
            else
            {
                MessageBox.Show("Wrong Old Password.");
            }
        }
Esempio n. 17
0
        private void Btn_UpdateQuestion(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(QuestionIdTextBox.Text))
            {
                MessageBox.Show("Id field is empty");
                return;
            }
            var teacher = new TeacherBll();

            _myQuestion.QuestionStatement = QStatemenTextBox.Text;
            _myQuestion.OptionA           = OptionATextBox.Text;
            _myQuestion.OptionB           = OptionBTextBox.Text;
            _myQuestion.OptionC           = OptionCTextBox.Text;
            _myQuestion.OptionD           = OptionDTextBox.Text;
            _myQuestion.Answer            = OptionBox.Text;
            if (teacher.UpdateQuestionById(_myQuestion))
            {
                MessageBox.Show("Question Updated");
            }
            else
            {
                MessageBox.Show("Something went wrong");
            }
        }
Esempio n. 18
0
        private void Btn_FindQuestion(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(QuestionIdTextBox.Text))
            {
                MessageBox.Show("Id field is empty");
                return;
            }


            var teacher = new TeacherBll();

            List <Question> list = teacher.GetQuestionsList();

            foreach (Question question in list)
            {
                if (question.QuestionNo == QuestionIdTextBox.Text)
                {
                    myQuestion = question;
                    break;
                }
            }

            if (myQuestion != null)
            {
                QStatemenTextBox.Text = myQuestion.QuestionStatement;
                OptionATextBox.Text   = myQuestion.OptionA;
                OptionBTextBox.Text   = myQuestion.OptionB;
                OptionCTextBox.Text   = myQuestion.OptionC;
                OptionDTextBox.Text   = myQuestion.OptionD;
                OptionBox.Text        = myQuestion.Answer;
            }
            else
            {
                MessageBox.Show("Nothing found");
            }
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                stuAccount    = Request.QueryString["stuAccount"];
                titleRecordId = Convert.ToInt32(Request.QueryString["titleRecordId"]);
                if (stuAccount != null)
                {
                    Session["stuAccount"]    = stuAccount;
                    Session["titleRecordId"] = titleRecordId;
                }
                else
                {
                    stuAccount    = Session["stuAccount"].ToString();
                    titleRecordId = Convert.ToInt32(Session["titleRecordId"].ToString());
                }
            }
            //获取查重报告状态
            Path path = pathBll.getState(titleRecordId, 1);

            if (path == null)
            {
                checkState = 0;
            }
            else
            {
                checkState = path.state;
            }
            //获取中期质量报告状态
            MedtermQualityBll qualityBll = new MedtermQualityBll();
            MedtermQuality    medterm    = qualityBll.getState(titleRecordId);

            if (medterm == null)
            {
                midState = 0;
            }
            else
            {
                midState = medterm.state;
            }
            //获取论文完成状态
            Path pathPaper = pathBll.getState(titleRecordId, 0);

            if (pathPaper == null)
            {
                paperState = 0;
            }
            else
            {
                paperState = pathPaper.state;
            }
            getData = titlebll.GetByAccount(stuAccount);
            int i = getData.Tables[0].Rows.Count - 1;

            planId = Convert.ToInt32(getData.Tables[0].Rows[i]["planId"]);
            int proId = Convert.ToInt32(getData.Tables[0].Rows[i]["proId"]);

            teacher = (Teacher)Session["loginuser"];
            TeacherBll teaBll = new TeacherBll();
            int        a      = teacher.college.ColID;

            dsTitle = teaBll.getByColl(teacher.college.ColID, teacher.TeaAccount);
            string op = Request["op"];

            if (op == "submit")
            {
                insert();
            }
        }
Esempio n. 20
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
            {
            }
        }
Esempio n. 21
0
        /// <summary>
        ///   //批量导入
        /// </summary>
        public void upload()
        {
            try
            {
                Teacher            user = (Teacher)Session["user"];          //获取当前用户账号作为文件夹名称
                HttpFileCollection file = HttpContext.Current.Request.Files; //从HTTP文件流读取上传文件
                if (file.Count > 0)
                {
                    //文件大小
                    long size = file[0].ContentLength;
                    //文件类型
                    string type = file[0].ContentType;
                    //文件名 IE浏览器文件名是绝对路径,服务器文件夹名称不支持(//),其他浏览器为文件名(兼容IE)
                    string filename = "";
                    if (filename.IndexOf("\\") != -1)          //判断路径中是否包含\\
                    {
                        string[] a = filename.Split('\\');     //分割字符串
                        filename = a[a.Length - 1].ToString(); //获取数组 最后一位作为文件夹名称
                    }
                    else
                    {
                        filename = file[0].FileName;//不是IE 直接返回文件名称作为文件夹名称
                    }
                    //文件格式
                    string tp = System.IO.Path.GetExtension(filename);
                    if (tp == ".xls" || tp == "xlsx")
                    {
                        DirectoryInfo dir;
                        //将文件导入服务器
                        string savePath = Server.MapPath("~/upload/专业信息导入存储");//指定上传文件,在服务器保存路径
                        dir = new DirectoryInfo(savePath);
                        dir.Create();

                        DateTime d        = DateTime.Now;
                        string   datetime = d.ToString("yyyyMMddHHmmss");
                        string   name     = datetime + "-" + filename;       //将当前时间作为文件名称
                        savePath = savePath + "\\" + name;                   //路径合并
                        file[0].SaveAs(savePath);                            //存入服务器
                        var        dt  = ExcelHelper.GetDataTable(savePath); //从服务器路径读取数据成DataTable
                        TeacherBll bll = new TeacherBll();
                        int        row = bll.upload(dt);
                        if (row > 0)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", "<script>alert('导入失败');</script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", "<script>alert('导入成功');</script>");
                        }
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", "<script>alert('Excel格式不正确');</script>");
                    }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", "<script>alert('请选择上传文件');</script>");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(this.GetType(), ex);
                Response.Write(ex.Message);
            }
        }
 public TeacherEditView(StudentBll studentBll, TeacherBll teacherBll)
 {
     InitializeComponent();
     _teacherFormPresenter = new TeacherFormPresenter(this, studentBll, teacherBll);
 }
Esempio n. 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string op = Context.Request["op"];

            article = Request.QueryString["article"];
            //调用下拉菜单数据
            TeacherBll teabll = new TeacherBll();
            //TODO 获取当前登录的教师账号
            Teacher tea = (Teacher)Session["loginuser"];
            //加载登录教师所在分院的专业
            TableBuilder tabuilderPro = new TableBuilder();

            tabuilderPro.StrTable      = "T_Profession";
            tabuilderPro.StrWhere      = "collegeId = '" + tea.college.ColID + "'";
            tabuilderPro.IntColType    = 0;
            tabuilderPro.IntOrder      = 0;
            tabuilderPro.IntPageNum    = 1;
            tabuilderPro.IntPageSize   = 100;
            tabuilderPro.StrColumn     = "proId";
            tabuilderPro.StrColumnlist = "*";
            prods = probll.SelectBypage(tabuilderPro, out count);
            //加载登录教师所在分院的批次
            TableBuilder tabuilderPlan = new TableBuilder();

            tabuilderPlan.StrTable      = "T_Plan";
            tabuilderPlan.StrWhere      = "collegeId = '" + tea.college.ColID + "'";
            tabuilderPlan.IntColType    = 0;
            tabuilderPlan.IntOrder      = 0;
            tabuilderPlan.IntPageNum    = 1;
            tabuilderPlan.IntPageSize   = 100;
            tabuilderPlan.StrColumn     = "planId";
            tabuilderPlan.StrColumnlist = "*";
            plands = pbll.SelectBypage(tabuilderPlan, out count);

            if (article == "edit")
            {
                string titleId = Request.QueryString["titleId"];
                Session["titleId"] = titleId;
                TitleBll titBll = new TitleBll();
                titleEdit = titBll.GetTitle(Convert.ToInt32(titleId));
                //string ti = title.Limit.ToString();
            }
            else
            {
                TitleBll titlebll = new TitleBll();
                Title    title    = new Title();
                if (op == "new")
                {
                    try
                    {
                        string paperTitle   = Request["paperTitle"].ToString();
                        string profession   = Request["profession"].ToString();
                        string plans        = Request["plan"].ToString();
                        string numMax       = Request["numMax"].ToString();
                        string paperContent = Request["paperContent"].ToString();
                        title.title        = paperTitle;
                        title.TitleContent = HttpUtility.UrlDecode(paperContent);
                        title.CreateTime   = DateTime.Now;
                        //TODO 专业批次选定人数为固定值,需重新改动
                        title.Selected = 0;
                        title.Limit    = int.Parse(numMax);
                        title.teacher  = (Teacher)Session["loginuser"];
                        title.plan     = new Plan {
                            PlanId = Convert.ToInt32(plans)
                        };
                        title.profession = new Profession {
                            ProId = Convert.ToInt32(profession)
                        };

                        Result result = titlebll.Insert(title);
                        if (result == Result.添加成功)
                        {
                            LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 发布论文");
                            Response.Write("添加成功");
                            Response.End();
                        }
                        else
                        {
                            Response.Write("添加失败");
                            Response.End();
                        }
                    }catch (Exception ex)
                    {
                        LogHelper.Error(this.GetType(), ex);
                    }
                }
                else if (op == "edit")
                {
                    try
                    {
                        string paperTitle   = Request["paperTitle"].ToString();
                        string profession   = Request["profession"].ToString();
                        string plans        = Request["plan"].ToString();
                        string numMax       = Request["numMax"].ToString();
                        string paperContent = Request["paperContent"].ToString();
                        title.TitleId      = Convert.ToInt32(Session["titleId"].ToString());
                        title.title        = paperTitle;
                        title.TitleContent = HttpUtility.UrlDecode(paperContent);
                        title.CreateTime   = DateTime.Now;
                        //TODO 专业批次选定人数为固定值,需重新改动
                        title.Selected = 0;
                        title.Limit    = int.Parse(numMax);
                        title.teacher  = tea;
                        title.plan     = new Plan {
                            PlanId = 1
                        };
                        title.profession = new Profession {
                            ProId = 1
                        };
                        Result result = titlebll.Update(title);
                        if (result == Result.更新成功)
                        {
                            LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 修改" + Session["titleId"].ToString() + "论文");
                            Response.Write("更新成功");
                            Response.End();
                        }
                        else
                        {
                            Response.Write("更新失败");
                            Response.End();
                        }
                    }catch (Exception ex)
                    {
                        LogHelper.Error(this.GetType(), ex);
                    }
                }
            }
        }
Esempio n. 24
0
 public TeacherController()
 {
     rb = new ReviewBll();
     tb = new TeacherBll();
     cb = new ClassBll();
 }
Esempio n. 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string     op         = Request["op"];
            ScoreBll   scoreBll   = new ScoreBll();
            TeacherBll teacherBll = new TeacherBll();
            PlanBll    planBll    = new PlanBll();
            Teacher    teacher    = new Teacher();
            College    college    = new College();
            Score      score      = new Score();
            Teacher    tea        = (Teacher)Session["user"];
            int        collegeId  = tea.college.ColID;
            string     startTime  = DateTime.Now.ToString("yyyy-MM");
            Plan       plan       = planBll.getPlanId(collegeId, startTime + "%");
            int        planId     = plan.PlanId;

            try
            {
                if (op == "open")
                {
                    int state = 1;
                    teacher.state   = 0;
                    college.ColID   = collegeId;
                    teacher.college = college;
                    Result result = scoreBll.openScore(state, planId);
                    Result row    = teacherBll.updateState(teacher);
                    if (result == Result.更新成功 && row == Result.更新成功)
                    {
                        LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 开放查看成绩");
                        Response.Write("成绩已开放");
                        Response.End();
                    }
                    else
                    {
                        Response.Write("成绩开放失败,可能当前批次没有可开放成绩");
                        Response.End();
                    }
                }
                else if (op == "close")
                {
                    int    state  = 0;
                    Result result = scoreBll.openScore(state, planId);
                    if (result == Result.更新成功)
                    {
                        LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 关闭查看成绩");
                        Response.Write("成绩已关闭查询");
                        Response.End();
                    }
                    else
                    {
                        Response.Write("关闭查询失败,可能当前批次没有可开放成绩");
                        Response.End();
                    }
                }
                else
                {
                    int    openState = 1;
                    Result result    = scoreBll.selectSate(openState, planId);
                    //按钮开关
                    if (result == Result.记录存在)
                    {
                        status = 1;//开
                    }
                    else
                    {
                        status = 0;//关
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(this.GetType(), ex);
            }
        }
Esempio n. 26
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);
            }
        }
 public CourseEditView(CourseBll courseBll, TeacherBll teacherBll)
 {
     InitializeComponent();
     _courseViewPresenter = new CourseViewEditPresenter(this, courseBll, teacherBll);
 }
Esempio n. 28
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();
            }
        }
Esempio n. 29
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);
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 获取信息
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public void getdata(String strWhere)
        {
            string currentPage = Request.QueryString["currentPage"];

            if (currentPage == null || currentPage.Length <= 0)
            {
                currentPage = "1";
            }
            //判断是哪个院系的管理员登录 只加载该院系下的教师
            //获取登录者的类型
            string userType = Session["state"].ToString();
            //string userType = "2";
            string     usercollege = "";
            TeacherBll pro         = new TeacherBll();

            if (userType == "2")
            {
                //如果是分院管理员只加载该分院的教师
                Teacher tea           = (Teacher)Session["user"];
                int     usercollegeId = tea.college.ColID;
                string  strTeaType    = "";
                if (strWhere == null || strWhere == "")
                {
                    strTeaType  = "teaType=1 and ";
                    usercollege = "collegeId=" + "'" + usercollegeId + "'";
                }
                else
                {
                    strTeaType  = "teaType=1 and ";
                    usercollege = "collegeId=" + "'" + usercollegeId + "'" + "and " + "(" + strWhere + ")";
                }
                TableBuilder tabuilder = new TableBuilder()
                {
                    StrTable      = "V_Teacher",
                    StrWhere      = strTeaType + usercollege,
                    IntColType    = 0,
                    IntOrder      = 0,
                    IntPageNum    = int.Parse(currentPage),
                    IntPageSize   = pagesize,
                    StrColumn     = "teaAccount",
                    StrColumnlist = "*"
                };
                getCurrentPage = int.Parse(currentPage);
                ds             = pro.SelectBypage(tabuilder, out count);
            }
            else if (userType == "0")
            {
                //如果是超管则加载所有教师包括分院管理员
                string strTeaType = "teaType = 1";
                if (strWhere != null && strWhere != "")
                {
                    strTeaType = "teaType = 1 and" + "(" + strWhere + ")";
                }
                TableBuilder tabuilder = new TableBuilder()
                {
                    StrTable      = "V_Teacher",
                    StrWhere      = strTeaType,
                    IntColType    = 0,
                    IntOrder      = 0,
                    IntPageNum    = int.Parse(currentPage),
                    IntPageSize   = pagesize,
                    StrColumn     = "teaAccount",
                    StrColumnlist = "*"
                };
                getCurrentPage = int.Parse(currentPage);
                ds             = pro.SelectBypage(tabuilder, out count);
            }
        }