示例#1
0
        private bool DealWithLineData(string str, int lineNumber, ref string strErroInfo, ref List <string> gprs)
        {
            Boolean flag = false;

            //if (str.StartsWith("(") && str.EndsWith(")"))
            //{
            // gm 添加
            //string tmp = str.Substring(1, str.Length - 2);
            string[] arrayStr = str.Split(',');
            if (arrayStr.Length == 21)
            {
                if (arrayStr[0].Length == 4)
                {
                    try
                    {
                        string stationId   = arrayStr[0].Trim();
                        int    subcenterid = 2;
                        try
                        {
                            subcenterid = CDBDataMgr.Instance.GetSubCenterByName(arrayStr[3]).SubCenterID;
                        }
#pragma warning disable CS0168 // 声明了变量“ew”,但从未使用过
                        catch (Exception ew)
#pragma warning restore CS0168 // 声明了变量“ew”,但从未使用过
                        {
                        }

                        if (CDBDataMgr.Instance.GetStationById(stationId) != null)
                        {
                            strErroInfo = string.Format("行:{0} 站点不能重复\"{1}\"", lineNumber, stationId);
                            return(false);
                        }
                        //int subcenterid = int.Parse(arrayStr[1]);
                        string       stationname = arrayStr[1].Trim();
                        EStationType stationtype = CEnumHelper.UIStrToStationType(arrayStr[2]);
                        if (stationtype == EStationType.ERainFall)
                        {
                            float RAccuracy = 0.5f;
                            try
                            {
                                RAccuracy = float.Parse(arrayStr[8]);
                            }
#pragma warning disable CS0168 // 声明了变量“e5”,但从未使用过
                            catch (Exception e5)
#pragma warning restore CS0168 // 声明了变量“e5”,但从未使用过
                            {
                                RAccuracy = 0.5f;
                            }

                            Decimal RChange = 20.0M;
                            try
                            {
                                RChange = Decimal.Parse(arrayStr[9]);
                            }
#pragma warning disable CS0168 // 声明了变量“e6”,但从未使用过
                            catch (Exception e6)
#pragma warning restore CS0168 // 声明了变量“e6”,但从未使用过
                            {
                                RChange = 20.0M;
                            }
                            string Gsm  = arrayStr[10].Trim();
                            string Gprs = arrayStr[11].Trim();
                            if (Gprs != "" && gprs.Contains(Gprs))
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,GPRS与已有站点重复", lineNumber);
                                return(false);
                            }
                            else
                            {
                                gprs.Add(Gprs);
                            }

                            string BDSatellite = arrayStr[12].Trim();
                            string BDmember    = arrayStr[13].Trim();
                            float  VoltageMin  = 11;
                            try
                            {
                                VoltageMin = float.Parse(arrayStr[14]);
                            }
#pragma warning disable CS0168 // 声明了变量“er”,但从未使用过
                            catch (Exception er)
#pragma warning restore CS0168 // 声明了变量“er”,但从未使用过
                            {
                                VoltageMin = 11;
                            }

                            string maintran     = arrayStr[15].Trim();
                            string subtran      = arrayStr[16].Trim();
                            string dataprotocol = arrayStr[17].Trim();
                            //string watersensor = arrayStr[18].Trim();
                            string rainsensor     = arrayStr[19].Trim();
                            string reportinterval = arrayStr[20].Trim();

                            CEntityStation tmp = new CEntityStation();
                            tmp.StationID   = stationId;
                            tmp.SubCenterID = subcenterid;
                            tmp.StationName = stationname;
                            tmp.StationType = stationtype;
                            //tmp.DWaterBase = WBase;
                            //tmp.DWaterMax = WMax;
                            //tmp.DWaterMin = WMin;
                            //tmp.DWaterChange = WChange;
                            tmp.DRainAccuracy     = RAccuracy;
                            tmp.DRainChange       = RChange;
                            tmp.GSM               = Gsm;
                            tmp.GPRS              = Gprs;
                            tmp.BDSatellite       = BDSatellite;
                            tmp.BDMemberSatellite = BDmember;
                            tmp.DVoltageMin       = VoltageMin;
                            //判定maintrain不能为空
                            if (maintran == "SX-GPRS" || maintran == "HD-GPRS" || maintran == "GSM" || maintran == "Beidou-Normal" || maintran == "Beidou-500")
                            {
                                tmp.Maintran = maintran;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,主信道不能为空", lineNumber);
                                return(false);
                            }
                            //判定subtran不能为空
                            if (subtran == "SX-GPRS" || subtran == "HD-GPRS" || subtran == "GSM" || subtran == "Beidou-Normal" || subtran == "Beidou-500" || subtran == "无")
                            {
                                tmp.Subtran = subtran;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,备用信道不能为空", lineNumber);
                                return(false);
                            }
                            //判定数据协议不能为空
                            if (dataprotocol == "LN" || dataprotocol == "ZYJBX")
                            {
                                tmp.Datapotocol = dataprotocol;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,数据协议出错", lineNumber);
                                return(false);
                            }
                            // 判定watersensor不能为空
                            //if (watersensor == "浮子水位" || watersensor == "气泡水位" || watersensor == "压阻水位" || watersensor == "雷达水位" || watersensor == "无")
                            //{
                            //    tmp.Watersensor = CEnumHelper.WaterSensorTypeToDBStr(maintran).ToString();
                            //}
                            //else
                            //{
                            //    strErroInfo = string.Format("行:{0} 数据格式错误,水位传感器不能为空", lineNumber);
                            //    return false;
                            //}
                            // 判定Rainsensor不能为空
                            if (rainsensor == "翻斗雨量" || rainsensor == "雨雪雨量" || rainsensor == "无")
                            {
                                tmp.Rainsensor = CEnumHelper.RainSensorTypeToDBStr(rainsensor).ToString();
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,雨量传感器不能为空", lineNumber);
                                return(false);
                            }
                            //检测报讯断次
                            if (reportinterval == "1" || reportinterval == "4" || reportinterval == "8" ||
                                reportinterval == "12" || reportinterval == "24" || reportinterval == "48")
                            {
                                tmp.Reportinterval = reportinterval;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,报讯断次不能为空", lineNumber);
                                return(false);
                            }
                            tmp.Reportinterval = reportinterval;
                            m_listImport.Add(tmp);
                            flag = true;
                        }
                        else if (stationtype == EStationType.ERiverWater)
                        {
                            Decimal WBase = 0.0M;
                            try
                            {
                                WBase = Decimal.Parse(arrayStr[4]);
                            }
#pragma warning disable CS0168 // 声明了变量“e1”,但从未使用过
                            catch (Exception e1)
#pragma warning restore CS0168 // 声明了变量“e1”,但从未使用过
                            {
                                WBase = 0;
                            }
                            Decimal WMax = 100M;
                            try
                            {
                                WMax = Decimal.Parse(arrayStr[5]);
                            }
#pragma warning disable CS0168 // 声明了变量“e2”,但从未使用过
                            catch (Exception e2)
#pragma warning restore CS0168 // 声明了变量“e2”,但从未使用过
                            {
                                WMax = 100M;
                            }

                            Decimal WMin = 0.1M;
                            try
                            {
                                WMin = Decimal.Parse(arrayStr[6]);
                            }
#pragma warning disable CS0168 // 声明了变量“e3”,但从未使用过
                            catch (Exception e3)
#pragma warning restore CS0168 // 声明了变量“e3”,但从未使用过
                            {
                                WMin = 0.1M;
                            }
                            Decimal WChange = 2.2M;
                            try
                            {
                                WChange = Decimal.Parse(arrayStr[7]);
                            }
#pragma warning disable CS0168 // 声明了变量“e4”,但从未使用过
                            catch (Exception e4)
#pragma warning restore CS0168 // 声明了变量“e4”,但从未使用过
                            {
                                WChange = 2.2M;
                            }
                            //float RAccuracy = 0.5f;
                            //try
                            //{
                            //    RAccuracy = float.Parse(arrayStr[8]);
                            //}
                            //catch (Exception e5)
                            //{
                            //    RAccuracy = 0.5f;
                            //}
                            //Decimal RChange = 20.0M;
                            //try
                            //{
                            //    RChange = Decimal.Parse(arrayStr[9]);
                            //}
                            //catch (Exception e6)
                            //{
                            //    RChange = 20.0M;
                            //}
                            string Gsm = arrayStr[10].Trim();

                            string Gprs = arrayStr[11].Trim();
                            if (Gprs != "" && gprs.Contains(Gprs))
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,GPRS与已有站点重复", lineNumber);
                                return(false);
                            }
                            else
                            {
                                gprs.Add(Gprs);
                            }

                            string BDSatellite  = arrayStr[12].Trim();
                            string BDmember     = arrayStr[13].Trim();
                            float  VoltageMin   = float.Parse(arrayStr[14]);
                            string maintran     = arrayStr[15].Trim();
                            string subtran      = arrayStr[16].Trim();
                            string dataprotocol = arrayStr[17].Trim();
                            string watersensor  = arrayStr[18].Trim();
                            //string rainsensor = arrayStr[19].Trim();
                            string reportinterval = arrayStr[20].Trim();

                            CEntityStation tmp = new CEntityStation();
                            tmp.StationID    = stationId;
                            tmp.SubCenterID  = subcenterid;
                            tmp.StationName  = stationname;
                            tmp.StationType  = stationtype;
                            tmp.DWaterBase   = WBase;
                            tmp.DWaterMax    = WMax;
                            tmp.DWaterMin    = WMin;
                            tmp.DWaterChange = WChange;
                            //tmp.DRainAccuracy = RAccuracy;
                            //tmp.DRainChange = RChange;
                            tmp.GSM               = Gsm;
                            tmp.GPRS              = Gprs;
                            tmp.BDSatellite       = BDSatellite;
                            tmp.BDMemberSatellite = BDmember;
                            tmp.DVoltageMin       = VoltageMin;
                            //判定maintrain不能为空
                            if (maintran == "SX-GPRS" || maintran == "HD-GPRS" || maintran == "GSM" || maintran == "Beidou-Normal" || maintran == "Beidou-500")
                            {
                                tmp.Maintran = maintran;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,主信道不能为空", lineNumber);
                                return(false);
                            }
                            //判定subtran不能为空
                            if (subtran == "SX-GPRS" || subtran == "HD-GPRS" || subtran == "GSM" || subtran == "Beidou-Normal" || subtran == "Beidou-500" || subtran == "无")
                            {
                                tmp.Subtran = subtran;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,备用信道不能为空", lineNumber);
                                return(false);
                            }
                            //判定数据协议不能为空
                            if (dataprotocol == "LN" || dataprotocol == "ZYJBX")
                            {
                                tmp.Datapotocol = dataprotocol;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,数据协议出错", lineNumber);
                                return(false);
                            }
                            // 判定watersensor不能为空
                            if (watersensor == "浮子水位" || watersensor == "气泡水位" || watersensor == "压阻水位" || watersensor == "雷达水位" || watersensor == "无")
                            {
                                tmp.Watersensor = CEnumHelper.WaterSensorTypeToDBStr(watersensor).ToString();
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,水位传感器不能为空", lineNumber);
                                return(false);
                            }
                            // 判定Rainsensor不能为空
                            //if (rainsensor == "翻斗雨量" || rainsensor == "雨雪雨量" || rainsensor == "无")
                            //{
                            //    tmp.Rainsensor = CEnumHelper.RainSensorTypeToDBStr(maintran).ToString();
                            //}
                            //else
                            //{
                            //    strErroInfo = string.Format("行:{0} 数据格式错误,雨量传感器不能为空", lineNumber);
                            //    return false;
                            //}
                            //检测报讯断次
                            if (reportinterval == "1" || reportinterval == "4" || reportinterval == "8" ||
                                reportinterval == "12" || reportinterval == "24" || reportinterval == "48")
                            {
                                tmp.Reportinterval = reportinterval;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,报讯断次不能为空", lineNumber);
                                return(false);
                            }
                            //tmp.Reportinterval = reportinterval;
                            m_listImport.Add(tmp);
                            flag = true;
                        }
                        else if (stationtype == EStationType.EHydrology)
                        {
                            Decimal WBase = 0.0M;
                            try
                            {
                                WBase = Decimal.Parse(arrayStr[4]);
                            }
#pragma warning disable CS0168 // 声明了变量“e1”,但从未使用过
                            catch (Exception e1)
#pragma warning restore CS0168 // 声明了变量“e1”,但从未使用过
                            {
                                WBase = 0;
                            }
                            Decimal WMax = 100M;
                            try
                            {
                                WMax = Decimal.Parse(arrayStr[5]);
                            }
#pragma warning disable CS0168 // 声明了变量“e2”,但从未使用过
                            catch (Exception e2)
#pragma warning restore CS0168 // 声明了变量“e2”,但从未使用过
                            {
                                WMax = 100M;
                            }

                            Decimal WMin = 0.1M;
                            try
                            {
                                WMin = Decimal.Parse(arrayStr[6]);
                            }
#pragma warning disable CS0168 // 声明了变量“e3”,但从未使用过
                            catch (Exception e3)
#pragma warning restore CS0168 // 声明了变量“e3”,但从未使用过
                            {
                                WMin = 0.1M;
                            }
                            Decimal WChange = 2.2M;
                            try
                            {
                                WChange = Decimal.Parse(arrayStr[7]);
                            }
#pragma warning disable CS0168 // 声明了变量“e4”,但从未使用过
                            catch (Exception e4)
#pragma warning restore CS0168 // 声明了变量“e4”,但从未使用过
                            {
                                WChange = 2.2M;
                            }
                            float RAccuracy = 0.5f;
                            try
                            {
                                RAccuracy = float.Parse(arrayStr[8]);
                            }
#pragma warning disable CS0168 // 声明了变量“e5”,但从未使用过
                            catch (Exception e5)
#pragma warning restore CS0168 // 声明了变量“e5”,但从未使用过
                            {
                                RAccuracy = 0.5f;
                            }
                            Decimal RChange = 20.0M;
                            try
                            {
                                RChange = Decimal.Parse(arrayStr[9]);
                            }
#pragma warning disable CS0168 // 声明了变量“e6”,但从未使用过
                            catch (Exception e6)
#pragma warning restore CS0168 // 声明了变量“e6”,但从未使用过
                            {
                                RChange = 20.0M;
                            }
                            string Gsm = arrayStr[10].Trim();

                            string Gprs = arrayStr[11].Trim();
                            if (Gprs != "" && gprs.Contains(Gprs))
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,GPRS与已有站点重复", lineNumber);
                                return(false);
                            }
                            else
                            {
                                gprs.Add(Gprs);
                            }

                            string         BDSatellite    = arrayStr[12].Trim();
                            string         BDmember       = arrayStr[13].Trim();
                            float          VoltageMin     = float.Parse(arrayStr[14]);
                            string         maintran       = arrayStr[15].Trim();
                            string         subtran        = arrayStr[16].Trim();
                            string         dataprotocol   = arrayStr[17].Trim();
                            string         watersensor    = arrayStr[18].Trim();
                            string         rainsensor     = arrayStr[19].Trim();
                            string         reportinterval = arrayStr[20].Trim();
                            CEntityStation tmp            = new CEntityStation();
                            tmp.StationID         = stationId;
                            tmp.SubCenterID       = subcenterid;
                            tmp.StationName       = stationname;
                            tmp.StationType       = stationtype;
                            tmp.DWaterBase        = WBase;
                            tmp.DWaterMax         = WMax;
                            tmp.DWaterMin         = WMin;
                            tmp.DWaterChange      = WChange;
                            tmp.DRainAccuracy     = RAccuracy;
                            tmp.DRainChange       = RChange;
                            tmp.GSM               = Gsm;
                            tmp.GPRS              = Gprs;
                            tmp.BDSatellite       = BDSatellite;
                            tmp.BDMemberSatellite = BDmember;
                            tmp.DVoltageMin       = VoltageMin;
                            //判定maintrain不能为空
                            if (maintran == "SX-GPRS" || maintran == "HD-GPRS" || maintran == "GSM" || maintran == "Beidou-Normal" || maintran == "Beidou-500")
                            {
                                tmp.Maintran = maintran;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,主信道不能为空", lineNumber);
                                return(false);
                            }
                            //判定subtran不能为空
                            if (subtran == "SX-GPRS" || subtran == "HD-GPRS" || subtran == "GSM" || subtran == "Beidou-Normal" || subtran == "Beidou-500" || subtran == "无")
                            {
                                tmp.Subtran = subtran;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,备用信道不能为空", lineNumber);
                                return(false);
                            }
                            //判定数据协议不能为空
                            if (dataprotocol == "LN" || dataprotocol == "ZYJBX")
                            {
                                tmp.Datapotocol = dataprotocol;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,数据协议出错", lineNumber);
                                return(false);
                            }
                            // 判定watersensor不能为空
                            if (watersensor == "浮子水位" || watersensor == "气泡水位" || watersensor == "压阻水位" || watersensor == "雷达水位" || watersensor == "无")
                            {
                                tmp.Watersensor = CEnumHelper.WaterSensorTypeToDBStr(watersensor).ToString();
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,水位传感器不能为空", lineNumber);
                                return(false);
                            }
                            // 判定Rainsensor不能为空
                            if (rainsensor == "翻斗雨量" || rainsensor == "雨雪雨量" || rainsensor == "无")
                            {
                                tmp.Rainsensor = CEnumHelper.RainSensorTypeToDBStr(rainsensor).ToString();
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,雨量传感器不能为空", lineNumber);
                                return(false);
                            }
                            //检测报讯断次
                            if (reportinterval == "1" || reportinterval == "4" || reportinterval == "8" ||
                                reportinterval == "12" || reportinterval == "24" || reportinterval == "48")
                            {
                                tmp.Reportinterval = reportinterval;
                            }
                            else
                            {
                                strErroInfo = string.Format("行:{0} 数据格式错误,报讯断次不能为空", lineNumber);
                                return(false);
                            }
                            tmp.Reportinterval = reportinterval;
                            m_listImport.Add(tmp);
                            flag = true;
                        }
                    }
                    catch (Exception e)
                    {
                        strErroInfo = string.Format("行:{0} 数据格式错误", lineNumber);
                        Debug.WriteLine(e.ToString());
                        return(false);
                    }
                }
            }
            else
            {
                strErroInfo = string.Format("行:{0} 数据格式错误", lineNumber);

                return(false);
            }

            return(flag);

            //if (str.StartsWith("(") && str.EndsWith(")"))
            //{

            //    return false;
            //}
            //else
            //{
            //    // 格式不对
            //    strErroInfo = (string.Format("行:{0} 开始结束符号\"(\"\")\"格式错误", lineNumber));
            //    return false;
            //}
        }
示例#2
0
        private CEntityStation GenerateStationFromUI()
        {
            try
            {
                if (!AssertInputValid())
                {
                    return(null);
                }
                // 读取界面数据,并构建一个站点实体类
                CEntityStation station = new CEntityStation();
                station.StationID   = textBox_StationID.Text.Trim(); //去掉空格
                station.StationName = textBox_StationName.Text;
                station.SubCenterID = CDBDataMgr.Instance.GetSubCenterByName(cmb_SubCenter.Text).SubCenterID;
                station.StationType = CEnumHelper.UIStrToStationType(cmb_StationType.Text);
                if (!textBox_WaterBase.Text.Trim().Equals(""))
                {
                    // 设置了水位基值
                    station.DWaterBase = Decimal.Parse(textBox_WaterBase.Text.Trim());
                }
                if (!textBox_WaterChange.Text.Trim().Equals(""))
                {
                    // 设置了水位变化
                    station.DWaterChange = Decimal.Parse(textBox_WaterChange.Text.Trim());
                }
                if (!textBox_WaterMax.Text.Trim().Equals(""))
                {
                    // 设置了水位最大值
                    station.DWaterMax = Decimal.Parse(textBox_WaterMax.Text.Trim());
                }
                if (!textBox_WaterMin.Text.Trim().Equals(""))
                {
                    // 设置了水位最小值
                    station.DWaterMin = Decimal.Parse(textBox_WaterMin.Text.Trim());
                }
                if (station.StationType == EStationType.ERainFall || station.StationType == EStationType.EHydrology)
                {
                    // 雨量精度不能为空
                    try
                    {
                        station.DRainAccuracy = float.Parse(cmb_RainAccuracy.Text);
                    }
                    catch (Exception e)
                    {
                        station.DRainAccuracy = 0.5f;
                    }
                }
                if (!textBox_RainChange.Text.Trim().Equals(""))
                {
                    // 设置了雨量变化
                    station.DRainChange = Decimal.Parse(textBox_RainChange.Text.Trim());
                }
                if (!textBox_Voltage.Text.Trim().Equals(""))
                {
                    // 设置了电压阀值
                    station.DVoltageMin = float.Parse(textBox_Voltage.Text.Trim());
                }
                if (!textBox_GSM.Text.Trim().Equals(""))
                {
                    string gsmNum = textBox_GSM.Text.Trim();
                    //if (!CStringUtil.IsDigitStrWithSpecifyLength(gsmNum, 11))
                    //{
                    //    MessageBox.Show("GSM号码参数不合法,长度必须为11位,必须全部是数字!");
                    //    return null;
                    //}
                    if (!CStringUtil.IsDigit(gsmNum))
                    {
                        MessageBox.Show("GSM号码参数不合法,必须全部是数字!");
                        return(null);
                    }
                    // 设置了GSM号码
                    station.GSM = gsmNum;
                }
                //if (!textBox_GPRS.Text.Trim().Equals(""))
                //{
                //    //GPRS号码
                //    string gprsNum = textBox_GPRS.Text.Trim();
                //    if (!CStringUtil.IsDigit(gprsNum))
                //    {
                //        MessageBox.Show("GPRS号码参数不合法,必须全部是数字!");
                //        return null;
                //    }
                station.GPRS = textBox_GPRS.Text.Trim();
                //}

                if (!textBox_Beidou.Text.Trim().Equals(""))
                {
                    string bdNum = textBox_Beidou.Text.Trim();
                    if (!CStringUtil.IsDigit(bdNum))
                    {
                        MessageBox.Show("北斗卫星终端号码参数不合法,必须全部是数字!");
                        return(null);
                    }
                    // 北斗卫星号码
                    station.BDSatellite = bdNum;
                }


                if (!textBox_BeidouMember.Text.Trim().Equals(""))
                {
                    string bdNum = textBox_BeidouMember.Text.Trim();
                    if (!CStringUtil.IsDigit(bdNum))
                    {
                        MessageBox.Show("北斗卫星成员号码参数不合法,必须全部是数字!");
                        return(null);
                    }
                    // 北斗卫星号码
                    station.BDMemberSatellite = bdNum;
                }

                station.Maintran   = comb_MainRoad.Text;
                station.Subtran    = comb_PrepareRoad.Text;
                station.Rainsensor = comb_RainSensor.SelectedIndex.ToString();

                station.Watersensor = comb_WaterSensor.SelectedIndex.ToString();
                station.Datapotocol = comb_DataProtocol.Text;
                //station.DRainAccuracy = float.Parse(cmb_RainAccuracy.Text.ToString());
                station.Reportinterval = comb_Paragraph.Text;
                //if (!textBox_BeidouMember.Text.Trim().Equals(""))
                //{
                //    string bdNum = textBox_BeidouMember.Text.Trim();
                //    if (!CStringUtil.IsDigit(bdNum))
                //    {
                //        MessageBox.Show("北斗卫星成员号码参数不合法,必须全部是数字!");
                //        return null;
                //    }
                //    // 北斗卫星号码
                //    station.BDMemberSatellite = bdNum;
                //}

                //if (comb_MainRoad.Text == "SX-GPRS" || comb_PrepareRoad.Text == "GPRS")
                //{
                //}
                return(station);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
示例#3
0
        // 检验输入是否有效
        private bool AssertInputValid()
        {
            try
            {
                // 1. stationId 不能为空, 也不能重复,只能占用四个字节
                string stationId = textBox_StationID.Text.Trim();
                if (stationId.Equals(""))
                {
                    MessageBox.Show("测站编号不能为空");
                    return(false);
                }
                // 测站编号不能超过10位
                if (stationId.Length > 10)
                {
                    MessageBox.Show("测站编码不能超过10位");
                    return(false);
                }

                // 判断编号是否为负数
                try
                {
                    int.Parse(stationId);
                }
                catch (System.Exception)
                {
                    MessageBox.Show("站点编号不能含有非法字符");
                    return(false);
                }
                for (int i = 0; i < m_listStationCombination.Count; ++i)
                {
                    if (m_listStationCombination[i].StationID.Trim() == stationId)
                    {
                        //MessageBox.Show(string.Format("测站站号不能重复!编号 \"{0}\" 与测站 \"{1}\" 重复",
                        //    stationId, m_listStationCombination[i].StationName.Trim()));
                        MessageBox.Show(string.Format("水情测站站号不能重复!已存在水情测站{0}",
                                                      stationId));
                        return(false);
                    }
                }
                //for (int i = 0; i < m_listSoilStation.Count; ++i)
                //{
                //    if (m_listSoilStation[i].StationID.Trim() == stationId)
                //    {
                //        MessageBox.Show(string.Format("水情测站站号不能与墒情测站编号一样!已存在墒情测站{0}",
                //        stationId));
                //        return false;
                //    }
                //}
                if (comb_MainRoad.Text.ToString() == "SX-GPRS" || comb_PrepareRoad.Text.ToString() == "SX-GPRS")
                {
                    string gprs = textBox_GPRS.Text.Trim();
                    if (gprs.Equals(""))
                    {
                        MessageBox.Show("GPRS号码不能为空!");
                        return(false);
                    }
                    else
                    {
                        //GPRS号码
                        //  string gprsNum = textBox_GPRS.Text.Trim();
                        if (!CStringUtil.IsDigit(gprs))
                        {
                            MessageBox.Show("GPRS号码参数不合法,必须全部是数字!");
                            return(false);
                        }
                        else
                        {
                        }
                    }

                    for (int i = 0; i < m_listStationCombination.Count; ++i)
                    {
                        if (m_listStationCombination[i].GPRS.Trim() == gprs)
                        {
                            MessageBox.Show(string.Format("水情测站Gprs不能重复!与水情站{0} gprs号码一样 ",
                                                          m_listStationCombination[i].StationID.Trim()));
                            return(false);
                        }
                    }
                    //for (int i = 0; i < m_listSoilStation.Count; ++i)
                    //{
                    //    if (m_listSoilStation[i].GPRS.Trim() == gprs)
                    //    {
                    //        MessageBox.Show(string.Format("水情测站Gprs不能重复!与墒情站{0} gprs号码一样 ",
                    //       m_listSoilStation[i].StationID.Trim()));
                    //        return false;
                    //    }

                    //}
                }

                if (System.Text.Encoding.Default.GetByteCount(stationId) > 10)
                {
                    MessageBox.Show("测站ID字符数不能超过10个");
                    return(false);
                }

                // 2. 站名不能为空,不能超过50个字符
                if (textBox_StationName.Text.Trim().Equals(""))
                {
                    MessageBox.Show("站名不能为空");
                    return(false);
                }
                if (System.Text.Encoding.Default.GetByteCount(textBox_StationName.Text.Trim()) > 50)
                {
                    MessageBox.Show("站名不能超过50个字符");
                    return(false);
                }
                // 3. 站类不能为空
                if (cmb_StationType.Text.Equals(""))
                {
                    MessageBox.Show("站点类型不能为空");
                    return(false);
                }
                // 4. 分中心不能为空
                if (cmb_SubCenter.Text.Equals(""))
                {
                    MessageBox.Show("分中心不能为空");
                    return(false);
                }
                // 5. 雨量精度不能为空,如果是水文站或者雨量站
                EStationType type = CEnumHelper.UIStrToStationType(cmb_StationType.Text);
                if (type == EStationType.EHydrology || type == EStationType.ERainFall)
                {
                    if (cmb_RainAccuracy.Text.Equals(""))
                    {
                        MessageBox.Show("雨量精度不能为空");
                        return(false);
                    }
                }
                // 6. 水位基值合法
                if (!textBox_WaterBase.Text.Equals(""))
                {
                    try
                    {
                        Decimal.Parse(textBox_WaterBase.Text);
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show("请输入正确的水位基值" + ex.Message);
                        return(false);
                    }
                }
                // 7. 水位变化合法
                if (!textBox_WaterChange.Text.Equals(""))
                {
                    try
                    {
                        if (Decimal.Parse(textBox_WaterChange.Text) < 0)
                        {
                            MessageBox.Show("水位阀值不能为负!");
                            return(false);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show("请输入正确的水位变化值" + ex.Message);
                        return(false);
                    }
                }
                // 8. 水位最大值合法
                if (!textBox_WaterMax.Text.Equals(""))
                {
                    try
                    {
                        Decimal.Parse(textBox_WaterMax.Text);
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show("请输入正确的水位最大值" + ex.Message);
                        return(false);
                    }
                }
                // 9. 水位最小值
                if (!textBox_WaterMin.Text.Equals(""))
                {
                    try
                    {
                        Decimal.Parse(textBox_WaterMin.Text);
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show("请输入正确的水位最小值" + ex.Message);
                        return(false);
                    }
                }
                // 10. 雨量变化合法
                if (!textBox_RainChange.Text.Equals(""))
                {
                    try
                    {
                        if (Decimal.Parse(textBox_RainChange.Text) < 0)
                        {
                            MessageBox.Show("雨量阀值不能为负!");
                            return(false);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show("请输入正确的雨量变化值" + ex.Message);
                        return(false);
                    }
                }

                // 11. 电压下限合法
                if (!textBox_Voltage.Text.Equals(""))
                {
                    try
                    {
                        if (float.Parse(textBox_Voltage.Text) < 0)
                        {
                            MessageBox.Show("电压阀值不能为负!");
                            return(false);
                        }
                    }
                    catch (System.Exception)
                    {
                        MessageBox.Show("请输入正确的电压阀值");
                        return(false);
                    }
                }

                return(true);
            }catch (Exception ex)
            {
                return(false);
            }
        }
示例#4
0
        private bool DealWithLineData(string str, int lineNumber, ref string strErroInfo, ref List <string> gprs)
        {
            decimal a10, b10, c10, d10, m10, n10, a20, b20, c20, d20, m20, n20, a30, b30, c30, d30, m30, n30, a40, b40, c40, d40, m40, n40, a60, b60, c60, d60, m60, n60, voltagemin;

            string[] results = str.Split(',');
            if (43 == results.Length)
            {
                try
                {
                    string stationid   = results[0];
                    int    subcenterid = CDBDataMgr.Instance.GetSubCenterByName(results[3]).SubCenterID;
                    string cname       = results[1];

                    //    ESoilStationType stationtype = CEnumHelper.UIStrToStationType(results[3]);
                    CEntitySoilStation soilStation = new CEntitySoilStation();
                    soilStation.StationID   = stationid;
                    soilStation.SubCenterID = subcenterid;
                    soilStation.StationName = cname;
                    soilStation.StationType = CEnumHelper.UIStrToStationType(results[2]);
                    if (results[12] != "")
                    {
                        a10             = decimal.Parse(results[12]);
                        soilStation.A10 = a10;
                    }
                    if (results[13] != "")
                    {
                        b10             = decimal.Parse(results[13]);
                        soilStation.B10 = b10;
                    }
                    if (results[14] != "")
                    {
                        c10             = decimal.Parse(results[14]);
                        soilStation.C10 = c10;
                    }
                    if (results[15] != "")
                    {
                        d10             = decimal.Parse(results[15]);
                        soilStation.D10 = d10;
                    }
                    if (results[16] != "")
                    {
                        m10             = decimal.Parse(results[16]);
                        soilStation.M10 = m10;
                    }
                    if (results[17] != "")
                    {
                        n10             = decimal.Parse(results[17]);
                        soilStation.N10 = n10;
                    }
                    if (results[18] != "")
                    {
                        a20             = decimal.Parse(results[18]);
                        soilStation.A20 = a20;
                    }
                    if (results[19] != "")
                    {
                        b20             = decimal.Parse(results[19]);
                        soilStation.B20 = b20;
                    }
                    if (results[20] != "")
                    {
                        c20             = decimal.Parse(results[20]);
                        soilStation.C20 = c20;
                    }
                    if (results[21] != "")
                    {
                        d20 = decimal.Parse(results[21]);

                        soilStation.D20 = d20;
                    }
                    if (results[22] != "")
                    {
                        m20             = decimal.Parse(results[22]);
                        soilStation.M20 = m20;
                    }
                    if (results[23] != "")
                    {
                        n20             = decimal.Parse(results[23]);
                        soilStation.N20 = n20;
                    }
                    if (results[24] != "")
                    {
                        a30             = decimal.Parse(results[24]);
                        soilStation.A30 = a30;
                    }
                    if (results[25] != "")
                    {
                        b30             = decimal.Parse(results[25]);
                        soilStation.B30 = b30;
                    }
                    if (results[26] != "")
                    {
                        c30             = decimal.Parse(results[26]);
                        soilStation.C30 = c30;
                    }
                    if (results[27] != "")
                    {
                        d30             = decimal.Parse(results[27]);
                        soilStation.D30 = d30;
                    }
                    if (results[28] != "")
                    {
                        m30             = decimal.Parse(results[28]);
                        soilStation.M30 = m30;
                    }
                    if (results[29] != "")
                    {
                        n30             = decimal.Parse(results[29]);
                        soilStation.N30 = n30;
                    }
                    if (results[30] != "")
                    {
                        a40             = decimal.Parse(results[30]);
                        soilStation.A40 = a40;
                    }
                    if (results[31] != "")
                    {
                        b40             = decimal.Parse(results[31]);
                        soilStation.B40 = b40;
                    }
                    if (results[32] != "")
                    {
                        c40             = decimal.Parse(results[32]);
                        soilStation.C40 = c40;
                    }
                    if (results[33] != "")
                    {
                        d40             = decimal.Parse(results[33]);
                        soilStation.D40 = d40;
                    }
                    if (results[34] != "")
                    {
                        m40             = decimal.Parse(results[34]);
                        soilStation.M40 = m40;
                    }
                    if (results[35] != "")
                    {
                        n40             = decimal.Parse(results[35]);
                        soilStation.N40 = n40;
                    }
                    if (results[36] != "")
                    {
                        a60             = decimal.Parse(results[36]);
                        soilStation.A60 = a60;
                    }
                    if (results[37] != "")
                    {
                        b60             = decimal.Parse(results[37]);
                        soilStation.B60 = b60;
                    }
                    if (results[38] != "")
                    {
                        c60             = decimal.Parse(results[38]);
                        soilStation.C60 = c60;
                    }
                    if (results[39] != "")
                    {
                        d60             = decimal.Parse(results[39]);
                        soilStation.D60 = d60;
                    }
                    if (results[40] != "")
                    {
                        m60             = decimal.Parse(results[40]);
                        soilStation.M60 = m60;
                    }
                    if (results[41] != "")
                    {
                        n60             = decimal.Parse(results[41]);
                        soilStation.N60 = n60;
                    }
                    if (results[42] != "")
                    {
                        voltagemin             = decimal.Parse(results[42]);
                        soilStation.VoltageMin = voltagemin;
                    }
                    soilStation.GSM = results[4];
                    if (results[5] != "" && gprs.Contains(results[5]))
                    {
                        strErroInfo = string.Format("行:{0} 数据格式错误", lineNumber);
                        return(false);
                    }
                    else
                    {
                        soilStation.GPRS = results[5];
                        gprs.Add(results[5]);
                    }
                    soilStation.BDSatellite       = results[6];
                    soilStation.BDMemberSatellite = results[7];
                    if (results[8] == "SX-GPRS" || results[8] == "GSM" || results[8] == "Beidou-Normal" || results[8] == "Beidou-500")
                    {
                        soilStation.Maintran = results[8];
                    }
                    else
                    {
                        strErroInfo = string.Format("行:{0} 数据格式错误,主信道不能为空", lineNumber);
                        return(false);
                    }
                    //判定subtran不能为空
                    if (results[9] == "SX-GPRS" || results[9] == "GSM" || results[9] == "Beidou-Normal" || results[9] == "Beidou-500" || results[9] == "无")
                    {
                        soilStation.Subtran = results[9];
                    }
                    else
                    {
                        strErroInfo = string.Format("行:{0} 数据格式错误,备用信道不能为空", lineNumber);
                        return(false);
                    }

                    if (results[10] == "LN")
                    {
                        soilStation.Datapotocol = results[10];
                    }
                    else
                    {
                        strErroInfo = string.Format("行:{0} 数据格式错误,数据协议出错", lineNumber);
                        return(false);
                    }
                    if (results[11] == "1" || results[11] == "4" || results[11] == "8" ||
                        results[11] == "12" || results[11] == "24" || results[11] == "48")
                    {
                        soilStation.Reportinterval = results[11];
                    }
                    else
                    {
                        strErroInfo = string.Format("行:{0} 数据格式错误,报讯断次不能为空", lineNumber);
                        return(false);
                    }
                    m_listImport.Add(soilStation);

                    return(true);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.ToString());
                    strErroInfo = string.Format("行:{0} 数据格式错误", lineNumber);
                    return(false);
                }
            }
            else
            {
                strErroInfo = string.Format("行:{0} 数据格式错误", lineNumber);
                return(false);
            }
            // return false;
        }
示例#5
0
        private CEntitySoilStation GenerateSoilStationFromUI()
        {
            try
            {
                if (!AssertInputData())
                {
                    return(null);
                }
                // 读取界面数据,并构建一个站点实体类
                CEntitySoilStation soilStation = new CEntitySoilStation();
                soilStation.StationID   = textBox_StationID.Text.Trim(); //去掉空格
                soilStation.StationName = textBox_StationName.Text.Trim();
                soilStation.SubCenterID = CDBDataMgr.Instance.GetSubCenterByName(cmb_SubCenter.Text).SubCenterID;
                soilStation.StationType = CEnumHelper.UIStrToStationType(cmb_StationType.Text);

                //   soilStation.StrDeviceNumber=textBox_deviceNumber.Text.Trim();
                soilStation.VoltageMin = CStringFromatHelper.ConvertToNullableDecimal(textBox_Voltage.Text.ToString());
                soilStation.A10        = CStringFromatHelper.ConvertToNullableDecimal(textBox_10a.Text.ToString());
                soilStation.A20        = CStringFromatHelper.ConvertToNullableDecimal(textBox_20a.Text.ToString());
                soilStation.A30        = CStringFromatHelper.ConvertToNullableDecimal(textBox_30a.Text.ToString());
                soilStation.A40        = CStringFromatHelper.ConvertToNullableDecimal(textBox_40a.Text.ToString());
                soilStation.A60        = CStringFromatHelper.ConvertToNullableDecimal(textBox_60a.Text.ToString());

                soilStation.B10 = CStringFromatHelper.ConvertToNullableDecimal(textBox_10b.Text.ToString());
                soilStation.B20 = CStringFromatHelper.ConvertToNullableDecimal(textBox_20b.Text.ToString());
                soilStation.B30 = CStringFromatHelper.ConvertToNullableDecimal(textBox_30b.Text.ToString());
                soilStation.B40 = CStringFromatHelper.ConvertToNullableDecimal(textBox_40b.Text.ToString());
                soilStation.B60 = CStringFromatHelper.ConvertToNullableDecimal(textBox_60b.Text.ToString());

                soilStation.C10 = CStringFromatHelper.ConvertToNullableDecimal(textBox_10c.Text.ToString());
                soilStation.C20 = CStringFromatHelper.ConvertToNullableDecimal(textBox_20c.Text.ToString());
                soilStation.C30 = CStringFromatHelper.ConvertToNullableDecimal(textBox_30c.Text.ToString());
                soilStation.C40 = CStringFromatHelper.ConvertToNullableDecimal(textBox_40c.Text.ToString());
                soilStation.C60 = CStringFromatHelper.ConvertToNullableDecimal(textBox_60c.Text.ToString());

                soilStation.D10 = CStringFromatHelper.ConvertToNullableDecimal(textBox_10d.Text.ToString());
                soilStation.D20 = CStringFromatHelper.ConvertToNullableDecimal(textBox_20d.Text.ToString());
                soilStation.D30 = CStringFromatHelper.ConvertToNullableDecimal(textBox_30d.Text.ToString());
                soilStation.D40 = CStringFromatHelper.ConvertToNullableDecimal(textBox_40d.Text.ToString());
                soilStation.D60 = CStringFromatHelper.ConvertToNullableDecimal(textBox_60d.Text.ToString());

                soilStation.M10 = CStringFromatHelper.ConvertToNullableDecimal(textBox_10m.Text.ToString());
                soilStation.M20 = CStringFromatHelper.ConvertToNullableDecimal(textBox_20m.Text.ToString());
                soilStation.M30 = CStringFromatHelper.ConvertToNullableDecimal(textBox_30m.Text.ToString());
                soilStation.M40 = CStringFromatHelper.ConvertToNullableDecimal(textBox_40m.Text.ToString());
                soilStation.M60 = CStringFromatHelper.ConvertToNullableDecimal(textBox_60m.Text.ToString());

                soilStation.N10 = CStringFromatHelper.ConvertToNullableDecimal(textBox_10n.Text.ToString());
                soilStation.N20 = CStringFromatHelper.ConvertToNullableDecimal(textBox_20n.Text.ToString());
                soilStation.N30 = CStringFromatHelper.ConvertToNullableDecimal(textBox_30n.Text.ToString());
                soilStation.N40 = CStringFromatHelper.ConvertToNullableDecimal(textBox_40n.Text.ToString());
                soilStation.N60 = CStringFromatHelper.ConvertToNullableDecimal(textBox_60n.Text.ToString());

                if (!textBox_GSM.Text.Trim().Equals(""))
                {
                    string gsmNum = textBox_GSM.Text.Trim();
                    //  if (!CStringUtil.IsDigitStrWithSpecifyLength(gsmNum, 11))
                    // {
                    //  MessageBox.Show("GSM号码参数不合法,长度必须为11位,必须全部是数字!");
                    if (!CStringUtil.IsDigit(gsmNum))
                    {
                        MessageBox.Show("GSM号码参数不合法,必须全部是数字!");
                        return(null);
                    }
                    // 设置了GSM号码
                    soilStation.GSM = gsmNum;
                }

                if (!textBox_GPRS.Text.Trim().Equals(""))
                {
                    //GPRS号码
                    string gprsNum = textBox_GPRS.Text.Trim();
                    if (!CStringUtil.IsDigit(gprsNum))
                    {
                        MessageBox.Show("GPRS号码参数不合法,必须全部是数字!");
                        return(null);
                    }
                    soilStation.GPRS = gprsNum;
                }

                if (!textBox_Beidou.Text.Trim().Equals(""))
                {
                    string bdNum = textBox_Beidou.Text.Trim();
                    if (!CStringUtil.IsDigit(bdNum))
                    {
                        MessageBox.Show("北斗卫星终端号码参数不合法,必须全部是数字!");
                        return(null);
                    }
                    // 北斗卫星号码
                    soilStation.BDSatellite = bdNum;
                }

                if (!textBox_BeidouMember.Text.Trim().Equals(""))
                {
                    string bdNum = textBox_BeidouMember.Text.Trim();
                    if (!CStringUtil.IsDigit(bdNum))
                    {
                        MessageBox.Show("北斗卫星成员号码参数不合法,必须全部是数字!");
                        return(null);
                    }
                    // 北斗卫星号码
                    soilStation.BDMemberSatellite = bdNum;
                }

                soilStation.Maintran = comb_MainRoad.Text;
                soilStation.Subtran  = comb_PrepareRoad.Text;

                soilStation.Datapotocol    = comb_DataProtocol.Text;
                soilStation.Reportinterval = comb_Paragraph.Text;
                return(soilStation);
            }
            catch (Exception ex) { return(null); }
        }
        /// <summary>
        /// 获取更新过的数据,包括增加的用户记录
        /// </summary>
        private void GetUpdatedData()
        {
            try
            {
                // 标记为删除的就不需要添加的修改或者添加的分中心中了
                List <int> listEditRows = new List <int>();
                foreach (int item in base.m_listEditedRows)
                {
                    if (!m_listMaskedDeletedRows.Contains(item))
                    {
                        listEditRows.Add(item);
                    }
                }
                // 将去重后的项赋给编辑项
                base.m_listEditedRows = listEditRows;
                for (int i = 0; i < base.m_listEditedRows.Count; ++i)
                {
                    CEntitySoilStation soilStation = new CEntitySoilStation();
                    soilStation.StationID   = base.Rows[m_listEditedRows[i]].Cells[CS_StationId].Value.ToString();
                    soilStation.SubCenterID = CDBDataMgr.Instance.GetSubCenterByName(base.Rows[m_listEditedRows[i]].Cells[CS_StationSubcenter].Value.ToString()).SubCenterID;
                    // soilStation.SubCenterID = Int32.Parse(base.Rows[m_listEditedRows[i]].Cells[CS_StationSubcenter].Value.ToString());
                    soilStation.StationName = base.Rows[m_listEditedRows[i]].Cells[CS_StationName].Value.ToString();
                    soilStation.VoltageMin  = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_VoltageMin].Value.ToString());
                    soilStation.StationType = CEnumHelper.UIStrToStationType(base.Rows[m_listEditedRows[i]].Cells[CS_StationType].Value.ToString());


                    //  soilStation.StrDeviceNumber = base.Rows[m_listEditedRows[i]].Cells[CS_DeviceNumber].Value.ToString();
                    soilStation.A10 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_A10].Value.ToString());
                    soilStation.A20 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_A20].Value.ToString());
                    soilStation.A30 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_A30].Value.ToString());
                    soilStation.A40 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_A40].Value.ToString());
                    soilStation.A60 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_A60].Value.ToString());

                    soilStation.B10 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_B10].Value.ToString());
                    soilStation.B20 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_B20].Value.ToString());
                    soilStation.B30 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_B30].Value.ToString());
                    soilStation.B40 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_B40].Value.ToString());
                    soilStation.B60 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_B60].Value.ToString());

                    soilStation.C10 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_C10].Value.ToString());
                    soilStation.C20 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_C20].Value.ToString());
                    soilStation.C30 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_C30].Value.ToString());
                    soilStation.C40 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_C40].Value.ToString());
                    soilStation.C60 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_C60].Value.ToString());

                    soilStation.D10 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_D10].Value.ToString());
                    soilStation.D20 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_D20].Value.ToString());
                    soilStation.D30 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_D30].Value.ToString());
                    soilStation.D40 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_D40].Value.ToString());
                    soilStation.D60 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_D60].Value.ToString());

                    soilStation.M10 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_M10].Value.ToString());
                    soilStation.M20 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_M20].Value.ToString());
                    soilStation.M30 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_M30].Value.ToString());
                    soilStation.M40 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_M40].Value.ToString());
                    soilStation.M60 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_M60].Value.ToString());

                    soilStation.N10 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_N10].Value.ToString());
                    soilStation.N20 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_N20].Value.ToString());
                    soilStation.N30 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_N30].Value.ToString());
                    soilStation.N40 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_N40].Value.ToString());
                    soilStation.N60 = CStringFromatHelper.ConvertToNullableDecimal(base.Rows[m_listEditedRows[i]].Cells[CS_N60].Value.ToString());

                    soilStation.GSM               = base.Rows[m_listEditedRows[i]].Cells[CS_Gsm].Value.ToString();
                    soilStation.GPRS              = base.Rows[m_listEditedRows[i]].Cells[CS_Gprs].Value.ToString();
                    soilStation.BDSatellite       = base.Rows[m_listEditedRows[i]].Cells[CS_BDsatellite].Value.ToString();
                    soilStation.BDMemberSatellite = base.Rows[m_listEditedRows[i]].Cells[CS_BDmember].Value.ToString();
                    soilStation.Maintran          = base.Rows[m_listEditedRows[i]].Cells[CS_Maintran].Value.ToString();
                    soilStation.Subtran           = base.Rows[m_listEditedRows[i]].Cells[CS_Subtran].Value.ToString();
                    soilStation.Datapotocol       = base.Rows[m_listEditedRows[i]].Cells[CS_Dataprotocol].Value.ToString();
                    soilStation.Reportinterval    = base.Rows[m_listEditedRows[i]].Cells[CS_Reportinterval].Value.ToString();

                    String preSoilStation = base.Rows[m_listEditedRows[i]].Cells[CS_StationId].Value.ToString();
                    if (preSoilStation == CS_PreStationId_None)
                    {
                        // 添加的新墒情站配置
                        m_listAddedSoilStation.Add(soilStation);
                    }
                    else
                    {
                        // 如果墒情站的测站id没有改变,那么是更新,如果发生了改变,那么需要先删除,然后添加新的
                        if (preSoilStation == soilStation.StationID)
                        {
                            m_listUpdatedSoilStation.Add(soilStation);
                        }
                        else
                        {
                            // 先删除之前的
                            m_listDeletedStation.Add(preSoilStation);
                            m_listAddedSoilStation.Add(soilStation); //然后再添加新的墒情站
                        }
                    }
                }
                m_listEditedRows.Clear();   //清空此次记录
            }
            catch (Exception ex)
            {
                this.Hide();
                MessageBox.Show("请在同一界面完成修改");
                this.Show();
            }
        }