Exemplo n.º 1
0
        private double getDataValue(int formula, int medicalID, int dataMin, int dataMax)
        {
            double rtn = 0;
            List <DJK.Model.admin_MedicalSource> sourceList = dalSource.getModelList(medicalID);
            List <double> resultList = new List <double>();

            foreach (DJK.Model.admin_MedicalSource model in sourceList)
            {
                DJK.Model.admin_Clarity clarity = dalClarity.GetModel(model.SourceID);
                string tableType   = clarity.SourceTable;
                int    sourceNum   = (int)clarity.SourceNum;
                int    sourceMin   = (int)(clarity.SourceMin == null?0:clarity.SourceMin);
                int    sourceMax   = (int)(clarity.SourceMax == null ? 150 : clarity.SourceMax);
                double sourceValue = 0;
                try
                {
                    if (tableType == "info")
                    {
                        sourceValue = double.Parse(ipList[sourceNum - 1].Value);
                    }
                    else
                    {
                        sourceValue = double.Parse(mpList[sourceNum - 1].Value);
                    }
                }catch (Exception ex)
                {
                    sourceValue = 0;
                }
                double sourceResult = getSourceResult(sourceMin, sourceMax, sourceValue, dataMin, dataMax);
                resultList.Add(sourceResult);
            }
            if (resultList.Count == 0)
            {
                rtn = 0;
            }
            else
            {
                switch (formula)
                {
                case 1:
                    rtn = MathEx.getMax(resultList);
                    break;

                case 2:
                    rtn = MathEx.getMax(resultList);
                    break;

                default:
                    rtn = 0;
                    break;
                }
            }
            return(rtn);
        }
Exemplo n.º 2
0
        private void barSubItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.popupMenu1.HidePopup();
            FrmAddSource frmAdd = new FrmAddSource();

            frmAdd.ShowDialog();
            DJK.Model.admin_Clarity _model = frmAdd._model;
            if (_model != null)
            {
                DataRow dr = dtGrid.NewRow();
                dr["SourceTable"] = _model.SourceTable;
                dr["SourceNum"]   = _model.SourceNum;
                dr["SourceMin"]   = _model.SourceMin;
                dr["SourceMax"]   = _model.SourceMax;
                dtGrid.Rows.Add(dr);
                saveGrid();
                LoadGrid();
            }
        }