예제 #1
0
    protected void lbtAdd_Click(object sender, EventArgs e)
    {
        try
        {
            string alert;
            int    teacher = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
            //int teacher = 1;
            int id;
            //int teacher = 1, id = 3;
            try
            {
                id = Convert.ToInt32(Request.QueryString["id"].ToString());
            }
            catch
            {
                id = 3;
            }
            using (var db = new TeachingCenterEntities())
            {
                Activity ac = db.Activity.Single(a => a.Activity_id == id);
                if (ac.Activity_nowcount >= ac.Activity_limitcount)
                {
                    alert = "操作失败,人数已达到上限。";
                }
                else if (ac.Activity_hold_time < DateTime.Now)
                {
                    alert = "该活动已结束!";
                }
                else
                {
                    var acs = from it in db.ActivityTeacher where it.teacher_id == teacher && it.activity_id == id select it;

                    if (acs.Count() > 0)
                    {
                        alert = "您已参加了该项目!";
                    }
                    else
                    {
                        ac.Activity_nowcount++;
                        db.SaveChanges();
                        ActivityTeacher at = new ActivityTeacher();
                        at.activity_id = id;
                        at.teacher_id  = teacher;
                        db.ActivityTeacher.Add(at);
                        db.SaveChanges();
                        alert = "参与成功!";
                    }
                }
            }
            JSHelper.ShowAlert(alert);
        }
        catch
        {
            JSHelper.ShowAlert("请先登录!");
        }
    }
예제 #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(pro_id.Value.ToString());

        using (var db = new TeachingCenterEntities())
        {
            if (setIsPass())
            {
                var      category = db.ProjectCategory.SingleOrDefault(a => a.id == id);
                DateTime now      = DateTime.Now;
                if (DateTime.Compare(now, Convert.ToDateTime(category.end_time)) < 0)
                {
                    Response.Write("<script>alert('项目提交尚未结束,暂时无法开启下一阶段!');</script>");
                }
                else if (DateTime.Compare(now, Convert.ToDateTime(category.judge_end_time)) < 0)
                {
                    Response.Write("<script>alert('评审工作尚未结束,暂时无法开启下一阶段!');</script>");
                }
                else
                {
                    category.stage         += 1;
                    category.end_time       = txtTime.Text;
                    category.judge_end_time = txtJudgeTime.Text;
                    db.SaveChanges();
                    //Response.Write("<script>alert('开放成功!');location.href='ProCategoryList.aspx';</script>");
                    Server.Transfer("ProCategoryList.aspx");
                }
            }
            else
            {
                Response.Write("<script>alert('开放失败!');location.href='ProCategoryList.aspx';</script>");
            }
        }
    }
예제 #3
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        int    id      = Convert.ToInt32(Request.QueryString["id"].ToString());
        string title   = txtTitle.Text;
        string summary = txtSummary.Text;
        string body    = UeditorHelper.Change(myEditor11.InnerHtml);

        if (title.Length == 0)
        {
            Response.Write("<script>alert('标题不能为空!');</script>");
        }
        else if (summary.Length == 0)
        {
            Response.Write("<script>alert('内容摘要不能为空!');</script>");
        }
        else if (body.Length == 0)
        {
            Response.Write("<script>alert('文章内容不能为空!');</script>");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                var src = (from it in db.EducateSource where it.id == id select it).FirstOrDefault();
                src.title        = title;
                src.body         = body;
                src.publish_time = pushlishTime.Value;
                src.summary      = summary;
                db.SaveChanges();
                Response.Write("<script>alert('修改成功!');location.href='EduSrcList.aspx';</script>");
            }
        }
    }
예제 #4
0
    protected void lbtnSubmit_Click(object sender, EventArgs e)
    {
        int    teacher_id = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
        string oldpwd     = txtOld.Text;
        string newpwd     = txtNew.Text;
        string checkpwd   = txtCheck.Text;

        using (var db = new TeachingCenterEntities())
        {
            Teacher teacher = (from it in db.Teacher where it.id == teacher_id select it).FirstOrDefault();
            if (oldpwd.Length == 0 || newpwd.Length == 0 || checkpwd.Length == 0)
            {
                Response.Write("<script>alert('输入不能为空!');</script>");
            }
            else if (PwdHelper.MD5(oldpwd) != teacher.password)
            {
                Response.Write("<script>alert('原密码错误!');</script>");
            }
            else if (newpwd != checkpwd)
            {
                Response.Write("<script>alert('两次输入密码不一致!');</script>");
            }
            else
            {
                teacher.password = PwdHelper.MD5(newpwd);
                db.SaveChanges();
                Server.Transfer("EditInfo.aspx");
                //JSHelper.AlertThenRedirect("修改成功!", "EditInfo.aspx");
            }
        }
    }
예제 #5
0
 protected void rptCategory_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             var pro_category = db.ProjectCategory.SingleOrDefault(a => a.id == id);
             pro_category.is_deleted  = 1;
             pro_category.deletedtime = DateTime.Now;
             db.SaveChanges();
             Server.Transfer("ProCategoryList.aspx");
             //Response.Write("<script>alert('删除成功!');location.href='ProCategoryList.aspx';</script>");
         }
     }
     else if (e.CommandName == "open")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             var category = db.ProjectCategory.SingleOrDefault(a => a.id == id);
             if (category.stage < 2)
             {
                 plOpen.Visible = true;
                 pro_id.Value   = id.ToString();
             }
         }
     }
 }
 protected void rptService_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     //删除专题分类
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             Develop service = db.Develop.Single(a => a.Develop_id == id);
             db.Develop.Remove(service);
             db.SaveChanges();
             //JSHelper.AlertThenRedirect("删除成功!", "RecycleDevelop.aspx");
             Server.Transfer("RecycleDevelop.aspx");
         }
     }
     if (e.CommandName == "Recycle")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             Develop service = db.Develop.Single(a => a.Develop_id == id);
             service.Develop_deleted = 0;
             db.SaveChanges();
             //JSHelper.AlertThenRedirect("恢复成功!", "RecycleDevelop.aspx");
             Server.Transfer("RecycleDevelop.aspx");
         }
     }
 }
예제 #7
0
 protected void lbtnSubmit_Click(object sender, EventArgs e)
 {
     if (UpLoadFile() == false)
     {
         Response.Write("<script>alert('请上传项目文件!');</script>");
     }
     else
     {
         int project_id = Convert.ToInt32(Request.QueryString["id"]);
         int stage      = Convert.ToInt32(Request.QueryString["stage"]);
         using (var db = new TeachingCenterEntities())
         {
             var          project  = (from it in db.ProjectStage where it.project_id == project_id && it.stage == stage select it).FirstOrDefault();
             ProjectStage newStage = new ProjectStage();
             newStage.project_id      = project_id;
             newStage.project_content = UeditorHelper.Change(myEditor11.InnerHtml);
             newStage.project_file    = "file/" + FileUp.PostedFile.FileName;
             newStage.stage           = stage + 1;
             newStage.time            = DateTime.Now.ToString("yyyy-MM-dd");
             newStage.is_pass         = -2;
             db.ProjectStage.Add(newStage);
             db.SaveChanges();
             Response.Write("<script>location.href='MyProject.aspx?pageNumber=1';</script>");
         }
     }
 }
 protected void rptCategory_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Recycle")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             var pro_category = db.ProjectCategory.SingleOrDefault(a => a.id == id);
             pro_category.is_deleted = 0;
             db.SaveChanges();
             Server.Transfer("RecycleProjectCategory.aspx");
             //Response.Write("<script>alert('恢复成功!');location.href='RecycleProjectCategory.aspx';</script>");
         }
     }
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             var pro_category = db.ProjectCategory.SingleOrDefault(a => a.id == id);
             //db.ProjectCategory.Remove(pro_category);
             pro_category.is_deleted = 100;
             db.SaveChanges();
             //Response.Write("<script>alert('删除成功!');location.href='RecycleProjectCategory.aspx';</script>");
             Server.Transfer("RecycleProjectCategory.aspx");
         }
     }
 }
예제 #9
0
 protected void rptService_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     //删除专题分类
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             Service service = db.Service.Single(a => a.Service_id == id);
             service.Service_isdeleted   = 1;
             service.Service_deletedtime = DateTime.Now;
             db.SaveChanges();
             //JSHelper.AlertThenRedirect("删除成功!", "ServiceManage.aspx");
             Server.Transfer("ServiceManage.aspx");
         }
     }
     //修改分类
     if (e.CommandName == "Set")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         lbReplyID.Text   = id.ToString();
         divReply.Visible = true;
         //using (var db = new TeachingCenterEntities())
         //{
         //    Service sc = db.Service.Single(a => a.Service_id == id);
         //    //sc.Service_isdeal = 1;
         //    db.SaveChanges();
         //    JSHelper.AlertThenRedirect("处理成功!", "ServiceManage.aspx");
         //    //.Text = sc.ServiceCategory_name;
         //}
     }
 }
예제 #10
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        string title    = txtTitle.Text;
        string date     = logmin.Value;
        string place    = txtPlace.Text;
        string count    = txtLimit.Text;
        string category = dropCategory.SelectedValue;
        string content  = myEditor11.InnerHtml;
        string summary  = TextBox1.Text;

        if (title.Length == 0 || date.Length == 0 || place.Length == 0 || count.Length == 0 || content.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (summary.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else
        {
            try
            {
                using (var db = new TeachingCenterEntities())
                {
                    Activity ac = new Activity();
                    if (dropAuthor.SelectedValue == "0")
                    {
                        ac.Activity_author = AdminHelper.getNameByID(Session["AdminID"].ToString());
                    }
                    else if (dropAuthor.SelectedValue == "1")
                    {
                        ac.Activity_author = "匿名";
                    }
                    else
                    {
                        ac.Activity_author = "未知";
                    }

                    ac.Activity_title = title;
                    DateTime dt = Convert.ToDateTime(date);
                    ac.Activity_summary    = summary;
                    ac.Activity_time       = DateTime.Now;
                    ac.Activity_hold_time  = dt;
                    ac.Activity_content    = content;
                    ac.Activity_place      = place;
                    ac.Activity_limitcount = Convert.ToInt32(count);
                    ac.Activity_categoryid = ActivityHelper.getCategoryId(category);
                    db.Activity.Add(ac);
                    db.SaveChanges();

//                    Server.Transfer("ActivityManage.aspx");
                    JSHelper.AlertThenRedirect("发布成功!", "ActivityManage.aspx");
                }
            }
            catch
            {
                JSHelper.ShowAlert("存在非法输入!");
            }
        }
    }
예제 #11
0
    //添加分类
    protected void btnSubAdd_Click(object sender, EventArgs e)
    {
        string category = txtCategory.Text;

        if (category.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (DevelopHelper.checkCategoryNameExit(category))
        {
            JSHelper.ShowAlert("该分类已存在!");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                var cate = new DevelopCategory();
                cate.DevelopCategory_name = category;
                db.DevelopCategory.Add(cate);
                db.SaveChanges();
                Server.Transfer("DevelopCategoryManage.aspx");
                //                JSHelper.AlertThenRedirect("添加成功!", "DevelopCategoryManage.aspx");
            }
        }
    }
예제 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] == null)
     {
         Response.Redirect("main-index.aspx");
     }
     else
     {
         using (var db = new TeachingCenterEntities())
         {
             int id  = Convert.ToInt32(Request.QueryString["id"]);
             var src = (from it in db.EducateSource where it.id == id select it).FirstOrDefault();
             src.view_times += 1;
             db.SaveChanges();
         }
         if (Session["TeacherNumber"] == null)
         {
             mobileLogin.Visible  = true;
             mobilePerson.Visible = false;
         }
         else
         {
             mobileLogin.Visible  = false;
             mobilePerson.Visible = true;
         }
     }
 }
예제 #13
0
    //修改分类
    protected void btnChange_Click(object sender, EventArgs e)
    {
        string title = txtChangeTitle.Text;
        string link  = txtChangeLink.Text;
        string order = (txtChangeOrder.Text);

        if (title.Length == 0 || link.Length == 0 || order.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (Convert.ToInt16(order) > 4 || Convert.ToInt16(order) <= 0)
        {
            JSHelper.ShowAlert("请正确输入列数!");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                int         id   = Convert.ToInt32(lbID.Text);
                FriendsLink cate = db.FriendsLink.Single(a => a.id == id);
                cate.title  = title;
                cate.link   = link;
                cate.orders = Convert.ToInt16(order);
                db.SaveChanges();
                Server.Transfer("FriendsLink.aspx");
                //JSHelper.AlertThenRedirect("修改成功!", "FriendsLink.aspx");
            }
        }
    }
예제 #14
0
    //添加分类
    protected void btnSubAdd_Click(object sender, EventArgs e)
    {
        string title = txtCategory.Text;
        string link  = txtLink.Text;
        string order = (txtOrder.Text);

        if (title.Length == 0 || link.Length == 0 || order.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (Convert.ToInt16(order) > 4 || Convert.ToInt16(order) <= 0)
        {
            JSHelper.ShowAlert("请正确输入列数!");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                var cate = new FriendsLink();
                cate.title  = title;
                cate.link   = link;
                cate.orders = Convert.ToInt16(order);
                db.FriendsLink.Add(cate);
                db.SaveChanges();
                Server.Transfer("FriendsLink.aspx");
                //JSHelper.AlertThenRedirect("添加成功!", "FriendsLink.aspx");
            }
        }
    }
    protected void ltbChange_Click(object sender, EventArgs e)
    {
        string intro = txtIntroduction.Value;
        string phone = txtPhone.Value;

        if (intro.Length == 0 || phone.Length == 0)
        {
            JSHelper.ShowAlert("输入存在空值!");
        }
        else
        {
            try
            {
                int id = Convert.ToInt32(Request.QueryString["id"].ToString());
                using (var db = new TeachingCenterEntities())
                {
                    Service ser = db.Service.Single(a => a.Service_id == id);
                    ser.Service_phone   = phone;
                    ser.Service_remarks = intro;
                    db.SaveChanges();
                    Server.Transfer("'MyServiceList.aspx");
                    //JSHelper.AlertThenRedirect("修改成功!", "MyServiceList.aspx");
                }
            }
            catch
            {
                //JSHelper.AlertThenRedirect("请先登陆!", "Login.aspx");
            }
        }
    }
예제 #16
0
    protected void lbtnSubmit_Click(object sender, EventArgs e)
    {
        string          message    = txtMessage.Text;
        int             judge_id   = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
        int             project_id = Convert.ToInt32(Request.QueryString["id"]);
        int             stage      = Convert.ToInt32(Request.QueryString["stage"]);
        int             is_pass    = 0;
        HtmlInputHidden result     = FindControl("result") as HtmlInputHidden;

        if (result.Value == "")
        {
            Response.Write("<script>alert('请选择是否通过!');</script>");
        }
        else
        {
            is_pass = Convert.ToInt32(result.Value);
            using (var db = new TeachingCenterEntities())
            {
                var record = (from it in db.ProjectJudge where it.judge_id == judge_id && it.project_id == project_id && it.stage == stage select it).FirstOrDefault();
                record.comment = message;
                record.is_pass = is_pass;
                db.SaveChanges();
                //Server.Transfer("MyJudgePro.aspx?pageNumber=1");
                Response.Write("<script>location.href='MyJudgePro.aspx?pageNumber=1';</script>");
            }
        }
    }
예제 #17
0
 protected void rptCategory_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     //删除专题分类
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             FriendsLink sc = db.FriendsLink.Single(a => a.id == id);
             db.FriendsLink.Remove(sc);
             db.SaveChanges();
             //JSHelper.AlertThenRedirect("删除成功!", "FriendsLink.aspx");
             Server.Transfer("FriendsLink.aspx");
         }
     }
     //修改分类
     if (e.CommandName == "Editor")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         lbID.Text = id.ToString();
         using (var db = new TeachingCenterEntities())
         {
             FriendsLink sc = db.FriendsLink.Single(a => a.id == id);
             txtChangeTitle.Text = sc.title;
             txtChangeOrder.Text = sc.orders.ToString();
             txtChangeLink.Text  = sc.link;
         }
         divEditor.Visible = true;
     }
 }
예제 #18
0
    protected void rptBanner_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        // 列表中删除一行
        if (e.CommandName == "Delete")
        {
            int id = Convert.ToInt32(e.CommandArgument.ToString());
            using (var db = new TeachingCenterEntities())
            {
                var banner = db.Picture.SingleOrDefault(a => a.Picture_id == id);
                db.Picture.Remove(banner);
                db.SaveChanges();
                Server.Transfer("BannerList.aspx");
                //Response.Write("<script>alert('删除成功!');location.href='BannerList.aspx';</script>");
            }
        }

        // 将图片置顶
        if (e.CommandName == "OnTop")
        {
            int id = Convert.ToInt32(e.CommandArgument.ToString());
            using (var db = new TeachingCenterEntities())
            {
                var banner = db.Picture.SingleOrDefault(a => a.Picture_id == id);
                int max    = Convert.ToInt32((from it in db.Picture orderby it.is_top descending select it.is_top).FirstOrDefault());
                banner.is_top = max + 1;
                db.SaveChanges();
                Server.Transfer("BannerList.aspx");
                //Response.Write("<script>alert('置顶成功!');location.href='BannerList.aspx';</script>");
            }
        }
    }
    protected void rptActivitySummary_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        //删除活动总结
        if (e.CommandName == "Delete")
        {
            int id = Convert.ToInt32(e.CommandArgument.ToString());
            using (var db = new TeachingCenterEntities())
            {
                ActivitySummary asu = db.ActivitySummary.Single(a => a.ActivitySummary_id == id);

                db.ActivitySummary.Remove(asu);
                db.SaveChanges();
                Server.Transfer("RecycleActivitySummary.aspx");
                //JSHelper.AlertThenRedirect("删除成功!", "RecycleActivitySummary.aspx");
            }
        }
        if (e.CommandName == "Recycle")
        {
            int id = Convert.ToInt32(e.CommandArgument.ToString());
            using (var db = new TeachingCenterEntities())
            {
                ActivitySummary asu = db.ActivitySummary.Single(a => a.ActivitySummary_id == id);
                asu.ActivitySummary_isdeleted = 0;
                db.SaveChanges();
                Server.Transfer("RecycleActivitySummary.aspx");
                //JSHelper.AlertThenRedirect("恢复成功!", "ActivitySummaryManage.aspx");
            }
        }
    }
예제 #20
0
    /*protected void lbtSendCode_Click(object sender, EventArgs e)
     * {
     *  string number = txtNumber.Text;
     *  if (number.Length == 0)
     *      JSHelper.ShowAlert("请输入工号!");
     *  else if (TeacherHelper.checkNumber(number))
     *      JSHelper.ShowAlert("工号不存在!");
     *  else
     *  {
     *      using (var db = new TeachingCenterEntities())
     *      {
     *          string email = (from it in db.Teacher where it.number == number select it.email).ToString();
     *          if((from it in db.PasswordCode where it.teacher_number == number select it).Any())
     *          {
     *              PasswordCode pwdcode = (from it in db.PasswordCode where it.teacher_number == number select it).FirstOrDefault();
     *              string code = MailHelper.Random_check(email);
     *              pwdcode.code = code;
     *              pwdcode.send_time = DateTime.Now;
     *              db.SaveChanges();
     *          }
     *          else
     *          {
     *              string code = MailHelper.Random_check(email);
     *              PasswordCode pwdcode = new PasswordCode();
     *              pwdcode.teacher_number = number;
     *              pwdcode.code = code;
     *              pwdcode.send_time = DateTime.Now;
     *              db.PasswordCode.Add(pwdcode);
     *              db.SaveChanges();
     *          }
     *          JSHelper.ShowAlert("验证码发送成功,请至邮箱查收!");
     *      }
     *  }
     * }*/

    /*protected void lbtSubmit_Click(object sender, EventArgs e)
     * {
     *  string number = txtNumber.Text;
     *  string code = txtCode.Text;
     *  DateTime time = DateTime.Now;
     *  if(number.Length == 0 || code.Length == 0)
     *      JSHelper.ShowAlert("输入不能为空!");
     *  else if (TeacherHelper.checkNumber(number))
     *      JSHelper.ShowAlert("工号不存在!");
     *  else
     *  {
     *      using (var db = new TeachingCenterEntities())
     *      {
     *          var pwdcode = (from it in db.PasswordCode where it.teacher_number == number && it.code == code select it).FirstOrDefault();
     *          DateTime send_time = pwdcode.send_time;
     *          if((time - send_time).TotalMinutes > 15)
     *              JSHelper.ShowAlert("验证码已超时,请重新获取验证码!");
     *          else
     *          {
     *              var teacher = (from it in db.Teacher where it.number == number select it).FirstOrDefault();
     *              teacher.password = PwdHelper.MD5("ouc123");
     *              db.PasswordCode.Remove(pwdcode);
     *              db.SaveChanges();
     *              JSHelper.AlertThenRedirect("重置密码成功,您的新密码为ouc123!", "main-index.aspx");
     *          }
     *      }
     *  }
     * }*/

    //protected void GetCode_Click(object sender, EventArgs e)
    //{
    //    string number = inputNumber.Value;
    //    if (number.Length == 0)
    //        JSHelper.ShowAlert("请输入工号!");
    //    else if (TeacherHelper.checkNumber(number))
    //        JSHelper.ShowAlert("工号不存在!");
    //    else
    //    {
    //        using (var db = new TeachingCenterEntities())
    //        {
    //            string email = (from it in db.Teacher where it.number == number select it.email).ToString();
    //            if ((from it in db.PasswordCode where it.teacher_number == number select it).Any())
    //            {
    //                PasswordCode pwdcode = (from it in db.PasswordCode where it.teacher_number == number select it).FirstOrDefault();
    //                string code = MailHelper.Random_check(email);
    //                pwdcode.code = code;
    //                pwdcode.send_time = DateTime.Now;
    //                db.SaveChanges();
    //            }
    //            else
    //            {
    //                string code = MailHelper.Random_check(email);
    //                PasswordCode pwdcode = new PasswordCode();
    //                pwdcode.teacher_number = number;
    //                pwdcode.code = code;
    //                pwdcode.send_time = DateTime.Now;
    //                db.PasswordCode.Add(pwdcode);
    //                db.SaveChanges();
    //            }
    //            JSHelper.ShowAlert("验证码发送成功,请至邮箱查收!");
    //        }
    //    }


    protected void codesubmit_Click(object sender, EventArgs e)
    {
        string   number = inputNumber.Text;
        string   code   = inputCode.Text;
        DateTime time   = DateTime.Now;

        if (number.Length == 0 || code.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (TeacherHelper.checkNumber(number))
        {
            JSHelper.ShowAlert("工号不存在!");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                var      pwdcode   = (from it in db.PasswordCode where it.teacher_number == number && it.code == code select it).FirstOrDefault();
                DateTime send_time = pwdcode.send_time;
                if ((time - send_time).TotalMinutes > 15)
                {
                    JSHelper.ShowAlert("验证码已超时,请重新获取验证码!");
                }
                else
                {
                    var teacher = (from it in db.Teacher where it.number == number select it).FirstOrDefault();
                    teacher.password = PwdHelper.MD5("ouc123");
                    db.PasswordCode.Remove(pwdcode);
                    db.SaveChanges();
                    JSHelper.AlertThenRedirect("重置密码成功,您的新密码为ouc123!", "main-index.aspx");
                }
            }
        }
    }
예제 #21
0
 // 列表中删除一行
 protected void rptProject_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             var project = db.Project.SingleOrDefault(a => a.project_id == id);
             project.is_deleted  = 1;
             project.deletedtime = DateTime.Now;
             db.SaveChanges();
             //Response.Write("<script>alert('删除成功!');location.href='ProjectList.aspx';</script>");
             Server.Transfer("ProjectList.aspx");
         }
     }
     if (e.CommandName == "Diliver")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             var project_stage = (from it in db.ProjectStage where it.project_id == id orderby it.stage descending select it).FirstOrDefault();
             int now_status    = project_stage.is_pass;
             if (now_status == -1)
             {
                 Response.Redirect("ProjectJudge.aspx?id=" + id);
             }
             else if (now_status == -2)
             {
                 pro_id.Value  = id.ToString();
                 Judge.Visible = true;
             }
         }
     }
 }
예제 #22
0
 protected void rptService_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     //删除专题分类
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             Service service = db.Service.Single(a => a.Service_id == id);
             db.Service.Remove(service);
             db.SaveChanges();
             //JSHelper.AlertThenRedirect("删除成功!", "ServiceManage.aspx");
             Server.Transfer("RecycleService.aspx");
         }
     }
     //修改分类
     if (e.CommandName == "Recycle")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             Service sc = db.Service.Single(a => a.Service_id == id);
             sc.Service_isdeleted = 0;
             db.SaveChanges();
             Server.Transfer("RecycleService.aspx");
             //JSHelper.AlertThenRedirect("处理成功!", "ServiceManage.aspx");
             //.Text = sc.ServiceCategory_name;
         }
     }
 }
예제 #23
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        string picture_path = UpLoadFile();

        if (UpLoadFile() == "")
        {
            Response.Write("<script>alert('请选择正确的文件!');</script>");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                String title   = txtTitle.Text;
                String link    = txxtLink.Text;
                String summary = txtSummary.Text;
                if (link.Length == 0)
                {
                    link = "";
                }
                if (title.Length == 0 || summary.Length == 0)
                {
                    Response.Write("<script>alert('输入不能为空!');</script>");
                }
                else
                {
                    Picture picture = new Picture();
                    picture.Picture_title   = title;
                    picture.Picture_link    = link;
                    picture.Picture_path    = "picture/" + picture_path;
                    picture.is_top          = 0;
                    picture.Picture_summary = summary;
                    db.Picture.Add(picture);
                    db.SaveChanges();
                    var banner = db.Picture.SingleOrDefault(a => a.Picture_id == picture.Picture_id);
                    int max    = Convert.ToInt32((from it in db.Picture orderby it.is_top descending select it.is_top).FirstOrDefault());
                    banner.is_top = max + 1;
                    db.SaveChanges();
                    Server.Transfer("BannerList.aspx");
                    //Response.Write("<script>alert('添加成功!');location.href='BannerList.aspx';</script>");
                }
            }
        }
    }
예제 #24
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string name       = txtName.Text;
        int    teacher_id = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
        string fund       = txtMoney.Text;
        Regex  numRegex   = new Regex(@"^\d+$");
        string filePath   = FileUp.PostedFile.FileName;

        if (name.Length == 0)
        {
            Response.Write("<script>alert('项目名称不能为空!');</script>");
        }
        else if (fund.Length == 0)
        {
            Response.Write("<script>alert('资助金额不能为空!');</script>");
        }
        else if (!numRegex.IsMatch(fund))
        {
            Response.Write("<script>alert('请输入正确的资助金额!');</script>");
        }
        //else if (UpLoadFile() == false)
        //Response.Write("<script>alert('请上传项目文件!');</script>");
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                int     project_id = Convert.ToInt32(Request.QueryString["id"]);
                Project project    = (from it in db.Project where it.project_id == project_id select it).FirstOrDefault();
                project.name = name;
                project.fund = fund;
                db.SaveChanges();

                ProjectStage project_stage = (from it in db.ProjectStage where it.project_id == project_id orderby it.stage descending select it).FirstOrDefault();
                project_stage.project_content = UeditorHelper.Change(myEditor11.InnerHtml);
                if (UpLoadFile() == true)
                {
                    project_stage.project_file = "file/" + FileUp.PostedFile.FileName;
                }
                db.SaveChanges();
                Response.Redirect("MyProject.aspx?pageNumber=1");
            }
        }
    }
예제 #25
0
 protected void BtnReset_Click(object sender, EventArgs e)
 {
     using (var db = new TeachingCenterEntities())
     {
         string  number = ltNumber.Text;
         Teacher te     = db.Teacher.Single(a => a.number == number);
         te.password = PwdHelper.MD5("ouc" + number);
         db.SaveChanges();
         //Server.Transfer("ResetPwd.aspx");
         JSHelper.AlertThenRedirect("重置成功,重置密码为ouc+教师工号!", "ResetPwd.aspx");
     }
 }
예제 #26
0
    // 开启下一阶段前将尚未完善的项目和为评判结果的评审记录设置为超时
    protected bool setIsPass()
    {
        try
        {
            // 获取当前项目类型id
            int id = Convert.ToInt32(pro_id.Value.ToString());

            using (var db = new TeachingCenterEntities())
            {
                var      category       = (from it in db.ProjectCategory where it.id == id select it).FirstOrDefault(); // 当前项目类型
                DateTime end_time       = Convert.ToDateTime(category.end_time);                                        // 提交项目截止时间
                DateTime judge_end_time = Convert.ToDateTime(category.judge_end_time);                                  // 评审评判截止时间

                // 遍历所有项目
                var project = from it in db.Project where it.is_deleted == 0 select it;
                foreach (var item in project)
                {
                    // 判断是否属于当前项目类型
                    if (item.category == id)
                    {
                        // 获取该项目当前的阶段
                        var pro = (from it in db.ProjectStage where it.project_id == item.project_id orderby it.stage descending select it).FirstOrDefault();
                        // 若该项目当前阶段落后于项目类型的阶段,则设置为超时
                        if (pro.stage < category.stage || pro.is_pass < 0)
                        {
                            pro.is_pass = -100;
                        }

                        // 遍历该项目分配至评审的所有记录
                        var judge = from it in db.ProjectJudge where it.project_id == item.project_id select it;
                        if (judge.Count() != 0)
                        {
                            foreach (var record in judge)
                            {
                                // 若该记录当前阶段落后于项目类型的阶段,则设置为超时
                                if (record.is_pass == -1)
                                {
                                    record.is_pass = -100;
                                }
                            }
                        }
                    }
                }
                db.SaveChanges();
            }
            return(true);
        }
        catch
        {
            return(false);
        }
    }
예제 #27
0
    protected void btnNewPwd_Click(object sender, EventArgs e)
    {
        string teacher = Session["AdminID"].ToString();

        using (var db = new TeachingCenterEntities())
        {
            Admin admin = db.Admin.Single(a => a.Admin_id == teacher);
            admin.Admin_pwd = PwdHelper.MD5(txtNewPwd.Text);
            db.SaveChanges();
            Server.Transfer("AdminInformation.aspx");
            //JSHelper.AlertThenRedirect("修改成功!", "AdminInformation.aspx");
        }
    }
예제 #28
0
    protected void btnChange_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt16(lbReplyID.Text);

        using (var db = new TeachingCenterEntities())
        {
            Service sc = db.Service.Single(a => a.Service_id == id);
            sc.Service_isdeal = 1;
            sc.Service_reply  = txtReply.Text;
            db.SaveChanges();
            Server.Transfer("ServiceManage.aspx");
//            JSHelper.AlertThenRedirect("处理成功!", "ServiceManage.aspx");
        }
    }
예제 #29
0
 // 列表中删除一行
 protected void rptSource_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         using (var db = new TeachingCenterEntities())
         {
             var src = db.EducateSource.SingleOrDefault(a => a.id == id);
             src.is_deleted  = 1;
             src.deletedtime = DateTime.Now;
             db.SaveChanges();
             Response.Write("<script>alert('删除成功!');location.href='EduSrcList.aspx';</script>");
         }
     }
 }
예제 #30
0
    protected void btnCheck_Click(object sender, EventArgs e)
    {
        int project_id = Convert.ToInt32(pro_id.Value.ToString());

        using (var db = new TeachingCenterEntities())
        {
            foreach (RepeaterItem item in rptJudge.Items)
            {
                HtmlInputCheckBox isDeleted = item.FindControl("isDeleted") as HtmlInputCheckBox;
                HtmlInputHidden   judge_id  = item.FindControl("id") as HtmlInputHidden;
                int id = Convert.ToInt32(judge_id.Value);
                if (isDeleted.Checked == true)
                {
                    ProjectJudge data    = new ProjectJudge();
                    var          project = db.Project.SingleOrDefault(a => a.project_id == project_id);
                    data.project_id = project_id;
                    data.category   = project.category;
                    data.teacher_id = project.teacher_id;
                    data.judge_id   = id;
                    var judge         = db.Teacher.SingleOrDefault(a => a.id == id);
                    var project_stage = (from it in db.ProjectStage where it.project_id == project_id orderby it.stage descending select it).FirstOrDefault();
                    data.stage   = project_stage.stage;
                    data.comment = "";
                    data.is_pass = -1;
                    db.ProjectJudge.Add(data);
                    db.SaveChanges();
                    var update = db.ProjectStage.SingleOrDefault(a => a.project_id == project_id && a.stage == data.stage);
                    update.is_pass = -1;
                    db.SaveChanges();

                    //Response.Write("<script>alert('已成功分配给评审!');location.href='ProjectList.aspx';</script>");
                }
            }
            Server.Transfer("ProjectList.aspx");
        }
    }