Ejemplo n.º 1
0
 private void LoadImage()
 {
     Image1.ImageUrl = UploadSupport.Image("index1.png");
     Image2.ImageUrl = UploadSupport.Image("index2.png");
     Image3.ImageUrl = UploadSupport.Image("index3.png");
     Image4.ImageUrl = UploadSupport.Image("index4.png");
 }
Ejemplo n.º 2
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!Regex.IsMatch(StuNickName.Text.ToString(), @"^\S{2,10}$"))
        {
            throw new Exception();
        }
        if (!Regex.IsMatch(StuNickName.Text.ToString(), @"^\S[^\^]+$"))
        {
            throw new Exception();
        }
        if (!Regex.IsMatch(StuEmail.Text.ToString(), @"^\S[^\^]+$"))
        {
            throw new Exception();
        }
        if (!Regex.IsMatch(StuPassword.Text.ToString(), @"^\S{1,10}$"))
        {
            throw new Exception();
        }
        if (!Regex.IsMatch(StuPassword.Text.ToString(), @"^\S[^\^]+$"))
        {
            throw new Exception();
        }
        //头像
        if (!Regex.IsMatch(StuPassword.Text.ToString(), @"^\d+$"))
        {
            throw new Exception();
        }

        string server    = Server.MapPath("~/");
        string imageName = UploadSupport.GenerateRandom(10) + ".jpg";
        string error;

        if (!UploadSupport.SaveImage(ImageFile, server, imageName, out error))
        {
            return;
        }
        StudentInfo student = new StudentInfo();

        student.Stu_UserName = StuNickName.Text.ToString();
        student.Stu_Password = StuPassword.Text.ToString();
        student.Stu_Email    = StuEmail.Text.ToString();
        //头像
        //时长
        student.Stu_RegisteTime = DateTime.Now;
        student.Stu_LastLogin   = DateTime.Now;

        bllStudent.Add(student);

        Response.Redirect("~/User/UserList.aspx");
    }
Ejemplo n.º 3
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!Regex.IsMatch(StuNickName.Text.ToString(), @"^\S{2,10}$"))
        {
            throw new Exception();
        }
        if (!Regex.IsMatch(StuNickName.Text.ToString(), @"^\S[^\^]+$"))
        {
            throw new Exception();
        }
        if (!Regex.IsMatch(StuEmail.Text.ToString(), @"^([a-zA-Z0-9]+[_|_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$"))
        {
            throw new Exception();
        }


        if (Request.QueryString["id"] != null)
        {
            StuNo.Value = Request.QueryString["id"].ToString();
        }
        else
        {
            return;
        }

        string server    = Server.MapPath("~/");
        string imageName = UploadSupport.GenerateRandom(10) + ".jpg";
        string error;

        if (!UploadSupport.SaveImage(ImageFile, server, imageName, out error))
        {
            return;
        }

        StudentInfo student = bllStudent.Get(Int32.Parse(StuNo.Value));

        student.Stu_UserName    = StuNickName.Text.ToString();
        student.Stu_Email       = StuEmail.Text.ToString();
        student.Stu_LastLogin   = DateTime.Now;
        student.Stu_RegisteTime = DateTime.Now;
        student.Stu_Image       = UploadSupport.Image(imageName);
        //头像
        //时长

        bllStudent.Modify(student);

        Response.Redirect("~/User/UserList.aspx");
    }
Ejemplo n.º 4
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!Regex.IsMatch(TeacherName.Text.ToString(), @"^.{2,10}$"))
            throw new Exception();
        if (!Regex.IsMatch(TeacherNickName.Text.ToString(), @"^\S*$"))
            throw new Exception();
        if (!Regex.IsMatch(TeacherSex.SelectedValue, @"^\S*$"))
            throw new Exception();
        if (!Regex.IsMatch(TeacherAge.Text.ToString(), @"^\d{1,2}$"))
            throw new Exception();
        if (!Regex.IsMatch(TeacherNation.Text.ToString(), @"^America|England|Australia$"))
            throw new Exception();
        if (!Regex.IsMatch(TeacherSkill.Text.ToString(), @"^[^\^]+$"))
            throw new Exception();
        if (!Regex.IsMatch(TeacherDescribe.Text.ToString(), @"^[^\^]+$"))
            throw new Exception();

        string server = Server.MapPath("~/");
        string imageName = UploadSupport.GenerateRandom(10) + ".jpg";
        string error;

        if (!UploadSupport.SaveImage(FileUpload, server, imageName, out error))
            return;
        string imageSName = UploadSupport.GenerateRandom(10) + ".jpg";
        string errorS;
        if (!UploadSupport.SaveImage(FileSUpload, server, imageSName, out errorS))
            return;

        TeacherInfo teacher = new TeacherInfo();

        teacher.Tea_Name = TeacherName.Text.ToString();
        teacher.Tea_Nickname = TeacherNickName.Text.ToString();
        teacher.Tea_Image = UploadSupport.Image(imageName);
        teacher.Tea_SImage = UploadSupport.Image(imageSName);
        teacher.Tea_Sex = TeacherSex.SelectedValue.ToString();
        teacher.Tea_Age = Int32.Parse(TeacherAge.Text.ToString());
        teacher.Tea_Nation = TeacherNation.Text.ToString();
        teacher.Tea_Skill = TeacherSkill.Text.ToString();
        teacher.Tea_Describe = TeacherDescribe.Text.ToString();

        bllTeacher.Add(teacher);

        Response.Redirect("~/Teacher/TeacherList.aspx");
    }
Ejemplo n.º 5
0
    protected void Modify_Click(object sender, EventArgs e)
    {
        var    btn = sender as Button;
        string errorMsg;
        string server = Server.MapPath("~/");

        if (ImageFile1.HasFile)
        {
            UploadSupport.SaveImage(ImageFile1, server, "index1.png", out errorMsg);
        }
        if (ImageFile2.HasFile)
        {
            UploadSupport.SaveImage(ImageFile2, server, "index2.png", out errorMsg);
        }
        if (ImageFile3.HasFile)
        {
            UploadSupport.SaveImage(ImageFile3, server, "index3.png", out errorMsg);
        }
        if (ImageFile4.HasFile)
        {
            UploadSupport.SaveImage(ImageFile4, server, "index4.png", out errorMsg);
        }
    }