Exemplo n.º 1
0
        //public void InitView(dtoSelectMethod method, Boolean disabled)
        //{
        //    BaseInitialize(method, disabled, (method., RatingType.simple);
        //}

        public void InitView(dtoSelectMethod method, dtoSelectRatingSet ratingSet, dtoItemWeightSettings objectSettings, Boolean disabled)
        {
            RatingType type = objectSettings.RatingType;

            if (type == RatingType.none)
            {
                type = RatingType.simple;
            }
            BaseInitialize(method, disabled, ratingSet, type, objectSettings.IdRatingValue, objectSettings.IdRatingValueEnd);
        }
Exemplo n.º 2
0
        public void InitView(long idMethod, dtoSelectRatingSet ratingSet, Boolean disabled)
        {
            dtoSelectMethod method = Service.MethodGetAvailable(idMethod, UserContext.Language.Id);

            BaseInitialize(method, disabled, ratingSet, RatingType.simple);
        }
Exemplo n.º 3
0
 private void BaseInitialize(dtoSelectMethod method, Boolean disabled, dtoSelectRatingSet ratingSet, RatingType type, long idRatingValue = -1, long idRatingValueEnd = -1)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         View.Disabled = disabled;
         View.IsFuzzy  = method.IsFuzzy;
         Dictionary <RatingType, String> translations = View.GetTranslations();
         View.IdMethod = method.Id;
         if (ratingSet == null)
         {
             View.IdRatingSet = 0;
         }
         else
         {
             View.IdRatingSet = ratingSet.Id;
         }
         List <dtoRatingType> types = new List <dtoRatingType>();
         if ((method.Rating & RatingType.simple) > 0)
         {
             types.Add(new dtoRatingType()
             {
                 Id = (int)RatingType.simple, Name = translations[RatingType.simple], Type = RatingType.simple
             });
             if (type == RatingType.simple)
             {
                 View.InitializeRating((idRatingValue > 0), RatingType.simple, ratingSet, idRatingValue);
             }
             else
             {
                 View.InitializeRating(false, RatingType.simple, ratingSet, -1);
             }
         }
         if ((method.Rating & RatingType.extended) > 0)
         {
             types.Add(new dtoRatingType()
             {
                 Id = (int)RatingType.extended, Name = translations[RatingType.extended], Type = RatingType.extended
             });
             if (type == RatingType.extended)
             {
                 View.InitializeRating((idRatingValue > 0), RatingType.extended, ratingSet, idRatingValue, idRatingValueEnd);
             }
             else
             {
                 View.InitializeRating(false, RatingType.extended, ratingSet, -1, -1);
             }
         }
         if ((method.Rating & RatingType.intermediateValues) > 0)
         {
             types.Add(new dtoRatingType()
             {
                 Id = (int)RatingType.intermediateValues, Name = translations[RatingType.intermediateValues], Type = RatingType.intermediateValues
             });
             if (type == RatingType.intermediateValues)
             {
                 View.InitializeRating((idRatingValue > 0), RatingType.intermediateValues, ratingSet, idRatingValue, idRatingValueEnd);
             }
             else
             {
                 View.InitializeRating(false, RatingType.intermediateValues, ratingSet, -1, -1);
             }
         }
         View.LoadAvailableRatings(types, type);
         if (ratingSet == null)
         {
             View.Disabled = true;
         }
     }
 }