Exemple #1
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");
                    }
                }
            }
        }
    }
Exemple #2
0
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     if (txtNewPsw.Text == "" || txtAgainPsw.Text == "")
     {
         Response.Write(JSHelper.ShowAlert("请输入密码"));
     }
     else
     {
         if (txtNewPsw.Text != txtAgainPsw.Text)
         {
             Response.Write(JSHelper.ShowAlert("新密码和确认密码不同"));
         }
         else
         {
             User user   = (User)Session["User"];
             bool result = UserHelper.UpdatePwd(user.Number, txtAgainPsw.Text);
             if (result == true)
             {
                 Session.Clear();
                 Response.Write("<script>alert('修改成功,请重新登录!');window.location.href ='Login.aspx'</script>");
             }
             else
             {
                 Response.Write(JSHelper.ShowAlert("修改失败"));
             }
         }
     }
 }
Exemple #3
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");
            }
        }
    }
Exemple #4
0
    protected void submit_Click(object sender, EventArgs e)
    {
        string number = userNum.Text.Trim();
        Regex  reNUm  = new Regex(@"[0-9a-zA-Z]{1,11}");
        string name   = userName.Text.Trim();
        string pwd    = userPwd.Text.Trim();
        string rptPwd = userPwdRpt.Text.Trim();
        Regex  rePwd  = new Regex(@"^[a-zA-Z]\w{6,18}$");

        if (string.IsNullOrEmpty(pwd) || string.IsNullOrEmpty(number) || string.IsNullOrEmpty(name))
        {
            Response.Write(JSHelper.ShowAlert("信息不能为空!"));
            return;
        }
        else
        {
            if (!reNUm.IsMatch(number) || !rePwd.IsMatch(pwd) || !pwd.Equals(rptPwd))
            {
                //Response.Write(JSHelper.ShowAlert("请输入合法学工号或密码"));
                return;
            }
        }
        if (!AdminHelper.Add(number, name, pwd, dpl.SelectedValue))
        {
            Response.Write(JSHelper.ShowAlert("不能重复注册!"));
        }
        else
        {
            Response.Write(JSHelper.ShowAlert("添加成功!\\n学工号: " + number + "\\n密码: " + pwd + ""));
            Response.Write("<script>location.href='adminList.aspx';</script>");
        }
    }
Exemple #5
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");
            }
        }
    }
    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");
            }
        }
    }
Exemple #7
0
 protected void gdvTeacherLs_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Reset")
     {
         string userNum = e.CommandArgument.ToString().Trim();
         if (UserHelper.UpdatePwd(userNum, "OUCIT"))
         {
             Response.Write(JSHelper.ShowAlert("密码重置成功,密码为:OUCIT"));
         }
         else
         {
             Response.Write(JSHelper.ShowAlert("密码重置失败,请重试!"));
         }
     }
     else if (e.CommandName == "mydelete")
     {
         int userId = Convert.ToInt32(e.CommandArgument.ToString().Trim());
         if (UserHelper.Delete(userId))
         {
             Response.Write(JSHelper.ShowAlert("用户删除成功"));
             Response.Redirect("adminList.aspx");
         }
         else
         {
             Response.Write(JSHelper.ShowAlert("用户删除成功,请重试!"));
             Response.Redirect("adminList.aspx");
         }
     }
 }
    /*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");
                }
            }
        }
    }
Exemple #9
0
 protected void btnCheck_Click(object sender, EventArgs e)
 {
     if (txtNum.Text.Length == 0)
     {
         Response.Write(JSHelper.ShowAlert("输入不能为空!"));
     }
     else
     {
         var user = UserHelper.Select(txtNum.Text);
         if (user == null)
         {
             lblName.Text = "不存在该老师或学生<br/>";
         }
         else
         {
             var teac = TeacherHelper.Select(user.UserID);
             if (teac != null)
             {
                 lblName.Text = teac.Name;
             }
             else
             {
                 var stu = StudentHelper.Select(user.UserID);
                 if (stu != null)
                 {
                     lblName.Text = stu.Name;
                 }
                 else
                 {
                     lblName.Text = "不存在该老师或学生<br/>";
                 }
             }
         }
     }
 }
    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("存在非法输入!");
            }
        }
    }
Exemple #11
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        string url = "";

        /// <summary>
        if (FileUpload1.HasFile)
        {
            var      savePath         = HttpContext.Current.Server.MapPath("~/Uploads/");
            var      fileName         = FileUpload1.FileName;
            var      fileExtension    = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
            string[] allowedExtension = { ".png", ".gif", ".jpg" };
            if (allowedExtension.Contains(fileExtension))
            {
                fileName = DateTime.Now.ToString("yyyyMMdd-HHmmssff_") + fileName;
                FileUpload1.SaveAs(System.IO.Path.Combine(savePath, fileName));
                url = "/Uploads/" + fileName;
            }
            else
            {
                url = "";
            }
        }
        if (url != "")
        {
            Image1.ImageUrl = url;
        }
        else
        {
            JSHelper.ShowAlert("您上传的文件格式不正确,允许的格式为 png, gif, jpg");
        }
    }
Exemple #12
0
    protected void editGroup_Click(object sender, EventArgs e)
    {
        Regex re = new Regex(@"(http|https)://[^\s]*");

        if (txtGpName.Text.Trim().Equals(string.Empty))
        {
            Response.Write(JSHelper.ShowAlert("组织名称不能为空!"));
            return;
        }

        if (!re.IsMatch(txtGpLink.Text))
        {
            Response.Write(JSHelper.ShowAlert("请输入正确网址!"));
            return;
        }
        string link   = txtGpLink.Text;
        string imgUrl = Image1.ImageUrl;

        if (GroupHelper.Update(pageGp.GroupID, txtGpName.Text, dpl.SelectedValue, Image1.ImageUrl, txtGpLink.Text))
        {
            //Response.Write(JSHelper.ShowAlert("更改成功!"));
            Response.Redirect(Request.RawUrl);
        }
        else
        {
            Response.Write(JSHelper.ShowAlert("更改失败!(名字不能重复)"));
        }

        // Response.Redirect("groupEdit.aspx");
    }
Exemple #13
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        Regex rePwd = new Regex(@"^[a-zA-Z]\w{6,18}$");

        if (txtNewPsw.Text.Trim() == "" || txtAgainPsw.Text.Trim() == "")
        {
            Response.Write(JSHelper.ShowAlert("请输入密码"));
        }
        else
        {
            if (!rePwd.IsMatch(txtNewPsw.Text))
            {
                Response.Write(JSHelper.ShowAlert("请输入合法密码"));
                return;
            }
            else if (txtNewPsw.Text != txtAgainPsw.Text)
            {
                Response.Write(JSHelper.ShowAlert("新密码和确认密码不同"));
            }
            else
            {
                User user   = (User)Session["User"];
                bool result = UserHelper.UpdatePwd(user.Number, txtAgainPsw.Text);
                if (result == true)
                {
                    Session.Clear();
                    Response.Write("<script>alert('修改成功,请重新登录!');window.location.href ='../Login.aspx'</script>");
                }
                else
                {
                    Response.Write(JSHelper.ShowAlert("修改失败"));
                }
            }
        }
    }
Exemple #14
0
    protected void editGroup_Click(object sender, EventArgs e)
    {
        Regex re = new Regex(@"(http|https)://[^\s]*");

        if (txtGpName.Text.Trim().Equals(string.Empty))
        {
            Response.Write(JSHelper.ShowAlert("组织名称不能为空!"));
            return;
        }

        if (!re.IsMatch(txtGpLink.Text))
        {
            Response.Write(JSHelper.ShowAlert("请输入正确网址!"));
            return;
        }

        if (GroupHelper.Select(txtGpName.Text) != null)
        {
            Response.Write(JSHelper.ShowAlert("该组织已存在!"));
            return;
        }
        if (GroupHelper.Add(txtGpName.Text.Trim(), dplAddTyped.SelectedValue, Image1.ImageUrl, txtGpLink.Text.Trim()))
        {
            Response.Write(JSHelper.ShowAlert("添加成功!"));
            Response.Redirect("groupList.aspx");
        }
        else
        {
            Response.Write(JSHelper.ShowAlert("添加失败!请重试!"));
        }
    }
Exemple #15
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");
            }
        }
    }
Exemple #16
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("请先登录!");
        }
    }
Exemple #17
0
 protected void txtPwd_Click(object sender, EventArgs e)
 {
     if (txtCheckPwd.Text != Session["random"].ToString())
     {
         JSHelper.ShowAlert("验证码错误!");
     }
     else
     {
         divPwd.Visible    = false;
         divEditor.Visible = true;
     }
 }
Exemple #18
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string saveField = string.Empty;

        if (dplSubType.Visible == false)
        {
            saveField = dplType.SelectedValue;
        }
        else
        {
            saveField = dplSubType.SelectedValue;
        }
        if (saveField == "合作办学")
        {
            saveField = QueryType + ":" + txtCoopTitle.Text.Trim();
        }
        else
        {
            saveField = QueryType + ":" + saveField;
        }


        if (Server.HtmlDecode(myEditor11.InnerHtml).Trim().Length == 0 || (QueryType == "合作办学" && txtCoopTitle.Text.Trim().Length == 0))
        {
            Response.Write(JSHelper.ShowAlert("内容不能为空!"));
        }
        else
        {
            //判断是修改还是新增
            Introduce intr = db.Introduce.SingleOrDefault(p => p.name == saveField);
            if (intr == null)
            {
                //说明是新增
                intr = new Introduce
                {
                    name = saveField,
                    text = Server.HtmlDecode(myEditor11.InnerHtml)
                };
                db.Introduce.Add(intr);
                Response.Write(JSHelper.ShowAlert("添加成功!"));
            }
            else
            {
                //说明是修改
                intr.text = Server.HtmlDecode(myEditor11.InnerHtml);
                Response.Write(JSHelper.ShowAlert("修改成功!"));
            }
            db.SaveChanges();
        }
    }
Exemple #19
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtNum.Text.Length == 0)
     {
         Response.Write(JSHelper.ShowAlert("输入不能为空!"));
     }
     else
     {
         var user = UserHelper.Select(txtNum.Text);
         if (user != null)
         {
             var teac = TeacherHelper.Select(user.UserID);
             var stu  = StudentHelper.Select(user.UserID);
             if (teac != null || stu != null)
             {
                 var db      = new oucITEntities();
                 var itgroup = (from a in db.ITGroup
                                where a.GroupName == ddlGroup.Text
                                select a).SingleOrDefault();
                 var conn = (from a in db.Connection
                             where a.UserID == user.UserID && a.GroupID == itgroup.GroupID
                             select a).FirstOrDefault();
                 if (conn == null)
                 {
                     int class1 = ddlClass.Text == "管理员" ? 2 : 1;
                     if (ConnHelp.Add(itgroup.GroupID, user.UserID, ddlClass.Text, class1, txtJob.Text, txtDuty.Text, txtPhone.Text, txtEmail.Text) == true)
                     {
                         Response.Write("<script>alert('添加成功!');window.location.href ='Index.aspx'</script>");
                     }
                     else
                     {
                         Response.Write(JSHelper.ShowAlert("添加失败"));
                     }
                 }
                 else
                 {
                     Response.Write(JSHelper.ShowAlert("该老师或学生已存在于该组"));
                 }
             }
             else
             {
                 Response.Write(JSHelper.ShowAlert("该老师或学生不存在"));
             }
         }
         else
         {
             Response.Write(JSHelper.ShowAlert("该老师或学生不存在"));
         }
     }
 }
Exemple #20
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        string title   = txtTitle.Text;
        string content = myEditor11.InnerHtml;
        string summary = TextBox1.Text;

        if (title.Length == 0 || content.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (summary.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else
        {
            try
            {
                using (var db = new TeachingCenterEntities())
                {
                    int             id   = Convert.ToInt32(Request.QueryString["id"]);
                    ActivitySummary acsu = db.ActivitySummary.Single(a => a.ActivitySummary_id == id);
                    acsu.ActivitySummary_title   = title;
                    acsu.ActivitySummary_content = content;
                    acsu.ActivitySummary_summary = summary;
                    if (dropAuthor.SelectedValue == "0")
                    {
                        acsu.ActivitySummary_author = AdminHelper.getNameByID(Session["AdminID"].ToString());
                    }
                    else if (dropAuthor.SelectedValue == "1")
                    {
                        acsu.ActivitySummary_author = "匿名";
                    }
                    else
                    {
                        acsu.ActivitySummary_author = "未知";
                    }
                    acsu.ActivitySummary_time = Convert.ToDateTime(pushlishTime.Value);
                    db.SaveChanges();
                    Server.Transfer("ActivitySummaryManage.aspx");
                    //JSHelper.AlertThenRedirect("修改成功!", "ActivitySummaryManage.aspx");
                }
            }
            catch
            {
            }
        }
    }
    protected void ltbLogin_Click(object sender, EventArgs e)
    {
        string id  = txtID.Text;
        string pwd = txtPwd.Text;

        if (id.Length == 0 || pwd.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (TeacherHelper.checkNumber(id))
        {
            JSHelper.ShowAlert("工号不存在!");
        }
        else
        {
            if (Session["PngLogin"] != null)
            {
                if (TextBox1.Value != Session["PngLogin"].ToString())
                {
                    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));
                            }
                            //JSHelper.AlertThenRedirect("登陆成功!","main-index.aspx");

                            Session["TeacherNumber"] = id;
                            Server.Transfer("main-index.aspx");
                            //JSHelper.js("window.history.go(0);");
                        }
                        else
                        {
                            JSHelper.ShowAlert("密码错误!");
                        }
                    }
                }
            }
        }
    }
Exemple #22
0
 protected void gdvGpLs_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "mydelete")
     {
         int connID = Convert.ToInt32(e.CommandArgument.ToString());
         if (ConnHelp.Delete(connID))
         {
             Response.Write(JSHelper.ShowAlert("删除成功"));
             Response.Redirect(Request.RawUrl);
         }
         else
         {
             Response.Write(JSHelper.ShowAlert("删除失败,请重试"));
         }
     }
 }
Exemple #23
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (txtName.Text.Length == 0)
        {
            Response.Write(JSHelper.ShowAlert("姓名不能为空!"));
        }
        else if (txtYear.Text.Length == 0 || txtMonth.Text.Length == 0 || txtDay.Text.Length == 0)
        {
            Response.Write(JSHelper.ShowAlert("生日不能为空!"));
        }
        else if (ddlJobTitle.Text.Length == 0)
        {
            Response.Write(JSHelper.ShowAlert("请选择职称!"));
        }
        else if (ddlJob.Text.Length == 0)
        {
            Response.Write(JSHelper.ShowAlert("请选择职务!"));
        }
        else if (ddlTutor.Text.Length == 0)
        {
            Response.Write(JSHelper.ShowAlert("请选择导师!"));
        }
        else
        {
            User     u     = (User)Session["User"];
            string   birth = txtYear.Text + "/" + txtMonth.Text + "/" + txtDay.Text;
            DateTime dt    = DateTime.Parse(birth);
            //dt.Year = Convert.ToInt32(txtYear.Text);
            txtExperience.Text = txtExperience.Text.Replace("\r\n", "<br>");

            if (TeacherHelper.Update(u.UserID, Image1.ImageUrl, txtName.Text, dt, txtStatus.Text, txtEducation.Text,
                                     txtMobile.Text, txtOffice.Text, txtEmail.Text, txtWork.Text, txtAddress.Text,
                                     TeacherHelper.ChangeJobTitle(ddlJobTitle.Text), TeacherHelper.ChangeJob(ddlJob.Text),
                                     TeacherHelper.ChangeTutor(ddlTutor.Text), ddlDepartment.Text, txtCourse.Text,
                                     txtExperience.Text.Replace("\r\n", "<br>"), txtResearchDirection.Text.Replace("\r\n", "<br>"),
                                     txtResearchProject.Text.Replace("\r\n", "<br>"), txtAchievements.Text.Replace("\r\n", "<br>"),
                                     txtPaper.Text.Replace("\r\n", "<br>"), txtEnrolment.Text.Replace("\r\n", "<br>"),
                                     txtRemark.Text.Replace("\r\n", "<br>")) == true)
            {
                Response.Write("<script>alert('修改成功!');window.location.href ='Index.aspx'</script>");
            }
            else
            {
                Response.Write("修改失败");
            }
        }
    }
Exemple #24
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        User    u       = (User)Session["User"];
        var     db      = new oucITEntities();
        ITGroup itgroup = GroupHelper.Select(ddlGroup.Text);
        var     conn    = (from a in db.Connection
                           where a.UserID == u.UserID && a.GroupID == itgroup.GroupID
                           select a).FirstOrDefault();

        if (ConnHelp.MessUpdate(conn.GroupID, u.UserID, txtJob.Text, txtDuty.Text, txtPhone.Text, txtEmail.Text))
        {
            Response.Write("<script>alert('修改成功!');window.location.href ='Index.aspx'</script>");
        }
        else
        {
            Response.Write(JSHelper.ShowAlert("修改失败"));
        }
    }
Exemple #25
0
 protected void btnDelCheck_Click(object sender, EventArgs e)
 {
     if (txtDelete.Text.Length == 0)
     {
         Response.Write(JSHelper.ShowAlert("输入不能为空!"));
     }
     else
     {
         var user = UserHelper.Select(txtDelete.Text);
         if (user == null)
         {
             lblDelete.Text = "该组不存在该老师或学生<br/>";
         }
         else
         {
             var teac = TeacherHelper.Select(user.UserID);
             var stu  = StudentHelper.Select(user.UserID);
             if (teac != null || stu != null)
             {
                 var itgroup = GroupHelper.Select(ddlDelete.Text);
                 var db      = new oucITEntities();
                 var conn    = (from a in db.Connection
                                where a.UserID == user.UserID && a.GroupID == itgroup.GroupID
                                select a).SingleOrDefault();
                 if (conn != null && teac != null)
                 {
                     lblDelete.Text = teac.Name;
                 }
                 else if (conn != null && stu != null)
                 {
                     lblDelete.Text = stu.Name;
                 }
                 else
                 {
                     lblDelete.Text = "该组不存在该老师或学生<br/>";
                 }
             }
             else
             {
                 lblDelete.Text = "该组不存在该老师<br/>";
             }
         }
     }
 }
Exemple #26
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 (!AdminHelper.checkExit(id))
        {
            JSHelper.ShowAlert("账号不存在!");
        }
        else if (Session["CheckCode"] != null)
        {
            string checkcode = Session["CheckCode"].ToString();
            if (TextBox1.Text != checkcode)
            {
                JSHelper.ShowAlert("验证码错误!");
            }
            else
            {
                using (var db = new TeachingCenterEntities())
                {
                    Admin ad = db.Admin.Single(a => a.Admin_id == id);
                    if (ad.Admin_pwd == PwdHelper.MD5(pwd))
                    {
                        //if (cbxRemeberUser.Checked == true)
                        //{
                        //    CookieHelper.SetCookie("AdminID", txtID.Text, DateTime.Now.AddDays(30));
                        //    CookieHelper.SetCookie("AdminPwd", txtPwd.Text, DateTime.Now.AddDays(30));
                        //}
                        //JSHelper.ShowAlert("登陆成功");
                        Session["AdminID"] = id;
                        Server.Transfer("Index.aspx");
                    }
                    else
                    {
                        JSHelper.ShowAlert("密码错误!");
                    }
                }
            }
        }
    }
Exemple #27
0
    //批量删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        using (var db = new TeachingCenterEntities())
        {
            int count = 0;
            for (int i = 0; i < this.rptCategory.Items.Count; i++)
            {
                CheckBox cbx = (CheckBox)rptCategory.Items[i].FindControl("chbCheck");
                if (cbx != null)
                {
                    if (cbx.Checked == true)
                    {
                        count++;
                    }
                }
            }

            var list = from it in db.DevelopCategory select it;
            if (list.Count() == count)
            {
                JSHelper.ShowAlert("请至少留有一个分类!");
            }
            else
            {
                for (int i = 0; i < this.rptCategory.Items.Count; i++)
                {
                    CheckBox cbx  = (CheckBox)rptCategory.Items[i].FindControl("chbCheck");
                    string   name = ((Literal)rptCategory.Items[i].FindControl("ltName")).Text;
                    if (cbx != null)
                    {
                        if (cbx.Checked == true)
                        {
                            DevelopCategory sc = db.DevelopCategory.Single(a => a.DevelopCategory_name == name);
                            db.DevelopCategory.Remove(sc);
                            db.SaveChanges();
                        }
                    }
                }
                // JSHelper.AlertThenRedirect("删除成功!", "DevelopCategoryManage.aspx");
                Server.Transfer("DevelopCategoryManage.aspx");
            }
        }
    }
Exemple #28
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        string number = txtNumber.Text;

        if (TeacherHelper.checkNumber(number))
        {
            JSHelper.ShowAlert("工号不存在!");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                Teacher te = db.Teacher.Single(a => a.number == number);
                ltName.Text   = te.name;
                ltNumber.Text = te.number;
            }
            divTeacher.Visible = true;
        }
    }
Exemple #29
0
    protected void lbPwd_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);
            if (!Convert.ToBoolean(admin.Admin_emai_check))
            {
                JSHelper.ShowAlert("请先验证邮箱!");
            }
            else
            {
                divPwd.Visible = true;
                lbPwd.Visible  = false;
                SendMail();
            }
        }
    }
Exemple #30
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtDelete.Text.Length == 0)
     {
         Response.Write(JSHelper.ShowAlert("输入不能为空!"));
     }
     else
     {
         var user = UserHelper.Select(txtDelete.Text);
         if (user == null)
         {
             Response.Write(JSHelper.ShowAlert("该组不存在该老师"));
         }
         else
         {
             var teac = TeacherHelper.Select(user.UserID);
             var stu  = StudentHelper.Select(user.UserID);
             if (teac != null || stu != null)
             {
                 var itgroup = GroupHelper.Select(ddlDelete.Text);
                 var db      = new oucITEntities();
                 var conn    = (from a in db.Connection
                                where a.UserID == user.UserID && a.GroupID == itgroup.GroupID
                                select a).SingleOrDefault();
                 if (conn != null)
                 {
                     db.Connection.Remove(conn);
                     db.SaveChanges();
                     Response.Write("<script>alert('删除成功!');window.location.href ='Index.aspx'</script>");
                 }
                 else
                 {
                     Response.Write(JSHelper.ShowAlert("该组不存在该老师或学生"));
                 }
             }
             else
             {
                 Response.Write(JSHelper.ShowAlert("该组不存在该老师或学生"));
             }
         }
     }
 }