Ejemplo n.º 1
0
 /// <summary>
 /// Add a new Criteria to the list of criterias which allow this treatment.
 /// </summary>
 /// <param name="criteria"></param>
 public void AddCriteria(Criterias criteria)
 {
     _criterias.Add(criteria);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads all feasibility criteria for this treatment in for this treatment ID.
        /// </summary>
        public bool LoadFeasibility()
        {
            String strSelect = "SELECT CRITERIA,BINARY_CRITERIA,FEASIBILITYID FROM " + cgOMS.Prefix + "FEASIBILITY WHERE TREATMENTID='" + this.TreatmentID + "'";

            _table  = cgOMS.Prefix + "FEASIBILITY";
            _column = "BINARY_CRITERIA";

            DataSet ds;

            try
            {
                ds = DBMgr.ExecuteQuery(strSelect);
            }
            catch (Exception exception)
            {
                SimulationMessaging.AddMessage(new SimulationMessage("Fatal Error: Opening Treatment FEASIBILITY table.  SQL Message - " + exception.Message));
                return(false);
            }


            foreach (DataRow row in ds.Tables[0].Rows)
            {
                _id = row["FEASIBILITYID"].ToString();
                Criterias criteria         = new Criterias(_table, _column, _id);
                byte[]    assemblyCriteria = null;
                string    currentCriteria  = "";
                if (row["CRITERIA"] != DBNull.Value)
                {
                    currentCriteria = Simulation.ConvertOMSAttribute(row["CRITERIA"].ToString());
                }
                assemblyCriteria = SimulationMessaging.GetSerializedCalculateEvaluate(_table, _column, _id, assemblyCriteria);
                if (assemblyCriteria != null && assemblyCriteria.Length > 0)
                {
                    criteria.Evaluate = (CalculateEvaluate.CalculateEvaluate)AssemblySerialize.DeSerializeObjectFromByteArray(assemblyCriteria);
                    if (criteria.Evaluate.OriginalInput != currentCriteria)
                    {
                        criteria.Evaluate = null;
                    }
                }

                if (criteria.Evaluate != null && criteria.Evaluate.m_cr != null)
                {
                    if (!File.Exists(criteria.Evaluate.m_cr.PathToAssembly))
                    {
                        criteria.Evaluate = null;
                    }
                }

                criteria.Criteria = Simulation.ConvertOMSAttribute(row["CRITERIA"].ToString());

                foreach (String str in criteria.Errors)
                {
                    SimulationMessaging.AddMessage(new SimulationMessage("Error: Treatment feasibility criteria for Treatment " + _treatment + ":" + str));
                }

                this.CriteriaList.Add(criteria);
                foreach (String str in criteria.CriteriaAttributes)
                {
                    if (!SimulationMessaging.IsAttribute(str))
                    {
                        SimulationMessaging.AddMessage(new SimulationMessage("Error: " + str + " which is used by the Feasibility criteria is not present in the database."));
                    }
                    if (!_attributes.Contains(str))
                    {
                        _attributes.Add(str);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 3
0
 public Costs(string ID)
 {
     _costID   = ID;
     _criteria = new Criterias(cgOMS.Prefix + "COSTS", "BINARY_CRITERIA", ID);
 }