Beispiel #1
0
        protected void Button6_Click(object sender, EventArgs e)
        {
            FileUploadInfo lbg = new FileUploadInfo(this.booklib.Text, this.libphone.Text);

            lbg = bll.selectlib(lbg);
            string type    = DropDownList2.SelectedValue.ToString();
            string picpath = this.FileUpload4.PostedFile.FileName;

            UpBook          lg = new UpBook(this.bookName.Text, this.author.Text, this.intrduce.Text, type, this.maxcount.Text, this.usablecount.Text, lbg.path, picpath);
            OperationResult bp = bll.Registbook(lg);

            this.Image3.ImageUrl = "~/UploadPic/" + FileUpload4.FileName;


            if (bp.ToString() == "exist")
            {
                this.booktishi.Text = "记录已存在";
            }
            else if (bp.ToString() == "success")
            {
                string          user = Session["user"].ToString();
                string          text = user.ToString() + "上传图书信息:" + this.bookName.Text;
                daysInfo        da   = new daysInfo(user, DateTime.Now.ToLocalTime().ToString(), text);
                commentBll      bal  = new commentBll();
                OperationResult ob   = bal.Registday(da);
                this.booktishi.Text = "成功.";
                this.FileUpload4.SaveAs(Server.MapPath("~/UploadPic/") + FileUpload4.FileName);
            }
            else
            {
                this.booktishi.Text = "意外";
            }
        }
Beispiel #2
0
        protected void Button2_Click1(object sender, EventArgs e)
        {
            bool fileVaild = false;

            if (this.FileUpload2.HasFile)
            {
                string   fileExtension = System.IO.Path.GetExtension(this.FileUpload2.FileName).ToLower();
                string[] restrict      = { ".gif", ".jpg", ".jpeg", ".png", ".txt" };
                for (int i = 0; i < restrict.Length; i++)
                {
                    if (fileExtension == restrict[i])
                    {
                        fileVaild = true;
                    }
                }

                if (fileVaild == true)
                {
                    try
                    {
                        this.Image2.ImageUrl = "~/UploadPic/" + FileUpload2.FileName;

                        string picpath = this.FileUpload2.PostedFile.FileName;
                        string path    = this.FileUpload3.PostedFile.FileName;



                        string etype = DropDownList1.SelectedValue.ToString();

                        UpEbook         lg = new UpEbook(this.EbookName.Text, this.Eauthor.Text, this.intrduce.Text, etype, path, picpath);
                        OperationResult bp = bll.Registfile(lg);

                        if (bp.ToString() == "exist")
                        {
                            this.ebooktishi.Text = "记录已存在";
                        }
                        else if (bp.ToString() == "success")
                        {
                            string          user = Session["user"].ToString();
                            string          text = user.ToString() + "上传电子书信息:" + this.EbookName.Text;
                            daysInfo        da   = new daysInfo(user, DateTime.Now.ToLocalTime().ToString(), text);
                            commentBll      bal  = new commentBll();
                            OperationResult ob   = bal.Registday(da);

                            this.FileUpload2.SaveAs(Server.MapPath("~/UploadPic/") + FileUpload2.FileName);
                            this.FileUpload3.SaveAs(Server.MapPath("~/Etext/") + FileUpload3.FileName);
                            this.ebooktishi.Text = "成功.";
                        }
                        else
                        {
                            this.ebooktishi.Text = "意外";
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Write(ex.Message);
                    }
                }
            }
        }
Beispiel #3
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (Session["user"] != null)
            {
                bool fileVaild = false;
                if (this.FileUpload1.HasFile)
                {
                    string   fileExtension = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower();
                    string[] restrict      = { ".gif", ".jpg", ".jpeg", ".png", ".txt" };
                    for (int i = 0; i < restrict.Length; i++)
                    {
                        if (fileExtension == restrict[i])
                        {
                            fileVaild = true;
                        }
                    }

                    if (fileVaild == true)
                    {
                        try
                        {
                            this.Image1.ImageUrl = "~/UploadPic/" + FileUpload1.FileName;


                            string path = this.FileUpload1.PostedFile.FileName;


                            FileUploadInfo info = new FileUploadInfo(this.libname.Text, this.lobintr.Text, this.libphone.Text, this.lobpro.Text, this.lobcty.Text, this.adree.Text, path);


                            OperationResult op = bll.Registlib(info);
                            if (op.ToString() == "exist")
                            {
                                this.Label4.Text = "记录已存在";
                            }
                            else if (op.ToString() == "success")
                            {
                                this.Label4.Text = "成功";
                                string          user = Session["user"].ToString();
                                string          text = user.ToString() + "上传图书馆信息:" + this.libname.Text;
                                daysInfo        da   = new daysInfo(user, DateTime.Now.ToLocalTime().ToString(), text);
                                commentBll      bal  = new commentBll();
                                OperationResult ob   = bal.Registday(da);


                                this.FileUpload1.SaveAs(Server.MapPath("~/UploadPic/") + FileUpload1.FileName);
                            }
                            else
                            {
                                this.Label4.Text = "意外";
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
Beispiel #4
0
        protected void login_ServerClick(object sender, EventArgs e)
        {
            string emaile = this.Emaile.Value.ToString();
            string Pwd    = this.pwd.Value.ToString();

            this.Emaile.Value = emaile;
            if (emaile == "")
            {
                Response.Write("<style>#Emaile{border-color: #de615e;}</style>");
            }
            if (Pwd == "")
            {
                Response.Write("<style>#pwd{border-color: #de615e;}</style>");
            }
            if (emaile != "" && Pwd != "")
            {
                DES           des        = new DES();
                string        str        = des.DesEncrypt(Pwd, "12345678");
                string        connString = Convert.ToString(ConfigurationManager.ConnectionStrings["SqlConn"]);
                SqlConnection conn       = new SqlConnection(connString);//创建数据库链接
                conn.Open();
                string        strsql = "select * from T_UserInfo where email='" + emaile + "'and password='******'";
                SqlCommand    cmd    = new SqlCommand(strsql, conn);
                SqlDataReader dr     = cmd.ExecuteReader();
                if (dr.Read())
                {
                    Session["Emaile"]   = dr["email"];
                    Session["password"] = dr["password"];
                    if (emaile == Session["Emaile"].ToString())
                    {
                        Session["user"] = Session["Emaile"];

                        string          user = Session["user"].ToString();
                        string          text = user.ToString() + "用户登录:" + user;
                        daysInfo        da   = new daysInfo(user, DateTime.Now.ToLocalTime().ToString(), text);
                        commentBll      bal  = new commentBll();
                        OperationResult ob   = bal.Registday(da);

                        Response.Redirect("index.aspx", false);
                    }
                }
                else
                {
                    Response.Write("<script>alert('用户名或密码错误,请重新输入');</script>");
                }

                dr.Close();
                conn.Close();
            }
        }
Beispiel #5
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (Session["user"] != null)
            {
                if (Session["type"].ToString() == null)
                {
                }
                else if (Session["type"].ToString() == "e")
                {
                    string   username = Session["user"].ToString();
                    string   bookname = Session["name"].ToString();
                    Bookinfo user     = new Bookinfo(username);
                    user = bbl.selectuser(user);
                    Bookinfo book = new Bookinfo(bookname);
                    book = bbl.selectebook(book);

                    Bookinfo lg = new Bookinfo(username, bookname, user.userid, book.bookid);

                    OperationResult op = bbl.Registe(lg);

                    if (op.ToString() == "exist")
                    {
                        Response.Write("记录已存在");
                    }
                    else if (op.ToString() == "success")
                    {
                        string          userName = Session["user"].ToString();
                        string          text     = user.ToString() + "加入书架:" + bookname;
                        daysInfo        da       = new daysInfo(userName, DateTime.Now.ToLocalTime().ToString(), text);
                        commentBll      bal      = new commentBll();
                        OperationResult ob       = bal.Registday(da);
                        Response.Write("成功");
                    }
                }
                else if (Session["type"].ToString() == "b")
                {
                    string   username = Session["user"].ToString();
                    string   bookname = Session["name"].ToString();
                    Bookinfo user     = new Bookinfo(username);
                    user = bbl.selectuser(user);
                    Bookinfo book = new Bookinfo(bookname);
                    book = bbl.selectebook(book);

                    Bookinfo lg = new Bookinfo(username, bookname, user.userid, book.bookid);

                    OperationResult op = bbl.Regist(lg);

                    if (op.ToString() == "exist")
                    {
                        Response.Write("记录已存在");
                    }
                    else if (op.ToString() == "success")
                    {
                        Response.Write("成功");
                    }
                }
            }
            else
            {
            }
        }