Example #1
0
        private void BindData()
        {
            if (VesselPlanID != null)
            {
                OVesselPlan vp = OVesselPlan.Cache.Load(VesselPlanID);

                lblVesselName.Text = string.Format("<h3  class=\"p15\">船名:{0}</h3><h6 class=\"p15\">{1}</h6>", vp.VesselName, vp.VesselEnglishName);

                lblVoyageNumber.Text        = vp.VoyageNumber;
                lblImportOrExport.Text      = vp.ImportOrExportFlag;
                lblArrivePlanTime.Text      = vp.ArrivePlanTime.ToString();
                lblArriveActualTime.Text    = vp.ArriveActualTime.ToString();
                lblDeparturePlanTime.Text   = vp.DeparturePlanTime.ToString();
                lblDepartureActualTime.Text = vp.DepartureActualTime.ToString();
                lblIsCustomsClosing.Text    = vp.IsCustomsClosing.ToString();
            }
        }
        private void BindData()
        {
            if (VesselPlanID != null)
            {
                OVesselPlan vp = OVesselPlan.Cache.Load(VesselPlanID);

                lblVesselName.Text         = string.Format("<h3  class=\"p15\">船名:{0}</h3><h6  class=\"p15\">{1}</h6>", vp.VesselName, vp.VesselEnglishName);
                lblCSI.Text                = vp.CSI;
                lblVoyageNumber.Text       = vp.VoyageNumber;
                lblImportOrExport.Text     = vp.ImportOrExportFlag.ToString();
                lblContainerBeginTime.Text = vp.ContainerBeginTime.ToString();
                lblContainerDeadLine.Text  = vp.ContainerDeadline.ToString();
                lblAgency.Text             = vp.Agency;
                //lblPortOfCallId.Text = vp.PortOfCallID.ToString();



                List <PortOfCall> list = PortOfCall.GetPortOfCalls(vp.PortOfCallID.ToString()).FindAll(delegate(PortOfCall t)
                {
                    Boolean returnValue = true;
                    string tmpString    = string.Empty;
                    //if (vp.PortOfCallID.ToString() != null)
                    //{
                    //    tmpString = vp.PortOfCallID.ToString();
                    //    if (!string.IsNullOrEmpty(tmpString))
                    //        returnValue = returnValue && (t.ID.Equals(tmpString, StringComparison.OrdinalIgnoreCase));
                    //}

                    return(returnValue);
                });

                rptPortOfCall.DataSource = list;
                rptPortOfCall.DataBind();
                rptth.DataSource = list;
                rptth.DataBind();
            }
        }
Example #3
0
        protected void rptrFavourite_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string _strVP_Info = string.Empty;

                MyFavourite fav = e.Item.DataItem as MyFavourite;

                Literal ltrlFavourite = e.Item.FindControl("ltrlFavourites") as Literal;

                string _update = string.Empty;
                if (fav.STATUS == 1)
                {
                    _update = "<span class=\"ui-li-count\">New</span>";
                }

                switch (fav.OBJECTTYPE.ToUpper())
                {
                case "CONTAINERPLAN":
                    string _tmpltrlContainerPlan = "<li style=\"cursor: pointer\" onclick=\"window.location.href=\'{0}\'\"><h3>{1}</h3><p>申请/实际进港时间:{2}</p><p> 进港结束时间:{3} </p>{4}</li>";

                    ContainerPlan cp = ContainerPlan.Cache.Load(fav.OBJECTID);

                    if (cp != null)
                    {
                        string _planTime = "";

                        if (!string.IsNullOrEmpty(cp.PlanTime.ToString()))
                        {
                            _planTime = cp.PlanTime.ToString();
                            _planTime = _planTime.Substring(0, _planTime.Length - 3);
                        }

                        string _planAcceptedTime = "";

                        if (!string.IsNullOrEmpty(cp.PlanAcceptedTime.ToString()))
                        {
                            _planAcceptedTime = cp.PlanAcceptedTime.ToString();
                            _planAcceptedTime = _planAcceptedTime.Substring(0, _planAcceptedTime.Length - 3);
                        }

                        ltrlFavourite.Text = string.Format(_tmpltrlContainerPlan, fav.URL, cp.ID, _planTime, _planAcceptedTime, _update);
                    }
                    else
                    {
                        ltrlFavourite.Visible = false;
                    }

                    break;

                case "CONTAINERMAIN":
                    string _tmpltrlContainerMain = "<li style=\"cursor: pointer\" onclick=\"window.location.href=\'{0}\'\"><h3>{1}</h3><p>进港时间:{2} </p>{3}</li>";

                    ContainerMain c = new ContainerMain();
                    c.ID = fav.OBJECTID;
                    c.Select();

                    if (c != null)
                    {
                        string _arriveContainerTime = "";

                        if (!string.IsNullOrEmpty(c.ArrivalContainerTime.ToString()))
                        {
                            _arriveContainerTime = c.ArrivalContainerTime.ToString();
                            _arriveContainerTime = _arriveContainerTime.Substring(0, _arriveContainerTime.Length - 3);
                        }

                        ltrlFavourite.Text = string.Format(_tmpltrlContainerMain, fav.URL, c.ContainerNo, _arriveContainerTime, _update);
                    }
                    else
                    {
                        ltrlFavourite.Visible = false;
                    }
                    break;

                case "CONTAINERDETAIL":
                    string _tmpltrlContainerDetail = "<li style=\"cursor: pointer\" onclick=\"window.location.href=\'{0}\'\"><h3>{1}</h3><p>进场:{2} | 出场:{3} </p> <p>入场方式:{4} | 出场方式:{5}</p>{6}</li>";

                    ContainerMain cm = new ContainerMain();
                    cm.ID = fav.OBJECTID;
                    cm.Select();

                    if (cm != null)
                    {
                        string _arriveTime = "";

                        if (!string.IsNullOrEmpty(cm.ArriveTime.ToString()))
                        {
                            _arriveTime = cm.ArriveTime.ToString();
                            _arriveTime = _arriveTime.Substring(0, _arriveTime.Length - 3);
                        }

                        string _departureTime = "";

                        if (!string.IsNullOrEmpty(cm.DepartureTime.ToString()))
                        {
                            _departureTime = cm.DepartureTime.ToString();
                            _departureTime = _departureTime.Substring(0, _departureTime.Length - 3);
                        }

                        ltrlFavourite.Text = string.Format(_tmpltrlContainerDetail, fav.URL, cm.ContainerNo, _arriveTime, _departureTime, cm.ArriveType.ToString(), cm.DepartureType.ToString(), _update);
                    }
                    else
                    {
                        ltrlFavourite.Visible = false;
                    }
                    break;

                case "CONTAINERELOAD":
                    string _tmpltrlContainerEload = "<li style=\"cursor: pointer\" onclick=\"window.location.href=\'{0}\'\"><h3>{1}</h3><p>船名:{2} | 航次:{3} </p><p> 进港时间: {4}</p>{5}</li>";

                    ContainerEload ce = new ContainerEload();
                    ce.ID = fav.OBJECTID;
                    ce.Select();

                    if (ce != null)
                    {
                        string _sendPackingListTime = "";

                        if (!string.IsNullOrEmpty(ce.SendPackingListTime.ToString()))
                        {
                            _sendPackingListTime = ce.SendPackingListTime.ToString();
                            _sendPackingListTime = _sendPackingListTime.Substring(0, _sendPackingListTime.Length - 3);
                        }

                        ltrlFavourite.Text = string.Format(_tmpltrlContainerEload, fav.URL, ce.ContainerNo, ce.VesselName, ce.VoyageNumber, _sendPackingListTime, _update);
                    }
                    else
                    {
                        ltrlFavourite.Visible = false;
                    }
                    break;

                case "TRUCK":
                    string _tmpltrlOTruck = "<li style=\"cursor: pointer\" onclick=\"window.location.href=\'{0}\'\"><h3>{1}</h3><p>进堆场时间:{2} </p><p> 出堆场时间:{3} </p>{4}</li>";

                    OTruck t = OTruck.Cache.Load(fav.OBJECTID);

                    if (t != null)
                    {
                        string _arriveYardTime = "";

                        if (!string.IsNullOrEmpty(t.ArriveYardTime.ToString()))
                        {
                            _arriveYardTime = t.ArriveYardTime.ToString();
                            _arriveYardTime = _arriveYardTime.Substring(0, _arriveYardTime.Length - 3);
                        }
                        string _departureYardTime = "";

                        if (!string.IsNullOrEmpty(t.DepartureYardTime.ToString()))
                        {
                            _departureYardTime = t.DepartureYardTime.ToString();
                            _departureYardTime = _departureYardTime.Substring(0, _departureYardTime.Length - 3);
                        }

                        ltrlFavourite.Text = string.Format(_tmpltrlOTruck, fav.URL, t.TruckNo, _arriveYardTime, _departureYardTime, _update);
                    }
                    else
                    {
                        ltrlFavourite.Visible = false;
                    }
                    break;

                case "VESSELPLAN":

                    string _tmpltrlVesselPlan = "<li style=\"cursor: pointer\" onclick=\"window.location.href=\'{0}\'\"><h3>{1}({2})</h3><p>航次:{3} | 进/出口:{4} | 范围:{5}</p>{6}</li>";

                    OVesselPlan vp = OVesselPlan.Cache.Load(fav.OBJECTID);

                    if (vp != null)
                    {
                        ltrlFavourite.Text = string.Format(_tmpltrlVesselPlan, fav.URL, vp.VesselName, vp.VesselEnglishName, vp.VoyageNumber, vp.ImportOrExportFlag.Equals("E", StringComparison.OrdinalIgnoreCase) ? "出口" : "进口", vp.VesselPlanStatus, _update);
                    }
                    else
                    {
                        ltrlFavourite.Visible = false;
                    }
                    break;

                case "TVDANGERPLAN":
                    string _tmpltrlTVDangerPlan = "<li style=\"cursor: pointer\" onclick=\"window.location.href=\'{0}\'\"><h3>{1}</h3><p>船名/航次:{2}</p><p> 直装时间:{3} </p>{4}</li>";

                    TVDangerPlan tv = TVDangerPlan.Cache.Load(fav.OBJECTID);

                    if (tv != null)
                    {
                        string _TVDate = "";

                        if (!string.IsNullOrEmpty(tv.TVDATE.ToString()))
                        {
                            _TVDate = tv.TVDATE.ToString();
                            _TVDate = _TVDate.Substring(0, _TVDate.Length - 3);
                        }



                        ltrlFavourite.Text = string.Format(_tmpltrlTVDangerPlan, fav.URL, tv.ID, tv.VESSELVOYAGE, tv.TVDATE, _update);
                    }
                    else
                    {
                        ltrlFavourite.Visible = false;
                    }

                    break;

                default:

                    break;
                }
            }
        }
Example #4
0
        private void BindData()
        {
            try
            {
                if (VesselPlanID != null)
                {
                    OVesselPlan vp = OVesselPlan.Cache.Load(VesselPlanID);

                    string ArriveTimeText = string.Empty;
                    string ArriveTime     = string.Empty;

                    string DepartureTimeText = string.Empty;
                    string DepartureTime     = string.Empty;

                    string BerthText = string.Empty;
                    string Berth     = string.Empty;


                    switch (vp.VesselPlanStatus)
                    {
                    case "在港":
                        ArriveTimeText    = "实际靠泊";
                        ArriveTime        = "<td class=\"arrive-a-t\">" + vp.ArriveActualTime.ToString();
                        DepartureTimeText = "计划离泊";
                        DepartureTime     = "<td class=\"departure-p-t\">" + vp.DeparturePlanTime.ToString();
                        BerthText         = "实际泊位";
                        Berth             = "<td class=\"berth-a\">" + vp.BerthActual.ToString();
                        break;

                    case "离港":
                        ArriveTimeText    = "实际靠泊";
                        ArriveTime        = "<td class=\"arrive-a-t\">" + vp.ArriveActualTime.ToString();
                        DepartureTimeText = "实际离泊";
                        DepartureTime     = "<td class=\"departure-a-t\">" + vp.DepartureActualTime.ToString();
                        BerthText         = "实际泊位";
                        Berth             = "<td class=\"berth-a\">" + vp.BerthActual.ToString();

                        break;

                    case "计划":
                        ArriveTimeText         = "计划靠泊";
                        ArriveTime             = "<td class=\"arrive-p-t\">" + vp.ArrivePlanTime.ToString();
                        DepartureTimeText      = "计划离泊";
                        DepartureTime          = "<td class=\"departure-p-t\">" + vp.DeparturePlanTime.ToString();
                        BerthText              = "计划泊位";
                        Berth                  = "<td class=\"berth-p\">" + vp.BerthPlan.ToString();
                        lblCustomsClosing.Text = string.Format("<td class=\"customs-c\">{0}</td>", vp.IsCustomsClosing.ToString());

                        break;

                    default:
                        break;
                    }
                    lblVesselName.Text = string.Format("<h3 class=\"p15\">船名:{0}</h3><h6  class=\"p15\">{1}</h6>", vp.VesselName, vp.VesselEnglishName);

                    lblVoyageNumber.Text   = vp.VoyageNumber;
                    lblImportOrExport.Text = vp.ImportOrExportFlag;

                    lblArriveTime.Text = ArriveTime + "<div class=\"fieldLabel\">" + ArriveTimeText + "</div></td>";

                    lblDepartureTime.Text = DepartureTime + "<div class=\"fieldLabel\">" + DepartureTimeText + "</div></td>";

                    lblBerth.Text = Berth + "<div class=\"fieldLabel\">" + BerthText + "</div></td>";
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "failed", string.Format("alert('{0}');", ex.Message.ToString()), true);
            }
        }
Example #5
0
        public void ProcessRequest(HttpContext context)
        {
            string responseText = string.Empty;

            try
            {
                string _url      = string.Empty;
                string _username = string.Empty;

                if (!string.IsNullOrEmpty(context.Request.QueryString["PageUrl"]))
                {
                    _url = context.Request.QueryString["PageUrl"];
                }

                if (context.Request.Cookies["uid"] != null)
                {
                    _username = context.Request.Cookies["uid"].Values.ToString();
                }

                if (!string.IsNullOrEmpty(context.Request.QueryString["Method"]))
                {
                    if (context.Request.QueryString["Method"].Equals("get"))
                    {
                        #region Check Favourite Code
                        MyFavourite mf = MyFavourite.Cache.FavouriteList_Active.Find(f =>
                                                                                     f.USERNAME.Equals(_username, StringComparison.OrdinalIgnoreCase) && f.URL.Equals(_url, StringComparison.OrdinalIgnoreCase));

                        if (mf != null)
                        {
                            mf.STATUS = 0;
                            mf.Update();

                            MyFavourite.Cache.RefreshCache();

                            responseText = Boolean.TrueString;
                        }
                        else
                        {
                            responseText = Boolean.FalseString;
                        }
                        #endregion
                    }
                    else if (context.Request.QueryString["Method"].Equals("dele"))
                    {
                        if (!string.IsNullOrEmpty(_username))
                        {
                            #region Remove Favourite Code
                            MyFavourite mf = MyFavourite.Cache.FavouriteList_Active.Find(f =>
                                                                                         f.USERNAME.Equals(_username, StringComparison.OrdinalIgnoreCase) && f.URL.Equals(_url, StringComparison.OrdinalIgnoreCase));

                            if (mf != null)
                            {
                                mf.ISACTIVE = 0;
                                mf.Update();

                                MyFavourite.Cache.RefreshCache();

                                responseText = "success";
                            }
                            else
                            {
                                throw new Exception("收藏夹中未找到对应关注项");
                            }
                            #endregion
                        }
                        else
                        {
                            throw new Exception("nologin");
                        }
                    }
                    else if (context.Request.QueryString["Method"].Equals("post"))
                    {
                        if (!string.IsNullOrEmpty(_username))
                        {
                            #region Add Favourtie Code
                            string _objectID = string.Empty;
                            if (!string.IsNullOrEmpty(context.Request.QueryString["ObjectID"]))
                            {
                                _objectID = context.Request.QueryString["ObjectID"];
                            }

                            string _objectType = string.Empty;
                            if (!string.IsNullOrEmpty(context.Request.QueryString["ObjectType"]))
                            {
                                _objectType = context.Request.QueryString["ObjectType"];
                            }


                            if (MyFavourite.Cache.FavouriteList_Active.Exists(f =>
                                                                              f.USERNAME.Equals(_username, StringComparison.OrdinalIgnoreCase) && f.URL.Equals(_url, StringComparison.OrdinalIgnoreCase) &&
                                                                              f.OBJECTID.Equals(_objectID, StringComparison.OrdinalIgnoreCase) && f.OBJECTTYPE.Equals(_objectType, StringComparison.OrdinalIgnoreCase)))
                            {
                                throw new Exception("收藏夹中已有相同关注项");
                            }

                            MyFavourite fav = new MyFavourite();

                            fav.ID         = "";
                            fav.URL        = _url;
                            fav.USERNAME   = _username;
                            fav.UPDATETIME = DateTime.Now;
                            fav.CREATETIME = DateTime.Now;
                            fav.STATUS     = 0;
                            fav.OBJECTID   = _objectID;
                            fav.OBJECTTYPE = _objectType;

                            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                            string _objectContent = "";

                            switch (_objectType)
                            {
                            case "ContainerEload":
                                ContainerEload listContainerEload = ContainerEload.Cache.Load(_objectID);
                                _objectContent = jsonSerializer.Serialize(listContainerEload);
                                break;

                            case "ContainerMain":
                            case "ContainerDetail":
                                ContainerMain listContainerMain = ContainerMain.Cache.Load(_objectID);
                                _objectContent = jsonSerializer.Serialize(listContainerMain);
                                break;

                            case "ContainerPlan":
                                ContainerPlan listContainerPlan = ContainerPlan.Cache.Load(_objectID);
                                _objectContent = jsonSerializer.Serialize(listContainerPlan);
                                break;

                            case "Truck":
                                OTruck listOTruck = OTruck.Cache.Load(_objectID);
                                _objectContent = jsonSerializer.Serialize(listOTruck);
                                break;

                            case "VesselPlan":
                                OVesselPlan listOVesselPlan = OVesselPlan.Cache.Load(_objectID);
                                _objectContent = jsonSerializer.Serialize(listOVesselPlan);
                                break;

                            case "TVDangerPlan":
                                TVDangerPlan listTVDangerPlan = TVDangerPlan.Cache.Load(_objectID);
                                _objectContent = jsonSerializer.Serialize(listTVDangerPlan);
                                break;

                            default:
                                break;
                            }

                            fav.OBJECTCONTENT = _objectContent;
                            fav.ISACTIVE      = 1;
                            fav.REMARK        = string.Empty;

                            fav.Insert();

                            MyFavourite.Cache.RefreshCache();

                            responseText = "success";

                            #endregion
                        }
                        else
                        {
                            throw new Exception("nologin");
                        }
                    }
                    else if (context.Request.QueryString["Method"].Equals("refresh"))
                    {
                        if (!string.IsNullOrEmpty(_username))
                        {
                            MyFavourite.RefreshByUser(_username, "cache");

                            responseText = "success";
                        }
                        else
                        {
                            throw new Exception("nologin");
                        }
                    }
                }
                else
                {
                    throw new Exception("传参错误,请重试");
                }
            }
            catch (Exception ex)
            {
                responseText = ex.Message;
            }

            context.Response.Clear();
            context.Response.ContentType = "text/plain";
            context.Response.Write(responseText);
            context.Response.End();
        }