⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdcllist.aspx.cs

📁 一个很好的管理系统代码!!!! 能实现车辆的管理…… 大家用的试下啊
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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.IO;

public partial class Admin_Gdclxx : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //显示固定车辆信息列表
            this.GridView1.DataSource = DataControl.GetData("select * from 固定车辆信息,住户,楼栋 where 固定车辆信息.住户代码=住户.住户代码 and 住户.楼栋代码=楼栋.楼栋代码");
            this.GridView1.DataBind();
        }
    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string idKey = this.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)]["车辆代码"].ToString();
        if (e.CommandName == "Mod")
        {
            //传递修改的标志 跳转页面
            Response.Redirect("GdclEdit.aspx?ID=" + idKey);
        }
        else if (e.CommandName == "Del")
        {
            if (DataControl.GetData("select * from 分配车位 where  车辆代码=" + idKey + "").Rows.Count > 0)
            {
                Response.Write("<script>alert('当前车辆信息正在使用中');</script>");
                return;
            }
            //删除指定路径下边的图片文件

            string DPath;
            if (Server.MapPath("").Substring(Server.MapPath("").Length - 1, 1) == @"\")
            {
                DPath = Server.MapPath("");
            }
            else
            {
                DPath = Server.MapPath("") + @"\";
            }
            string picName = this.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)]["车辆图片"].ToString();
            DPath = DPath + @"Pic\";
            if (File.Exists(DPath + picName))
            {
                File.Delete(DPath + picName);
            }
            //删除当前的固定车辆信息  刷新列表
            DataControl.Execute("delete from 固定车辆信息 where 车辆代码=" + idKey + "");
            this.GridView1.DataSource = DataControl.GetData("select * from 固定车辆信息,住户,楼栋 where 固定车辆信息.住户代码=住户.住户代码 and 住户.楼栋代码=楼栋.楼栋代码");
            this.GridView1.DataBind();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //跳转页面
        Response.Redirect("GdclEdit.aspx");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -