Exemplo n.º 1
0
            //private static void InitCache(string custom)
            //{
            //    //ContainerPlanList = GetContainerPlanbyCustom();
            //}

            public static ContainerPlan Load(string tID)
            {
                if (ContainerPlanCache.ContainsKey(tID))
                {
                    return(ContainerPlanCache[tID]);
                }
                else
                {
                    ContainerPlan cp = new ContainerPlan();

                    cp.ID = tID;
                    cp.Select();

                    if (cp != null)
                    {
                        ContainerPlanCache.Add(tID, cp);
                    }

                    return(cp);
                }
            }
Exemplo n.º 2
0
        public static void ReloadAll(string source)
        {
            List<MyFavourite> list = MyFavourite.Cache.FavouriteList_Active;

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();

            if (list.Count > 0 && source == "cache")
            {
                foreach (MyFavourite mf in list)
                {
                    switch (mf.OBJECTTYPE)
                    {
                        case "ContainerEload":
                            ContainerEload ce = ContainerEload.Cache.Load(mf.OBJECTID);

                            if (ce != null) { mf.OverRideObjContent(jsonSerializer.Serialize(ce)); }

                            break;
                        case "ContainerMain":
                        case "ContainerDetail":
                            ContainerMain cm = ContainerMain.Cache.Load(mf.OBJECTID);

                            if (cm != null) { mf.OverRideObjContent(jsonSerializer.Serialize(cm)); }

                            break;
                        case "ContainerPlan":
                            ContainerPlan cp = ContainerPlan.Cache.Load(mf.OBJECTID);

                            if (cp != null) { mf.OverRideObjContent(jsonSerializer.Serialize(cp)); }

                            break;
                        case "Truck":
                            OTruck truck = OTruck.Cache.Load(mf.OBJECTID);

                            if (truck != null) { mf.OverRideObjContent(jsonSerializer.Serialize(truck)); }

                            break;
                        case "VesselPlan":
                            OVesselPlan vp = OVesselPlan.Cache.Load(mf.OBJECTID);

                            if (vp != null) { mf.OverRideObjContent(jsonSerializer.Serialize(vp)); }

                            break;
                        default:
                            break;
                    }
                }
            }
            else if (list.Count > 0 && source == "database")
            {
                foreach (MyFavourite mf in list)
                {
                    switch (mf.OBJECTTYPE)
                    {
                        case "ContainerEload":
                            ContainerEload ce = new ContainerEload();
                            ce.ID = mf.OBJECTID;
                            ce.Select();
                            if (ce != null) { mf.OverRideObjContent(jsonSerializer.Serialize(ce)); }

                            break;
                        case "ContainerMain":
                        case "ContainerDetail":
                            ContainerMain cm = new ContainerMain();
                            cm.ID = mf.OBJECTID;
                            cm.Select();

                            if (cm != null) { mf.OverRideObjContent(jsonSerializer.Serialize(cm)); }

                            break;
                        case "ContainerPlan":
                            ContainerPlan cp = new ContainerPlan();
                            cp.ID = mf.OBJECTID;
                            cp.Select();

                            if (cp != null) { mf.OverRideObjContent(jsonSerializer.Serialize(cp)); }

                            break;
                        case "Truck":
                            OTruck truck = new OTruck();
                            truck.ID = mf.OBJECTID;
                            truck.Select();

                            if (truck != null) { mf.OverRideObjContent(jsonSerializer.Serialize(truck)); }

                            break;
                        case "VesselPlan":
                            OVesselPlan vp = new OVesselPlan();
                            vp.ID = mf.OBJECTID;
                            vp.Select();

                            if (vp != null) { mf.OverRideObjContent(jsonSerializer.Serialize(vp)); }

                            break;
                        default:
                            break;
                    }
                }

            }

            // 持久化
            list = list.FindAll(f => f.UpdateFlag);

            foreach (MyFavourite mf in list)
            {
                mf.Update();
            }
        }
Exemplo n.º 3
0
        public static void ReloadAll(string source)
        {
            List <MyFavourite> list = MyFavourite.Cache.FavouriteList_Active;

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();

            if (list.Count > 0 && source == "cache")
            {
                foreach (MyFavourite mf in list)
                {
                    switch (mf.OBJECTTYPE)
                    {
                    case "ContainerEload":
                        ContainerEload ce = ContainerEload.Cache.Load(mf.OBJECTID);

                        if (ce != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(ce));
                        }

                        break;

                    case "ContainerMain":
                    case "ContainerDetail":
                        ContainerMain cm = ContainerMain.Cache.Load(mf.OBJECTID);

                        if (cm != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(cm));
                        }

                        break;

                    case "ContainerPlan":
                        ContainerPlan cp = ContainerPlan.Cache.Load(mf.OBJECTID);

                        if (cp != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(cp));
                        }

                        break;

                    case "Truck":
                        OTruck truck = OTruck.Cache.Load(mf.OBJECTID);

                        if (truck != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(truck));
                        }

                        break;

                    case "VesselPlan":
                        OVesselPlan vp = OVesselPlan.Cache.Load(mf.OBJECTID);

                        if (vp != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(vp));
                        }

                        break;

                    default:
                        break;
                    }
                }
            }
            else if (list.Count > 0 && source == "database")
            {
                foreach (MyFavourite mf in list)
                {
                    switch (mf.OBJECTTYPE)
                    {
                    case "ContainerEload":
                        ContainerEload ce = new ContainerEload();
                        ce.ID = mf.OBJECTID;
                        ce.Select();
                        if (ce != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(ce));
                        }

                        break;

                    case "ContainerMain":
                    case "ContainerDetail":
                        ContainerMain cm = new ContainerMain();
                        cm.ID = mf.OBJECTID;
                        cm.Select();

                        if (cm != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(cm));
                        }

                        break;

                    case "ContainerPlan":
                        ContainerPlan cp = new ContainerPlan();
                        cp.ID = mf.OBJECTID;
                        cp.Select();

                        if (cp != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(cp));
                        }

                        break;

                    case "Truck":
                        OTruck truck = new OTruck();
                        truck.ID = mf.OBJECTID;
                        truck.Select();

                        if (truck != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(truck));
                        }

                        break;

                    case "VesselPlan":
                        OVesselPlan vp = new OVesselPlan();
                        vp.ID = mf.OBJECTID;
                        vp.Select();

                        if (vp != null)
                        {
                            mf.OverRideObjContent(jsonSerializer.Serialize(vp));
                        }

                        break;

                    default:
                        break;
                    }
                }
            }

            // 持久化
            list = list.FindAll(f => f.UpdateFlag);

            foreach (MyFavourite mf in list)
            {
                mf.Update();
            }
        }
Exemplo n.º 4
0
            //private static void InitCache(string custom)
            //{
            //    //ContainerPlanList = GetContainerPlanbyCustom();
            //}
            public static ContainerPlan Load(string tID)
            {
                if (ContainerPlanCache.ContainsKey(tID))
                {
                    return ContainerPlanCache[tID];
                }
                else
                {
                    ContainerPlan cp = new ContainerPlan();

                    cp.ID = tID;
                    cp.Select();

                    if (cp != null)
                    {
                        ContainerPlanCache.Add(tID, cp);
                    }

                    return cp;
                }
            }