public bool GetProperties(object displayObject, Entities.TourCostRuleConstraint con)
        {
            Entities.ConstraintTourTime time = (Entities.ConstraintTourTime)displayObject;
            con.Properties.Clear();

            Entities.TourCostRuleConstraintProperty property;

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.StartHour;
            property.Value  = time.StartTime.Hour;
            con.Properties.Add(property);

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.StartMinute;
            property.Value  = time.StartTime.Minute;
            con.Properties.Add(property);

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.EndHour;
            property.Value  = time.EndTime.Hour;
            con.Properties.Add(property);

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.EndMinute;
            property.Value  = time.EndTime.Minute;
            con.Properties.Add(property);

            con.Name = GenerateName(time);

            return(true);

            return(false);
        }
        internal bool Update(Entities.TourCostRuleConstraint constraint, Entities.TourCostRuleConstraintProperty property)
        {
            bool res = false;

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

                this.query.Parameters.Add(new SqlParameter("@ConstraintId", constraint.Id));
                this.query.Parameters.Add(new SqlParameter("@PropertyTypeId", property.TypeId));
                this.query.Parameters.Add(new SqlParameter("@PropertyValue", property.Value));
                this.query.Parameters.Add(new SqlParameter("@PropertyId", property.Id));


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

            return(res);
        }
        protected void MapCostToObject(SqlDataReader reader, object userData)
        {
            Entities.TourCostRuleConstraintProperty prop = new
                                                           Entities.TourCostRuleConstraintProperty();

            prop.Id      = Utils.GetSafeInt32(reader, "PropertyId");
            prop.TypeId  = Utils.GetSafeInt32(reader, "PropertyTypeId");
            prop.Value   = Utils.GetSafeInt32(reader, "PropertyValue");
            prop.IsDirty = false;

            Entities.TourCostRuleConstraint Constraint = (Entities.TourCostRuleConstraint)userData;
            Constraint.Properties.Add(prop);
        }
示例#4
0
        public bool GetProperties(object displayObject, Entities.TourCostRuleConstraint con)
        {
            Entities.ConstraintTourDate date = (Entities.ConstraintTourDate)displayObject;
            con.Properties.Clear();

            Entities.TourCostRuleConstraintProperty property;

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.StartYear;
            property.Value  = date.StartDate.Year;
            con.Properties.Add(property);

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.StartMonth;
            property.Value  = date.StartDate.Month;
            con.Properties.Add(property);

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.StartDay;
            property.Value  = date.StartDate.Day;
            con.Properties.Add(property);

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.EndYear;
            property.Value  = date.EndDate.Year;
            con.Properties.Add(property);

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.EndMonth;
            property.Value  = date.EndDate.Month;
            con.Properties.Add(property);

            property        = new Entities.TourCostRuleConstraintProperty();
            property.TypeId = (int)TypeIds.EndDay;
            property.Value  = date.EndDate.Day;
            con.Properties.Add(property);

            con.Name = GenerateName(date);

            return(true);

            return(false);
        }