Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         rpj = new RoadProject("Data Source=Localhost;database=RoadCenter;User ID=admin;Password=admin123");
     }
     if (IsPostBack)
     {
         rpj = new RoadProject("Data Source=Localhost;database=RoadCenter;User ID=admin;Password=admin123");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            rpj = new RoadProject("Data Source=Localhost;database=RoadCenter;User ID=admin;Password=admin123");
            List<RoadProject> list = rpj.Load();

            RoadName.Text = list[0].RoadProjectName.ToString().Trim();
            Type.Text = list[0].RoadType.ToString();
            Grade.Text = list[0].RoadGrade.ToString();
            OwnerUnit.Text = list[0].OwnerUnit.ToString();
            DesignUnit.Text = list[0].DesignUnit.ToString();
            ProjectLocation.Text = list[0].ProjectLocation.ToString();
            RoadLength.Text = list[0].RoadLength.ToString();
            BeginStake.Text = list[0].BeginStake.ToString();
            EndStaeke.Text = list[0].EndStaeke.ToString();
            AmountOfExcavation.Text = list[0].AmountOfExcavation.ToString();
            AmountOfFill.Text = list[0].AmountOfFill.ToString();
            BridgeNumber.Text = list[0].BridgeNumber.ToString();
            CulvertNumber.Text = list[0].CulvertNumber.ToString();
            TunnelNumber.Text = list[0].TunnelNumber.ToString();
            PlaneIntersectionNumber.Text = list[0].PlaneIntersectionNumber.ToString();
            HighEmbankmentSlopeNumber.Text = list[0].HighEmbankmentSlopeNumber.ToString();
            HighExcavationSlopeNumber.Text = list[0].HighExcavationSlopeNumber.ToString();
            Description.Text = list[0].Description.ToString();

            if (string.IsNullOrEmpty(list[0].RoadProjectName.ToString().Trim()))
            {
                Response.Redirect("ProjectSet.aspx", true);
            }
            string b;
            b = rpj.AmountOfExcavation.ToString();

            HttpCookie objCookie = new HttpCookie("ProjectName", list[0].RoadProjectName.ToString().Trim());
            Response.Cookies.Add(objCookie);
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 ///加载道路项目
 /// </summary>
 public List<RoadProject> Load()
 {
     List<RoadProject> list = new List<RoadProject>();
     string sql = @"select *from RDC_RoadProject";
     DataSet ds = DbConnection.GetDataSet(sql);
     foreach (DataRow r in ds.Tables[0].Rows)
     {
         RoadProject rp = new RoadProject();
        rp.RoadProjectID = (int)r["RoadProjectID"];
        rp.RoadType = r["RoadType"] == DBNull.Value ? 0 : Convert.ToInt32(r["RoadType"]);
        rp.RoadGrade = r["RoadGrade"] == DBNull.Value ? 0 : Convert.ToInt32(r["RoadGrade"]);
        rp.RoadProjectName = r["RoadProjectName"].ToString();
        rp.OwnerUnit = r["OwnerUnit"].ToString();
        rp.DesignUnit = r["DesignUnit"].ToString();
        rp.ProjectLocation = r["ProjectLocation"].ToString();
        rp.RoadLength = r["RoadLength"] == DBNull.Value ? 0 : Convert.ToDouble(r["RoadLength"]);
        rp.BeginStake = r["BeginStake"].ToString();
        rp.EndStaeke = r["EndStaeke"].ToString();
        rp.AmountOfExcavation = r["AmountOfExcavation"] == DBNull.Value ? 0 : Convert.ToDouble(r["AmountOfExcavation"]);
        rp.AmountOfFill = r["AmountOfFill"] == DBNull.Value ? 0 : Convert.ToDouble(r["AmountOfFill"]);
        rp.BridgeNumber = r["BridgeNumber"] == DBNull.Value ? 0 : Convert.ToInt32(r["BridgeNumber"]);
        rp.CulvertNumber = r["CulvertNumber"] == DBNull.Value ? 0 : Convert.ToInt32(r["CulvertNumber"]);
        rp.TunnelNumber = r["TunnelNumber"] == DBNull.Value ? 0 : Convert.ToInt32(r["TunnelNumber"]);
        rp.PlaneIntersectionNumber = r["PlaneIntersectionNumber"] == DBNull.Value ? 0 : Convert.ToInt32(r["PlaneIntersectionNumber"]);
        rp.HighEmbankmentSlopeNumber = r["HighEmbankmentSlopeNumber"] == DBNull.Value ? 0 : Convert.ToInt32(r["HighEmbankmentSlopeNumber"]);
        rp.HighExcavationSlopeNumber = r["HighExcavationSlopeNumber"] == DBNull.Value ? 0 : Convert.ToInt32(r["HighExcavationSlopeNumber"]);
        rp.Description = r["Description"].ToString();
         list.Add(rp);
     }
     return list;
 }