コード例 #1
0
ファイル: DataSource.cs プロジェクト: Rich1-King/grain
        public List <YuMiPoHuaiModel> getYuMiPoHuaiData(string shiYanHao)
        {
            List <YuMiPoHuaiModel> yuMiModel = new List <YuMiPoHuaiModel>();
            YuMiPoHuaiModel        model     = new YuMiPoHuaiModel();

            try
            {
                SqlConnection();
            }
            catch (Exception e)
            {
                throw e;
            }

            sqlStr = "select * from 玉米加热破坏实验信息表 where 实验号 = '" + shiYanHao + "'";
            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }

            reader.Read();

            model.shiYanHao     = Convert.ToString(reader["实验号"]);
            model.cengShuNumber = Convert.ToInt32(reader["层数号"]);
            model.diDianNumber  = Convert.ToInt32(reader["实验地点号"]);
            reader.Close();

            sqlStr = "select * from 玉米加热破坏实验数据表 where 实验号 = '" + model.shiYanHao + "'";

            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }

            while (reader.Read())
            {
                YuMiPoHuaiModel model1 = new YuMiPoHuaiModel();
                model1.tem                = Convert.ToString(reader["温度"]);
                model1.poHuaiLv           = Convert.ToString(reader["破坏率"]);
                model1.rData              = 30;
                model1.xData              = Convert.ToString(reader["检测时间(/day)"]);
                model1.xLabel             = "时间:";
                model1.temLabel           = "温度:";
                model1.poHuaiLvLabel      = "破坏率:";
                model1.temSpeedLabel      = "温度变化速率:";
                model1.poHuaiLvSpeedLabel = "破坏率变化速率:";

                yuMiModel.Add(model1);
            }

            reader.Close();

            try
            {
                SqlClose();
            }
            catch (Exception e)
            {
                throw e;
            }

            for (int i = 0; i < yuMiModel.Count; i++)
            {
                if (i == 0)
                {
                    yuMiModel[i].temAddToSpeed      = 0.0;
                    yuMiModel[i].poHuaiLvAddToSpeed = 0.0;
                }
                else
                {
                    yuMiModel[i].temAddToSpeed = ((Convert.ToDouble(yuMiModel[i].tem) - Convert.ToDouble(yuMiModel[i - 1].tem)) * 1.0 / (Convert.ToDouble(yuMiModel[i].xData) - Convert.ToDouble(yuMiModel[i - 1].xData)));

                    yuMiModel[i].poHuaiLvAddToSpeed = ((Convert.ToDouble(yuMiModel[i].poHuaiLv) - Convert.ToDouble(yuMiModel[i - 1].poHuaiLv)) * 1.0 / (Convert.ToDouble(yuMiModel[i].xData) - Convert.ToDouble(yuMiModel[i - 1].xData)));
                }
            }
            for (int i = 0; i < yuMiModel.Count; i++)
            {
                yuMiModel[i].yData      = yuMiModel[i].tem;
                yuMiModel[i].addToSpeed = yuMiModel[i].temAddToSpeed;
            }

            yuMiModel[0].temHigh           = getMax(convert(yuMiModel));
            yuMiModel[0].temLow            = getMin(convert(yuMiModel));
            yuMiModel[0].temMedia          = getMedia(convert(yuMiModel));
            yuMiModel[0].temAddToSpeedHigh = getAddToSpeedMax(convert(yuMiModel));
            yuMiModel[0].temAddToSpeedLow  = getAddToSpeedMin(convert(yuMiModel));

            for (int j = 0; j < yuMiModel.Count; j++)
            {
                yuMiModel[j].yData      = yuMiModel[j].poHuaiLv;
                yuMiModel[j].addToSpeed = yuMiModel[j].poHuaiLvAddToSpeed;
            }
            yuMiModel[0].poHuaiLvHigh           = getMax(convert(yuMiModel));
            yuMiModel[0].poHuaiLvLow            = getMin(convert(yuMiModel));
            yuMiModel[0].poHuaiLvMedia          = getMedia(convert(yuMiModel));
            yuMiModel[0].poHuaiLvAddToSpeedHigh = getAddToSpeedMax(convert(yuMiModel));
            yuMiModel[0].poHuaiLvAddToSpeedLow  = getAddToSpeedMin(convert(yuMiModel));

            for (int i = 1; i < yuMiModel.Count; i++)
            {
                yuMiModel[i].temHigh           = yuMiModel[0].temHigh;
                yuMiModel[i].temLow            = yuMiModel[0].temLow;
                yuMiModel[i].temMedia          = yuMiModel[0].temMedia;
                yuMiModel[i].temAddToSpeedHigh = yuMiModel[0].temAddToSpeedHigh;
                yuMiModel[i].temAddToSpeedLow  = yuMiModel[0].temAddToSpeedLow;

                yuMiModel[i].poHuaiLvHigh           = yuMiModel[0].poHuaiLvHigh;
                yuMiModel[i].poHuaiLvLow            = yuMiModel[0].poHuaiLvLow;
                yuMiModel[i].poHuaiLvMedia          = yuMiModel[0].poHuaiLvMedia;
                yuMiModel[i].poHuaiLvAddToSpeedHigh = yuMiModel[0].poHuaiLvAddToSpeedHigh;
                yuMiModel[i].poHuaiLvAddToSpeedLow  = yuMiModel[0].poHuaiLvAddToSpeedLow;
            }
            return(yuMiModel);
        }
コード例 #2
0
ファイル: DataSource.cs プロジェクト: Rich1-King/grain
        public List <YuMiBaoZiModel> getYuMiBaoZiData(string shiYanHao)
        {
            List <YuMiBaoZiModel> yuMiModel = new List <YuMiBaoZiModel>();
            YuMiBaoZiModel        model     = new YuMiBaoZiModel();

            try
            {
                SqlConnection();
            }
            catch (Exception e)
            {
                throw e;
            }

            sqlStr = "select * from 玉米孢子检测实验信息表 where 实验号 = '" + shiYanHao + "'";
            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }

            reader.Read();

            model.shiYanHao = Convert.ToString(reader["实验号"]);

            model.canShuHao        = Convert.ToString(reader["孢子号"]);
            model.startCanShuValue = Convert.ToString(reader["起始孢子数"]);
            model.endCanShuValue   = Convert.ToString(reader["终点孢子数"]);
            try
            {
                model.startTime = Convert.ToDateTime(reader["开始时间"]);
                model.endTime   = Convert.ToDateTime(reader["结束时间"]);
            }
            catch (Exception)
            { }


            reader.Close();

            sqlStr = "select * from 玉米孢子信息表 where 孢子号 = '" + model.canShuHao + "'";
            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }
            reader.Read();
            model.canShuName = Convert.ToString(reader["孢子名"]);


            reader.Close();

            sqlStr = "select * from 玉米孢子检测实验数据表 where 实验号 = '" + shiYanHao + "'";

            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }

            while (reader.Read())
            {
                YuMiBaoZiModel model1 = new YuMiBaoZiModel();

                model1.shiYanHao = model.shiYanHao;

                model1.canShuHao        = model.canShuHao;
                model1.startCanShuValue = model.startCanShuValue;
                model1.endCanShuValue   = model.endCanShuValue;
                model1.startTime        = model.startTime;
                model1.endTime          = model.endTime;
                model1.canShuName       = model.canShuName;

                model1.water = Convert.ToString(reader["水分"]);

                model1.tem      = Convert.ToString(reader["温度"]);
                model1.humidity = Convert.ToString(reader["湿度"]);
                model1.xData    = Convert.ToString(reader["消耗时间(/h)"]);
                model1.xLabel   = "时间(h)";

                model1.yData = Convert.ToString(reader["孢子个数"]);
                model1.rData = Convert.ToDouble(model1.yData) * 0.1;
                try
                {
                    model1.checkTime = Convert.ToDateTime(reader["检测日期"]);
                }
                catch (Exception)
                { }
                yuMiModel.Add(model1);
            }

            reader.Close();

            try
            {
                SqlClose();
            }
            catch (Exception e)
            {
                throw e;
            }

            for (int i = 0; i < yuMiModel.Count; i++)
            {
                if (i == 0)
                {
                    yuMiModel[i].addToSpeed = 0.0;
                }
                else
                {
                    yuMiModel[i].addToSpeed = ((Convert.ToDouble(yuMiModel[i].yData) - Convert.ToDouble(yuMiModel[i - 1].yData)) * 1.0 / (Convert.ToDouble(yuMiModel[i].xData) - Convert.ToDouble(yuMiModel[i - 1].xData)));
                }
            }
            for (int i = 0; i < yuMiModel.Count; i++)
            {
                yuMiModel[i].high           = getMax(convert(yuMiModel));
                yuMiModel[i].low            = getMin(convert(yuMiModel));
                yuMiModel[i].media          = getMedia(convert(yuMiModel));
                yuMiModel[i].addToSpeedHigh = getAddToSpeedMax(convert(yuMiModel));
                yuMiModel[i].addToSpeedLow  = getAddToSpeedMin(convert(yuMiModel));
            }
            return(yuMiModel);
        }
コード例 #3
0
ファイル: DataSource.cs プロジェクト: Rich1-King/grain
        public List <DaoGuZhiLiangTeXingModel> getDaoGuZhiLiangTeXingData(string shiYanHao)
        {
            List <DaoGuZhiLiangTeXingModel> daoGuModel = new List <DaoGuZhiLiangTeXingModel>();
            DaoGuZhiLiangTeXingModel        model      = new DaoGuZhiLiangTeXingModel();

            try
            {
                SqlConnection();
            }
            catch (Exception e)
            {
                throw e;
            }

            sqlStr = "select * from 稻谷质量特性参数实验信息表 where 实验号 = '" + shiYanHao + "'";
            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }

            reader.Read();

            model.shiYanHao = Convert.ToString(reader["实验号"]);

            model.canShuHao        = Convert.ToString(reader["参数号"]);
            model.startCanShuValue = Convert.ToString(reader["起始参数值"]);
            model.endCanShuValue   = Convert.ToString(reader["终点参数值"]);

            try
            {
                model.startTime = Convert.ToDateTime(reader["开始时间"]);
            }
            catch (Exception)
            {
            }

            try
            {
                model.endTime = Convert.ToDateTime(reader["结束时间"]);
            }
            catch (Exception)
            { }


            reader.Close();

            sqlStr = "select * from 稻谷质量特性参数信息表 where 参数号 = '" + model.canShuHao + "'";
            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }
            reader.Read();
            model.canShuName = Convert.ToString(reader["参数名"]);


            reader.Close();

            sqlStr = "select * from 稻谷质量特性参数实验数据表 where 实验号 = '" + shiYanHao + "'";

            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }

            while (reader.Read())
            {
                DaoGuZhiLiangTeXingModel model1 = new DaoGuZhiLiangTeXingModel();

                model1.shiYanHao = model.shiYanHao;

                model1.canShuHao        = model.canShuHao;
                model1.startCanShuValue = model.startCanShuValue;
                model1.endCanShuValue   = model.endCanShuValue;
                if (model.startTime != null && model.endTime != null)
                {
                    model1.startTime = model.startTime;
                    model1.endTime   = model.endTime;
                }
                model1.canShuName = model.canShuName;

                model1.xData  = Convert.ToString(reader["消耗时间(/d)"]);
                model1.xLabel = "消耗时间:";
                model1.yData  = Convert.ToString(reader["参数值"]);
                if (model1.rData < 5)
                {
                    model1.rData = 10;
                }
                try
                {
                    model1.checkTime = Convert.ToDateTime(reader["检测日期"]);
                }
                catch (Exception)
                { }
                model.tem   = Convert.ToString(reader["粮温"]);
                model.water = Convert.ToString(reader["水分"]);
                daoGuModel.Add(model1);
            }

            reader.Close();


            try
            {
                SqlClose();
            }
            catch (Exception e)
            {
                throw e;
            }

            for (int i = 0; i < daoGuModel.Count; i++)
            {
                if (i == 0)
                {
                    daoGuModel[i].addToSpeed = 0.0;
                }
                else
                {
                    daoGuModel[i].addToSpeed = ((Convert.ToDouble(daoGuModel[i].yData) - Convert.ToDouble(daoGuModel[i - 1].yData)) * 1.0 / (Convert.ToDouble(daoGuModel[i].xData) - Convert.ToDouble(daoGuModel[i - 1].xData)));
                }
            }
            for (int i = 0; i < daoGuModel.Count; i++)
            {
                daoGuModel[i].high           = getMax(convert(daoGuModel));
                daoGuModel[i].low            = getMin(convert(daoGuModel));
                daoGuModel[i].media          = getMedia(convert(daoGuModel));
                daoGuModel[i].addToSpeedHigh = getAddToSpeedMax(convert(daoGuModel));
                daoGuModel[i].addToSpeedLow  = getAddToSpeedMin(convert(daoGuModel));
            }
            return(daoGuModel);
        }
コード例 #4
0
ファイル: DataSource.cs プロジェクト: Rich1-King/grain
        public List <YuMiTeXingDataModel> getYuMiTeXingData(string shiYanHao)
        {
            List <YuMiTeXingDataModel> yuMiModel = new List <YuMiTeXingDataModel>();
            YuMiTeXingDataModel        model     = new YuMiTeXingDataModel();

            try
            {
                SqlConnection();
            }
            catch (Exception e)
            {
                throw e;
            }

            sqlStr = "select * from 玉米特性参数实验信息表 where 实验号 = '" + shiYanHao + "'";
            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }

            reader.Read();

            model.shiYanHao = Convert.ToString(reader["实验号"]);

            model.canShuHao        = Convert.ToString(reader["参数号"]);
            model.startCanShuValue = Convert.ToString(reader["起始参数值"]);
            model.endCanShuValue   = Convert.ToString(reader["终点参数值"]);
            try
            {
                model.startTime = Convert.ToDateTime(reader["开始时间"]);
                model.endTime   = Convert.ToDateTime(reader["结束时间"]);
            }
            catch (Exception)
            { }


            reader.Close();

            sqlStr = "select * from 玉米特性参数信息表 where 参数号 = '" + model.canShuHao + "'";
            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }
            reader.Read();
            model.canShuName = Convert.ToString(reader["参数名"]);


            reader.Close();

            sqlStr = "select * from 玉米特性参数实验数据表 where 实验号 = '" + shiYanHao + "'";

            try
            {
                dataControl = new DataControl();
                reader      = dataControl.controlSql(sqlCon, sqlStr);
            }
            catch (Exception e)
            {
                throw e;
            }

            while (reader.Read())
            {
                YuMiTeXingDataModel model1 = new YuMiTeXingDataModel();

                model1.shiYanHao = model.shiYanHao;

                model1.canShuHao        = model.canShuHao;
                model1.startCanShuValue = model.startCanShuValue;
                model1.endCanShuValue   = model.endCanShuValue;
                model1.startTime        = model.startTime;
                model1.endTime          = model.endTime;
                model1.canShuName       = model.canShuName;

                if (Convert.ToString(reader["水分"]) != "")
                {
                    model1.xData  = Convert.ToString(reader["水分"]);
                    model1.xLabel = "水分";
                }
                else if (Convert.ToString(reader["破碎率"]) != "")
                {
                    model1.xData  = Convert.ToString(reader["破碎率"]);
                    model1.xLabel = "破碎率";
                }
                else if (Convert.ToString(reader["杂质含量"]) != "")
                {
                    model1.xData  = Convert.ToString(reader["杂质含量"]);
                    model1.xLabel = "杂质含量";
                }
                else
                {
                    throw new Exception("没有数据!!");
                }

                model1.yData = Convert.ToString(reader["参数值"]);
                model1.rData = Convert.ToDouble(model1.yData) * 0.05;
                if (model1.rData < 5)
                {
                    model1.rData = 10;
                }
                //model1.checkTime = Convert.ToDateTime(reader["检测日期"]);
                yuMiModel.Add(model1);
            }

            reader.Close();

            try
            {
                SqlClose();
            }
            catch (Exception e)
            {
                throw e;
            }

            for (int i = 0; i < yuMiModel.Count; i++)
            {
                if (i == 0)
                {
                    yuMiModel[i].addToSpeed = 0.0;
                }
                else
                {
                    yuMiModel[i].addToSpeed = ((Convert.ToDouble(yuMiModel[i].yData) - Convert.ToDouble(yuMiModel[i - 1].yData)) * 1.0 / (Convert.ToDouble(yuMiModel[i].xData) - Convert.ToDouble(yuMiModel[i - 1].xData)));
                }
            }
            for (int i = 0; i < yuMiModel.Count; i++)
            {
                yuMiModel[i].high           = getMax(convert(yuMiModel));
                yuMiModel[i].low            = getMin(convert(yuMiModel));
                yuMiModel[i].media          = getMedia(convert(yuMiModel));
                yuMiModel[i].addToSpeedHigh = getAddToSpeedMax(convert(yuMiModel));
                yuMiModel[i].addToSpeedLow  = getAddToSpeedMin(convert(yuMiModel));
            }
            return(yuMiModel);
        }