• 大小: 8.63MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-08
  • 语言: C#
  • 标签:

资源简介

vs2015写的.net demo希望能帮助大家

资源截图

代码片段和文件信息

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.xml.Linq;
using dbo.sql;

public partial class add_book : System.Web.UI.Page
{
    baseClass baseclass = new baseClass();
    protected void Page_Load(object sender EventArgs e)
    {
        
    }

    protected void submit_Click(object sender ImageClickEventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            string fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName);
            if (fileExtension != “.jpg“)
            {
                Label1.Text = “照片上传类型不正确,请上传jpg格式!“;
            }
            else
            {
                string picturename = DateTime.Now.ToString(“yyyyMMddHHmmss“) + “.jpg“;
                FileUpload1.PostedFile.SaveAs(Server.MapPath(“./image/books/“) + picturename);
                if (CustomValidator1.IsValid == true)
                {
                    decimal dprice = Convert.ToDecimal(price.Text.Trim());
                    int stocknum = Convert.ToInt32(stock_num.Text.Trim());
                    string strsql = “insert into books(ISBNtitleauthorversionpubdateintrodupricepicnametype) values(‘“ +
                               ISBN.Text + “‘‘“ + title.Text + “‘‘“ + author.Text + “‘‘“
                               + version.Text + “‘‘“ + pubdate.Text + “‘‘“ + introduce.Text + “‘‘“
                               + dprice + “‘‘“ + picturename + “‘‘“ + type.SelectedValue.ToString() + “‘)“;
                    try
                    {
                        if (baseclass.execsql(strsql))
                        {
                            strsql = “insert into stock(isbnstock_numpricelogdate) values(‘“ +
                               ISBN.Text + “‘‘“ + stocknum + “‘‘“ + dprice + “‘‘“
                               + pubdate.Text + “‘)“;
                            if (baseclass.execsql(strsql))
                            {
                                Label1.Text = “书籍发布成功!“;
                                Response.Write(“ript>alert(‘发布成功!‘)ript>“);
                            }
                        }
                        else
                        {
                            Label1.Text = “信息输入错误,请重新输入!“;
                        }
                    }
                    catch (Exception ex)
                    {
                        Label1.Text = ex.Message;
                    }

                }
                else
                {
                    Label1.Text = “已经存在该书籍!“;
                }
            }
        }
        else
        {
            Label1.Text = “文件不存在!“;
        }
    }

    protected void CustomValidator1_ServerValidate(object sourc

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6664  2016-04-21 13:44  演示\WebSite12\add_book.aspx

     文件       3599  2016-04-21 13:59  演示\WebSite12\add_book.aspx.cs

     文件        696  2016-04-21 10:23  演示\WebSite12\admin.aspx

     文件        277  2016-04-18 19:15  演示\WebSite12\admin.aspx.cs

     文件       2802  2016-05-04 17:50  演示\WebSite12\adminuser.aspx

     文件       2528  2016-04-21 14:32  演示\WebSite12\adminuser.aspx.cs

     文件      12656  2016-04-21 13:59  演示\WebSite12\admin_book.aspx

     文件        282  2016-04-21 13:58  演示\WebSite12\admin_book.aspx.cs

     文件       3589  2016-04-13 22:32  演示\WebSite12\App_Code\baseClass.cs

     文件       2142  2016-04-13 19:05  演示\WebSite12\App_Code\BundleConfig.cs

     文件       2616  2016-04-13 19:05  演示\WebSite12\App_Code\IdentityModels.cs

     文件        473  2016-04-13 19:05  演示\WebSite12\App_Code\RouteConfig.cs

     文件       1644  2016-04-13 19:05  演示\WebSite12\App_Code\Startup.Auth.cs

     文件        268  2016-04-13 19:05  演示\WebSite12\App_Code\Startup.cs

     文件     102912  2013-02-22 08:43  演示\WebSite12\Bin\Antlr3.Runtime.dll

     文件        106  2016-04-13 19:05  演示\WebSite12\Bin\Antlr3.Runtime.dll.refresh

     文件     431616  2013-02-22 08:43  演示\WebSite12\Bin\Antlr3.Runtime.pdb

     文件       6144  2013-08-22 22:09  演示\WebSite12\Bin\AspNet.scriptManager.bootstrap.dll

     文件        148  2016-04-13 19:05  演示\WebSite12\Bin\AspNet.scriptManager.bootstrap.dll.refresh

     文件       5120  2013-07-16 20:06  演示\WebSite12\Bin\AspNet.scriptManager.jQuery.dll

     文件        143  2016-04-13 19:05  演示\WebSite12\Bin\AspNet.scriptManager.jQuery.dll.refresh

     文件    5196496  2015-03-02 09:32  演示\WebSite12\Bin\Entityframework.dll

     文件        118  2016-04-13 19:05  演示\WebSite12\Bin\Entityframework.dll.refresh

     文件     621264  2015-03-02 09:32  演示\WebSite12\Bin\Entityframework.SqlServer.dll

     文件        128  2016-04-13 19:05  演示\WebSite12\Bin\Entityframework.SqlServer.dll.refresh

     文件     154866  2015-03-02 09:32  演示\WebSite12\Bin\Entityframework.SqlServer.xml

     文件    3652961  2015-03-02 09:32  演示\WebSite12\Bin\Entityframework.xml

     文件      45752  2013-07-30 16:57  演示\WebSite12\Bin\Microsoft.AspNet.FriendlyUrls.dll

     文件        151  2016-04-13 19:05  演示\WebSite12\Bin\Microsoft.AspNet.FriendlyUrls.dll.refresh

     文件      16435  2013-07-30 16:57  演示\WebSite12\Bin\Microsoft.AspNet.FriendlyUrls.xml

............此处省略244个文件信息

评论

共有 条评论

相关资源