Exemplo n.º 1
0
        /// <summary>
        /// 选择风场
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbWindFieldName_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cmbWindFieldName.SelectedItem == null)
            {
                return;
            }
            if ((string)cmbWindFieldName.SelectedItem == "风场名称")
            {
                //展示所有的风场名字
                DisplayNameOfWindField();
                return;
            }

            AllWindField windField = AllWindFieldDAL.GetWindFieldByName((string)cmbCompanyName.SelectedItem, (string)cmbWindFieldName.SelectedItem);

            if (windField == null)
            {
                txtDisplay.Text = "没有查到该风场的信息...";
                return;
            }
            txtDisplay.Text = "业主名称:" + windField.CompanyName
                              + "\n风场名称:" + windField.WindFieldName
                              + "\n详细地址:" + windField.Province + windField.City + windField.DetailAddress
                              + "\n风机数量:" + windField.FanCount + " 台"
                              + "\n风机类型:" + windField.FanType
                              + "\n风机型号:" + windField.FanModelNumber
                              + "\n风机高度:" + windField.FanHeight + " 米"
                              + "\n测风仪型号:" + windField.AnemoscopeModelNumber
                              + "\n信号模式:" + windField.SignalKind;
        }
Exemplo n.º 2
0
        //确认提交新业主
        private void TbtnUploadData_Click(object sender, RoutedEventArgs e)
        {
            if (TtxtCompanyName.Text == string.Empty || TtxtWindFieldName.Text == string.Empty ||
                TtxtTableName.Text == string.Empty || TtxtProvince.Text == string.Empty || TtxtCity.Text == string.Empty)
            {
                MessageBox.Show("必填项不可为空,请填写完整后重试!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            //检测该业主是否已在数据库存在
            int isExistOfCompany = AllWindFieldDAL.IsExistOfCompany(TtxtCompanyName.Text);

            if (isExistOfCompany > 0)
            {
                MessageBox.Show("该业主已经在数据库里存在,无需再次添加!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            //判断输入的数据表名是否在数据库里已经存在
            int isExistOfTable = AllWindFieldDAL.IsExistOfTable(TtxtTableName.Text);

            if (isExistOfTable > 0)
            {
                MessageBox.Show("该数据表名已经在数据库里存在,请更改后重试!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            //创建风场对象
            AllWindField newWindField = new AllWindField();

            newWindField.BranchTableName       = TtxtTableName.Text;
            newWindField.CompanyName           = TtxtCompanyName.Text;
            newWindField.WindFieldName         = TtxtWindFieldName.Text;
            newWindField.Province              = TtxtProvince.Text;
            newWindField.City                  = TtxtCity.Text;
            newWindField.DetailAddress         = TtxtDetailAddress.Text;
            newWindField.FanType               = TtxtFanType.Text;
            newWindField.FanCount              = 0;
            newWindField.FanModelNumber        = TtxtFanModelNumber.Text;
            newWindField.FanHeight             = TtxtFanHeight.Text;
            newWindField.AnemoscopeModelNumber = TtxtAnemoscopeModelNumber.Text;
            newWindField.SignalKind            = TtxtSignalKind.Text;

            //上传数据
            int insertResult = AllWindFieldDAL.InsertData(newWindField);

            if (insertResult <= 0)
            {
                MessageBox.Show("数据提交失败,请检查网络或数据库连接是否正常!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            //创建对应公司的表格
            AllWindFieldDAL.CreateTable(TtxtTableName.Text);
            MessageBox.Show("恭喜您,新业主添加成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
        }
Exemplo n.º 3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //失能对比按钮
            btnAddCompare.IsEnabled = false;
            this.Title = this.CompanyName + "---" + this.WindFieldName + "---第 " + this.FanNumber + " 号风机";
            //获取当前风机的风场信息
            windFieldOfFan = AllWindFieldDAL.GetWindFieldByName(this.CompanyName, this.WindFieldName);
            //获得当前风机的最新数据
            FanPoint fp = FanPointDAL.GetSinglePoint(windFieldOfFan.BranchTableName, this.WindFieldName, this.FanNumber);



            txtbkDigital.Text = "业主名称:" + windFieldOfFan.CompanyName + "\n"
                                + "风场名称:" + windFieldOfFan.WindFieldName + "\n"
                                + "地址:" + windFieldOfFan.Province + windFieldOfFan.City + windFieldOfFan.DetailAddress + "\n\n"
                                + "-------------------------------\n"
                                + "风机型号:" + windFieldOfFan.FanModelNumber + "\n"
                                + "风机高度:" + windFieldOfFan.FanHeight + "\n"
                                + "测风仪型号:" + windFieldOfFan.AnemoscopeModelNumber + "\n"
                                + "-------------------------------\n"
                                + "经纬度:" + fp.GPS_lng + "E  " + fp.GPS_lat + "N\n"
                                + "风机号:" + fp.FanNumber + "\n"
                                + "风速:" + fp.WindSpeed + "\n"
                                + "风向:" + fp.WindDirection + "\n"
                                + "临时IP:" + fp.TempIp + "\n"
                                + "海拔:" + fp.Elevation + "\n"
                                + "航向:" + fp.Course + "\n"
                                + "航速:" + fp.NavigationalSpeed + "\n"
                                + "温度:" + fp.Temperature + "\n"
                                + "湿度:" + fp.Humidity + "\n"
                                + "气压:" + fp.AirPressure + "\n";



            //预加载省份
            provinceArray = AllWindFieldDAL.GetAllProvince();
            if (provinceArray != null)
            {
                //如果查到了省份,则加载到复选框
                List <string> provinceList = new List <string>();
                provinceList.Add("全国范围");
                provinceList.AddRange(provinceArray);
                cmbProvince.ItemsSource  = provinceList;//加载省份
                cmbProvince.SelectedItem = "全国范围";
            }

            //预加载所有公司名称
            companyArray = AllWindFieldDAL.GetCompanyName();
            LoadCompany("全国范围", companyArray);
        }
Exemplo n.º 4
0
        //确认提交新风场
        private void btnUploadData_Click(object sender, RoutedEventArgs e)
        {
            if (cmbCompanyName.SelectedItem == null || txtWindFieldName.Text == string.Empty ||
                txtProvince.Text == string.Empty || txtCity.Text == string.Empty)
            {
                MessageBox.Show("必填项不可为空,请填写完整后重试!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            //检测该风场是否已在数据库存在
            AllWindField awf = AllWindFieldDAL.GetWindFieldByName(cmbCompanyName.SelectedItem.ToString(), txtWindFieldName.Text);

            if (awf != null)
            {
                MessageBox.Show("该风场已经在数据库里存在,请检查风场名是否正确!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            //根据选中的业主名获取公司数据库表名
            string tableName = AllWindFieldDAL.GetTableName(cmbCompanyName.SelectedItem.ToString());
            //创建风场对象
            AllWindField newWindField = new AllWindField();

            newWindField.BranchTableName       = tableName;
            newWindField.CompanyName           = cmbCompanyName.SelectedItem.ToString();
            newWindField.WindFieldName         = txtWindFieldName.Text;
            newWindField.Province              = txtProvince.Text;
            newWindField.City                  = txtCity.Text;
            newWindField.DetailAddress         = txtDetailAddress.Text;
            newWindField.FanType               = txtFanType.Text;
            newWindField.FanCount              = 0;
            newWindField.FanModelNumber        = txtFanModelNumber.Text;
            newWindField.FanHeight             = txtFanHeight.Text;
            newWindField.AnemoscopeModelNumber = txtAnemoscopeModelNumber.Text;
            newWindField.SignalKind            = txtSignalKind.Text;

            //上传数据
            int insertResult = AllWindFieldDAL.InsertData(newWindField);

            if (insertResult <= 0)
            {
                MessageBox.Show("数据提交失败,请检查网络或数据库连接是否正常!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            else
            {
                MessageBox.Show("恭喜您,新风场添加成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
        }
Exemplo n.º 5
0
 //选择风场
 private void cmbWindFieldName_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cmbWindFieldName.SelectedItem == null)
     {
         return;
     }
     if (cmbWindFieldName.SelectedItem.ToString() == "风场名称")
     {
         cmbWindFanNumber.ItemsSource = null;
         return;
     }
     //获得此风机所在的表名 awf.BranchTableName
     windFieldOfCompareFan = AllWindFieldDAL.GetWindFieldByName(cmbCompanyName.SelectedItem.ToString(), cmbWindFieldName.SelectedItem.ToString());
     //获得此风场下的所有风机编号
     int[] fanNumber = FanPointDAL.GetFanNumber(windFieldOfCompareFan.BranchTableName, cmbWindFieldName.SelectedItem.ToString());
     cmbWindFanNumber.ItemsSource = fanNumber;
 }