protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //判断是不是评审
         if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
         {
             liJudge.Visible = false;
         }
         int teacher = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
         if (!IsPostBack)
         {
             using (var db = new TeachingCenterEntities())
             {
                 int     id  = Convert.ToInt32(Request.QueryString["id"].ToString());
                 Service ser = db.Service.Single(a => a.Service_id == id);
                 ltType.Text           = ServiceHelper.getCategoryName(ser.Service_category);
                 ltTeacher.Text        = TeacherHelper.getTeacherNameByID(teacher);
                 txtPhone.Value        = ser.Service_phone;
                 txtIntroduction.Value = ser.Service_remarks;
             }
         }
         //判断是不是评审
         if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
         {
             liJudge.Visible = false;
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "main-index.aspx");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AdminID"].ToString() == null)
        {
            JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
        }
        int id = 1;

        try
        {
            if (Request.QueryString["id"] == null)
            {
                JSHelper.AlertThenRedirect("地址栏有误!", "ProCategoryList.aspx");
            }
            id = Convert.ToInt32(Request.QueryString["id"].ToString());
            if (!IsPostBack)
            {
                using (var db = new TeachingCenterEntities())
                {
                    var pro = (from it in db.ProjectCategory where it.id == id select it).FirstOrDefault();
                    txtName.Text         = pro.name;
                    txtSummary.Text      = pro.summary;
                    pushlishTime.Value   = pro.publish_time;
                    myEditor11.InnerHtml = Server.HtmlDecode(pro.project_content);
                    txtTime.Text         = pro.end_time;
                    txtJudgeTime.Text    = pro.judge_end_time;
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("地址栏有误!", "ProCategoryList.aspx");
        }
    }
Exemplo n.º 3
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");
                }
            }
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string teacher = Session["AdminID"].ToString();
            if (!IsPostBack)
            {
                using (var db = new TeachingCenterEntities())
                {
                    int id = 0;
                    if (Request.QueryString["id"] != null)
                    {
                        id = Convert.ToInt32(Request.QueryString["id"]);
                    }
                    else
                    {
                        Response.Redirect("ProjectList.aspx");
                    }

                    // 绑定项目列表
                    int stage = (from it in db.ProjectStage where it.project_id == id orderby it.stage descending select it).FirstOrDefault().stage;
                    var judge = from it in db.ProjectJudge where it.project_id == id && it.stage == stage select it;
                    TotalPage.Text       = Math.Ceiling(judge.Count() / 10.0).ToString();
                    currentPage.Text     = "1";
                    rptResult.DataSource = judge.ToList().Take(10);
                    rptResult.DataBind();
                    Session["ds"] = judge.ToList();
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
        }
    }
Exemplo n.º 5
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        string id  = txtID.Text;
        string pwd = txtPwd.Text;

        if (id.Length == 0 || pwd.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (Session["Png"] != null)
        {
            string checkcode = Session["Png"].ToString();
            if (TextBox1.Text != checkcode)
            {
                JSHelper.ShowAlert("验证码错误!");
            }
            else
            {
                using (var db = new TeachingCenterEntities())
                {
                    Teacher ad = db.Teacher.Single(a => a.number == id);
                    if (ad.password == PwdHelper.MD5(pwd))
                    {
                        if (cbxRemeberUser.Checked == true)
                        {
                            CookieHelper.SetCookie("TeacherNumber", txtID.Text, DateTime.Now.AddDays(30));
                            CookieHelper.SetCookie("TeacherPwd", txtPwd.Text, DateTime.Now.AddDays(30));
                        }
                        Session["TeacherNumber"] = id;
                        JSHelper.AlertThenRedirect("登录成功!", "AddProject.aspx");
                    }
                }
            }
        }
    }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string teacher = Session["AdminID"].ToString();
         if (!IsPostBack)
         {
             int id = 0;
             if (Request.QueryString["id"] != null)
             {
                 id = Convert.ToInt32(Request.QueryString["id"]);
             }
             else
             {
                 Response.Redirect("EduSrcList.aspx");
             }
             using (var db = new TeachingCenterEntities())
             {
                 var src = db.EducateSource.SingleOrDefault(a => a.id == id);
                 lbTitle.Text     = src.title;
                 lbPublisher.Text = src.publisher;
                 lbTime.Text      = src.publish_time;
                 lbViewTimes.Text = src.view_times.ToString();
                 lbBody.Text      = Server.HtmlDecode(src.body);
             }
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
     }
 }
Exemplo n.º 7
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("存在非法输入!");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AdminID"].ToString() == null)
        {
            JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
        }
        if (!IsPostBack)
        {
            try
            {
                string teacher = Session["AdminID"].ToString();
                using (var db = new TeachingCenterEntities())
                {
                    var cate = from it in db.ProCatCategory select it;

                    dropCategory.DataSource = cate.ToList();

                    dropCategory.DataTextField = "ProCatCategory_name";

                    dropCategory.DataBind();
                }
            }
            catch
            {
                JSHelper.AlertThenRedirect("请先登陆!", "Login.aspx");
            }
        }
    }
Exemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string teacher = Session["AdminID"].ToString();
         if (!IsPostBack)
         {
             using (var db = new TeachingCenterEntities())
             {
                 // 绑定轮播图列表
                 var banner = from it in db.Picture orderby it.is_top descending select it;
                 ltSum.Text           = banner.Count().ToString();
                 TotalPage.Text       = Math.Ceiling(banner.Count() / 10.0).ToString();
                 currentPage.Text     = "1";
                 rptBanner.DataSource = banner.ToList().Take(10);
                 rptBanner.DataBind();
                 Session["ds"] = banner.ToList();
             }
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string teacher = Session["AdminID"].ToString();
         if (!IsPostBack)
         {
             using (var db = new TeachingCenterEntities())
             {
                 // 绑定项目列表
                 var pro_category = from it in db.ProjectCategory where it.is_deleted == 1 orderby it.deletedtime descending select it;
                 ltSum.Text             = pro_category.Count().ToString();
                 TotalPage.Text         = Math.Ceiling(pro_category.Count() / 10.0).ToString();
                 currentPage.Text       = "1";
                 rptCategory.DataSource = pro_category.ToList().Take(10);
                 rptCategory.DataBind();
                 Session["ds"] = pro_category.ToList();
             }
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
     }
 }
Exemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AdminID"] == null)
        {
            JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
        }
        int id = 1;

        try
        {
            if (Request.QueryString["id"] == null)
            {
                JSHelper.AlertThenRedirect("地址栏有误!", "EduSrcList.aspx");
            }
            id = Convert.ToInt32(Request.QueryString["id"].ToString());
            if (!IsPostBack)
            {
                using (var db = new TeachingCenterEntities())
                {
                    var src = (from it in db.EducateSource where it.id == id select it).FirstOrDefault();
                    txtTitle.Text        = src.title;
                    pushlishTime.Value   = src.publish_time;
                    txtSummary.Text      = src.summary;
                    myEditor11.InnerHtml = Server.HtmlDecode(src.body);
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("地址栏有误!", "EduSrcList.aspx");
        }
    }
Exemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AdminID"].ToString() == null)
        {
            JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
        }
        int id = 1;

        try
        {
            if (Request.QueryString["id"] == null)
            {
                JSHelper.AlertThenRedirect("地址栏有误!", "BannerList.aspx");
            }
            id = Convert.ToInt32(Request.QueryString["id"].ToString());
            if (!IsPostBack)
            {
                using (var db = new TeachingCenterEntities())
                {
                    var banner = (from it in db.Picture where it.Picture_id == id select it).FirstOrDefault();
                    txtTitle.Text      = banner.Picture_title;
                    txtSummary.Text    = banner.Picture_summary;
                    txxtLink.Text      = banner.Picture_link;
                    imgBanner.ImageUrl = banner.Picture_path;
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("地址栏有误!", "BannerList.aspx");
        }
    }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int id = 1;
            try
            {
                string teacher = Session["AdminID"].ToString();
                id = Convert.ToInt32(Request.QueryString["id"].ToString());
                using (var db = new TeachingCenterEntities())
                {
                    var cate = from it in db.DevelopCategory select it;

                    dropCategory.DataSource = cate.ToList();

                    dropCategory.DataTextField = "DevelopCategory_name";

                    dropCategory.DataBind();

                    Develop dev = db.Develop.Single(a => a.Develop_id == id);
                    txtTitle.Text        = dev.Develop_title;
                    TextBox1.Text        = dev.Develop_summary;
                    txtLink.Text         = dev.Develop_link;
                    txtAuthor.Text       = dev.Develop_author;
                    pushlishTime.Value   = dev.Develop_time.ToString();
                    myEditor11.InnerHtml = Server.HtmlDecode(dev.Develop_content);
                }
            }
            catch
            {
                JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
            }
        }
    }
Exemplo n.º 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string teacher = Session["AdminID"].ToString();
         if (!IsPostBack)
         {
             using (var db = new TeachingCenterEntities())
             {
                 // 绑定教学资源列表
                 var src = from it in db.EducateSource where it.is_deleted == 0 orderby it.publish_time descending select it;
                 src                  = src.ThenByDescending(a => a.id);
                 ltSum.Text           = src.Count().ToString();
                 TotalPage.Text       = Math.Ceiling(src.Count() / 10.0).ToString();
                 currentPage.Text     = "1";
                 rptSource.DataSource = src.ToList().Take(10);
                 rptSource.DataBind();
                 Session["ds"] = src.ToList();
             }
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
     }
 }
Exemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string teacher = Session["AdminID"].ToString();
            if (!IsPostBack)
            {
                int id = 0;
                if (Request.QueryString["id"] != null)
                {
                    id = Convert.ToInt32(Request.QueryString["id"]);
                }
                else
                {
                    Response.Redirect("ProjectList.aspx");
                }
                Dictionary <int, string> stage = new Dictionary <int, string>();
                stage.Add(0, "初审");
                stage.Add(1, "中期");
                stage.Add(2, "结题");
                Dictionary <int, string> status = new Dictionary <int, string>();
                status.Add(-2, "未分配至评审");
                status.Add(-1, "未评判结果");
                status.Add(1, "已通过当前阶段");
                status.Add(0, "未通过");
                status.Add(-100, "已过期");
                using (var db = new TeachingCenterEntities())
                {
                    var project = db.ProjectInfo.SingleOrDefault(a => a.project_id == id);
                    lbName.Text      = project.name;
                    lbCategory.Text  = project.category_name;
                    lbTeacher.Text   = project.teacher_name;
                    content_id.Value = id.ToString();
                    var project_stage = (from it in db.ProjectStage where it.project_id == id orderby it.stage descending select it).FirstOrDefault();
                    int now_stage     = project_stage.stage;
                    int now_status    = project_stage.is_pass;
                    lbStage.Text   = stage[now_stage];
                    lbStatus.Text  = status[now_status];
                    lbContent.Text = Server.HtmlDecode(project_stage.project_content);
                    string fund = (from it in db.Project where it.project_id == id select it).FirstOrDefault().fund;
                    lbFund.Text = fund;
                    //if (now_status == -2)
                    //    btnDeliver.Visible = true;
                    //if (now_status == -1)
                    //    btnJudge.Visible = true;

                    // 绑定评审列表
                    //var judge = from it in db.Teacher where it.is_judge == 1 select it;
                    //rptJudge.DataSource = judge.ToList();
                    //rptJudge.DataBind();
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
        }
    }
Exemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string teacher = Session["AdminID"].ToString();
            ltName.Text = AdminHelper.getNameByID(teacher);
            using (var db = new TeachingCenterEntities())
            {
                var service = from it in db.Service where it.Service_isdeal == 0 && it.Service_isdeleted == 0 select it;
                ltServese.Text = service.ToList().Count().ToString();
                if (service.Count() == 0)
                {
                    services.Visible = false;
                }

                int number = 0;
                var apply  = from it in db.JudgeApplication select it;
                //foreach(var a in apply)
                //{
                //    var record = (from b in db.ProjectStage where b.project_id == a orderby b.stage descending select b).FirstOrDefault();
                //    if (record.is_pass == -2)
                //        number++;
                //}
                number = apply.Count();
                if (number == 0)
                {
                    applys.Visible = false;
                }
                ltApply.Text = number.ToString();

                int p_number = 0;
                var project  = from it in db.Project where it.is_deleted == 0 select it;
                foreach (var item in project)
                {
                    var project_stage = (from it in db.ProjectStage where it.project_id == item.project_id orderby it.stage descending select it).FirstOrDefault();
                    if (project_stage.is_pass == -1 || project_stage.is_pass == -2)
                    {
                        p_number++;
                    }
                }
                if (p_number == 0)
                {
                    projects.Visible = false;
                }
                ltProject.Text = p_number.ToString();
                Admin admin = db.Admin.Single(a => a.Admin_id == teacher);
                if (admin.Admin_emai_check == 0)
                {
                    email.Visible = true;
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
        }
    }
Exemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //判断是不是评审
            if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
            {
                liJudge.Visible = false;
            }

            int project_id = 5;
            int stage      = 0;
            if (Request.QueryString["id"] != null && Request.QueryString["stage"] != null)
            {
                project_id = Convert.ToInt32(Request.QueryString["id"]);
                stage      = Convert.ToInt32(Request.QueryString["stage"]);
            }
            else
            {
                Response.Redirect("main-index.aspx");
            }
            if (Session["TeacherNumber"] == null)
            {
                Response.Redirect("main-index.aspx");
            }
            else
            {
                this.FileUp.Attributes.Add("onchange", "javascript:return Check_FilePath();");
                if (!IsPostBack)
                {
                    using (var db = new TeachingCenterEntities())
                    {
                        var projectinfo = (from it in db.ProjectInfo where it.project_id == project_id select it).FirstOrDefault();
                        txtName.Text     = projectinfo.name;
                        txtCategory.Text = projectinfo.category_name;
                        txtDuty.Text     = projectinfo.teacher_name;
                        DateTime time = Convert.ToDateTime(projectinfo.submit_time);
                        txtYear.Text  = time.Year.ToString();
                        txtMonth.Text = time.Month.ToString();
                        txtDay.Text   = time.Day.ToString();
                        var project = (from it in db.Project where it.project_id == project_id select it).FirstOrDefault();
                        txtMoney.Text = project.fund;
                        string department = (from it in db.Teacher where it.id == project.teacher_id select it).FirstOrDefault().department;
                        txtDepartment.Text = department;
                        var project_stage = (from it in db.ProjectStage where it.project_id == project_id select it).FirstOrDefault();
                    }
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("请先登录!", "main-index.aspx");
        }
    }
Exemplo n.º 18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string teacher = Session["AdminID"].ToString();
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
     }
 }
Exemplo n.º 19
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");
     }
 }
Exemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //判断是不是评审
            if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
            {
                //liJudge.Visible = false;
                this.FileUp.Attributes.Add("onchange", "javascript:return Check_FilePath();");
            }
            if (!IsPostBack)
            {
                if (Session["TeacherNumber"] == null)
                {
                    Response.Redirect("main-index.aspx");
                }
                else
                {
                    if (!IsPostBack)
                    {
                        using (var db = new TeachingCenterEntities())
                        {
                            int teacher_id = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
                            var teacher    = (from it in db.Teacher where it.id == teacher_id select it).FirstOrDefault();
                            if (teacher.department == "")
                            {
                                JSHelper.AlertThenRedirect("请先完善个人单位!", "Person-index.aspx");
                            }

                            DateTime now                = DateTime.Now;
                            var      category           = from it in db.ProjectCategory where it.is_deleted == 0 && it.stage == 0 select it;
                            List <ProjectCategory> show = new List <ProjectCategory>();
                            foreach (var item in category)
                            {
                                DateTime end = Convert.ToDateTime(item.end_time);
                                if (DateTime.Compare(end, now) > 0)
                                {
                                    show.Add(item);
                                }
                            }
                            rptSelect.DataSource = show;
                            rptSelect.DataBind();
                        }
                    }
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("请先登录!", "main-index.aspx");
        }
    }
Exemplo n.º 21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string teacher = Session["AdminID"].ToString();
         int    id      = Convert.ToInt16(Request.QueryString["id"]);
         DataBindToRepeater(1);
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
     }
 }
Exemplo n.º 22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string teacher = Session["AdminID"].ToString();
         if (!IsPostBack)
         {
             DataBindToRepeater(1);
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
     }
 }
Exemplo n.º 23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //判断是不是评审
         if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
         {
             liJudge.Visible = false;
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "main-index.aspx");
     }
 }
Exemplo n.º 24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //判断是不是评审
         if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
         {
             liJudge.Visible = false;
         }
         int page = 1;
         try
         {
             page = Convert.ToInt16(Request.QueryString["page"].ToString());
         }
         catch
         {
         }
         using (var db = new TeachingCenterEntities())
         {
             int teacher = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
             //int teacher = 1;
             var             at = from it in db.ActivityTeacher where it.teacher_id == teacher select it;
             List <Activity> ac = new List <Activity>();
             foreach (var i in at)
             {
                 Activity activity = db.Activity.Single(a => a.Activity_id == i.activity_id);
                 if (activity.Activity_isdeleted == 0)
                 {
                     ac.Add(activity);
                 }
             }
             HtmlInputHidden count = FindControl("count") as HtmlInputHidden;
             count.Value            = ac.Count().ToString();
             rptActivity.DataSource = ac.Skip((page - 1) * 9).Take(9);
             rptActivity.DataBind();
             //判断是不是评审
             if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
             {
                 liJudge.Visible = false;
             }
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "main-index.aspx");
     }
 }
Exemplo n.º 25
0
    protected void lbtRegister_Click(object sender, EventArgs e)
    {
        string name   = txtName.Text;
        string pwd    = txtNewPwd.Text;
        string repwd  = txtCheckPwd.Text;
        string number = txtNumber.Text;
        string phone  = txtPhone.Text;
        string email  = txtEmail.Text;

        if (name == "" || pwd == "" || repwd == "" || number == "" || phone == "" || email == "")
        {
            JSHelper.AlertThenRedirect("输入不能为空!", "main-index.aspx");
        }
        //Server.Transfer("main-index.aspx");
        else if (pwd != repwd)
        {
            JSHelper.AlertThenRedirect("前后密码不一致!", "main-index.aspx");
        }
        else if (!TeacherHelper.checkNumber(number))
        {
            JSHelper.AlertThenRedirect("该工号已存在!", "main-index.aspx");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                Teacher teacher = new Teacher();

                teacher.name         = name;
                teacher.password     = PwdHelper.MD5(pwd);
                teacher.gender       = 0;
                teacher.email        = email;
                teacher.number       = number;
                teacher.phone_number = phone;
                teacher.department   = "";
                teacher.rank         = "";
                teacher.is_judge     = 0;

                db.Teacher.Add(teacher);
                db.SaveChanges();
                JSHelper.AlertThenRedirect("注册成功!", "main-index.aspx");
                //JSHelper.js("window.location.reload();");
            }
        }
    }
Exemplo n.º 26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         int teacher_id = 1;
         if (Session["TeacherNumber"] != null)
         {
             teacher_id = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
         }
         else
         {
             Response.Redirect("main-index.aspx");
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "main-index.aspx");
     }
 }
Exemplo n.º 27
0
    public void Read(string path)
    {
        StreamReader sr   = new StreamReader(path, System.Text.Encoding.GetEncoding("utf-8"));
        string       line = sr.ReadLine();

        while (line != null)
        {
            string title = line.ToString().Length > 40 ?line.ToString().Substring(0, 40): line.ToString();
            string time  = sr.ReadLine().ToString() + " 20:26:50.557";
            sr.ReadLine();
            string img = sr.ReadLine();
            if (img == "" || img.TrimStart() == "")
            {
                img = ".\\dataimg\\6367117527503186294767178.jpg";
            }
            //sr.ReadLine();
            string content = sr.ReadLine().ToString().TrimStart();
            line = sr.ReadLine();
            //line = sr.ReadLine().TrimStart();
            //while (line != null && line[0] == '<')
            //{
            //    content += line;
            //    line = sr.ReadLine();
            //}
            //line = sr.ReadLine();

            using (var db = new TeachingCenterEntities())
            {
                ActivitySummary acsu = new ActivitySummary();
                acsu.ActivitySummary_title   = title;
                acsu.ActivitySummary_content = content;
                acsu.ActivitySummary_time    = Convert.ToDateTime(time);
                acsu.ActivitySummary_summary = title;
                acsu.ActivitySummary_cover   = img.TrimStart();
                acsu.ActivitySummary_author  = "系统管理员";
                db.ActivitySummary.Add(acsu);
                db.SaveChanges();
                JSHelper.AlertThenRedirect("发布成功!", "ActivitySummaryManage.aspx");
                //Server.Transfer("ActivitySummaryManage.aspx");
            }
        }
    }
Exemplo n.º 28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string teacher = Session["AdminID"].ToString();
            if (!IsPostBack)
            {
                using (var db = new TeachingCenterEntities())
                {
                    // 绑定项目列表
                    var project = from it in db.ProjectInfo where it.is_deleted == 0 orderby it.submit_time descending select it;
                    ltSum.Text            = project.Count().ToString();
                    TotalPage.Text        = Math.Ceiling(project.Count() / 10.0).ToString();
                    currentPage.Text      = "1";
                    rptProject.DataSource = project.ToList().Take(10);
                    rptProject.DataBind();
                    Session["ds"] = project.ToList();

                    // 绑定项目分类下拉框
                    var category = from it in db.ProjectCategory where it.is_deleted == 0 select it;
                    this.DropDownList.DataSource     = category.ToList();
                    this.DropDownList.DataValueField = "id";
                    this.DropDownList.DataTextField  = "name";
                    this.DropDownList.DataBind();
                    ListItem item = new ListItem();
                    item.Text  = "全部分类";
                    item.Value = "0";
                    this.DropDownList.Items.Insert(0, item);

                    // 绑定评审列表
                    var judge = from it in db.Teacher where it.is_judge == 1 select it;
                    rptJudge.DataSource = judge.ToList();
                    rptJudge.DataBind();
                }
            }
        }
        catch
        {
            JSHelper.AlertThenRedirect("请先登录!", "Login.aspx");
        }
    }
Exemplo n.º 29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //判断是不是评审
         if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
         {
             liJudge.Visible = false;
         }
         int page = 1;
         try
         {
             page = Convert.ToInt16(Request.QueryString["page"].ToString());
         }
         catch
         {
         }
         int teacher = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString());
         //int teacher = 2;
         using (var db = new TeachingCenterEntities())
         {
             var myService = from it in db.Service
                             where it.Service_teacher == teacher && it.Service_isdeleted == 0
                             orderby it.Service_time descending
                             select it;
             HtmlInputHidden count = FindControl("count") as HtmlInputHidden;
             count.Value           = myService.Count().ToString();
             rptService.DataSource = myService.ToList().Skip((page - 1) * 9).Take(9);
             rptService.DataBind();
         }
         //判断是不是评审
         if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
         {
             liJudge.Visible = false;
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登录!", "main-index.aspx");
     }
 }
Exemplo n.º 30
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //判断是不是评审
         if (!TeacherHelper.isJudge(Session["TeacherNumber"].ToString()))
         {
             liJudge.Visible = false;
         }
         this.FileUp.Attributes.Add("onchange", "javascript:return Check_FilePath();");
         if (!IsPostBack)
         {
             int project_id = 1;
             if (Request.QueryString["id"] != null)
             {
                 project_id = Convert.ToInt32(Request.QueryString["id"]);
             }
             else
             {
                 Response.Redirect("main-index.aspx");
             }
             using (var db = new TeachingCenterEntities())
             {
                 // 获取当前项目
                 var projectinfo = (from it in db.ProjectInfo where it.project_id == project_id select it).FirstOrDefault();
                 txtName.Text = projectinfo.name;                                         // 项目名称
                 var project = (from it in db.Project where it.project_id == project_id select it).FirstOrDefault();
                 txtMoney.Text = project.fund;                                            // 资助金额
                 var project_stage = (from it in db.ProjectStage where it.project_id == project_id orderby it.stage descending select it).FirstOrDefault();
                 myEditor11.InnerText = Server.HtmlDecode(project_stage.project_content); // 项目内容
                 int index = project_stage.project_file.IndexOf("/");
                 lbFileName.Text = project_stage.project_file.Substring(index + 1);       // 项目文件
             }
         }
     }
     catch
     {
         JSHelper.AlertThenRedirect("请先登陆!", "main-index.aspx");
     }
 }