void getRes(object sender, RoutedEventArgs e) { OilsDAL oilsDal = new OilsDAL(); ComboBoxItem item = (ComboBoxItem)oils.SelectedItem; DataTable oilsdata = oilsDal.getSingleOilosData(int.Parse(item.Tag + "")); Oils oil = new Oils() { // Density = "754", Density = oilsdata.Rows[0]["oils_density"] + "", // Viscosity = "1.08E-06", Viscosity = oilsdata.Rows[0]["oils_viscosity"] + "", // OutputByYear = "270", OutputByYear = oilsdata.Rows[0]["output_year"] + "", // MasFlow = "600", MasFlow = oilsdata.Rows[0]["mass_flow"] + "", // Volume_concentration = "0.01" Volume_concentration = oilsdata.Rows[0]["volume_concentration"] + "", }; PipeDAL pipeDal = new PipeDAL(); item = (ComboBoxItem)pipe.SelectedItem; ProDAL proDal = new ProDAL(); int proid = proDal.getNowPro(); DataTable pipedata = pipeDal.getSinglePipeData(proid, int.Parse(item.Tag + "")); Pipe pip = new Pipe(1, 1, "", "", "", pipedata.Rows[0]["pipe_length"] + "" , pipedata.Rows[0]["pipe_outer_diameter"] + "", pipedata.Rows[0]["wall_thickness"] + "", "", "", "", "", "", "", "", ""); PumpDAL pumpDal = new PumpDAL(); item = (ComboBoxItem)pump.SelectedItem; DataTable pumpdata = pumpDal.getSinglePumpData(int.Parse(item.Tag + "")); Pump pum = new Pump("", 1, "", "", pumpdata.Rows[0]["power"] + "", "", "", pumpdata.Rows[0]["in_pressure"] + "", pumpdata.Rows[0]["out_pressure"] + ""); OtherDAL otherDAL = new OtherDAL(); item = (ComboBoxItem)other.SelectedItem; DataTable otherdata = otherDAL.getSingleOtherData(int.Parse(item.Tag + "")); // PowerCost pc = new PowerCost(oil, pip, pum, 350, 0.87, 27, 150, double.Parse(otherdata.Rows[0]["cost_operating"] + ""), 1.5, 0.06, 9.8, 30); double[] q = new double[] { 300, 500, 600 }; double[] H = new double[] { 650, 600, 550 }; ////public PowerCost(Oils oils, Pipe pipe, Pump pump, double[] 泵流量, double[] 泵扬程, //double 年工作时间, double 电机效率, double 管道起点高程, double 管道终点高程, // double 电费, double 流速, double 当量粗糙度, double 重力加速度, double 首站进站压力) PowerCost pc = new PowerCost(oil, pip, pum, q, H, double.Parse(年工作时间.Text), double.Parse(电机效率.Text), double.Parse(管道起点高程.Text), double.Parse(管道终点高程.Text), double.Parse(otherdata.Rows[0]["cost_operating"] + ""), double.Parse(流速.Text), double.Parse(当量粗糙度.Text), double.Parse(重力加速度.Text), double.Parse(首站进站压力.Text)); double 运行能耗 = pc.getResult(); Console.WriteLine("----------------------------------------------------------"); Console.WriteLine("运行能耗:{0}", 运行能耗); res.Content = 运行能耗 + "元"; resa.Visibility = Visibility.Visible; }