public BizResult delete(string user)
        {
            BizResult res = new BizResult();

            if (trip == null || trip.Id == 0)
            {
                res.context = "Data is empty";
            }
            else
            {
                if (updating_verify(res, user, trip))
                {
                    C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
                    elog.Platform_isBackend();
                    elog.Controller = user;
                    elog.setActionLevel(trip.Id, CtmJobEventLogRemark.Level.Trip, 2);

                    //===========
                    deleting_reSequence_autoFixIncentive();
                    Manager.ORManager.ExecuteDelete <CtmJobDet2>("Id=" + trip.Id);
                    res.status = true;
                    deleted_removeCost();


                    elog.log();
                }
            }
            return(res);
        }
        public BizResult insert(string user, CtmJobDet2 par)
        {
            setData(null);
            if (par == null)
            {
                throw new Exception("data is null");
            }
            BizResult res = new BizResult();

            if (inserting_verify(res, user, par))
            {
                Manager.ORManager.StartTracking(par, Wilson.ORMapper.InitialState.Inserted);
                Manager.ORManager.PersistChanges(par);
                res.status = true;
                trip       = par;

                resetOldValues();

                inserted_to_container(user);


                C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
                elog.Platform_isBackend();
                elog.Controller = user;
                elog.setActionLevel(trip.Id, CtmJobEventLogRemark.Level.Trip, 1);
                elog.log();
            }
            return(res);
        }
        public BizResult update(string user)
        {
            BizResult res = new BizResult();

            if (trip == null)
            {
                res.context = "Data is empty";
                return(res);
            }

            if (updating_verify(res, user, trip))
            {
                updated_before(user);
                Manager.ORManager.StartTracking(trip, Wilson.ORMapper.InitialState.Updated);
                Manager.ORManager.PersistChanges(trip);
                res.status = true;
                updated_Status_changed(user);
                updated_reSequence_autoFixIncentive();

                updated_to_container(user);
                updated_to_house(user);
                updated_to_cost(user);

                resetOldValues();

                C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
                elog.Platform_isBackend();
                elog.Controller = user;
                elog.setActionLevel(trip.Id, CtmJobEventLogRemark.Level.Trip, 3, " Status[" + trip.Statuscode + "]FromDate[" + trip.FromDate.ToString("yyyyMMdd") + "]");
                elog.log();
            }

            return(res);
        }
        public BizResult update(string user)
        {
            BizResult res = new BizResult();

            if (det1 == null)
            {
                throw new Exception("data is null");
            }

            if (updating_verify(res, user, det1))
            {
                det1.ScheduleDate = SafeValue_mb.DateTime_ClearTime(det1.ScheduleDate);
                det1.ScheduleTime = SafeValue_mb.convertTimeFormat(det1.ScheduleTime);
                det1.ServiceType  = (SafeValue.SafeString(det1.ServiceType).Equals("") ? default_ServiceType : det1.ServiceType);
                Manager.ORManager.StartTracking(det1, Wilson.ORMapper.InitialState.Updated);
                Manager.ORManager.PersistChanges(det1);
                res.status = true;

                //========== log container no changed
                C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
                elog.Platform_isBackend();
                elog.Controller = user;
                if (oldv_containerNo != null && det1.ContainerNo != null && !oldv_containerNo.Equals(det1.ContainerNo))
                {
                    elog.setActionLevel(det1.Id, CtmJobEventLogRemark.Level.Container, -1, "ContainerNo[" + oldv_containerNo + "]->[" + det1.ContainerNo + "]");
                    elog.log();
                }

                updated_Status_changed(user);
                updated_to_trip();
                updated_to_house(user);

                resetOldValues();


                elog.setActionLevel(det1.Id, CtmJobEventLogRemark.Level.Container, 3);
                elog.log();
            }
            return(res);
        }
        public BizResult insert(string user, CtmJobDet1 par)
        {
            setData(null);
            if (par == null)
            {
                throw new Exception("data is null");
            }
            BizResult res = new BizResult();

            if (inserting_verify(res, user, par))
            {
                par.ScheduleDate      = SafeValue_mb.DateTime_ClearTime(par.ScheduleDate);
                par.ScheduleTime      = SafeValue_mb.convertTimeFormat(par.ScheduleTime);
                par.ScheduleStartDate = SafeValue_mb.DateTime_ClearTime(par.ScheduleStartDate);
                par.ServiceType       = (SafeValue.SafeString(par.ServiceType).Equals("") ? default_ServiceType : par.ServiceType);
                Manager.ORManager.StartTracking(par, Wilson.ORMapper.InitialState.Inserted);
                Manager.ORManager.PersistChanges(par);
                res.status = true;
                det1       = par;
                updated_Status_changed(user);

                resetOldValues();
                oldv_ServiceType = "";//==== update trips by service type.
                inserted_auto_CreateTrip(user);
                updated_to_trip();
                resetOldValues();


                C2.CtmJobEventLog elog = new C2.CtmJobEventLog();
                elog.Platform_isBackend();
                elog.Controller = user;
                elog.setActionLevel(det1.Id, CtmJobEventLogRemark.Level.Container, 1);
                elog.log();
            }
            return(res);
        }