/// <summary>
 /// 返回删除按钮是否可用
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 protected bool GetVisuable(object obj)
 {
     string AgentShipGuid = obj as string;
     string Status = new CawInfoAgentShipInfo().GetDetail(Request.QueryString["ShipInfoGuid"].ToString()).DATASTATUS;
     //提交审核中、审批通过和审批暂停三种状态,删除按钮不能使用
     if (Status.Trim() == "1" || Status.Trim() == "2" || Status.Trim() == "4")
         return false;
     else
         return true;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ViewState["AgentInfoGuid"] = Request.QueryString["ShipInfoGuid"];
         Detail_CAW_AGENTSHIPINFO DCASI = new CawInfoAgentShipInfo().GetDetail(Request.QueryString["ShipInfoGuid"].ToString());
         this.lblShipName.Text = DCASI.SHIPNAMECN + "/" + DCASI.SHIPNAMEEN;
         this.lblZJGTime.Text = DCASI.ARRIVEZJGDATE.ToString();
         if (DCASI.DATASTATUS == "1" || DCASI.DATASTATUS == "2")
             this.btnAdd.Visible = false;
         this.refresh();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                ViewState["AgentGuid"] = Request.QueryString["Guid"];
                Detail_CAW_AGENTSHIPINFO DCASI = new CawInfoAgentShipInfo().GetDetail(Request.QueryString["Guid"].ToString());
                this.lblShipName.Text = DCASI.SHIPNAMECN + "/" + DCASI.SHIPNAMEEN;
                this.lblZJGTime.Text = DCASI.ARRIVEZJGDATE.ToString();
                //生产新的实例Guid,上传附件需要用到
                ViewState["Guid"] = Guid.NewGuid().ToString();

                AddClass1TopNodes();
                AddClass2TopNodes();
            }
        }
        private void InitiData(string Guid)
        {
            //获取明细
            Detail_CAW_AGENTGOODS DCAG = CIAS.GetDetail(Guid);
            //装卸货物信息
            this.lblGuid.Text = DCAG.GUID;
            this.lblAgentShipGuid.Text = DCAG.AGENTSHIPINFOGUID;
            Detail_CAW_AGENTSHIPINFO DCASI = new CawInfoAgentShipInfo().GetDetail(DCAG.AGENTSHIPINFOGUID);
            this.lblShipName.Text = DCASI.SHIPNAMECN + "/" + DCASI.SHIPNAMEEN;
            this.lblZJGTime.Text = DCASI.ARRIVEZJGDATE.ToString();
            this.rbtCargoType.SelectedIndex = this.rbtCargoType.Items.IndexOf(this.rbtCargoType.Items.FindByValue(DCAG.CARGOTYPE));
            if (DCAG.CARGOTYPE == "0")
            {
                this.txtCargoName.Text = DCAG.CARGONAME;
                this.ntbPiece.Text = DCAG.CARGOPIECE.ToString();
                this.ttvCargoClass1.Text = DCAG.CARGOCLASSNAME1;
                this.ttvCargoClass1.Value = DCAG.CARGOCLASSGUID1;
                this.ttvCargoClass2.Text = DCAG.CARGOCLASSNAME2;
                this.ttvCargoClass2.Value = DCAG.CARGOCLASSGUID2;
                this.ntbWeight.Text = DCAG.CARGOWEIGHT.ToString();
            }
            else
            {
                this.CallJsFun("javascript:Is_JZX(1);");
                this.ntbEmrty20.Text = DCAG.EMPTY20.ToString();
                this.ntbEmrty40.Text = DCAG.EMPTY40.ToString();
                this.ntbEmrty45.Text = DCAG.EMPTY45.ToString();
                this.ntbEmrtyTotal.Text = DCAG.EMPTYTOTAL.ToString();
                this.ntbWeighty20.Text = DCAG.WEIGHTY20.ToString();
                this.ntbWeighty40.Text = DCAG.WEIGHTY40.ToString();
                this.ntbWeighty45.Text = DCAG.WEIGHTY45.ToString();
                this.ntbWeightyTotal.Text = DCAG.WEIGHTTOTAL.ToString();
                this.ntbContainerTotal.Text = DCAG.CONTAINERTOTAL.ToString();
                this.ntbConWeight.Text = DCAG.CARGOWEIGHT.ToString();
            }
            this.rbtTradeType.SelectedIndex = this.rbtTradeType.Items.IndexOf(this.rbtTradeType.Items.FindByValue(DCAG.TRADETYPE));
            this.rbtUpORDown.SelectedIndex = this.rbtUpORDown.Items.IndexOf(this.rbtUpORDown.Items.FindByValue(DCAG.WORKLOAD));
            this.rbtInOROut.SelectedIndex = this.rbtInOROut.Items.IndexOf(this.rbtInOROut.Items.FindByValue(DCAG.INOROUT));
            this.txtLoadCountry.Text = DCAG.LOADCOUNTRY;
            this.txtLoadHarbour.Text = DCAG.LOADHARBOUR;
            this.txtUnloadCountry.Text = DCAG.UNLOADCOUNTRY;
            this.txtUnloadHarbour.Text = DCAG.UNLOADHARBOUR;

            string Status = new CawInfoAgentShipInfo().GetDetail(DCAG.AGENTSHIPINFOGUID).DATASTATUS;
            if (Status == "1" || Status == "2")
                this.btnEdit.Enabled = false;
        }
        /// <summary>
        /// 
        /// 编写日期:2010-3-19
        /// 编写人:GWF
        /// </summary>
        /// <param name="DESIGNGUID"></param>
        public Detail_CAW_AGENTSHIPMOVEMENT Select(string pGUID)
        {
            Database db = DatabaseFactory.CreateDatabase(CawConnStr);
            string strSql = "SELECT A.*, B.DATASTATUS,B.DATASTATUS_NAME  FROM CAW_AGENTSHIPMOVEMENT A,CAW_DATESTATUS B WHERE A.GUID=B.KEYGUID AND A.GUID='" + pGUID + "'";

            DbCommand cmd = db.GetSqlStringCommand(strSql);
            DataView dv = db.ExecuteDataView(cmd);
            Detail_CAW_AGENTSHIPMOVEMENT CDG = new Detail_CAW_AGENTSHIPMOVEMENT();
            if (dv.Count > 0)
            {
                CDG.GUID = dv[0]["GUID"].ToString();
                CDG.COMPANYGUID = dv[0]["COMPANYGUID"].ToString();
                CDG.AGENTSHIPGUID = dv[0]["AGENTSHIPGUID"].ToString();
                CDG.AFFAIR = dv[0]["AFFAIR"].ToString();
                CDG.BERTH = dv[0]["BERTH"].ToString();
                CDG.PORT = dv[0]["PORT"].ToString();

                CDG.DATASTATUS = dv[0]["DATASTATUS"].ToString();
                CDG.DATASTATUS_NAME = dv[0]["DATASTATUS_NAME"].ToString();
            }

            DataView dvinfo = new CawInfoAgentShipInfo().Select(CDG.AGENTSHIPGUID);
            if (dvinfo.Count>0)
            {
                Detail_CAW_AGENTSHIPINFO AGENTSHIPINFO = new Detail_CAW_AGENTSHIPINFO();
                AGENTSHIPINFO.GUID = dvinfo[0]["GUID"].ToString();
                AGENTSHIPINFO.SHIPNAMECN=dvinfo[0]["SHIPNAMECN"].ToString();
                AGENTSHIPINFO.SHIPNAMEEN = dvinfo[0]["SHIPNAMEEN"].ToString();
                AGENTSHIPINFO.NATIONNALITY = dvinfo[0]["NATIONNALITY"].ToString();
                AGENTSHIPINFO.SHIPLENGTH = Convert.ToDecimal(dvinfo[0]["SHIPLENGTH"].ToString());
                AGENTSHIPINFO.PREVIOUSHARBOUR = dvinfo[0]["PREVIOUSHARBOUR"].ToString();
                AGENTSHIPINFO.NEXTHARBOUR = dvinfo[0]["NEXTHARBOUR"].ToString();
                AGENTSHIPINFO.SHIPMENNATIONNALITY = dvinfo[0]["SHIPMENNATIONNALITY"].ToString();
                CDG.AGENTSHIPINFO = AGENTSHIPINFO;
            }
            return CDG;
        }