Exemple #1
0
        public System.Data.DataTable QueryV_HKListPager(out string resultMsg, out int recordCount, out int TotalPages, Criterias.CustomsCriterias.CriteriaNuclearButton criteria, int pageSize = 10, int pageIndex = 1)
        {
            recordCount = 0;
            TotalPages = 0;
            resultMsg = string.Empty;
            DataSet data = new DataSet();
            DataTable dt = new DataTable();
            try
            {
                //存储过程名称
                string sql = "usp_v_hk_select_pager";
                //参数添加
                IList<DBParameter> parm = new List<DBParameter>();
                parm.Add(new DBParameter() { ParameterName = "CargoTypeTest", ParameterValue = criteria.CargoTypeTest, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "CustomerName", ParameterValue = criteria.CustomerName, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "OrderNumber", ParameterValue = criteria.OrderNumber, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "WayOut", ParameterValue = criteria.WayOut, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "PlateNum", ParameterValue = criteria.PlateNum, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "NoDeclaration", ParameterValue = criteria.NoDeclaration, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "ApprovalStatus", ParameterValue = criteria.ApprovalStatus, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "WayOutStartTime", ParameterValue = criteria.WayOutStartTime, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "WayOutEndTime", ParameterValue = criteria.WayOutEndTime, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "CustomsCode", ParameterValue = criteria.CustomsCode, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "CustomerOrderNumber", ParameterValue = criteria.CustomerOrderNumber, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "NuclearButtonNumber", ParameterValue = criteria.NuclearButtonNumber, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "ContainerNumber", ParameterValue = criteria.ContainerNumber, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "PagerIndex", ParameterValue = pageIndex, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Int32 });
                parm.Add(new DBParameter() { ParameterName = "PagerSize", ParameterValue = pageSize, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Int32 });
                parm.Add(new DBParameter() { ParameterName = "RowCount", ParameterInOut = BaseDict.ParmOut, ParameterType = DbType.Int32 });
                parm.Add(new DBParameter() { ParameterName = "TotalPages", ParameterInOut = BaseDict.ParmOut, ParameterType = DbType.Int32 });
                //查询执行
                using (data = DBHelper.ExecuteDataSet(sql, isStoredProc: true, parm: parm))
                {
                    foreach (var item in parm)
                    {
                        //获取输出参数值
                        if (item.ParameterName == "RowCount")
                        {
                            int.TryParse(item.ParameterValue.ToString(), out recordCount);
                        }

                        if (item.ParameterName == "TotalPages")
                        {
                            int.TryParse(item.ParameterValue.ToString(), out TotalPages);
                        }
                    }
                }
                if (data != null && data.Tables.Count > 0)
                {
                    dt = data.Tables[0];
                }
            }
            catch (Exception ex)
            {
                resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString());
            }
            return dt;
        }
Exemple #2
0
        public ActionResult Search(SearchModel model)
        {
            int totalservice = 0;

            using (InhCheckupDataContext cdc = new InhCheckupDataContext())
            {
                totalservice = cdc.vw_patient_corporates
                               .Where(x => (x.companyname == null ? "" : x.companyname) == (model.companyname == null ? "" : model.companyname) &&
                                      x.arrived_date.Value.Date >= model.startdate.Date &&
                                      x.arrived_date.Value.Date <= model.enddate.Date)
                               .Count();
                model.totalservice = totalservice;
            }
            try
            {
                if (model.func == SearchModel.functionCriterias.funcSearch)
                {
                    using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                    {
                        model.dataListCompany = getListCorp();
                        using (DBToDoList.InhToDoListDataContext itc = new DBToDoList.InhToDoListDataContext())
                        {
                            string sub_com = "";
                            if (!string.IsNullOrEmpty(model.companyname))
                            {
                                var doc_no = (from itd in itc.index_trn_company_details
                                              join tcd in itc.trn_company_details
                                              on itd.tcd_id equals tcd.tcd_id
                                              where tcd.tcd_tname == model.companyname
                                              select itd.tcd_document_no).FirstOrDefault();

                                sub_com = (from tcd in itc.trn_company_details
                                           join itd in itc.index_trn_company_details
                                           on tcd.tcd_id equals itd.tcd_id
                                           where tcd.tcd_document_no == doc_no
                                           select tcd.tcd_legal).FirstOrDefault();

                                model.sub_companyname = sub_com;

                                if (!string.IsNullOrEmpty(doc_no))
                                {
                                    List <patient> pt = cdc.trn_patient_book_covers
                                                        .Where(x => x.tcd_document_no == doc_no && x.trn_patient_regi.tpr_arrive_date.Value.Date >= model.startdate.Date &&
                                                               x.trn_patient_regi.tpr_arrive_date.Value.Date <= model.enddate.Date)
                                                        .Select(x => new patient
                                    {
                                        hn   = x.trn_patient_regi.trn_patient.tpt_hn_no,
                                        en   = x.trn_patient_regi.tpr_en_no,
                                        id   = x.trn_patient_regi.trn_patient_book_cover.tpbc_emp_id,
                                        name = x.trn_patient_regi.trn_patient.tpt_othername,
                                        // arrived = x.trn_patient_regi.trn_patient_regis_detail.tpr_real_arrived_date.Value
                                        arrived = cdc.GetArrivedate(x.tpr_id).Value
                                    }).OrderBy(x => x.arrived).ToList();



                                    model.listPatient     = pt;
                                    model.patients        = pt.Count();
                                    model.sub_companyname = sub_com;
                                }
                                else
                                {
                                    model.listPatient     = new List <patient>();
                                    model.patients        = model.listPatient.Count();
                                    model.sub_companyname = sub_com;
                                }
                            }
                            else
                            {
                                model.listPatient     = new List <patient>();
                                model.patients        = model.listPatient.Count();
                                model.sub_companyname = sub_com;
                            }

                            //List<patient> pt = cdc.vw_patient_corporates
                            //                      .Where(x => (x.companyname == null ? "" : x.companyname) == (model.companyname == null ? "" : model.companyname) &&
                            //                                  x.arrived_date.Value.Date >= model.startdate.Date &&
                            //                                  x.arrived_date.Value.Date <= model.enddate.Date)
                            //                      .Select(x => new patient
                            //                      {
                            //                          hn = x.hn,
                            //                          en = x.en,
                            //                          name = x.patient_name,
                            //                          arrived = x.arrived_date.Value
                            //                      }).ToList();
                            //model.listPatient = pt;
                        }
                    }
                }
                else
                {
                    Criterias cModel = new Criterias
                    {
                        companyname     = model.companyname,
                        startdate       = model.startdate,
                        enddate         = model.enddate,
                        patients        = model.patients,
                        totalservice    = model.totalservice,
                        sub_companyname = model.sub_companyname
                    };
                    return(SelectReport(model));
                }
            }
            catch
            {
            }
            return(View("Search", model));
        }
        /// <summary>
        /// Updates summary when necessary
        /// </summary>
        private void UpdateSummaryValues()
        {
            if (!m_bChange)
            {
                return;
            }
            labelError.Visible = false;
            String strTreatment = dgvSummary[1, 1].Value.ToString();


            if (strTreatment == m_strCurrentTreatment)
            {
                dgvSummary[1, 2].Value = m_strCurrentBudget;
                dgvSummary[1, 3].Value = m_strCurrentCost;
                dgvSummary[1, 4].Value = m_strCurrentAny;
                dgvSummary[1, 5].Value = m_strCurrentSame;

                dgvAttribute.Rows.Clear();
                foreach (String key in m_hashCurrentChange.Keys)
                {
                    int nRow = dgvAttribute.Rows.Add(key, m_hashCurrentChange[key]);
                }
            }
            else if (m_listFeasibleTreatment.Contains(strTreatment))
            {
                double dArea     = 0;
                String strSelect = "SELECT AREA FROM " + this.ReportTable + " WHERE SECTIONID ='" + this.SectionID + "' AND YEARS='" + this.Year + "'";
                try
                {
                    DataSet ds = DBMgr.ExecuteQuery(strSelect);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        DataRow dr = ds.Tables[0].Rows[0];
                        dArea = double.Parse(dr["AREA"].ToString());
                    }
                }
                catch (Exception exception)
                {
                    labelError.Visible = true;
                    labelError.Text    = "Error retrieving AREA." + exception.Message;
                }


                strSelect = "SELECT BUDGET,YEARSANY,YEARSSAME,COST_,CHANGEHASH FROM " + this.BenefitCostTable + " WHERE SECTIONID ='" + this.SectionID + "' AND YEARS='" + this.Year + "' AND TREATMENT='" + strTreatment + "'";
                try
                {
                    DataSet ds = DBMgr.ExecuteQuery(strSelect);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DataRow dr     = ds.Tables[0].Rows[0];
                        double  dCost  = double.Parse(dr["COST_"].ToString()) * dArea * inflationRate;
                        string  budget = dr["BUDGET"].ToString();
                        if (!budget.Contains("|"))
                        {
                            dgvSummary[1, 2].Value = budget;
                        }

                        dgvSummary[1, 3].Value = Math.Round(dCost, 2).ToString("c");
                        dgvSummary[1, 4].Value = dr["YEARSANY"].ToString();
                        dgvSummary[1, 5].Value = dr["YEARSSAME"].ToString();
                        String strChangeHash = dr["CHANGEHASH"].ToString();

                        dgvAttribute.Rows.Clear();
                        string[] pairs = strChangeHash.Split(new string[] { "\n" }, StringSplitOptions.None);
                        for (int i = 0; i < pairs.Length; i++)
                        {
                            if (pairs[i].Contains("\t"))
                            {
                                string[] attributechange = pairs[i].Split(new string[] { "\t" }, StringSplitOptions.None);
                                dgvAttribute.Rows.Add(attributechange[0], attributechange[1]);
                            }
                        }
                    }
                }
                catch (Exception exception)
                {
                    labelError.Visible = true;
                    labelError.Text    = "Error: Retrieving default information from the BENEFIT_COST table." + exception.Message;
                }
            }
            else if (m_listTreatments.Contains(strTreatment))
            {
                //Fill with default from Treatment table
                String strSelect      = "SELECT BUDGET, BEFOREANY, BEFORESAME, TREATMENTID FROM TREATMENTS WHERE SIMULATIONID ='" + this.SimulationID + "' AND TREATMENT='" + strTreatment + "'";
                String strTreatmentID = "";
                try
                {
                    DataSet ds = DBMgr.ExecuteQuery(strSelect);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        DataRow dr = ds.Tables[0].Rows[0];
                        dgvSummary[1, 2].Value = dr["BUDGET"].ToString();
                        dgvSummary[1, 4].Value = dr["BEFOREANY"].ToString();
                        dgvSummary[1, 5].Value = dr["BEFORESAME"].ToString();
                        strTreatmentID         = dr["TREATMENTID"].ToString();
                    }
                }
                catch (Exception exception)
                {
                    labelError.Visible = true;
                    labelError.Text    = "Error: Retrieving default information from the TREATMENTS table." + exception.Message;
                }

                //Get Cost information
                String strCost = "0";
                //strSelect = "SELECT COST_ FROM COSTS WHERE TREATMENTID='" + strTreatmentID + "' AND CRITERIA=''";
                //inserting '' in oracle inserts a null
                // TODO: Why not pull the criteria for each cost equation found, and calculate the cost for each and show them in a cost dropdown.
                strSelect = "SELECT COST_,CRITERIA FROM COSTS WHERE TREATMENTID='" + strTreatmentID + "'";
                try
                {
                    DataSet ds = DBMgr.ExecuteQuery(strSelect);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        DataRow dr       = ds.Tables[0].Rows[0];
                        var     cost     = dr["COST_"];
                        var     criteria = dr["CRITERIA"];


                        if (criteria == DBNull.Value)
                        {
                            strCost = dr["COST_"].ToString();
                        }
                        else
                        {
                            var criteriaString = criteria.ToString();
                            if (String.IsNullOrWhiteSpace(criteriaString))
                            {
                                strCost = dr["COST_"].ToString();
                            }
                            else
                            {
                                var criteriaToEvaluate = new Criterias();
                                criteriaToEvaluate.Criteria = criteriaString;
                                if (criteriaToEvaluate.IsCriteriaMet(m_hashAttributeValue))
                                {
                                    strCost = dr["COST_"].ToString();
                                }
                            }
                        }
                        strCost = dr["COST_"].ToString();
                    }
                }
                catch (Exception exception)
                {
                    labelError.Visible = true;
                    labelError.Text    = "Error: Retrieving default COST information from the COSTS table." + exception.Message;
                }
                List <String> listError;
                List <String> listAttributesEquation          = Global.TryParseAttribute(strCost, out listError);  // See if listAttributeEquations is included in dgvDefault
                CalculateEvaluate.CalculateEvaluate calculate = new CalculateEvaluate.CalculateEvaluate();
                calculate.BuildTemporaryClass(strCost, true);
                CompilerResults m_crEquation = calculate.CompileAssembly();

                object[] input = new object[listAttributesEquation.Count];
                int      i     = 0;
                foreach (String attribute in listAttributesEquation)
                {
                    input[i] = m_hashAttributeValue[attribute];
                    i++;
                }
                try
                {
                    object result = calculate.RunMethod(input);
                    dgvSummary[1, 3].Value = result.ToString();
                }
                catch (Exception exc)
                {
                    Global.WriteOutput("Error running single section. " + exc.Message);
                }


                //strSelect = "SELECT ATTRIBUTE_,CHANGE_ FROM CONSEQUENCES WHERE TREATMENTID='" + strTreatmentID + "' AND CRITERIA=''";
                //inserting '' in oracle inserts a null
                strSelect = "SELECT ATTRIBUTE_,CHANGE_, CRITERIA FROM CONSEQUENCES WHERE TREATMENTID='" + strTreatmentID + "'";
                dgvAttribute.Rows.Clear();
                try
                {
                    DataSet ds = DBMgr.ExecuteQuery(strSelect);
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        var attribute = dr["ATTRIBUTE_"];
                        var change    = dr["CHANGE_"];
                        var criteria  = dr["CRITERIA"];

                        if (criteria == DBNull.Value)
                        {
                            dgvAttribute.Rows.Add(dr["ATTRIBUTE_"].ToString(), dr["CHANGE_"].ToString());
                        }
                        else
                        {
                            var criteriaString = criteria.ToString();
                            if (String.IsNullOrWhiteSpace(criteriaString))
                            {
                                dgvAttribute.Rows.Add(dr["ATTRIBUTE_"].ToString(), dr["CHANGE_"].ToString());
                            }
                            else
                            {
                                var criteriaToEvaluate = new Criterias();
                                criteriaToEvaluate.Criteria = criteriaString;
                                if (criteriaToEvaluate.IsCriteriaMet(m_hashAttributeValue))
                                {
                                    dgvAttribute.Rows.Add(dr["ATTRIBUTE_"].ToString(), dr["CHANGE_"].ToString());
                                }
                            }
                        }
                    }
                }
                catch (Exception exception)
                {
                    labelError.Visible = true;
                    labelError.Text    = "Error: Loading Consequences for selected TREATMENT. " + exception.Message;
                }
            }
            else
            {
                //User defined treatment.  Leave existing as is.
            }
            dgvSummary.Update();
            dgvAttribute.Update();
        }
 public static Criteria <Item> equal_to <Item, Property>(this IProvideAccessToMatchBuilders <Item, Property> extension_point, Property value)
 {
     return(create_using(extension_point, Criterias.equal_to(value)));
 }
 /// <summary>
 ///
 /// </summary>
 private void SaveBinary()
 {
     try
     {
         Criterias     cris = RunReport.cs;
         SqlConnection conn = null;
         List <string> list = new List <string>();
         try
         {
             conn = new
                    SqlConnection(ConfigurationManager.ConnectionStrings["conRsTool"].ConnectionString.ToString());
             conn.Open();
             SqlCommand cmd = new SqlCommand("FT_Reports_Ins", conn);
             cmd.CommandType = CommandType.StoredProcedure;
             for (int j = 0; j < cris.CriteriaN[0].CriteriaName.Count; j++)
             {
                 for (int k = 0; k < cris.CriteriaN[1].CriteriaName.Count; k++)
                 {
                     for (int l = 0; l < cris.CriteriaN[2].CriteriaName.Count; l++)
                     {
                         for (int m = 0; m < cris.CriteriaN[3].CriteriaName.Count; m++)
                         {
                             for (int n = 0; n < cris.CriteriaN[4].CriteriaName.Count; n++)
                             {
                                 if (!ft.CheckFileExist(cris.CriteriaN[0].CriteriaName[j], cris.CriteriaN[0].CriteriaValue[j], cris.CriteriaN[1].CriteriaName[k], cris.CriteriaN[1].CriteriaValue[k], cris.CriteriaN[2].CriteriaName[l], cris.CriteriaN[2].CriteriaValue[l], cris.CriteriaN[3].CriteriaName[m], cris.CriteriaN[3].CriteriaValue[m], cris.CriteriaN[4].CriteriaName[n], cris.CriteriaN[4].CriteriaValue[n], cris.TemplatePath))
                                 {
                                     cmd.Parameters.Add(new SqlParameter("@Criteria1", cris.CriteriaN[0].CriteriaName[j]));
                                     cmd.Parameters.Add(new SqlParameter("@Value1", cris.CriteriaN[0].CriteriaValue[j]));
                                     cmd.Parameters.Add(new SqlParameter("@Criteria2", cris.CriteriaN[1].CriteriaName[k]));
                                     cmd.Parameters.Add(new SqlParameter("@Value2", cris.CriteriaN[1].CriteriaValue[k]));
                                     cmd.Parameters.Add(new SqlParameter("@Criteria3", cris.CriteriaN[2].CriteriaName[l]));
                                     cmd.Parameters.Add(new SqlParameter("@Value3", cris.CriteriaN[2].CriteriaValue[l]));
                                     cmd.Parameters.Add(new SqlParameter("@Criteria4", cris.CriteriaN[3].CriteriaName[m]));
                                     cmd.Parameters.Add(new SqlParameter("@Value4", cris.CriteriaN[3].CriteriaValue[m]));
                                     cmd.Parameters.Add(new SqlParameter("@Criteria5", cris.CriteriaN[4].CriteriaName[n]));
                                     cmd.Parameters.Add(new SqlParameter("@Value5", cris.CriteriaN[4].CriteriaValue[n]));
                                     cmd.Parameters.Add(new SqlParameter("@TemplateName", Path.GetFileNameWithoutExtension(cris.TemplatePath)));
                                     cmd.Parameters.Add(new SqlParameter("@Data", ft.GetData(cris.TemplatePath)));
                                     cmd.Parameters.Add(new SqlParameter("@DataType", Path.GetExtension(cris.TemplatePath)));
                                     cmd.Parameters.Add(new SqlParameter("@PDFData", ft.GetData("")));
                                     cmd.Parameters.Add(new SqlParameter("@XMLData", ""));
                                     cmd.Parameters.Add(new SqlParameter("@TemplatePath", cris.TemplatePath));
                                     cmd.ExecuteNonQuery();
                                     cmd.Parameters.Clear();
                                 }
                                 else
                                 {
                                     list.Add(cris.CriteriaN[0].CriteriaName[j] + " " + cris.CriteriaN[0].CriteriaValue[j] + " " + cris.CriteriaN[1].CriteriaName[k] + " " + cris.CriteriaN[1].CriteriaValue[k] + " " + cris.CriteriaN[2].CriteriaName[l] + " " + cris.CriteriaN[2].CriteriaValue[l] + " " + cris.CriteriaN[3].CriteriaName[m] + " " + cris.CriteriaN[3].CriteriaValue[m] + " " + cris.CriteriaN[4].CriteriaName[n] + " " + cris.CriteriaN[4].CriteriaValue[n]);
                                 }
                             }
                         }
                     }
                 }
             }
             if (list.Count != 0)
             {
                 string str = "Below reports are exist , please check them and change the report certerias.\r\n \r\n";
                 foreach (string s in list)
                 {
                     str += s;
                     str += "\r\n \r\n";
                 }
                 MessageBox.Show(str);
                 LogHelper.WriteLog(typeof(RunReport), str);
             }
             else
             {
                 MessageBox.Show("Success!", "Message - RSystems FinanceTools", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             RunReport.cs.CriteriaN.Clear();
         }
         finally
         {
             if (conn != null)
             {
                 conn.Close();
             }
         }
     }
     catch { }
 }
Exemple #6
0
 public IQueryAction CloseBracket()
 {
     Criterias.Add(new TextOnlyHqlProvider(string.Empty, Operator.None, ")"));
     return(this);
 }
Exemple #7
0
 public Criteria <Item> between(Property start, Property end)
 {
     return(create_using(Criterias.between(start, end)));
 }
 protected BasePaginateSpecification(Expression <Func <T, bool> > criteria)
     : base(criteria)
 {
     Criterias.Add(criteria);
 }
 public static Criteria <Item> equal_to_any <Item, Property>(this IProvideAccessToMatchBuilders <Item, Property> extension_point, params Property[] values)
 {
     return(create_using(extension_point, Criterias.equal_to_any(values)));
 }
Exemple #10
0
 public SearchColumn(string name, string value, Operands operand, Criterias criteria)
     : this(name, value, operand)
 {
     this.Criteria = criteria.ToString();
 }
Exemple #11
0
        // обновить надпись
        public void ChangeCriterion(Criterias currentCriterion)
        {
            Font font = new Font("Arial", 10);
            switch (currentCriterion)
            {
                case Criterias.Delay:
                    text = String.Format("{0}ms", Delay);
                    Criterion = Delay;
                    break;

                case Criterias.Cost:
                    text = String.Format("{0}$", Cost);
                    Criterion = Cost;
                    break;

                case Criterias.Metric:
                    text = String.Format("{0}", Metric);
                    Criterion = Metric;
                    break;

                case Criterias.OspfMetric:
                    text = String.Format("{0}", OspfMetric);
                    Criterion = OspfMetric;
                    break;
            }
            textSize = TextRenderer.MeasureText(text, font);
        }
Exemple #12
0
        public CompoundTreatmentElement(string compoundTreatmentID, string compoundTreatmentName, string attributeFrom, string attributeTo, string costEquation, string extentEquation, string quantityCriteria, string criteriaString)
        {
            _compoundTreatmentID   = compoundTreatmentID;
            _compoundTreatmentName = compoundTreatmentName;

            // Begin building the relavent attribute list.  This list contains all attributes used in the various
            // criteria and equations.
            _attributeFrom = attributeFrom;
            if (!_relevantAttributes.Contains(_attributeFrom))
            {
                _relevantAttributes.Add(_attributeFrom);
            }

            _attributeTo = attributeTo;
            if (!_relevantAttributes.Contains(_attributeTo))
            {
                _relevantAttributes.Add(_attributeTo);
            }

            // Add cost attributes


            byte[] assembly = SimulationMessaging.GetSerializedCalculateEvaluate(cgOMS.Prefix + "COMPOUNDTREATMENT", "COST", compoundTreatmentID, null);
            if (assembly != null && assembly.Length > 0)
            {
                _cost = (CalculateEvaluate.CalculateEvaluate)AssemblySerialize.DeSerializeObjectFromByteArray(assembly);
                if (SimulationMessaging.Area.OriginalInput != costEquation)
                {
                    _cost = null;
                }
            }
            if (_cost == null)
            {
                _cost = new CalculateEvaluate.CalculateEvaluate();
                _cost.BuildClass(costEquation, true, cgOMS.Prefix + "COMPOUNDTREATMENT_COST_" + compoundTreatmentID);
                _cost.CompileAssembly();
                SimulationMessaging.SaveSerializedCalculateEvaluate(cgOMS.Prefix + "COMPOUNDTREATMENT", "COST", compoundTreatmentID, _cost);
            }
            foreach (string parameter in _cost.m_listParameters)
            {
                if (!_relevantAttributes.Contains(parameter))
                {
                    _relevantAttributes.Add(parameter);
                }
            }


            assembly = null;
            assembly = SimulationMessaging.GetSerializedCalculateEvaluate(cgOMS.Prefix + "COMPOUNDTREATMENT", "EXTENT", compoundTreatmentID, null);
            if (assembly != null && assembly.Length > 0)
            {
                _extent = (CalculateEvaluate.CalculateEvaluate)AssemblySerialize.DeSerializeObjectFromByteArray(assembly);
                if (SimulationMessaging.Area.OriginalInput != extentEquation)
                {
                    _extent = null;
                }
            }
            if (_extent == null)
            {
                // Add extent attributes
                _extent = new CalculateEvaluate.CalculateEvaluate();
                _extent.BuildClass(extentEquation, true, cgOMS.Prefix + "COMPOUNDTREATMENT_EXTENT_" + compoundTreatmentID);
                _extent.CompileAssembly();
                SimulationMessaging.SaveSerializedCalculateEvaluate(cgOMS.Prefix + "COMPOUNDTREATMENT", "EXTENT", compoundTreatmentID, _extent);
            }
            foreach (string parameter in _extent.m_listParameters)
            {
                if (!_relevantAttributes.Contains(parameter))
                {
                    _relevantAttributes.Add(parameter);
                }
            }



            assembly = null;
            assembly = SimulationMessaging.GetSerializedCalculateEvaluate(cgOMS.Prefix + "COMPOUNDTREATMENT", "QUANTITY", compoundTreatmentID, null);
            if (assembly != null && assembly.Length > 0)
            {
                _quantity = (CalculateEvaluate.CalculateEvaluate)AssemblySerialize.DeSerializeObjectFromByteArray(assembly);
                if (SimulationMessaging.Area.OriginalInput != extentEquation)
                {
                    _quantity = null;
                }
            }
            if (_quantity == null)
            {
                // Add quantity attributes
                _quantity = new CalculateEvaluate.CalculateEvaluate();
                _quantity.BuildClass(quantityCriteria, true, cgOMS.Prefix + "COMPOUNDTREATMENT_QUANTITY_" + compoundTreatmentID);
                _quantity.CompileAssembly();
                SimulationMessaging.SaveSerializedCalculateEvaluate(cgOMS.Prefix + "COMPOUNDTREATMENT", "QUANTITY", compoundTreatmentID, _quantity);
            }
            foreach (string parameter in _quantity.m_listParameters)
            {
                if (!_relevantAttributes.Contains(parameter))
                {
                    _relevantAttributes.Add(parameter);
                }
            }

            // Add any criteria attributes
            _criteria = new Criterias();
            if (!string.IsNullOrEmpty(criteriaString))
            {
                _criteria.Criteria = criteriaString;
                foreach (string parameter in _criteria.CriteriaAttributes)
                {
                    if (!_relevantAttributes.Contains(parameter))
                    {
                        _relevantAttributes.Add(parameter);
                    }
                }
            }
        }
Exemple #13
0
 public Criteria <Item> equal_to_any(params Property[] values)
 {
     return(create_using(Criterias.equal_to_any(values)));
 }
Exemple #14
0
 public Criteria <Item> equal_to(Property value)
 {
     return(create_using(Criterias.equal_to(value)));
 }
 public virtual void AddCriteria(Expression <Func <T, bool> > expression)
 {
     Criterias.Add(expression);
 }
 public static Criteria <Item> greater_than <Item, Property>(this IProvideAccessToMatchBuilders <Item, Property> extension_point, Property value) where Property : IComparable <Property>
 {
     return(create_using(extension_point, Criterias.greater_than(value)));
 }
 protected virtual void AddCriteria(Expression <Func <T, bool> > criteriaExpression)
 {
     Criterias.Add(criteriaExpression);
 }
 public static Criteria <Item> between <Item, Property>(this IProvideAccessToMatchBuilders <Item, Property> extension_point, Property start, Property end) where Property : IComparable <Property>
 {
     return(create_using(extension_point, Criterias.between(start, end)));
 }
Exemple #19
0
 public IQueryBuilder OpenBracket()
 {
     Criterias.Add(new TextOnlyHqlProvider(string.Empty, CurrentOperator, "("));
     CurrentOperator = Operator.None;
     return(this);
 }
Exemple #20
0
 public Criteria <Item> greater_than(Property value)
 {
     return(create_using(Criterias.greater_than(value)));
 }