/// <summary>
 /// Save the ModelFactor.
 /// </summary>
 /// <param name="modelFactor"></param>
 public static void Save(ModelFactor modelFactor)
 {
     using (IdeaContext context = ContextManager.GetNewDataContext())
     {
         context.ModelFactors.AddOrUpdate(modelFactor);
         context.SaveChanges();
     }
 }
 /// <summary>
 /// Deletes a ModelFactor
 /// </summary>
 /// <param name="modelFactor"></param>
 public static void Delete(ModelFactor modelFactor)
 {
     using (IdeaContext context = ContextManager.GetNewDataContext())
     {
         ModelFactor f = (from o in context.ModelFactors where o.IDModelFactor == modelFactor.IDModelFactor select o).FirstOrDefault();
         context.ModelFactors.Remove(f);
         context.SaveChanges();
     }
 }
 /// <summary>
 /// Validates fields with parameter factor.
 /// </summary>
 /// <param name="factor"></param>
 /// <returns></returns>
 public static bool ValidateRequiredFields(ModelFactor factor)
 {
     if (factor.ScaleMin < 0)
     {
         throw new ArgumentException("FactorScaleMin");
     }
     if (factor.ScaleMax <= factor.ScaleMin)
     {
         throw new ArgumentException("FactorScaleMax");
     }
     if (factor.Interval <= 0)
     {
         throw new ArgumentException("FactorInterval");
     }
     return(true);
 }
Esempio n. 4
0
        private void LoadFactors(List <ModelFactor> list)
        {
            List <Factor> allFactors = FactorHelper.GetAll();

            flpFactors.Controls.Clear();
            foreach (Factor factor in allFactors)
            {
                FactorItem  control = new FactorItem();
                ModelFactor aux     = ModelFactorHelper.GetNew();
                aux.IDFactor = factor.IdFactor;
                aux.IDModel  = _model.IDModel;
                if (!factor.CumulativeFactor)
                {
                    aux.Interval = factor.Interval;
                    aux.ScaleMin = factor.ScaleMin;
                    aux.ScaleMax = factor.ScaleMax;
                    aux.Weight   = 100;
                }
                foreach (ModelFactor modelFactor in list)
                {
                    if (factor.IdFactor == modelFactor.IDFactor)
                    {
                        control.Checked = true;
                        if (factor.CumulativeFactor)
                        {
                            break;
                        }
                        aux.Interval = modelFactor.Interval;
                        aux.ScaleMin = modelFactor.ScaleMin;
                        aux.ScaleMax = modelFactor.ScaleMax;
                        aux.Weight   = modelFactor.Weight;
                        break;
                    }
                }
                control.Factor  = aux;
                control.Editing = _editing;
                flpFactors.Controls.Add(control);
            }
        }
 /// <summary>
 /// Returns the list a ModelFactorData by modelFactor (service).
 /// </summary>
 /// <param name="modelFactor"></param>
 /// <returns></returns>
 public static List <ModelFactorData> GetByModelFactor(ModelFactor modelFactor)
 {
     return(GetService().GetByModelFactor(modelFactor.IDModelFactor).ToList());
 }
Esempio n. 6
0
 /// <summary>
 /// Saves the ModelFactor (service).
 /// </summary>
 /// <param name="modelFactor"></param>
 public static void Save(ModelFactor modelFactor)
 {
     GetService().Save((modelFactor));
 }
Esempio n. 7
0
 /// <summary>
 /// Make a validation for Modelfactor (service).
 /// </summary>
 /// <param name="modelFactor"></param>
 /// <returns></returns>
 public static bool Validate(ModelFactor modelFactor)
 {
     return(GetService().Validate((modelFactor)));
 }
Esempio n. 8
0
 /// <summary>
 /// Deletes the ModelFactor
 /// </summary>
 /// <param name="modelFactor"></param>
 public static void Delete(ModelFactor modelFactor)
 {
     GetService().Delete(modelFactor);
 }
Esempio n. 9
0
 public void Delete(ModelFactor modelFactor)
 {
     ModelFactorManager.Delete(modelFactor);
 }
Esempio n. 10
0
 public void Save(ModelFactor modelFactor)
 {
     ModelFactorManager.Save((modelFactor));
 }
Esempio n. 11
0
 public bool Validate(ModelFactor modelFactor)
 {
     return(ModelFactorManager.ValidateRequiredFields((modelFactor)));
 }