private void btnConfirm_Click(object sender, EventArgs e) { //if (this.wdmDBtxt.Text == ""||!File.Exists(this.wdmDBtxt.Text)) //{ // MessageBox.Show("请输入WDM数据库文件"); // return; //} //WDMIntegrationModule.setWDMDBFilePath(this.wdmDBtxt.Text); string msg = ""; if (testWDMConnection(out msg)) { WDMIntegrationModule.setWDMDBConnectionStrings(msg); if (testWDMQueryName(out msg, msg)) { this.Close(); } else { MessageBox.Show(msg); } } else { MessageBox.Show(msg); } }
private bool testWDMConnection(out string msg) { msg = ""; if (this.IPtxt.Text == "") { msg = "请输入IP地址"; return(false); } else if (this.DBName.Text == "") { msg = "请输入数据库名称"; return(false); } else if (this.DBUserName.Text == "") { msg = "请输入用户名称"; return(false); } msg = "Data Source=" + this.IPtxt.Text + ";Initial Catalog=" + this.DBName.Text + ";User ID=" + this.DBUserName.Text + ";Password="******"数据库连接失败"; return(false); } else { return(true); } }
private bool testWDMQueryName(out string msg, string connectString) { msg = ""; if (this.AircTxt.Text == "" || !WDMIntegrationModule.testWDMDBConnection(connectString, this.AircTxt.Text)) { msg = "WDM的型号特征不存在"; return(false); } else { WDMIntegrationModule.setWDMDBQueryName("WDM_AIRC", this.AircTxt.Text); } if (this.OperTxt.Text == "" || !WDMIntegrationModule.testWDMDBConnection(connectString, this.OperTxt.Text)) { msg = "WDM的质量特性不存在"; return(false); } else { WDMIntegrationModule.setWDMDBQueryName("WDM_OPER", this.OperTxt.Text); } if (this.StmcTxt.Text == "" || !WDMIntegrationModule.testWDMDBConnection(connectString, this.StmcTxt.Text)) { msg = "WDM的加载状态不存在"; return(false); } else { WDMIntegrationModule.setWDMDBQueryName("WDM_STMC", this.StmcTxt.Text); } return(true); }
private void FromWDM_Load(object sender, EventArgs e) { //this.wdmFile = WDMIntegrationModule.getWDMDBFilePath(); //if (wdmFile == "") //{ // return; //} this.airs = WDMIntegrationModule.getAircs(); if (this.airs == null) { MessageBox.Show("机型没有读取成功,请检查参数配置."); this.Close(); return; } TreeNode parentNode = new TreeNode("WDM机型列表"); this.WDMTree.Nodes.Add(parentNode); for (int i = 0; i < airs.Length; i++) { TreeNode childNode = new TreeNode(); childNode.Name = airs[i].ID; childNode.Text = airs[i].MC; childNode.Tag = i; parentNode.Nodes.Add(childNode); } this.WDMTree.ExpandAll(); }
private void btnConfirm_Click(object sender, EventArgs e) { TreeNode node = this.WDMTree.SelectedNode; if (node == null || node.Level != 1) { MessageBox.Show("请选择机型"); return; } WDMIntegrationModule.Air air = airs[Convert.ToInt32(node.Tag)]; WDMIntegrationModule.TOper[] topers = WDMIntegrationModule.GetOpers(node.Name); //Random r = new Random(); List <WeightData> lstWeightData = new List <WeightData>(); WeightData parentWD = new WeightData(); parentWD.weightName = air.MC; parentWD.nID = 0; parentWD.nParentID = -1; lstWeightData.Add(parentWD); //int i = r.Next(10); double weightValueSum = 0; for (int i = 0; i < topers.Length; i++) { WDMIntegrationModule.TOper toper = topers[i]; if (node.Name == air.ID) { WeightData wd = new WeightData(); wd.weightName = toper.MC; wd.nID = i + 1;// Convert.ToInt32(toper.ID); wd.weightValue = this.actualDataRadio.Checked ? (toper.SCW == 0 && this.useTestData.Checked ? toper.ZTW : toper.SCW) : toper.ZTW; wd.nParentID = 0; // 添加重量数据至重量数据列表 lstWeightData.Add(wd); weightValueSum += wd.weightValue; } } parentWD.weightValue = weightValueSum; WeightSortData wsd = new WeightSortData(); wsd.lstWeightData = lstWeightData; ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(wsd, 2); this.Close(); }
private void FromWDM_Load(object sender, EventArgs e) { this.wdmFile = CommonUtil.getWDMDBFilePath(); if (wdmFile == "") { return; } this.airs = WDMIntegrationModule.getAircs(wdmFile); TreeNode parentNode = new TreeNode("WDM机型列表"); this.WDMTree.Nodes.Add(parentNode); for (int i = 0; i < airs.Length; i++) { TreeNode childNode = new TreeNode(); childNode.Name = airs[i].ID; childNode.Text = airs[i].MC; childNode.Tag = i; parentNode.Nodes.Add(childNode); } this.WDMTree.ExpandAll(); }
private void WDMSettingForm_Load(object sender, EventArgs e) { try { string connectString = WDMIntegrationModule.getWDMDBConnectionStrings(); if (connectString != "") { string[] cs = connectString.Split(';'); this.IPtxt.Text = cs[0].Split('=')[1]; this.DBName.Text = cs[1].Split('=')[1]; this.DBUserName.Text = cs[2].Split('=')[1]; this.DBPassword.Text = cs[3].Split('=').Length == 2 ? cs[3].Split('=')[1] : "";; } this.AircTxt.Text = WDMIntegrationModule.getWDMDBQueryName("WDM_AIRC"); this.OperTxt.Text = WDMIntegrationModule.getWDMDBQueryName("WDM_OPER"); this.StmcTxt.Text = WDMIntegrationModule.getWDMDBQueryName("WDM_STMC"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void loadWDMDB() { this.airs = WDMIntegrationModule.getAircs();//取数据源动作 string msg = ""; if (this.airs == null) { msg = "机型没有读取成功,请检查参数配置."; } //else //{ // TreeNode parentNode = new TreeNode("WDM机型列表"); // this.WDMTree.Nodes.Add(parentNode); // for (int i = 0; i < airs.Length; i++) // { // TreeNode childNode = new TreeNode(); // childNode.Name = airs[i].ID; // childNode.Text = airs[i].MC; // childNode.Tag = i; // parentNode.Nodes.Add(childNode); // } // this.WDMTree.ExpandAll(); //} //执行回调. if (this.InvokeRequired) { CallBackDelegate cbd = new CallBackDelegate(callBack); this.BeginInvoke(cbd, msg); //异步调用回调 //this.Invoke(cbd, msg); //同步调用回调 } else { this.Close(); } }
private void btnConfirm_Click(object sender, EventArgs e) { TreeNode node = this.WDMTree.SelectedNode; if (node == null || node.Level != 1) { MessageBox.Show("请选择机型"); return; } WDMIntegrationModule.Air air = airs[Convert.ToInt32(node.Tag)]; WDMIntegrationModule.TStmc[] tstmcs = WDMIntegrationModule.GetStmcs(node.Name); Random r = new Random(); List <CorePointExt> cpdList = new List <CorePointExt>(); //List<WeightData> lstWeightData = new List<WeightData>(); //CorePointExt parentWD = new CorePointExt(); //parentWD.pointName = air.MC; //parentWD. = 0; //parentWD.nParentID = -1; //lstWeightData.Add(parentWD); //int i = r.Next(10); //double weightValueSum = 0; foreach (WDMIntegrationModule.TStmc tstmc in tstmcs) { if (node.Name == air.ID) { CorePointExt cpe = new CorePointExt(); // gridView.Rows[i].Cells[0].Value = cpe.pointName; //gridView.Rows[i].Cells[1].Value = Math.Round(cpe.pointXValue, 6); //gridView.Rows[i].Cells[2].Value = Math.Round(cpe.pointYValue, 6); //WeightData wd = new WeightData(); cpe.pointName = tstmc.MC; cpe.pointYValue = tstmc.ZTW; cpe.pointXValue = (this.actualDataRadio.Checked?tstmc.XCG:tstmc.YCG) * 1000; //wd.nID = r.Next(10);// Convert.ToInt32(toper.ID); //wd.weightValue = this.actualDataRadio.Checked ? // (tstmc.SCW == 0 && this.useTestData.Checked ? // tstmc.ZTW : tstmc.SCW) : tstmc.ZTW; //wd.nParentID = 0; // 添加重量数据至重量数据列表 cpdList.Add(cpe); // weightValueSum += wd.weightValue; } } //parentWD.weightValue = weightValueSum; ((CoreEnvelopeAssessForm)this.Owner).saveCoreGridView(cpdList, "1"); this.Close(); }