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

📄 lscdjedit.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;

public partial class Czy_LscdjEdit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //绑定临时车收费标准列表 绑定临时车位列表
            this.GridView1.DataSource = DataControl.GetData("select * from 临时车收费标准");
            this.GridView1.DataBind();
            this.DropDownList2.DataTextField = "车位编号";
            this.DropDownList2.DataValueField = "车位编号";
            this.DropDownList2.DataSource = DataControl.GetData(" select * from 车位管理 where 车位类别='临时车位' ");
            this.DropDownList2.DataBind();
            DataTable dt = new DataTable();
            if (Request.QueryString["ID"] != null)
            {
                //显示当前的临时车位信息
                this.TextBox6.Text = DateTime.Now.ToString();
                dt = DataControl.GetData("select * from 临时车登记 where 临时车代码=" + Request.QueryString["ID"] + "");
                if (dt.Rows.Count > 0)
                {
                    this.TextBox1.Text = dt.Rows[0]["临时车名称"].ToString();
                    this.Textbox2.Text = dt.Rows[0]["计费开始时间"].ToString();
                    this.Textbox4.Text = dt.Rows[0]["驾驶员名称"].ToString();
                    this.DropDownList3.SelectedIndex = DataControl.GetIndex(DropDownList3, dt.Rows[0]["证件类型"].ToString()); 
                    this.DropDownList2.SelectedValue= dt.Rows[0]["车位编号"].ToString(); 
                    //计算所收费用
                    DataTable tmprs = new DataTable();
                    TimeSpan t = Convert.ToDateTime(this.TextBox6.Text) - Convert.ToDateTime(this.Textbox2.Text);
                    tmprs=DataControl.GetData("select * from 临时车收费标准 where 时间下限<="+ t.Hours +" and 时间上限>"+ t.Hours +"");
                    if(tmprs.Rows.Count>0 )
                    {
                        this.TextBox7.Text=tmprs.Rows[0]["费用"].ToString(); 
                    }
                    else
                    {
                        this.TextBox7.Text = "0"; 
                    }
                }
            }
            else
            {
                this.TextBox6.ReadOnly = true;
                this.TextBox7.ReadOnly = true;
                this.Textbox2.Text = DateTime.Now.ToString();
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //跳转页面
        Response.Redirect("LscdjList.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        //添加或修改临时车登记
        if (Request.QueryString["ID"] != null)
        {
            DataControl.Execute("update 临时车登记 set 计费结束时间='"+ TextBox6.Text +"',收费金额="+ TextBox7.Text +"  " +
              " where 临时车代码='" + Request.QueryString["ID"] + "'");
        }
        else
        {
            DataControl.Execute("insert into 临时车登记(临时车名称,计费开始时间,驾驶员名称,证件类型,帐号, " +
             " 车位编号) values ('" + TextBox1.Text + "','" + Textbox2.Text + "','"+ Textbox4.Text  +"', " +
             " '"+ DropDownList3.Text  +"','" + Session["帐号"].ToString() + "','"+ DropDownList2.SelectedItem.Text +"')");

        }
        Response.Redirect("LscdjList.aspx");
    }
}

⌨️ 快捷键说明

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