Ejemplo n.º 1
0
        private void BindDDL()
        {
            try
            {
                IList<PortInfo> dPortList = new Port().GetList();
                ddlStartPort.DataSource = dPortList;
                ddlStartPort.DataBind();

                ddlEndPort.DataSource = dPortList;
                ddlEndPort.DataBind();

                BindRoute(0, pGrid.PageSize);
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Ejemplo n.º 2
0
        //航次基本信息绑定
        private void bindVoyageInfo(string voyageid)
        {
            VoyageInfo vi = new VoyageInfo();
            Voyage v = new Voyage();

            vi = v.GetByID(voyageid);

            string voyageName = vi.Name;
            string beginDate = vi.BeginDate.ToString();
            string endDate = vi.EndDate.ToString();
            string routeId = vi.RouteID.ToString();

            Route r = new Route();
            RouteInfo ri = new RouteInfo();

            ri = r.GetByID(routeId);
            float distance = ri.Distance;

            Ship ship = new Ship();
            ShipInfo si = new ShipInfo();
            si = ship.GetByID(vi.ShipID.ToString());

            string shipName = si.Name;
            string chiefEngineer = si.ChiefEngineer;
            string captain = si.Captain;
            string generalManager = si.GeneralManager;

            Relation_RoutePort rrp = new Relation_RoutePort();
            Relation_RoutePortInfo rrpi = new Relation_RoutePortInfo();

            int startPortId = 0;
            int endPortId = 0;
            rrpi = rrp.GetListByRouteID(routeId)[0];
            int portType = rrpi.PortTypeID;

            //出发港
            if (portType == 2)
            {
                startPortId = rrpi.PortID;
            }
            //到达港
            if (portType == 4)
            {
                endPortId = rrpi.PortID;
            }

            rrpi = rrp.GetListByRouteID(routeId)[1];
            portType = rrpi.PortTypeID;

            //出发港
            if (portType == 2)
            {
                startPortId = rrpi.PortID;
            }
            //到达港
            if (portType == 4)
            {
                endPortId = rrpi.PortID;
            }

            Port p = new Port();
            PortInfo pi = new PortInfo();

            pi = p.GetByID(startPortId.ToString());
            string startPortName = pi.Name;
            pi = p.GetByID(endPortId.ToString());
            string endPortName = pi.Name;

            lblShipName.Text = shipName;
            lblDistance.Text = distance.ToString();

            if (beginDate.Split(' ')[0].ToString().Equals("1900/1/1"))
            {
                lblStartTime.Text = "";
            }
            else
            {
                lblStartTime.Text = beginDate;
            }

            if (endDate.Split(' ')[0].ToString().Equals("1900/1/1"))
            {
                lblStartTime.Text = "";
            }
            else
            {
                lblEndTime.Text = endDate;
            }

            lblStartPort.Text = startPortName;
            lblEndPort.Text = endPortName;
            lblChiefEngineer.Text = chiefEngineer;
            lblCaptain.Text = captain;
            lblGeneralManager.Text = generalManager;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 路线增改事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSaveRoute_Click(object sender, EventArgs e)
        {
            try
            {
                RouteInfo ri = new RouteInfo();
                ri.Distance = float.Parse(tbDistance.Text);
                ri.Name = tbRouteName.Text;

                Relation_RoutePortInfo rrpis = new Relation_RoutePortInfo();
                rrpis.PortID = Convert.ToInt32(ddlStartPort.SelectedValue);
                rrpis.PortTypeID = 2;
                rrpis.OrderNum = "0";
                Relation_RoutePortInfo rrpie = new Relation_RoutePortInfo();
                rrpie.PortID = Convert.ToInt32(ddlEndPort.SelectedValue);
                rrpie.PortTypeID = 4;
                rrpie.OrderNum = "0";
                //新增
                if (string.IsNullOrEmpty(lbID.Value))
                {
                    int routeId = Convert.ToInt32(new Route().Add(ri));
                    //始发港
                    rrpis.RouteID = routeId;
                    new Relation_RoutePort().Add(rrpis);
                    //目的港
                    rrpie.RouteID = routeId;
                    new Relation_RoutePort().Add(rrpie);
                }
                //编辑
                else
                {
                    int routeId = Convert.ToInt32(lbID.Value);
                    ri.ID = routeId.ToString();
                    new Route().Update(ri);
                    //始发港
                    rrpis.RouteID = routeId;
                    IList<PortInfo> pList = new Port().GetList(routeId.ToString(), "2");

                    rrpis.ID = new Port().GetPortListByRoute(routeId.ToString(), "2").Tables[0].Rows[0]["relateId"].ToString();
                    new Relation_RoutePort().Update(rrpis);
                    //目的港
                    rrpie.RouteID = routeId;
                    rrpie.ID = new Port().GetPortListByRoute(routeId.ToString(), "4").Tables[0].Rows[0]["relateId"].ToString();
                    new Relation_RoutePort().Update(rrpie);

                    string id = lbID.Value;
                    RouteInfo rInfo = new Route().GetByID(id);
                    lbTotalRoute.Text = rInfo.TotalRoute;
                }

                BindRoute(0, pGrid.PageSize);
                BindPassPortList(lbID.Value);
                ShowMsg("操作成功!");
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 绑定经停港报表
        /// </summary>
        /// <param name="routeId"></param>
        private void BindPassPortList(string routeId)
        {
            try
            {
                DataSet ds = new Port().GetPortListByRoute(routeId, "5");

                DataTable dt = ds.Tables[0];

                int n = dt.Rows.Count;

                DataRow dr = dt.NewRow();
                dr["PortID"] = 0;
                dr["PortName"] = "";
                dt.Rows.InsertAt(dr, n);

                gvPassedPorts.DataSource = dt;
                gvPassedPorts.DataBind();
                gvPassedPorts.SelectedIndex = 0;
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///  路线报表改变选择路线绑定事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rbSel_RouteCheckedChanged(object sender, EventArgs e)
        {
            try
            {
                string id = lbID.Value;
                RouteInfo rInfo = new Route().GetByID(id);
                tbRouteName.Text = rInfo.Name;
                tbDistance.Text = rInfo.Distance.ToString();
                lbTotalRoute.Text = rInfo.TotalRoute;

                IList<PortInfo> pList = new Port().GetList(id, "2");
                String startPort = pList[0].ID;
                pList = new Port().GetList(id, "4");
                String endPort = pList[0].ID;
                ddlStartPort.SelectedValue = startPort;
                ddlEndPort.SelectedValue = endPort;

                BindPassPortList(id);
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Ejemplo n.º 6
0
        private void VoyageLoadInitial(VoyageInfo vInfo)
        {
            if (GetRequest("type") == "other")
            {
                divOther.Visible = true;
                divFCL.Visible = false;
                divLCL.Visible = false;
            }
            if (vInfo == null || string.IsNullOrEmpty(vInfo.ID))
            {
                return;
            }

            #region 其他收入
            if (GetRequest("type") == "other")
            {

                VoyageOtherInfo voInfo = new VoyageOther().GetByVoyageID(vInfo.ID);
                if (voInfo != null && string.IsNullOrEmpty(voInfo.ID) == false)
                {
                    tbOtherName.Text = voInfo.OtherName;
                    tbRemark.Text = voInfo.Remark;
                    tbOtherFee.Text = voInfo.Amount;
                    ddlCurrencyOther.SelectedValue = voInfo.CurrencyID;
                    tbOtherUser1.Text = voInfo.User1;
                    tbOtherUser2.Text = voInfo.User2;
                    tbOtherUser3.Text = voInfo.User3;
                    lbOtherRMB.Text = new ExchangeRate().GetRMB(voInfo.Amount, voInfo.CurrencyID, voInfo.CreateTime).ToString();
                }
                return;
            }
            #endregion

            IList<PortInfo> pList = new Port().GetList(vInfo.RouteID.ToString(), string.Empty);
            gvList.DataSource = pList;
            gvList.DataBind();
            ShipInfo sInfo = new Ship().GetByID(vInfo.ShipID.ToString());
            switch (sInfo.LoadTypeEnum)
            {
                case ShipType.LCL:
                    #region 散货
                    divLCL.Visible = true;
                    // 散货
                    VoyageLCLInfo vlInfo = new VoyageLCL().GetByVoyageID(vInfo.ID);
                    if (vlInfo != null && string.IsNullOrEmpty(vlInfo.ID) == false)
                    {
                        tbCustomer.Text = vlInfo.Customer;
                        tbTaxNo.Text = vlInfo.TaxNo;
                        tbLCLAmount.Text = vlInfo.LCLAmount;
                        tbLCLAmountReal.Text = vlInfo.LCLAmountReal;
                        tbLCLName.Text = vlInfo.LCLCatalog;
                        tbTransport.Text = vlInfo.LCLPrice;
                        ddlCurrency.SelectedValue = vlInfo.CurrencyID;
                        lbAmount.Text = vlInfo.Fee;

                        tbDelay.Text = vlInfo.DelayDay;
                        tbDelayFee.Text = vlInfo.DelayRate;
                        lbDelayAmount.Text = vlInfo.DelayAmount;
                        lbDelayRMB.Text = new ExchangeRate().GetRMB(vlInfo.DelayAmount, vlInfo.CurrencyID, vlInfo.CreateTime).ToString();

                        tbDispatch.Text = vlInfo.QuickDay;
                        tbDispatchFee.Text = vlInfo.QuickRate;
                        lbDispatchAmount.Text = vlInfo.DispatchAmount;
                        lbDispatchRMB.Text = new ExchangeRate().GetRMB(vlInfo.DispatchAmount, vlInfo.CurrencyID, vlInfo.CreateTime).ToString();

                        lbTotal.Text = new VoyageLCL().GetAmout(vlInfo);
                        lbLCLCName.Text = ddlCurrency.SelectedItem.Text;
                        lbTotalRMB.Text = new VoyageLCL().GetRMBAmout(vlInfo);

                        tbLCLUser1.Text = vlInfo.User1;
                        tbLCLUser2.Text = vlInfo.User2;
                        tbLCLUser3.Text = vlInfo.User3;
                    }
                    #endregion
                    break;
                case ShipType.FCL:
                    #region 集装箱
                    divFCL.Visible = true;
                    VoyageFCLInfo vfInfo = new VoyageFCL().GetByVoyageID(vInfo.ID);
                    if (vfInfo != null && string.IsNullOrEmpty(vfInfo.ID) == false)
                    {
                        tbCustomer.Text = vfInfo.Customer;
                        tbTaxNo.Text = vfInfo.TaxNo;
                        tbFCLFee.Text = vfInfo.Amount;
                        ddlCurrencyFCL.SelectedValue = vfInfo.CurrencyID;

                        tbFCLUser1.Text = vfInfo.User1;
                        tbFCLUser2.Text = vfInfo.User2;
                        tbFCLUser3.Text = vfInfo.User3;

                        tbFCLFee.Text = vfInfo.Fee;
                        tbBeginFee.Text = vfInfo.BeginFee;
                        tbEndFee.Text = vfInfo.EndFee;
                        tbOilFee.Text = vfInfo.OilFee;
                        tbTally.Text = vfInfo.Tally;
                        tbBox.Text = vfInfo.Box;
                        tbOther.Text = vfInfo.Other;
                        tbSubsidize.Text = vfInfo.Subsidize;
                        tbBookFee.Text = vfInfo.BookFee;
                        tbBranchOther.Text = vfInfo.BranchOther;

                        lbFCLTotal.Text = new VoyageFCL().GetAmout(vfInfo.ID);
                        lbFCLTotalRMB.Text = new VoyageFCL().GetRMBAmout(vfInfo.ID);
                        tbFCLRemark.Text = vfInfo.Remark;
                    }
                    #endregion
                    break;
                default:
                    break;
            }

        }
Ejemplo n.º 7
0
        /// <summary>
        /// 初始化航次信息
        /// </summary>
        /// <param name="voyageID"></param>
        private string VoyageInitial(string voyageIds)
        {
            //根据航次或者船舶绑定数据
            string[] voyageIdArray = voyageIds.Split(',');
            IList<VoyageInfo> vList = new Voyage().GetList(voyageIdArray);
            ddlVoyage.DataSource = vList;
            ddlVoyage.DataBind();

            string voyageID = voyageIdArray[0];
            VoyageInfo vInfo = new Voyage().GetByID(voyageID);
            ddlVoyage.SelectedValue = voyageID;

            string shipID = vInfo.ShipID.ToString();
            ShipInfo sInfo = new Ship().GetByID(shipID);
            lbShip.Text = sInfo.Name;

            string routeID = vInfo.RouteID.ToString();
            RouteInfo rInfo = new Route().GetByID(routeID);
            lbRoute.Text = rInfo.Name;
            lbMile.Text = rInfo.Distance.ToString();

            IList<PortInfo> pList = new Port().GetList(routeID, "2");
            lbBegin.Text = pList[0].Name;
            pList = new Port().GetList(routeID, "4");
            lbEnd.Text = pList[0].Name;

            return voyageID;
        }