Exemplo n.º 1
0
        /// <summary>
        /// 
        /// 编写日期:2010-3-25
        /// 编写人:JW
        /// </summary>
        /// <param name="GUID"></param>
        public Detail_CAW_MANAGE_SHIPS GetDetail(string GUID)
        {
            Database db = DatabaseFactory.CreateDatabase(CawConnStr);
            string strSql = (db.DbProviderFactory.ToString() != "System.Data.OracleClient.OracleClientFactory") ?
                "SELECT * FROM CAW_MANAGE_SHIPS WHERE  GUID=@GUID " :
                "SELECT * FROM CAW_MANAGE_SHIPS WHERE  GUID=:GUID ";
            DbCommand cmd = db.GetSqlStringCommand(strSql);

            db.AddInParameter(cmd, "GUID", DbType.String, GUID);

            Detail_CAW_MANAGE_SHIPS myDetail = new Detail_CAW_MANAGE_SHIPS();

            using (IDataReader myReader = db.ExecuteReader(cmd))
            {
                if (myReader.Read())
                {
                    if (!Convert.IsDBNull(myReader["GUID"]))
                    {
                        myDetail.GUID = Convert.ToString(myReader["GUID"]);
                    }
                    if (!Convert.IsDBNull(myReader["SHIPNAMECN"]))
                    {
                        myDetail.SHIPNAMECN = Convert.ToString(myReader["SHIPNAMECN"]);
                    }
                    if (!Convert.IsDBNull(myReader["SHIPNAMEEN"]))
                    {
                        myDetail.SHIPNAMEEN = Convert.ToString(myReader["SHIPNAMEEN"]);
                    }
                    if (!Convert.IsDBNull(myReader["SHIPTYPE"]))
                    {
                        myDetail.SHIPTYPE = Convert.ToInt32(myReader["SHIPTYPE"]);
                    }
                    if (!Convert.IsDBNull(myReader["SHIPTYPENAME"]))
                    {
                        myDetail.SHIPTYPENAME = Convert.ToString(myReader["SHIPTYPENAME"]);
                    }
                    if (!Convert.IsDBNull(myReader["NATIONALITY"]))
                    {
                        myDetail.NATIONALITY = Convert.ToString(myReader["NATIONALITY"]);
                    }
                    if (!Convert.IsDBNull(myReader["CALLLETTER"]))
                    {
                        myDetail.CALLLETTER = Convert.ToString(myReader["CALLLETTER"]);
                    }
                    if (!Convert.IsDBNull(myReader["YEARNUM"]))
                    {
                        myDetail.YEARNUM = Convert.ToInt32(myReader["YEARNUM"]);
                    }
                    if (!Convert.IsDBNull(myReader["GRT"]))
                    {
                        myDetail.GRT = Convert.ToDecimal(myReader["GRT"]);
                    }
                    if (!Convert.IsDBNull(myReader["NRT"]))
                    {
                        myDetail.NRT = Convert.ToDecimal(myReader["NRT"]);
                    }
                    if (!Convert.IsDBNull(myReader["DWT"]))
                    {
                        myDetail.DWT = Convert.ToDecimal(myReader["DWT"]);
                    }
                    if (!Convert.IsDBNull(myReader["SHIPLENGTH"]))
                    {
                        myDetail.SHIPLENGTH = Convert.ToDecimal(myReader["SHIPLENGTH"]);
                    }
                    if (!Convert.IsDBNull(myReader["SHIPWIDTH"]))
                    {
                        myDetail.SHIPWIDTH = Convert.ToDecimal(myReader["SHIPWIDTH"]);
                    }
                    if (!Convert.IsDBNull(myReader["SEAGUAGE"]))
                    {
                        myDetail.SEAGUAGE = Convert.ToDecimal(myReader["SEAGUAGE"]);
                    }
                    if (!Convert.IsDBNull(myReader["LOLLSEAGUAGE"]))
                    {
                        myDetail.LOLLSEAGUAGE = Convert.ToDecimal(myReader["LOLLSEAGUAGE"]);
                    }
                    if (!Convert.IsDBNull(myReader["OWNER"]))
                    {
                        myDetail.OWNER = Convert.ToString(myReader["OWNER"]);
                    }
                    if (!Convert.IsDBNull(myReader["SHIPHOIST"]))
                    {
                        myDetail.SHIPHOIST = Convert.ToInt32(myReader["SHIPHOIST"]);
                    }
                    if (!Convert.IsDBNull(myReader["SHIPHOLD"]))
                    {
                        myDetail.SHIPHOLD = Convert.ToInt32(myReader["SHIPHOLD"]);
                    }
                    if (!Convert.IsDBNull(myReader["LENGTH"]))
                    {
                        myDetail.LENGTH = Convert.ToDecimal(myReader["LENGTH"]);
                    }
                    if (!Convert.IsDBNull(myReader["HEIGHT"]))
                    {
                        myDetail.HEIGHT = Convert.ToDecimal(myReader["HEIGHT"]);
                    }
                }
            }
            return myDetail;
        }
 private void InitiData(string ShipGuid)
 {
     DCShip = ShipDB.GetDetail(ShipGuid);
     this.txtShipNameCN.Text = DCShip.SHIPNAMECN;
     this.txtSHIPNAMEEN.Text = DCShip.SHIPNAMEEN;
     this.txtCALLLETTER.Text = DCShip.CALLLETTER;
     this.txtOWNER.Text = DCShip.OWNER;
     this.ntbYearNum.Text = DCShip.YEARNUM.ToString();
     this.txtNationality.Text = DCShip.NATIONALITY;
     this.ddlShipType.SelectedIndex = this.ddlShipType.Items.IndexOf(this.ddlShipType.Items.FindByValue(DCShip.SHIPTYPE.ToString()));
     this.ntbShipHoist.Text = DCShip.SHIPHOIST.ToString();
     this.ntbShipHold.Text = DCShip.SHIPHOLD.ToString();
     this.ntxtTOTALTON.Text = DCShip.GRT.ToString();
     this.ntxtNETTON.Text = DCShip.NRT.ToString();
     this.ntxtLOADTON.Text = DCShip.DWT.ToString();
     this.ntxtSHIPLENGTH.Text = DCShip.SHIPLENGTH.ToString();
     this.ntxtSHIPWIDTH.Text = DCShip.SHIPWIDTH.ToString();
     this.ntxtLENGTH.Text = DCShip.LENGTH.ToString();
     this.ntxtHEIGHT.Text = DCShip.HEIGHT.ToString();
     this.ntxtDEPTH.Text = DCShip.SEAGUAGE.ToString();
     this.ntxtLOLLDEPTH.Text = DCShip.LOLLSEAGUAGE.ToString();
 }