protected void Button1_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrWhiteSpace(TextBox1.Text) && !string.IsNullOrWhiteSpace(TextBox2.Text) && !string.IsNullOrWhiteSpace(TextBox3.Text) && !string.IsNullOrWhiteSpace(TextBox4.Text) && !string.IsNullOrWhiteSpace(TextBox5.Text) && !string.IsNullOrWhiteSpace(TextBox6.Text))
        {
            using (var db = new ItshowEntities2())
            {

                var changeMem = new Display_admin();
                changeMem.Membername  = TextBox1.Text;
                changeMem.Hobby = TextBox2.Text;
                changeMem.Speciality  = TextBox3.Text;
                changeMem.Experience = TextBox4.Text;
                changeMem.Position = TextBox5.Text;
                changeMem.Time = TextBox6.Text;

                changeMem.Phtograph = Session["Image2"].ToString();

                int Vf = db.SaveChanges();
                db.SaveChanges();

                if (Vf == 1)
                {
                    Response.Write("<script>alert('修改成功');</script>");

                }

            }

        }

        else
        {
            Response.Write("<script>alert('请输入完整的信息');</script>");
        }
    }
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "delete")
        {
            using (var db = new ItshowEntities2())
            {
                string workName = e.CommandArgument.ToString();
                var workRm = db.Display__works.SingleOrDefault(a => a.Name == workName);
                if (workRm == null)
                {
                    Response.Redirect("~/Backstage/Addadmin.aspx");
                }
                else
                {
                    db.Display__works.Remove(workRm);
                    int Vf = db.SaveChanges();
                    db.SaveChanges();
                    if (Vf == 1)
                    {

                        Response.Write("<script>alert('删除成功');</script>");
                        Response.Write("<script>location.reload()</script>");

                    }
                    else
                    {
                        Response.Write("<script>alert('删除失败');</script>");
                    }

                }
            }

        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string Code = Session["image"].ToString().Trim();  //验证码
        string Txtbox =HttpUtility.HtmlEncode(this.TextBox2.Text).ToString().Trim();
        if (TextBox1.Text != "")
        {
            if (Code == Txtbox.ToUpper())
            {
                using (var db = new ItshowEntities2())
                {
                    string New_Message;
                    New_Message = HttpUtility.HtmlEncode(TextBox1.Text);
                    var guidebook = new Guestbook();

                    guidebook.Contents = New_Message;
                    guidebook.Puttime = DateTime.Now.ToString();
                    db.Guestbooks.Add(guidebook);
                    db.SaveChanges();
                    Response.Write("<script>alert('留言提交成功,请耐心等待审核结果!');</script>");
                    TextBox1.Text = null;
                    TextBox2.Text = null;
                }
            }
            else
                Response.Write("<script>alert('验证码不正确,请重新输入!');</script>");
        }
        else
            Response.Write("<script>alert('主要内容不能为空!');</script>");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrWhiteSpace(TextBox1.Text) && !string.IsNullOrWhiteSpace(TextBox2.Text) && !string.IsNullOrWhiteSpace(TextBox3.Text) && !string.IsNullOrWhiteSpace(TextBox4.Text))
        {
            using (var db = new ItshowEntities2())

            {

                var changeWord = new Display__works();
                changeWord.Name = TextBox1.Text;
                changeWord.Contents = TextBox2.Text;
                changeWord.Time = TextBox3.Text;
                changeWord.Html = TextBox4.Text;
                changeWord.Image = Session["Image"].ToString();

                int Vf = db.SaveChanges();
                db.SaveChanges();

                if (Vf == 1)
                {
                    Response.Write("<script>alert('修改成功');</script>");

                }

            }

        }

        else
        {
            Response.Write("<script>alert('请输入完整的信息');</script>");
        }
    }
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Add")
        {
            TextBox Reply = e.Item.FindControl("Reply") as TextBox;
            string reply = Reply.Text;
            if (Reply.Visible)
            {
                if (!string.IsNullOrEmpty(Reply.Text))
                {

                    using (var db = new ItshowEntities2())
                    {
                        string replyer = Session["admin"].ToString();
                        string Head = e.CommandArgument.ToString();
                        var change = db.Guestbooks.SingleOrDefault(a => a.Headline == Head);
                        change.Pass = 1;
                        change.Reply = reply;
                        change.Replytime = DateTime.Now.ToString();
                        change.Replyer = replyer;
                        int Vf = db.SaveChanges();

                        if (Vf == 1)
                        {
                            Response.Write("<script>alert('操作成功');</script>");
                        }
                    }

                    BindGrid();
                }
                else
                {
                    Response.Write("<script>alert('回复内容不能为空');location.href='#" + "Repeater1_" + Reply.ClientID + "'</script>");
                }
            }
            else
            {
                Reply.Visible = true;

            }
        }
        if (e.CommandName == "Del")
        {
            LinkButton Del = e.Item.FindControl("Del") as LinkButton;
            using (var db = new ItshowEntities2())
            {
                string Head = e.CommandArgument.ToString();
                var del = db.Guestbooks.SingleOrDefault(a => a.Headline == Head);
                db.Guestbooks.Remove(del);
                int Vf = db.SaveChanges();
                if (Vf == 1)
                {
                    Response.Write("<script>alert('操作成功');</script>");
                }
            }

            BindGrid();
            Response.Write("<script>location.href='#" + "Repeater1_" + Del.ClientID + "'</script>");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
            //_FileBrowser.BasePath = "/ckfinder/";
            //_FileBrowser.SetupCKEditor(CKEditor1);

            CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
            _FileBrowser.BasePath = "/ckfinder/";
            _FileBrowser.SetupCKEditor(CKEditorControl1);

            if (Request.QueryString["Headline"]!= null)
            {
                string Headline = Request.QueryString["Headline"].ToString();
                using (var db = new ItshowEntities2())
                {
                    var newsChange = db.Notices.SingleOrDefault(a => a.Headline == Headline);

                    TextBox1.Text = newsChange.Headline;
                    CKEditorControl1.Text = newsChange.Contents;

                }

            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        using (var db = new ItshowEntities2())

        {

            var joinVf = db.joinTimes.SingleOrDefault(a => a.joinON== 0);

            if (joinVf == null)
            {
                Response.Write("<script>alert('报名已开启');</script>");
            }
            else {
                joinVf.joinON = 1;
               int Vf= db.SaveChanges();
               if (Vf == 1)

               {
                   Response.Write("<script>alert('成功开启报名');</script>");
               }

            }

        }
    }
    protected void submit_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBox1.Text) && !string.IsNullOrEmpty(CKEditorControl1.Text))
        {

            using (var db = new ItshowEntities2())
            {

                var noticeAdd = new Notice();
                noticeAdd.Headline = TextBox1.Text;
                noticeAdd.Puttime = DateTime.Now.ToString();
              //  noticeAdd.Contents = CKEditorControl1.Text;

                noticeAdd.Image = "1";

                noticeAdd = new Notice
                    {
                        Headline = TextBox1.Text,

                        Puttime = DateTime.Now.ToString(),

                        Contents = CKEditorControl1.Text,
                        Image = "1",
                    };

                db.Notices.Add(noticeAdd);

                try
                {

                    int Vf = db.SaveChanges(); // 写数据库
                    db.SaveChanges();
                    if (Vf == 1)
                    {
                        Response.Write("<script>alert('添加成功');</script>");

                    }
                }
                catch (DbEntityValidationException Ex)

                {

                }

                      //  DbEntityValidationException

                // Response.Redirect("~/Frontstage/login.aspx");

            }

        }

        else
        {
            Response.Write("<script>alert('标题和内容不能为空');</script>");

        }
    }
 public void BindGrid()
 {
     using (var db = new ItshowEntities2())
     {
         var count = db.Guestbooks.Where(a => a.Pass == 1).Count();
         AspNetPager1.RecordCount = count;
         var selectmessage = (from mess in db.Guestbooks
                              where mess.Pass == 1
                              orderby mess.Puttime
                              select mess).Skip(AspNetPager1.StartRecordIndex - 1).Take(AspNetPager1.PageSize);
         Repeater1.DataSource = selectmessage.ToList();
         Repeater1.DataBind();
     }
 }
Beispiel #10
0
 public void BindGrid()
 {
     using (var db = new ItshowEntities2())
     {
         var count = db.Notices.Count();
         AspNetPager1.RecordCount = count;
         var selectnews = (from n in db.Notices
                           orderby n.Puttime
                           select n).Skip(AspNetPager1.StartRecordIndex - 1).Take(AspNetPager1.PageSize);
         Repeater1.DataSource = selectnews.ToList();
         Repeater1.DataBind();
         Repeater2.DataSource = selectnews.ToList();
         Repeater2.DataBind();
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        using (var db = new ItshowEntities2())

        {
            if (!IsPostBack)
            {
                var joinVf = db.Joinus.Where(a => a.ifSeen == 1).Count();
                Label2.Text = joinVf.ToString();

                Label1.Text = "总访问量:"+Application["counter"].ToString();
            }

        }
    }
    public void BindGrid()
    {
        using (var db = new ItshowEntities2())
        {
            var Count = db.Joinus.Where(a => a.Name != null).Count();
            AspNetPager1.RecordCount = Count;

            var Join = (from a in db.Joinus
                       orderby a.Key descending
                        select a).Skip(AspNetPager1.StartRecordIndex - 1).Take(AspNetPager1.PageSize);

            Repeater1.DataSource = Join.ToList();
            Repeater1.DataBind();

        }
    }
Beispiel #13
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        using (var dv = new ItshowEntities2())
        {
            var ifadd = (from c in dv.joinTimes
                         orderby c.Key descending
                         select c.joinON).First();
            if (ifadd != 0)
            {
                if (addName.Text != "" && addSex.Text != "" && addMagor.Text != "" && addPhone.Text != "" && addEmail.Text != ""
         && addIntruduce.Text != "" && DropDownList1.Text != "选择方向")
                {
                    if (AddHelper.IsEmail(addEmail.Text) == false)
                        Response.Write("<script>alert('邮箱格式不正确,请重新输入'); location.href='ITMain.aspx#joinus'</script>");
                    else if (addSex.Text != "男" && addSex.Text != "女")
                        Response.Write("<script>alert('请正确填写性别信息'); location.href='ITMain.aspx#joinus'</script>");
                    else if (AddHelper.IsPhone(addPhone.Text) == false)
                        Response.Write("<script>alert('请正确填写手机信息'); location.href='ITMain.aspx#joinus'</script>");
                    else if (AddHelper.IsName(addName.Text) == false)
                        Response.Write("<script>alert('请正确填写姓名信息'); location.href='ITMain.aspx#joinus'</script>");
                    else
                    {
                        using (var db = new ItshowEntities2())
                        {
                            var joiner = new Joinu();
                            joiner.Name = HttpUtility.HtmlEncode(addName.Text);
                            joiner.Sex = HttpUtility.HtmlEncode(addSex.Text);
                            joiner.Major = HttpUtility.HtmlEncode(addMagor.Text);
                            joiner.Phonenumber = HttpUtility.HtmlEncode(addPhone.Text);
                            joiner.E_mail = HttpUtility.HtmlEncode(addEmail.Text);
                            joiner.Introduce = HttpUtility.HtmlEncode(addIntruduce.Text);
                            joiner.Direction = DropDownList1.Text;
                            joiner.ifSeen = 0;
                            db.Joinus.Add(joiner);
                            db.SaveChanges();
                            Response.Write("<script>alert('提交报名信息成功!'); location.href='ITMain.aspx'</script>");

                        }
                    }
                }
                else
                    Response.Write("<script>alert('关键信息不能为空!'); location.href='ITMain.aspx#joinus'</script>");
            }
            else
                Response.Write("<script>alert('当前时间不是有效的报名时间!'); location.href='ITMain.aspx#joinus'</script>");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrWhiteSpace(TextBox1.Text) && !string.IsNullOrWhiteSpace(TextBox2.Text) && !string.IsNullOrWhiteSpace(TextBox3.Text) && !string.IsNullOrWhiteSpace(TextBox4.Text) && !string.IsNullOrWhiteSpace(TextBox5.Text) && !string.IsNullOrWhiteSpace(TextBox6.Text) && !string.IsNullOrWhiteSpace(Session["Image2"].ToString ()))
        {
            using (var db = new ItshowEntities2())
            {
                var addMember = new Display_admin();
                addMember.Membername = TextBox1.Text;
                addMember.Hobby = TextBox2.Text;
                addMember.Speciality = TextBox3.Text;
                addMember.Experience = TextBox4.Text;
                addMember.Position = TextBox5.Text;
                addMember.Time = TextBox6.Text;
                addMember.Phtograph = Session["Image2"].ToString();

                addMember = new Display_admin
                {
                    Membername = TextBox1.Text,
              Hobby = TextBox2.Text,
               Speciality = TextBox3.Text,
                Experience = TextBox4.Text,
                Position = TextBox5.Text,
                Time = TextBox6.Text,
                Phtograph = Session["Image2"].ToString(),

                };

                db.Display_admin.Add(addMember);
                int Vf = db.SaveChanges();
                db.SaveChanges();

                if (Vf == 1)
                {
                    Response.Write("<script>alert('添加成功');</script>");
                  //  Response.Redirect("~/Frontstage/login.aspx");
                }

            }

        }

        else
        {
            Response.Write("<script>alert('请输入完整的信息');</script>");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        using (var db = new ItshowEntities2())

        {

            string personName = Request.QueryString["personName"].ToString();
            var joinVf = db.Joinus.SingleOrDefault(a => a.Name == personName);

                joinVf.ifSeen = 1;
                int Vf = db.SaveChanges();
                if (Vf == 1)
                {
                    Response.Write("<script>alert('成功');</script>");
                }

            }
    }
    public void BindGrid()
    {
        using (var db = new ItshowEntities2())
        {
            var Count = db.Admins.Where(a => a.Adminname != null).Count();
            AspNetPager1.RecordCount = Count;

            var admin = (from a in db.Admins
                         where a.Adminname.Length > 0
                         orderby a.Key descending
                         select a).Skip(AspNetPager1.StartRecordIndex - 1).Take(AspNetPager1.PageSize);
            Repeater1.DataSource = admin.ToList();
            Repeater1.DataBind();

            //Repeater1.DataSource = selectmessage.ToList();
            //Repeater1.DataBind();
        }
    }
    protected void submit_passWord_click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBox1.Text) && !string.IsNullOrEmpty(TextBox2.Text))
        {
            if (TextBox1.Text == TextBox2.Text)
            {
                using (var db = new ItshowEntities2())

                {
                    string adminName1= Session ["admin"].ToString();
                    var admin = db.Admins.SingleOrDefault(a => a.Adminname==adminName1 );
                    admin.Password = EncryptionMD5.EncryptionMD51(TextBox1.Text);

                    int Vf =db.SaveChanges();

                    db.SaveChanges();

                    if (Vf == 1)
                    {
                        Response.Write("<script>alert('修改成功');</script>");

                    }
                    else

                    {
                        Response.Write("<script>alert('修改失败');</script>");
                    }

                }
            }

            else
            {
                Response.Write("<script>alert('两次密码输入不一致');</script>");
            }

        }

        else {

            Response.Write("<script>alert('请输入完整的密码并确认');</script>");

        }
    }
    protected void submit_Mail_click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBox3.Text))
        {
                  string Mail1=TextBox3.Text;
                  if (Mail1.Contains("@") && Mail1.Contains(".com") && Mail1.Length >= 5)
                  {

                      using (var db = new ItshowEntities2())
                      {
                          string adminName1 = Session["admin"].ToString();
                          var admin = db.Admins.SingleOrDefault(a => a.Adminname == adminName1);
                          admin.Mail = TextBox3.Text;

                          int Vf = db.SaveChanges();
                          db.SaveChanges();
                          if (Vf == 1)
                          {
                              Response.Write("<script>alert('修改成功');</script>");

                             Mail .Text=  TextBox3.Text;
                          }
                          else
                          {
                              Response.Write("<script>alert('修改失败');</script>");
                          }

                      }

                  }

                  else

                  {
                      Response.Write("<script>alert('请输入合法的邮箱地址');</script>");
                  }

        }
        else

        {
            Response.Write("<script>alert('请输入邮箱地址');</script>");
        }
    }
    public void BindGrid()
    {
        using (var db = new ItshowEntities2())
        {
            var Count = db.Display__works.Where(a => a.Name != null).Count();
            AspNetPager1.RecordCount = Count;

            var Work = (from a in db.Display__works

                       orderby a.Key descending
                       select a).Skip(AspNetPager1.StartRecordIndex - 1).Take(AspNetPager1.PageSize);
            //articles = db.Articles
            //    .Where(a => a.Category.Name.Length > 0)
            //    .OrderByDescending(a => a.PostDate);
            Repeater1.DataSource = Work.ToList();
            Repeater1.DataBind();

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (var db = new ItshowEntities2())
            {
                string personName=Request.QueryString["personName"].ToString();
                var Person = db.Joinus .SingleOrDefault(a => a.Name ==personName );

                Label1.Text =Person.Name ;
                Label2.Text =Person .Sex  ;
                Label3.Text = Person .Major ;
                Label4.Text = Person .Direction;
                Label5.Text =Person .E_mail  ;
                Label6.Text = Person.Phonenumber ;
                Label7.Text =Person .Introduce  ;

            }
        }
    }
Beispiel #21
0
    public void BindGrid()
    {
        using (var db = new ItshowEntities2())
        {   //成员展示
            var member = (from m in db.Display_admin
                          orderby m.Time
                          select m);

            Repeater1.DataSource = member.ToList();
            Repeater1.DataBind();
            Repeater2.DataSource = member.ToList();
            Repeater2.DataBind();
            //作品展示
            var proshow = (from p in db.Display__works
                           orderby p.Time
                           select p);
            ProShow.DataSource = proshow.ToList();
            ProShow.DataBind();
        }
    }
    public void BindGrid()
    {
        using (var db = new ItshowEntities2())
        {
            // 查多个
            {

                var Count = db.Guestbooks.Where(a => a.Pass == 0).Count();
                AspNetPager1.RecordCount = Count;

                var selectmessage = (from message in db.Guestbooks
                                     where message.Pass == 0
                                     orderby message.Key descending
                                     select message).Skip(AspNetPager1.StartRecordIndex - 1).Take(AspNetPager1.PageSize);
                Repeater1.DataSource = selectmessage.ToList();
                Repeater1.DataBind();
            }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Admin.Text = Session["admin"].ToString ();
            using (var db = new ItshowEntities2())

            {
                var adminMail = db.Admins.SingleOrDefault(a => a.Adminname == Admin.Text);
                if (adminMail.Mail.ToString() != null)
                { Mail.Text = adminMail.Mail.ToString(); }
                else {
                    Mail.Text = "您还没有设置邮箱;";
                }

            }
           // Mail.Text = .ToString();
            Label1.Text = Session["admin"].ToString();

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (var db = new ItshowEntities2())
            {
                // 查多个
                {
                    var Work = from a in db.Display__works

                               orderby a.Key descending
                               select a;
                    //articles = db.Articles
                    //    .Where(a => a.Category.Name.Length > 0)
                    //    .OrderByDescending(a => a.PostDate);
                    Repeater1.DataSource = Work.ToList();
                    Repeater1.DataBind();
                }

            }
        }
    }
Beispiel #25
0
    //登录确定
    protected void submit_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(adminName.Text) && !string.IsNullOrEmpty(passWord.Text))
        {

            if (!CheckCode())

            {
                Response.Write("<script>alert('请输入正确的验证码');</script>");

            }

            else {
            using (var db = new ItshowEntities2())
            {
                string password = EncryptionMD5.EncryptionMD51(passWord.Text);
                var adminVf = db.Admins.SingleOrDefault(a => a.Adminname == adminName.Text && a.Password == password);

                if (adminVf != null)
                {

                    Session["admin"] = adminName.Text;
                    Session["passWord"] = password;
                    Response.Redirect("~/Backstage/adminMessage.aspx");

                }
                else
                {
                    Response.Write("<script>alert('用户名或密码错误');</script>");
                }
            }
        }     }
        else

        {
            Response.Write("<script>alert('请输入完整的用户名或密码');</script>");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)

        {

        if( Request.QueryString["workName"].ToString()!=null )

        {
            string workName= Request.QueryString["workName"].ToString();
            using ( var db =new ItshowEntities2() )

            {
                var changeWork = db.Display__works.SingleOrDefault(a => a.Name == workName); ;

                 TextBox1.Text = changeWork.Name;
                TextBox2.Text =changeWork.Contents;
                  TextBox3.Text=changeWork.Time;
                 TextBox4.Text = changeWork.Html;
                 Image1.ImageUrl = changeWork.Image;

            }

        }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            if (Request.QueryString["memberName"].ToString() != null)
            {
                string workName = Request.QueryString["memberName"].ToString();
                using (var db = new ItshowEntities2())
                {
                    var changeMem= db.Display_admin.SingleOrDefault(a => a.Membername == workName); ;

                    TextBox1.Text = changeMem.Membername;
                    TextBox2.Text = changeMem.Hobby;
                    TextBox3.Text = changeMem.Speciality ;
                    TextBox4.Text = changeMem.Experience;
                    TextBox5.Text = changeMem.Position;
                    TextBox6.Text = changeMem.Time;
                    Image1.ImageUrl = changeMem.Phtograph;

                }

            }

        }
    }
    //protected void cancel_Click(object sender, EventArgs e)
    //{
    //    Response.Redirect("~/Backstage/Addadmin.aspx");
    //}
    protected void submit_Click(object sender, EventArgs e)
    {
        if (name.Text == "" || password.Text == "" || again.Text == "" || name.Text == null || password.Text == null || again.Text == null)
        {

            Response.Write("<script>alert('请输入完整的账号密码');</script>");
        }
        else if (!IsNumAndEnCh(name.Text)&&!IsNumAndEnCh(name.Text))
        {
            Response.Write("<script>alert('用户名和密码只能由4到8位的字母和数字组成');</script>");

        }
        else if (name.Text.Length >= 8 && name.Text.Length <= 4 && password.Text.Length >= 8 && password.Text.Length <= 4)

        {
            Response.Write("<script>alert('用户名和密码只能由4到8位的字母和数字组成');</script>");

        }
        else if (password.Text != again.Text)
        {
            Response.Write("<script>alert('请输入一致的密码');</script>");
        }

        else
        {
            using (var db = new ItshowEntities2())
            {
                //var adminVf = from a in db.Admins
                //               where a.Adminname == name.Text
                //               select a;
                var adminVf = db.Admins.SingleOrDefault(a => a.Adminname == name.Text);
                string ADMIN = Session["admin"].ToString();
                var adminVf1 = db.Admins.SingleOrDefault(a => a.Adminname == ADMIN);
                if (adminVf1.Rank == "2")
                {
                    Response.Write("<script>alert('您的权限不足');</script>");

                }
                else if (adminVf != null)
                {

                    Response.Write("<script>alert('用户名重复');</script>");

                }

                else
                {
                    var adminAdd = new Admin();
                    adminAdd.Adminname = name.Text;
                    adminAdd.Password = EncryptionMD5.EncryptionMD51(password.Text);
                    adminAdd.Rank = "2";

                    // adminAdd.Password = db.ArticleCategories.SingleOrDefault(a => a.ID == 1);
                    //artilce.CategoryID = db.ArticleCategories.SingleOrDefault(a => a.ID == 1).ID;

                    adminAdd = new Admin
                    {
                        Adminname = name.Text,
                        Password = EncryptionMD5.EncryptionMD51(password.Text),
                        Rank = "2",
                    };

                    db.Admins.Add(adminAdd);
                    int Vf = db.SaveChanges();
                    db.SaveChanges();

                    if (Vf == 1)
                    {
                        Response.Write("<script>alert('添加成功');</script>");
                        // Response.Redirect("~/Frontstage/login.aspx");
                    }
                    // Response.Redirect("~/Frontstage/login.aspx");

                }

            }

            //Response.Write("<script>alert('添加成功');</script>");
            //Response.Redirect("~/Frontstage/login.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (var db = new ItshowEntities2())
            {
                // 查多个
                {
                    var Join = from a in db.Joinus

                               orderby a.Key descending
                               select a;

                    Repeater1.DataSource = Join.ToList();
                    Repeater1.DataBind();
                    var Count1 = db.Joinus.Where(a => a.Direction == "程序").Count();
                   Label1 .Text  = Count1.ToString ();
                   var Count2 = db.Joinus.Where(a => a.Direction == "美工").Count();
                   Label2.Text = Count1.ToString();
                   var Count3 = db.Joinus.Where(a => a.Direction == "维护").Count();
                   Label3.Text = Count1.ToString();

                   var Join1 = from a in db.Joinus
                               orderby a.Key descending
                               select a;
                   GridView1.DataSource = Join1.ToList();
                   GridView1.DataBind();
                }

            }
        }
    }