issuanceDepot.aspx.cs
上传用户:yawei0714
上传日期:2020-11-26
资源大小:1004k
文件大小:3k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. public partial class issuanceDepot : System.Web.UI.Page
  12. {
  13.     protected void Page_Load(object sender, EventArgs e)
  14.     {
  15.         if (!IsPostBack)
  16.         {
  17.             bindSf();
  18.         }
  19.     }
  20.     public void bindSf()
  21.     {
  22.         string sql = "select distinct sf from tb_City";
  23.         DataSet ds = dataOperate.getDataset(sql, "tb_City");        
  24.         this.ddldSf.DataSource = ds.Tables["tb_City"].DefaultView;        
  25.         ddldSf.DataTextField = "sf";
  26.         ddldSf.DataValueField = "sf";        
  27.         this.ddldSf.DataBind();
  28.     }
  29.     //联动终点城市
  30.     protected void ddldSf_SelectedIndexChanged(object sender, EventArgs e)
  31.     {
  32.         string sf = ddldSf.SelectedValue.ToString();
  33.         string sql = "select cs from tb_City where sf='" + sf + "'";
  34.         DataSet ds = dataOperate.getDataset(sql, "tb_City");
  35.         this.ddldCs.DataSource = ds.Tables["tb_City"].DefaultView;
  36.         ddldCs.DataTextField = "cs";
  37.         ddldCs.DataValueField = "cs";
  38.         this.ddldCs.DataBind();
  39.     }
  40.     protected void Button1_Click(object sender, EventArgs e)
  41.     {
  42.         string UserName = Session["UserName"].ToString();
  43.         string DepotType = ddlDepotType.SelectedValue;
  44.         string DepotCity = ddldSf.SelectedValue.ToString() + ddldCs.SelectedValue.ToString();
  45.         string DepotSite = this.txtDepotSite.Text;
  46.         string DepotAcreage = this.txtDepotAcreage.Text;
  47.         string DepotSum = this.txtDepotSum.Text;        
  48.         string DepotPrice=this.txtDepotPrice.Text;
  49.         int Loading;
  50.         int Packing;
  51.         int Send;
  52.         if (ckbLoading.Checked)
  53.         {
  54.             Loading = 1;
  55.         }
  56.         else
  57.         {
  58.             Loading = 0;
  59.         }
  60.         if (ckbPacking.Checked)
  61.         {
  62.             Packing = 1;
  63.         }
  64.         else
  65.         {
  66.             Packing = 0;
  67.         }
  68.         if (ckbSend.Checked)
  69.         {
  70.             sender = 1;
  71.         }
  72.         else
  73.         {
  74.             sender = 0;
  75.         }
  76.         string Linkman = this.txtLinkman.Text;
  77.         string Phone = this.txtPhone.Text;
  78.         string Term = this.txtTerm.Text;
  79.         string Content = this.txtContent.Text;
  80.         string FBDate = DateTime.Now.ToString();
  81.         string UserType = Session["UserType"].ToString();
  82.         string sql = "insert into tb_Depot values('" + UserName + "','" + DepotType + "','" + DepotCity + "','" + DepotSite + "','" +
  83.             DepotAcreage + "','" + DepotSum + "','" + DepotPrice + "','" + Loading + "','" + Packing + "','" + sender + "','" + Linkman + "','" + Phone + "','" + Term + "','" + Content + "','" + FBDate + "','" + UserType + "','')";
  84.         if (dataOperate.execSQL(sql))
  85.         {
  86.             txtContent.Text = "";
  87.             txtDepotAcreage.Text = "";
  88.             txtDepotPrice.Text = "";
  89.             txtDepotSite.Text = "";
  90.             txtDepotSum.Text = "";
  91.             txtLinkman.Text = "";
  92.             txtPhone.Text = "";
  93.             txtTerm.Text = "";
  94.             
  95.             RegisterStartupScript("true", "<script>alert('发布成功!')</script>");
  96.         }
  97.         else
  98.         {
  99.             RegisterStartupScript("false", "<script>alert('发布失败!')</script>");
  100.         }
  101.     }
  102.    
  103. }