示例#1
0
        /// <summary>
        /// 获取完工报明细
        /// 编写日期:2010-4-1
        /// 编写人:JW
        /// </summary>
        /// <param name="GUID"></param>
        public Detail_CAW_MANAGE_END GetDetail(string ENDGUID)
        {
            Database db = DatabaseFactory.CreateDatabase(CawConnStr);
            string strSql = (db.DbProviderFactory.ToString() != "System.Data.OracleClient.OracleClientFactory") ?
                "SELECT A.* FROM CAW_MANAGE_END A WHERE A.GUID=@GUID " :
                "SELECT A.* FROM CAW_MANAGE_END A WHERE A.GUID=:GUID ";
            DbCommand cmd = db.GetSqlStringCommand(strSql);

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

            Detail_CAW_MANAGE_END myDetail = new Detail_CAW_MANAGE_END();

            using (IDataReader myReader = db.ExecuteReader(cmd))
            {
                if (myReader.Read())
                {
                    if (!Convert.IsDBNull(myReader["GUID"]))
                    {
                        myDetail.GUID = Convert.ToString(myReader["GUID"]);
                    }
                    if (!Convert.IsDBNull(myReader["STARTGUID"]))
                    {
                        myDetail.STARTGUID = Convert.ToString(myReader["STARTGUID"]);
                    }
                    if (!Convert.IsDBNull(myReader["DOWNHARBOUR"]))
                    {
                        myDetail.DOWNHARBOUR = Convert.ToString(myReader["DOWNHARBOUR"]);
                    }
                    if (!Convert.IsDBNull(myReader["ENDTIME"]))
                    {
                        myDetail.ENDTIME = Convert.ToDateTime(myReader["ENDTIME"]);
                    }
                    if (!Convert.IsDBNull(myReader["LEAVETIME"]))
                    {
                        myDetail.LEAVETIME = Convert.ToDateTime(myReader["LEAVETIME"]);
                    }
                }
            }
            return myDetail;
        }
        private void InitiData()
        {
            string EndGuid = Request.QueryString["guid"].ToString();
            DCME = EndDB.GetDetail(EndGuid);
            DataView dv = EndDB.GetStatusByGuid(EndGuid);
            this.lblDataStatusName.Text = dv.Count == 0 ? "未填写完工报" : dv[0]["DATASTATUS_NAME"].ToString();
            this.hidDataStatus.Value = dv.Count == 0 ? "" : dv[0]["DATASTATUS"].ToString();
            ViewState["CurrStatus"] = this.hidDataStatus.Value;
            this.txtDownAdd.Text = DCME.DOWNHARBOUR;
            this.dtbEndDate.Text = DCME.ENDTIME == DateTime.MinValue ? "" : DCME.ENDTIME.ToShortDateString();
            this.ntbEndHour.Text = DCME.ENDTIME == DateTime.MinValue ? "00" : DCME.ENDTIME.Hour.ToString("00");
            this.ntbEndMinute.Text = DCME.ENDTIME == DateTime.MinValue ? "00" : DCME.ENDTIME.Minute.ToString("00");
            this.dtbLeaveDate.Text = DCME.LEAVETIME == DateTime.MinValue ? "" : DCME.LEAVETIME.ToShortDateString();
            this.ntbLeaveHour.Text = DCME.LEAVETIME == DateTime.MinValue ? "00" : DCME.LEAVETIME.Hour.ToString("00");
            this.ntbLeaveMinute.Text = DCME.LEAVETIME == DateTime.MinValue ? "00" : DCME.LEAVETIME.Minute.ToString("00");

            string StartGuid = DCME.STARTGUID;
            DCMS = StartDB.GetDetail(StartGuid);
            if (DCMS.IS_AGENT == "1")
            {
                this.lblCompanyGuid.Text = DCMS.AGENTGUID;
                this.lblCompanyName.Text = DCMS.AGENTCORP;
            }
            else
            {
                this.lblCompanyName.Text = DCMS.COMPANYNAME;
                this.lblCompanyGuid.Text = DCMS.COMPANYGUID;
            }
            this.lblCorp.Text = DCMS.COMPANYNAME;
            //船舶信息
            this.lblShipGuid.Text = DCMS.SHIPGUID;
            this.lblShip.Text = DCMS.SHIPNAME;
            this.lblBerth.Text = DCMS.BERTHNAME;
            this.lblUpAdd.Text = DCMS.UPHARBOUR;
            this.rbtWorkType.SelectedItem.Value = DCMS.WORKTYPE;
            this.lblDockTime.Text = DCMS.ARRIVETIME.ToString("yyyy-MM-dd HH:mm");
            this.lblStartTime.Text = DCMS.STARTWORKTIME.ToString("yyyy-MM-dd HH:mm");
            //装卸货物信息
            this.rbtCargoType.SelectedIndex = this.rbtCargoType.Items.IndexOf(this.rbtCargoType.Items.FindByValue(DCMS.CARGOTYPE));
            if (DCMS.CARGOTYPE == "0")
            {
                this.lblCargoName.Text = DCMS.CARGONAME;
                this.lblPiece.Text = DCMS.CARGOPIECE.ToString();
                this.lblCargoClass1.Text = DCMS.CARGOCLASSNAME1;
                this.lblCargoClass2.Text = DCMS.CARGOCLASSNAME2;
                this.lblWeight.Text = DCMS.CARGOWEIGHT.ToString();
            }
            else
            {
                this.CallJsFun("javascript:Is_JZX(1);");
                this.lblEmpty20.Text = DCMS.EMPTY20.ToString();
                this.lblEmpty40.Text = DCMS.EMPTY40.ToString();
                this.lblEmpty45.Text = DCMS.EMPTY45.ToString();
                this.lblEmptyTotal.Text = DCMS.EMPTYTOTAL.ToString();
                this.lblWeighty20.Text = DCMS.WEIGHTY20.ToString();
                this.lblWeighty40.Text = DCMS.WEIGHTY40.ToString();
                this.lblWeighty45.Text = DCMS.WEIGHTY45.ToString();
                this.lblWeightyTotal.Text = DCMS.WEIGHTTOTAL.ToString();
                this.lblContainerTotal.Text = DCMS.CONTAINERTOTAL.ToString();
                this.lblConWeight.Text = DCMS.CARGOWEIGHT.ToString();
            }
            this.rbtTradeType.SelectedIndex = this.rbtTradeType.Items.IndexOf(this.rbtTradeType.Items.FindByValue(DCMS.TRADETYPE));
            this.rbtUpORDown.SelectedIndex = this.rbtUpORDown.Items.IndexOf(this.rbtUpORDown.Items.FindByValue(DCMS.WORKLOAD));
            this.rbtInOROut.SelectedIndex = this.rbtInOROut.Items.IndexOf(this.rbtInOROut.Items.FindByValue(DCMS.INOROUT));
            this.lblLoadCountry.Text = DCMS.LOADCOUNTRY;
            this.lblLoadHarbour.Text = DCMS.LOADHARBOUR;
            this.lblUnloadCountry.Text = DCMS.UNLOADCOUNTRY;
            this.lblUnloadHarbour.Text = DCMS.UNLOADHARBOUR;
            this.lblAgentCorp.Text = DCMS.AGENTCORP;
            this.lblDealgoodsCorp.Text = DCMS.DEALGOODSCORP;
            this.lblLoadCorp.Text = DCMS.LOADCORP;

            if (Session["IsCAW"].ToString() == "Y")
            {
                this.spanLeave.Visible = false;
                this.spanEnd.Visible = false;
            }

            //根据传入的参数进行按钮的可见和可用设置
            //根据明细判断:审核用(按钮全隐藏)
            //数据状态:0保存未提交(可修改);1提交待审批(不可修改);2审批通过(不可修改);3退回(可修改);4审批暂停(可修改)
            //以下为按钮控制
            bool InCheck = false;
            if (Request.QueryString["InCheck"] != null)
            {
                InCheck = true;
            }
            if (this.hidDataStatus.Value != "")
            {
                //注意传入的按钮顺序,如果没有则填null,分别为:保存按钮、提交按钮、返回按钮、添加附件按钮
                new CommonFun().SetBtnStatus(InCheck, this.hidDataStatus.Value.Trim(), btnEdit, btnSubmit, btnReturn, null);
            }
        }
        private void InitiData()
        {
            string EndGuid = Request.QueryString["guid"].ToString();
            DCME = EndDB.GetDetail(EndGuid);
            DataView dv = EndDB.GetStatusByGuid(EndGuid);
            this.lblDataStatusName.Text = dv[0]["DATASTATUS_NAME"].ToString();
            this.lblDownHarbour.Text = DCME.DOWNHARBOUR;
            this.lblEndTime.Text = DCME.ENDTIME.ToString("yyyy-MM-dd HH:mm");
            this.lblLeaveTime.Text = DCME.ENDTIME.ToString("yyyy-MM-dd HH:mm");

            string StartGuid = DCME.STARTGUID;
            DCMS = StartDB.GetDetail(StartGuid);
            if (DCMS.IS_AGENT == "1")
            {
                this.lblCompanyGuid.Text = DCMS.AGENTGUID;
                this.lblCompanyName.Text = DCMS.AGENTCORP;
            }
            else
            {
                this.lblCompanyGuid.Text = DCMS.COMPANYGUID;
                this.lblCompanyName.Text = DCMS.COMPANYNAME;
            }
            this.lblCorp.Text = DCMS.COMPANYNAME;
            //船舶信息
            this.lblShipGuid.Text = DCMS.SHIPGUID;
            this.lblShip.Text = DCMS.SHIPNAME;
            this.lblBerth.Text = DCMS.BERTHNAME;
            this.lblUpAdd.Text = DCMS.UPHARBOUR;
            this.rbtWorkType.SelectedItem.Value = DCMS.WORKTYPE;
            this.lblDockTime.Text = DCMS.ARRIVETIME.ToString("yyyy-MM-dd HH:mm");
            this.lblStartTime.Text = DCMS.STARTWORKTIME.ToString("yyyy-MM-dd HH:mm");
            //装卸货物信息
            this.rbtCargoType.SelectedIndex = this.rbtCargoType.Items.IndexOf(this.rbtCargoType.Items.FindByValue(DCMS.CARGOTYPE));
            if (DCMS.CARGOTYPE == "0")
            {
                this.lblCargoName.Text = DCMS.CARGONAME;
                this.lblPiece.Text = DCMS.CARGOPIECE.ToString();
                this.lblCargoClass1.Text = DCMS.CARGOCLASSNAME1;
                this.lblCargoClass2.Text = DCMS.CARGOCLASSNAME2;
                this.lblWeight.Text = DCMS.CARGOWEIGHT.ToString();
            }
            else
            {
                this.CallJsFun("javascript:Is_JZX(1);");
                this.lblEmpty20.Text = DCMS.EMPTY20.ToString();
                this.lblEmpty40.Text = DCMS.EMPTY40.ToString();
                this.lblEmpty45.Text = DCMS.EMPTY45.ToString();
                this.lblEmptyTotal.Text = DCMS.EMPTYTOTAL.ToString();
                this.lblWeighty20.Text = DCMS.WEIGHTY20.ToString();
                this.lblWeighty40.Text = DCMS.WEIGHTY40.ToString();
                this.lblWeighty45.Text = DCMS.WEIGHTY45.ToString();
                this.lblWeightyTotal.Text = DCMS.WEIGHTTOTAL.ToString();
                this.lblContainerTotal.Text = DCMS.CONTAINERTOTAL.ToString();
                this.lblConWeight.Text = DCMS.CARGOWEIGHT.ToString();
            }
            this.rbtTradeType.SelectedIndex = this.rbtTradeType.Items.IndexOf(this.rbtTradeType.Items.FindByValue(DCMS.TRADETYPE));
            this.rbtUpORDown.SelectedIndex = this.rbtUpORDown.Items.IndexOf(this.rbtUpORDown.Items.FindByValue(DCMS.WORKLOAD));
            this.rbtInOROut.SelectedIndex = this.rbtInOROut.Items.IndexOf(this.rbtInOROut.Items.FindByValue(DCMS.INOROUT));
            this.lblLoadCountry.Text = DCMS.LOADCOUNTRY;
            this.lblLoadHarbour.Text = DCMS.LOADHARBOUR;
            this.lblUnloadCountry.Text = DCMS.UNLOADCOUNTRY;
            this.lblUnloadHarbour.Text = DCMS.UNLOADHARBOUR;
            this.lblAgentCorp.Text = DCMS.AGENTCORP;
            this.lblDealgoodsCorp.Text = DCMS.DEALGOODSCORP;
            this.lblLoadCorp.Text = DCMS.LOADCORP;
        }