Exemple #1
0
        public bool Insert(string PortPassId, string TruckNumber, string FirstName, string LastName, bool SuspendyTruckDriver, int CompanyId)
        {
            bool isSave = true;

            try
            {
                //TruckDriver Table
                td.FirstName          = FirstName;
                td.LastName           = LastName;
                td.PortPassId         = PortPassId;
                td.TruckNumber        = TruckNumber.ToString();
                td.SuspendTruckDriver = SuspendyTruckDriver;
                db.TruckDriver.Add(td);
                db.SaveChanges();

                var L = (from r in db.TruckDriver
                         orderby r.TruckDriverId descending
                         select r).First();

                //TruckDriverCompany Table
                tdc.TruckDriverId = Convert.ToInt32(L.TruckDriverId);

                tdc.CompanyId = CompanyId;
                db.TruckDriverCompany.Add(tdc);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                isSave = false;
            }
            return(isSave);
        }
Exemple #2
0
        public bool AddOrUpdate(Release release)
        {
            bool isSaved = true;

            try
            {
                using (WTCCeresEntities db = new WTCCeresEntities())
                {
                    r = release;

                    if (r.ReleaseId == 0)
                    {
                        db.Release.Add(r);
                    }
                    else
                    {
                        db.Release.AddOrUpdate(r);
                    }

                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                isSaved = false;
            }
            return(isSaved);
        }
Exemple #3
0
        public bool AddOrUpdate(BookingDestination bookingDestination)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    if (bookingDestination.BookingDestinationId == 0)
                    {
                        db.BookingDestination.Add(bookingDestination);
                    }
                    else
                    {
                        db.BookingDestination.AddOrUpdate(bookingDestination);
                    }

                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string message = ex.Message;
                    isSaved = false;
                }
            }
            return(isSaved);
        }
Exemple #4
0
        public bool AddOrUpdate(ReleaseOrderMinibooking releaseDetailMinibooking)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    rdm = releaseDetailMinibooking;

                    if (releaseDetailMinibooking.ReleaseOrderMinibookingId == 0)
                    {
                        db.ReleaseOrderMinibooking.Add(releaseDetailMinibooking);
                    }
                    else
                    {
                        db.ReleaseOrderMinibooking.AddOrUpdate(releaseDetailMinibooking);
                    }
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string msg = ex.Message + " - " + ex.InnerException.Message;
                    isSaved = false;
                }
            }

            return(isSaved);
        }
Exemple #5
0
        public bool Delete(string PortPassID)
        {
            bool isDelete = true;

            try
            {
                td = db.Truck_Drivers.Find(PortPassID);
                db.Truck_Drivers.Remove(td);
                db.SaveChanges();
            }
            catch (Exception)
            {
                isDelete = false;
            }
            return(isDelete);
        }
Exemple #6
0
        public bool AddOrUpdate(ReleaseOrder releaseDetail)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    rd = releaseDetail;
                    if (releaseDetail.ReleaseOrderId == 0)
                    {
                        db.ReleaseOrder.Add(rd);
                    }
                    else
                    {
                        db.ReleaseOrder.AddOrUpdate(rd);
                    }
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                    isSaved = false;
                }
            }
            return(isSaved);
        }
Exemple #7
0
        public bool AddOrUpdate(Booking booking, WTCCeresEntities db)
        {
            bool isSaved = true;

            b = booking;
            try
            {
                if (booking.BookingId == 0)
                {
                    db.Booking.Add(b);
                }
                else
                {
                    db.Booking.AddOrUpdate(b);
                }

                db.SaveChanges();
            }
            catch (Exception e)
            {
                string message = e.Message;
                isSaved = false;
            }

            return(isSaved);
        }
Exemple #8
0
        public bool AddOrUpdate(InboundRequest inboundRequest)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    if (inboundRequest.InboundRequestId == 0)
                    {
                        db.InboundRequest.Add(inboundRequest);
                    }
                    else
                    {
                        db.InboundRequest.AddOrUpdate(inboundRequest);
                    }

                    db.SaveChanges();
                    ir = inboundRequest;
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                    isSaved = false;
                }
            }
            return(isSaved);
        }
Exemple #9
0
        public bool Insert(string VesselName, string VesselOwner, string Manager, decimal Capacity, int VesselYear, string Flag, bool IsActiveVessel)
        {
            bool isSave = true;

            try
            {
                using (WTCCeresEntities d = new WTCCeresEntities())
                {
                    v.VesselName     = VesselName;
                    v.VesselOwner    = VesselOwner;
                    v.Manager        = Manager;
                    v.Capacity       = Capacity;
                    v.VesselYear     = VesselYear;
                    v.Flag           = Flag;
                    v.IsActiveVessel = IsActiveVessel;
                    d.Vessel.Add(v);
                    d.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                isSave = false;
            }
            return(isSave);
        }
Exemple #10
0
        public bool Delete(int MinibookingMiniUnitAssignmentId, bool IsStorageUnit)
        {
            bool isDeleted = true;

            try
            {
                using (WTCCeresEntities db = new WTCCeresEntities())
                {
                    if (IsStorageUnit == false)
                    {
                        bus = db.MinibookingMiniUnitAssignment.Find(MinibookingMiniUnitAssignmentId);
                        db.MinibookingMiniUnitAssignment.Remove(bus);
                    }
                    else
                    {
                        gima = db.GrainInvMinibookingAssignment.Find(MinibookingMiniUnitAssignmentId);
                        db.GrainInvMinibookingAssignment.Remove(gima);
                    }

                    db.SaveChanges();
                }
            }
            catch
            {
                isDeleted = false;
            }
            return(isDeleted);
        }
Exemple #11
0
        public bool AddOrUpdate(Company company, WTCCeresEntities db)
        {
            bool isSaved = true;

            try
            {
                if (company.CompanyId == 0)
                {
                    db.Company.Add(company);
                }
                else
                {
                    db.Company.AddOrUpdate(company);
                }
                db.SaveChanges();
                cp = company;
            }
            catch (Exception e)
            {
                string error = e.Message;
                isSaved = false;
            }

            return(isSaved);
        }
Exemple #12
0
        public bool UpdateBagLocation(int BagLocationId, int BagInventoryId, string LocationName, int StorageTypeId, int StorageId, int BagQuantity)
        {
            bool isSaved = true;

            try
            {
                using (WTCCeresEntities dbContext = new WTCCeresEntities())
                {
                    blt = dbContext.BagLocation.Find(BagLocationId);
                    blt.BagInventoryId = BagInventoryId;

                    blt.StorageId     = StorageId;
                    blt.LocationName  = LocationName;
                    blt.StorageTypeId = StorageTypeId;
                    blt.BagQuantity   = BagQuantity;

                    dbContext.BagLocation.AddOrUpdate(blt);
                    dbContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                isSaved = false;
            }

            return(isSaved);
        }
Exemple #13
0
        public bool UpdateGrainInvMinibookingAssignment(int GrainInvMinibookingAssignmentId, int MinibookingId, int GrainInvStorageLocationId, double QuantityAssigned, DateTime AssignedAt)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    gima = db.GrainInvMinibookingAssignment.Find(GrainInvMinibookingAssignmentId);
                    gima.MinibookingId             = MinibookingId;
                    gima.GrainInvStorageLocationId = GrainInvStorageLocationId;
                    gima.QuantityAssigned          = QuantityAssigned;
                    gima.AssignedAt = AssignedAt;

                    db.GrainInvMinibookingAssignment.AddOrUpdate(gima);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    var msg = e.Message;
                    isSaved = false;
                }
            }
            return(isSaved);
        }
Exemple #14
0
        public bool UpdateBagInventory(int BagInventoryId, int ShipperId, int BagId, int Quantity, DateTime StorageDate, bool ActiveBag)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    bi                 = db.BagInventory.Find(BagInventoryId);
                    bi.ShipperId       = ShipperId;
                    bi.BagId           = BagId;
                    bi.InitialQuantity = Quantity;

                    bi.StorageDate = StorageDate;
                    bi.ActiveBag   = ActiveBag;

                    db.BagInventory.AddOrUpdate(bi);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    isSaved = false;
                }
            }

            return(isSaved);
        }
Exemple #15
0
        public bool UpdateBag(int BagId, int BagSizeId, int BagWeightId, int ColorId, string ColorType, int BagLogoId, string BagDescription)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    var b = db.Bag.Find(BagId);
                    b.ColorId        = ColorId;
                    b.BagSizeId      = BagSizeId;
                    b.BagWeightId    = BagWeightId;
                    b.ColorType      = ColorType;
                    b.BagLogoId      = BagLogoId;
                    b.BagDescription = BagDescription;
                    db.Bag.AddOrUpdate(b);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    isSaved = false;
                }
                return(isSaved);
            }
        }
Exemple #16
0
        public bool InsertBagLocation(int BagInventoryId, string LocationName, int StorageTypeId, int StorageId, int BagQuantity)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    blt.BagInventoryId = BagInventoryId;
                    blt.StorageId      = StorageId;
                    blt.LocationName   = LocationName;
                    blt.StorageTypeId  = StorageTypeId;
                    blt.BagQuantity    = BagQuantity;

                    db.BagLocation.Add(blt);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    isSaved = false;
                }
            }

            return(isSaved);
        }
Exemple #17
0
        public bool Delete(int Id)
        {
            bool isDelete = true;

            try
            {
                ds = db.DocumentsStored.Find(Id);
                db.DocumentsStored.Remove(ds);
                db.SaveChanges();
            }
            catch (Exception)
            {
                isDelete = false;
            }
            return(isDelete);
        }
Exemple #18
0
        public bool Insert(int EmployeeId, string RecordModified, string ActionTaken, string ModuleName, string Detail)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    eal.EmployeeId     = EmployeeId;
                    eal.RecordModified = RecordModified;
                    eal.ActionTaken    = ActionTaken;
                    eal.ModuleName     = ModuleName;
                    eal.Detail         = Detail;
                    eal.CreatedAt      = DateTime.Now;
                    db.EmployeeActivityLog.Add(eal);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string message = ex.Message;
                    isSaved = false;
                }
            }

            return(isSaved);
        }
Exemple #19
0
        public bool Delete(int Id)
        {
            bool isDelete = true;

            try
            {
                dr = db.DrayageRate.Find(Id);
                db.DrayageRate.Remove(dr);
                db.SaveChanges();
            }
            catch (Exception)
            {
                isDelete = false;
            }
            return(isDelete);
        }
Exemple #20
0
        public bool Insert(string ContainerNumber, int OwnerId, int SSLineId, double TareWeight, double GrossMaxWeight, int ContainerSizeId,
                           string StressLevel, int YardLocationId)
        {
            bool isSaved = true;

            try
            {
                c.ContainerNumber = ContainerNumber;
                c.OwnerId         = OwnerId;
                c.SSLineId        = SSLineId;
                //c.TareWeight = TareWeight;
                //c.GrossMaxWeight = GrossMaxWeight;
                c.ContainerSizeId = ContainerSizeId;
                c.StressLevel     = StressLevel;
                // c.YardLocationId = YardLocationId;

                db.Container.Add(c);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                isSaved = false;
            }

            return(isSaved);
        }
Exemple #21
0
        public bool Delete(int Id)
        {
            bool isDeleted = true;

            try
            {
                cm = db.ContainerMinibooking.Find(Id);
                db.ContainerMinibooking.Remove(cm);
                db.SaveChanges();
            }
            catch
            {
                isDeleted = false;
            }
            return(isDeleted);
        }
Exemple #22
0
        public bool AddOrUpdate(UnitSource unitSource)
        {
            bool isSaved = true;

            try
            {
                using (WTCCeresEntities db = new WTCCeresEntities())
                {
                    if (unitSource.UnitSourceId == 0)
                    {
                        db.UnitSource.Add(unitSource);
                    }
                    else
                    {
                        db.UnitSource.AddOrUpdate(unitSource);
                    }

                    db.SaveChanges();
                    us = unitSource;
                }
            }
            catch (Exception ex)
            {
                isSaved = false;
            }
            return(isSaved);
        }
Exemple #23
0
        public bool InsertOrUpdate(MiniUnit MURecord)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    if (MURecord.MiniUnitId == 0)
                    {
                        db.MiniUnit.Add(MURecord);
                    }
                    else
                    {
                        db.MiniUnit.AddOrUpdate(MURecord);
                    }
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string message = ex.Message;
                    isSaved = false;
                }
            }
            return(isSaved);
        }
Exemple #24
0
        public bool Delete(int TruckDriverCompanyId)
        {
            bool isDelete = true;

            try
            {
                tdc = db.TruckDriverCompany.Find(TruckDriverCompanyId);
                db.TruckDriverCompany.Remove(tdc);
                db.SaveChanges();
            }
            catch (Exception)
            {
                isDelete = false;
            }
            return(isDelete);
        }
Exemple #25
0
        public bool Insert(string StorageTypeName)
        {
            bool isSaved = true;

            try
            {
                st.StorageTypeName = StorageTypeName;

                db.StorageType.Add(st);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                isSaved = false;
            }
            return(isSaved);
        }
Exemple #26
0
        public bool Update(int UnitSourceId, string UnitNumber, int UnitStatusId, string UnitType, int CargoTypeId, string OriginLocation, string UnitLine, DateTime ETADate,
                           string ETALocation, DateTime LatTraced, string LastLocation, string Sequence, string Track, int DemurageDays, int InTransitDays, DateTime BillDate,
                           DateTime CallDate, DateTime ArrivalDate, DateTime AvailableDate, DateTime ReleaseDate, float TotalBilled, DateTime LastUpdated, bool ActiveUpdates,
                           bool isActive, int RailListId, string CargoDescription, int ShipperId)
        {
            bool isSaved = true;

            try
            {
                using (WTCCeresEntities db = new WTCCeresEntities())
                {
                    DateTime minDate = new DateTime(0001, 1, 1);
                    if (UnitSourceId == 0)
                    {
                        us = new UnitSource();
                    }
                    else
                    {
                        us = db.UnitSource.Find(UnitSourceId);
                    }

                    us.UnitNumber       = UnitNumber;
                    us.UnitStatusId     = UnitStatusId;
                    us.UnitType         = UnitType;
                    us.CargoTypeId      = CargoTypeId;
                    us.OriginLocation   = OriginLocation;
                    us.UnitLine         = UnitLine;
                    us.ETALocation      = ETALocation;
                    us.Sequence         = Sequence;
                    us.Track            = Track;
                    us.DemurageDays     = DemurageDays;
                    us.InTransitDays    = InTransitDays;
                    us.TotalBilled      = TotalBilled;
                    us.LastUpdate       = LastUpdated;
                    us.ActiveUpdates    = ActiveUpdates;
                    us.Active           = isActive;
                    us.RecordKey        = RailListId;
                    us.CargoDescription = CargoDescription;
                    us.ShipperId        = ShipperId;

                    us.ETADate       = (minDate.Date == ETADate.Date) ? (DateTime?)null : ETADate;
                    us.BillDate      = (minDate.Date == BillDate.Date) ? (DateTime?)null : BillDate;
                    us.CallDate      = (minDate.Date == CallDate.Date) ? (DateTime?)null : CallDate;
                    us.AvailableDate = (minDate.Date == AvailableDate.Date) ? (DateTime?)null : AvailableDate;
                    us.ArrivalDate   = (minDate.Date == ArrivalDate.Date) ? (DateTime?)null : ArrivalDate;
                    us.ReleaseDate   = (minDate.Date == ReleaseDate.Date) ? (DateTime?)null : ReleaseDate;

                    db.UnitSource.AddOrUpdate(us);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                isSaved = false;
            }
            return(isSaved);
        }
Exemple #27
0
        public bool Insert(string PalletName, int YardLocationId)
        {
            bool isSaved = true;

            try
            {
                pl.PalletName     = PalletName;;
                pl.YardLocationId = YardLocationId;

                db.Pallet.Add(pl);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                isSaved = false;
            }
            return(isSaved);
        }
Exemple #28
0
        public bool Delete(int TimeSheetId)
        {
            bool isSaved = true;

            try
            {
                ts = db.TimeSheet.Find(TimeSheetId);
                db.TimeSheet.Remove(ts);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                var message = ex.Message;
                isSaved = false;
            }

            return(isSaved);
        }
Exemple #29
0
        public bool Insert(string CommodityCode, string CommodityName)
        {
            bool isSaved = true;

            try
            {
                var cm = new Commodity();
                cm.CommodityCode = CommodityCode;
                cm.CommodityName = CommodityName;

                db.Commodity.AddOrUpdate(cm);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                var message = ex.Message;
                isSaved = false;
            }

            return(isSaved);
        }
Exemple #30
0
        public bool Insert(string GradeCode, string GradeName)
        {
            bool isSaved = true;

            try
            {
                var gr = new Grade();
                gr.GradeCode = GradeCode;
                gr.GradeName = GradeName;

                db.Grade.AddOrUpdate(gr);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                var message = ex.Message;
                isSaved = false;
            }

            return(isSaved);
        }