Esempio n. 1
0
        public void  GetLatestActiveTruckWeight(string TruckPlateNo, string TrailerPlateNo)
        {
            TruckWeight obj = null;

            obj = TruckWeightDAL.GetLatestActiveTruckWeight(TruckPlateNo, TrailerPlateNo);
            if (obj != null)
            {
                this.Id             = obj.Id;
                this.TruckPlateNo   = obj.TruckPlateNo;
                this.TrailerPlateNo = obj.TrailerPlateNo;
                this.hasTrailer     = obj.hasTrailer;
                this.DateWeighed    = obj.DateWeighed;
                this.Weight         = obj.Weight;
                this.Status         = obj.Status;
            }
        }
Esempio n. 2
0
        public bool SaveNew()
        {
            bool isSaved = false;

            this.CreatedBy = UserBLL.GetCurrentUser();
            if ((string.IsNullOrEmpty(this.TruckPlateNo) != true) && (string.IsNullOrEmpty(this.TrailerPlateNo) == true))
            {
                this.hasTrailer = TruckHasTrailerType.TruckOnly;
            }
            else if ((string.IsNullOrEmpty(this.TruckPlateNo) == true) && (string.IsNullOrEmpty(this.TrailerPlateNo) != true))
            {
                this.hasTrailer = TruckHasTrailerType.TrailerOnly;
            }
            else if ((string.IsNullOrEmpty(this.TruckPlateNo) != true) && (string.IsNullOrEmpty(this.TrailerPlateNo) != true))
            {
                this.hasTrailer = TruckHasTrailerType.TruckTrailer;
            }
            else if ((string.IsNullOrEmpty(this.TruckPlateNo) == true) && (string.IsNullOrEmpty(this.TrailerPlateNo) == true))
            {
                throw new Exception("Truck Plate No. And Trailer Plate No. Are Both Empty");
            }
            this.Status = TruckWeightStatus.Active;

            //THE FOLLOWING METHOD ADDED BY SINISHAW
            isSaved = TruckWeightDAL.InsertNew(this);

            AuditTrailBLL objAt = new AuditTrailBLL();
            int           at    = -1;

            if (isSaved == true)
            {
                at = objAt.saveAuditTrail(this, WFStepsName.RegisterTruckWeight.ToString(), UserBLL.GetCurrentUser(), "Scaling Information");
                if (at == 1)
                {
                    isSaved = true;
                }
                else
                {
                    isSaved = false;
                }
            }
            return(isSaved);
        }