Esempio n. 1
0
        public bool UpdateIsActive(int VesselVoyageId, bool isActive)
        {
            bool isSave = true;

            try
            {
                vv = db.VesselVoyage.Find(VesselVoyageId);
                vv.IsActiveTrip = isActive;

                db.VesselVoyage.Attach(vv);
                db.Entry(vv).Property(p => p.IsActiveTrip).IsModified = true;
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                isSave = false;
            }
            return(isSave);
        }
Esempio n. 2
0
        public bool Delete(int Id)
        {
            bool isSaved = true;

            try
            {
                using (WTCCeresEntities d = new WTCCeresEntities())
                {
                    vv = d.VesselVoyage.Find(Id);
                    d.VesselVoyage.Remove(vv);
                    d.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                isSaved = false;
            }
            return(isSaved);
        }
Esempio n. 3
0
        public bool Update(int VesselTripId, string VoyageNumber, string ERD, string LRD, string ETA, string ETD, string PortCity, string PortCountry, bool IsActiveTrip, int VesselVoyageStatusId, int VesselId, int PortId)
        {
            bool isSave = true;

            try
            {
                using (WTCCeresEntities db = new WTCCeresEntities())
                {
                    vv = db.VesselVoyage.Find(VesselTripId);
                    vv.VesselVoyageId = VesselTripId;
                    vv.VoyageNumber   = VoyageNumber;

                    if (!String.IsNullOrEmpty(ERD))
                    {
                        vv.ERD = Convert.ToDateTime(ERD);
                    }
                    else
                    {
                        vv.ERD = null;
                    }

                    if (!String.IsNullOrEmpty(LRD))
                    {
                        vv.LRD = Convert.ToDateTime(LRD);
                    }
                    else
                    {
                        vv.LRD = null;
                    }

                    if (!String.IsNullOrEmpty(ETA))
                    {
                        vv.ETA = Convert.ToDateTime(ETA);
                    }
                    else
                    {
                        vv.ETA = null;
                    }

                    if (!String.IsNullOrEmpty(ETD))
                    {
                        vv.ETD = Convert.ToDateTime(ETD);
                    }
                    else
                    {
                        vv.ETD = null;
                    }
                    vv.PortCity             = PortCity;
                    vv.PortCountry          = PortCountry;
                    vv.IsActiveTrip         = IsActiveTrip;
                    vv.VesselVoyageStatusId = VesselVoyageStatusId;
                    vv.VesselId             = VesselId;
                    vv.PortId = PortId;
                    db.VesselVoyage.AddOrUpdate(vv);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                isSave = false;
            }
            return(isSave);
        }