Exemplo n.º 1
0
        public Result Update()
        {
            Result result = new Result();

            List <PassengerOrdersItinerariesBLL> PassengerOrdersItinerariesBLL = new PassengerOrdersItinerariesBLL().GetPassengerOrdersItinerariesByPassengerOrderID(this.PassengerOrderID);

            // validate i
            if (PassengerOrdersItinerariesBLL == null || PassengerOrdersItinerariesBLL.Count <= 0)
            {
                result            = new Result();
                result.Entity     = null;
                result.EnumType   = typeof(PassengerOrdersValidationEnum);
                result.EnumMember = PassengerOrdersValidationEnum.RejectedBecauseItineraryRequired.ToString();

                return(result);
            }


            List <PassengerOrdersEscortsBLL> PassengerOrdersEscortsBLL = new PassengerOrdersEscortsBLL().GetPassengerOrdersEscortsByPassengerOrderID(this.PassengerOrderID);

            // validate i
            if (DALInstance.PassengerOrdersEscorts != null && DALInstance.PassengerOrdersEscorts.Count > 4)
            {
                result.Entity     = null;
                result.EnumType   = typeof(PassengerOrdersValidationEnum);
                result.EnumMember = PassengerOrdersValidationEnum.RejectedBecauseMaxEscortMemberInOrdersIsFour.ToString();

                return(result);
            }
            //if (IsPassengerOrderAlreadyTook(DALInstance.EmployeeCareerHistoryID, DALInstance.PassengerOrderTypeID.Value))
            //{
            //    result.Entity = null;
            //    result.EnumType = typeof(PassengerOrdersValidationEnum);
            //    result.EnumMember = PassengerOrdersValidationEnum.RejectedBecausePassengerOrderAlreadyTook.ToString();

            //    return result;
            //}

            result = new Result();
            PassengerOrders PassengerOrder = DALInstance;

            PassengerOrder.LastUpdatedBy = this.LoginIdentity.EmployeeCodeID;
            this.PassengerOrderID        = new PassengerOrdersDAL().Update(PassengerOrder);
            if (this.PassengerOrderID != 0)
            {
                result.Entity     = this;
                result.EnumType   = typeof(PassengerOrdersValidationEnum);
                result.EnumMember = PassengerOrdersValidationEnum.Done.ToString();
            }
            return(result);
        }
Exemplo n.º 2
0
        public Result Add(PassengerOrdersEscortsBLL EscortBLL)
        {
            Result result = new Result();

            //// validate location already exists
            PassengerOrdersEscorts Escort = new PassengerOrdersEscortsDAL()
                                            .GetPassengerOrdersEscortsByPassengerOrderID(EscortBLL.PassengerOrder.PassengerOrderID)
                                            .Where(e => e.EscortName.ToUpper().Equals(EscortBLL.EscortName.ToUpper()) &&
                                                   e.EscortIDNo.ToUpper().Equals(EscortBLL.EscortIDNo.ToUpper()) &&
                                                   e.EscortAge.ToUpper().Equals(EscortBLL.EscortAge.ToUpper()) &&
                                                   e.EscortRelativeRelation.ToUpper().Equals(EscortBLL.EscortRelativeRelation.ToUpper())).FirstOrDefault();

            if (Escort != null)
            {
                result.Entity     = null;
                result.EnumType   = typeof(PassengerOrdersValidationEnum);
                result.EnumMember = PassengerOrdersValidationEnum.RejectedBecausePassengerOrderEscortAlreadyExist.ToString();

                return(result);
            }

            result = new Result();
            PassengerOrdersEscorts Obj = new PassengerOrdersEscorts()
            {
                PassengerOrderID       = EscortBLL.PassengerOrder.PassengerOrderID,
                EscortName             = EscortBLL.EscortName,
                EscortIDNo             = EscortBLL.EscortIDNo,
                EscortAge              = EscortBLL.EscortAge,
                EscortRelativeRelation = EscortBLL.EscortRelativeRelation,
                CreatedDate            = DateTime.Now,
            };

            this.PassengerOrdersEscortID = new PassengerOrdersEscortsDAL().Insert(Obj, EscortBLL.LoginIdentity.EmployeeCodeID);
            if (this.PassengerOrdersEscortID != 0)
            {
                result.Entity     = null;
                result.EnumType   = typeof(PassengerOrdersValidationEnum);
                result.EnumMember = PassengerOrdersValidationEnum.Done.ToString();
            }
            return(result);
        }