Example #1
0
        internal bool Update(Entities.TourServiceBase service, Entities.TourCostDetail cost)
        {
            bool res = false;

            try
            {
                this.query.Parameters.Clear();

                this.query.Parameters.Add(new SqlParameter("@GroupServiceId", service.Id));
                this.query.Parameters.Add(new SqlParameter("@CostGroupId", cost.CostGroup.Id));
                this.query.Parameters.Add(new SqlParameter("@SignUpCount", cost.SignUpCount));
                this.query.Parameters.Add(new SqlParameter("@ParticipantsCount", cost.ParticipantsCount));
                this.query.Parameters.Add(new SqlParameter("@CostId", cost.Id));

                int affected;
                res = this.query.ExecuteUpdateProc("TourGroupServiceCostUpdateById", out affected);
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }

            return(res);
        }
Example #2
0
        protected void MapCostToObject(SqlDataReader reader, object userData)
        {
            Entities.TourCostDetail cost = new Entities.TourCostDetail();

            cost.Id                = Utils.GetSafeInt32(reader, "CostId");
            cost.SignUpCount       = Utils.GetSafeInt32(reader, "SignUpCount");
            cost.ParticipantsCount = Utils.GetSafeInt32(reader, "ParticipantCount");
            cost.CostGroup         = DomainModel.TourCostGroups.GetById(
                Utils.GetSafeInt32(reader, "CostGroupId"));
            cost.IsDirty = false;

            Entities.Tour tour = (Entities.Tour)userData;
            //tour.CostDetails.Add(cost);
        }
Example #3
0
        internal bool Update(Entities.Tour tour, Entities.TourCostDetail cost)
        {
            bool res = false;

            try
            {
                if (cost.Id < 0)
                {
                    DomainModel.Application.Status.Update(
                        StatusTypes.Warning,
                        "stat_wrn_db_id_not_exists");
                    return(true);
                }

                this.query.Parameters.Clear();

                this.query.Parameters.Add(new SqlParameter("@SignUpCount", cost.SignUpCount));
                this.query.Parameters.Add(new SqlParameter("@ParticipantCount", cost.ParticipantsCount));
                this.query.Parameters.Add(new SqlParameter("@CostGroupId", cost.CostGroup.Id));
                this.query.Parameters.Add(new SqlParameter("@CostId", cost.Id));
                this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id));


                int affected;
                res = this.query.ExecuteUpdateProc("TourCostUpdateById", out affected);
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }

            return(res);
        }
        public bool Matches(Entities.Tour tour, ITourService service, Entities.TourCostDetail detail, Entities.TourCostRuleConstraint constraint)
        {
            bool res = false;

            Entities.ConstraintTourTime time =
                (Entities.ConstraintTourTime) this.mapper.GetDisplayObject(constraint.Properties);

            if (time != null)
            {
                if (time.StartTime.Hour >= 0)
                {
                    if (tour.Time.Time.Hour < time.StartTime.Hour)
                    {
                        // Hour value of tour is
                        // less than min of the rule
                        return(res);
                    }
                    else if (tour.Time.Time.Hour == time.StartTime.Hour)
                    {
                        if (time.StartTime.Minute >= 0 &&
                            time.StartTime.Minute > tour.Time.Time.Minute)
                        {
                            // hours value are equal but
                            // minutes value of tour is
                            // less than min of rule
                            return(res);
                        }
                    }
                }
                else if (time.StartTime.Minute >= 0)
                {
                    if (time.StartTime.Minute > tour.Time.Time.Minute)
                    {
                        // hours value are equal but
                        // minutes value of tour is
                        // less than min of rule
                        return(res);
                    }
                }

                if (time.EndTime.Hour >= 0)
                {
                    if (tour.Time.Time.Hour > time.EndTime.Hour)
                    {
                        // Hour value of tour is
                        // after max of the rule
                        return(res);
                    }
                    else if (tour.Time.Time.Hour == time.EndTime.Hour)
                    {
                        if (time.EndTime.Minute >= 0 &&
                            time.EndTime.Minute > tour.Time.Time.Minute)
                        {
                            // hours value are equal but
                            // minutes value of tour is
                            // less than min of rule
                            return(res);
                        }
                    }
                }
                else if (time.EndTime.Minute >= 0)
                {
                    if (time.EndTime.Minute > tour.Time.Time.Minute)
                    {
                        // hours value are equal but
                        // minutes value of tour is
                        // less than min of rule
                        return(res);
                    }
                }

                res = true;
            }

            return(res);
        }
        public bool Matches(Entities.Tour tour, ITourService service, Entities.TourCostDetail detail, Entities.TourCostRuleConstraint constraint)
        {
            bool res = false;

            Entities.ConstraintTourDate date =
                (Entities.ConstraintTourDate) this.mapper.GetDisplayObject(constraint.Properties);

            if (date != null)
            {
                if (date.StartDate.Year >= 0)
                {
                    if (tour.Time.Date.Year < date.StartDate.Year)
                    {
                        // Hour value of tour is
                        // less than min of the rule
                        return(res);
                    }
                    else if (tour.Time.Date.Year == date.StartDate.Year)
                    {
                        if (date.StartDate.Month >= 0)
                        {
                            if (date.StartDate.Month > tour.Time.Date.Month)
                            {
                                return(res);
                            }
                            else if (date.StartDate.Month == tour.Time.Date.Month)
                            {
                                if (date.StartDate.Day >= 0 &&
                                    date.StartDate.Day > tour.Time.Date.Day)
                                {
                                    return(res);
                                }
                            }/*
                              * else if (date.StartDate.Day >= 0 &&
                              *     date.StartDate.Day > tour.Time.Date.Day)
                              * {
                              * return res;
                              * }*/
                        }
                        else if (date.StartDate.Day >= 0 &&
                                 date.StartDate.Day > tour.Time.Date.Day)
                        {
                            return(res);
                        }
                    }
                }
                else if (date.StartDate.Month >= 0)
                {
                    if (date.StartDate.Month > tour.Time.Date.Month)
                    {
                        return(res);
                    }
                    else if (date.StartDate.Month == tour.Time.Date.Month)
                    {
                        if (date.StartDate.Day >= 0 &&
                            date.StartDate.Day > tour.Time.Date.Day)
                        {
                            return(res);
                        }
                    }
                }
                else if (date.StartDate.Day >= 0 &&
                         date.StartDate.Day > tour.Time.Date.Day)
                {
                    return(res);
                }


                if (date.EndDate.Year >= 0)
                {
                    if (tour.Time.Date.Year > date.EndDate.Year)
                    {
                        return(res);
                    }
                    else if (tour.Time.Date.Year == date.EndDate.Year)
                    {
                        if (date.EndDate.Month >= 0)
                        {
                            if (date.EndDate.Month < tour.Time.Date.Month)
                            {
                                return(res);
                            }
                            else if (date.EndDate.Month == tour.Time.Date.Month)
                            {
                                if (date.EndDate.Day >= 0 &&
                                    date.EndDate.Day < tour.Time.Date.Day)
                                {
                                    return(res);
                                }
                            }
                        }
                        else if (date.EndDate.Day >= 0 &&
                                 date.EndDate.Day < tour.Time.Date.Day)
                        {
                            return(res);
                        }
                    }
                }
                else if (date.EndDate.Month >= 0)
                {
                    if (date.EndDate.Month < tour.Time.Date.Month)
                    {
                        return(res);
                    }
                    else if (date.EndDate.Month == tour.Time.Date.Month)
                    {
                        if (date.EndDate.Day >= 0 &&
                            date.EndDate.Day < tour.Time.Date.Day)
                        {
                            return(res);
                        }
                    }
                }
                else if (date.EndDate.Day >= 0 &&
                         date.EndDate.Day < tour.Time.Date.Day)
                {
                    return(res);
                }

                res = true;
            }

            return(res);
        }