private void loadData() { dtable = DatHelper.Read(); //List<FenXiModel> datasource = DatHelper.ReadYsfx(); foreach (DataRow dr in dtable.Rows) { ListBoxItem item = new ListBoxItem(); item.Content = dr[0]; ListBox1.Items.Add(item); } string sql = "select * from WELL_STATUS"; wellLocation = DbHelperOleDb.Query(sql).Tables[0]; string temp = WaterWellMonth.getMinDate(); datePicker1.SelectedDate = DateTime.Parse(temp); temp = WaterWellMonth.getMaxDate(); datePicker2.SelectedDate = DateTime.Parse(temp); //if (datasource.Count > 0) //{ // list = datasource; // (from i in datasource select i.SJH).Distinct().ToList().ForEach(x => ListBox2.Items.Add(x)); //} }
public DataSet ExecuteDataSet(MsDatParameters db_params) { var _sqlstr = String.Format("SELECT * FROM {0}\n", m_tblName); var _index = 0; var _where = ""; foreach (MsDatParameter _p in db_params) { if (String.IsNullOrEmpty(_where) == true) { _where += " WHERE "; } if (String.IsNullOrEmpty(_p.Field) == true) { _where += String.Format("{0}={1}", _p.Name.Substring(1), _p.Name); } else { _where += String.Format("{0}={1}", _p.Field, _p.Name); } if (_index != db_params.Count - 1) { _where += " AND "; } _index++; } _sqlstr += _where; return(DatHelper.ExecuteDataSet(ConnectionString, _sqlstr, db_params)); }
/// <summary> /// 获取表格DVG数据,通过读取原始dat文件 /// </summary> /// <param name="_data"></param> /// <returns></returns> public bool GetDGVData(Data _data) { try { watch1.Start(); List <double[]> dt = DatHelper.ReadDat(_data.Name); watch1.Stop(); //_data.DGVDataSource = dt; if (dt == null || dt.Count == 0) { return(false); } watch2.Start(); if (GEOHelper.normalizationsToFile(dt, _data.Name) == null) { return(false); } watch2.Stop(); Console.WriteLine("DatHelper.ReadDat方法运行时长:" + watch1.Elapsed.TotalMilliseconds); Console.WriteLine("调用geo方法运行时长:" + watch2.Elapsed.TotalMilliseconds); watch1.Reset(); watch2.Reset(); return(true); } catch (Exception ex) { Log4netHelper.Error(ex); return(false); } }
/// <summary> /// 删除原始dat文件最后一条测点 /// </summary> /// <param name="Lastid"></param> /// <returns></returns> public bool DeleteDat(string FileName) { try { return(DatHelper.DeleteDat(FileName)); } catch (Exception ex) { Log4netHelper.Error(ex); return(false); } }
private void Btn_save_Click(object sender, RoutedEventArgs e) { try { DatHelper.SaveToDat(list); MessageBox.Show("操作成功!"); } catch (Exception ex) { MessageBox.Show("操作失败!原因:" + ex.Message); } }
/// <summary> /// 数据加载 /// </summary> private void loading_data() { List <tpc_model> list = DatHelper.read_tpc(); #region 调试模式 if (App.is_debug == true) { debug_loading_data(); return; } #endregion if (list != null) { // 调剖井数据加载 List <string> list_tpj = Data.DatHelper.TPJRead(); List <string> list_tpc = new List <string>(); foreach (tpc_model tpc in list) { list_tpc.Add(tpc.jh); } list_tpj = list_tpj.Except(list_tpc).ToList(); // 差集 oc_tpj = new ObservableCollection <tpc_model>(list_tpj.Select(p => new tpc_model() { jh = p })); // 调剖层数据加载 foreach (tpc_model item in list) { oc_tpc.Add(item); } // 井组连通数据加载 foreach (tpc_jzlt_model item in Data.DatHelper.read_jzlt()) { oc_jzlt.Add(item); } } else { List <string> list_tpj = Data.DatHelper.TPJRead(); foreach (string str in list_tpj) { oc_tpj.Add(new tpc_model() { jh = str }); } } }
public TPJ_XSPM(TPJXGPJ pJXGPJ) { InitializeComponent(); tpj = pJXGPJ; TpxgModels = pJXGPJ.tpxgModels; tpjpara = DatHelper.TPJParaRead(); this.Loaded += ListInitialize; csq_date.Checked += new RoutedEventHandler(CSQ_Radio_Checked); csq_img.Checked += new RoutedEventHandler(CSQ_Radio_Checked); csq_img.Unchecked += new RoutedEventHandler(Radio_UnChecked); csh_date.Checked += new RoutedEventHandler(CSH_Radio_Checked); csh_img.Checked += new RoutedEventHandler(CSH_Radio_Checked); csh_img.Unchecked += new RoutedEventHandler(Radio_UnChecked); }
public bool CheckExistence(MsDatParameters db_params) { bool _result; DataSet _ds = ExecuteDataSet(db_params); if (DatHelper.IsNullOrEmpty(_ds) == false) { _result = true; } else { _result = false; } return(_result); }
/// <summary> /// 采集数据插入原始dat文件 /// </summary> /// <param name="data"></param> /// <returns></returns> public bool AppendDat(Data _data) { try { if (DatHelper.AppendDat(_data.Name, _data.ModbusData)) { return(true); } return(false); } catch (Exception ex) { Log4netHelper.Error(ex); return(false); } }
public void OpenDatFile(string path) { if (!DatHelper.TestFile(path) || dispatcher.Ecu.IsStarted) { return; } var oldDatFile = dispatcher.DatFile; if (!dispatcher.OpenDatFile(path)) { return; } var newDatFile = dispatcher.DatFile; PrepareOpenedDatFile(oldDatFile, newDatFile); }
public bool OpenDatFile(string path) { if (!DatHelper.TestFile(path)) { return(false); } DatFile = new DatFile(path); if (calibrLogger != null) { calibrLogger.Close(); } calibrLogger = new CalibrLogger(DatFile, Ecu); return(true); }
/// <summary> /// 获取曲线图Chart数据,通过读取归一化dat文件 /// </summary> /// <param name="_data"></param> /// <returns></returns> public bool GetChartData(Data _data) { try { double[][] dt = DatHelper.ReadGEODat(_data.Name); _data.ChartDataSource = dt; if (dt == null || dt.Length == 0) { return(false); } return(true); } catch (Exception ex) { Log4netHelper.Error(ex); return(false); } }
public bool DeleteInfo(string info_name) { try { if (!DatHelper.DeleteBoth(info_name)) { return(false); } string sql2 = " delete from info where name = '" + info_name + "'"; if (SQLiteHelper.ExecuteNonQuery(sql2) == 0) { return(false); } return(true); } catch (Exception ex) { Log4netHelper.Error(ex); return(false); } }
public static XGYC_ZRJ_BLL getBLL(string jh) { XGYC_ZRJ_BLL bll = new XGYC_ZRJ_BLL(); bll.JH = jh; bll.tpj = DatHelper.ReadTPJ(jh); bll.tpcxx = DatHelper.read_jcxx_tpcxx().FirstOrDefault(n => n.jh == jh); //注入液粘度:读取RSL3.DAT中**TPDSSJ 调前注入液粘度-----------------------------------------(未完成) //bll.ZRYND = double.Parse(DatHelper.SaveTQZRYND()); bll.ZRYND = 10; //日注液量:读取RSL3.DAT中**JCXX *TPCL 日注液量 bll.tpcl = DatHelper.read_jcxx_tpcls().FirstOrDefault(n => n.jh == jh); if (bll.tpcl != null) { bll.RZYL = bll.tpcl.dqrzl; } //bll.RZYL = 18.03; //调剖半径:读取RSL3.DAT中*STCS 调剖半径-----------------------------------------(未完成) bll.TPBJ = 3; //措施前视吸水指数:读取RSL1.DAT中**PROFILE CONTROL WELL *TWELL 视吸水指数 if (bll.tpj != null) { bll.CSQ_SXSZS = bll.tpj.AWI; } //bll.CSQ_SXSZS = 11; //等效压力 = 日注液量 / 措施前视吸水指数 try { bll.CSQ_DXYL = bll.RZYL / bll.CSQ_SXSZS; } catch { bll.CSQ_DXYL = 0; } return(bll); }
private void Button_Click(object sender, RoutedEventArgs e) { var selecteditems = Wells.SelectedItems.OfType <DataRowView>().ToList(); if (parentPage.Title.Equals("储层物性动态计算")) { selecteditems.ForEach( x => ccwx_bll.oc_tpjing_info.Add(new ccwx_tpjing_model() { jh = x.Row.ItemArray[0].ToString(), IsCustomize = true })); } else { selecteditems.ForEach( x => { string jh = x.Row.ItemArray[0].ToString(); var targetwell = DatHelper.read_zcjz().Find(x => x.JH.Equals(jh)); jcxx_bll.oc_tpcxx.Add(new jcxx_tpcxx_model() { jh = jh }); jcxx_bll.oc_tpjxx.Add(new jcxx_tpjxx_model() { jh = jh }); jcxx_bll.oc_tpcls.Add(new jcxx_tpcls_model() { jh = jh, Zcjj = targetwell == null ? 0 : targetwell.AverageDistance }); }); } this.Close(); }
public DataSet ExecuteDataSet() { var _sqlstr = "SELECT * FROM " + m_tblName; return(DatHelper.ExecuteDataSet(ConnectionString, _sqlstr)); }
/// <summary> /// 按钮“保存”操作接口 /// </summary> public bool btn_save() { return(DatHelper.save_zcjz(oc_well_group.Where(p => p.Selected == true).ToList())); }
/// <summary> /// 按钮“保存”操作接口 /// </summary> public bool btn_save() { DatHelper.save_tpc(oc_tpc.ToList()); DatHelper.save_tpc_jzlt(oc_jzlt.ToList()); return(true); }
//----------------------------------------------------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------------------------------------------------- private void _fillBinarySet(string connection_string, string command_text, MsDatParameters db_params) { DatStore.Merge(DatHelper.SelectDataSet(connection_string, command_text, db_params)); }
public static XGYC_SCJ_BLL getBLL(string jz) { XGYC_SCJ_BLL bll = new XGYC_SCJ_BLL(); bll.JZ = jz; bll.tpj = DatHelper.read_jcxx_tpjxx().FirstOrDefault(n => n.jh == jz); //调剖有效期:所选液体调剖剂(PC_XTPL_STATUS)中SXQ字段 string sql = string.Format("Select SXQ From PC_XTPL_STATUS Where MC='{0}'", bll.tpj.klmc); object ob = DbHelperOleDb.GetSingle(sql); if (ob == null) { bll.TPYXQ = 0; } else { bll.TPYXQ = double.Parse(ob.ToString()); } //调剖层增油:读取RSL3.DAT中*STCS中增油量-----------------------------------------(未完成) double tpczy = 0; //日注液量Q:读取RSL3.DAT中**JCXX *TPCL 日注液量 double Q = 0; jcxx_tpcls_model tpcl = DatHelper.read_jcxx_tpcls().FirstOrDefault(n => n.jh == jz); if (tpcl != null) { Q = tpcl.dqrzl; } //措施后增注段吸液量Q2:读取RSL4.DAT中*ZRYC 措施后增注段吸液量 double Q2 = 0; XGYC_ZRJ_BLL item = DatHelper_RLS4.read_XGYC_ZRJ(jz); if (item != null) { Q2 = item.CSQ_ZZDXYL; } //井组措施前含水 : 读取RSL1.DAT中**PROFILE CONTROL WELL *TWELL 综合含水 TPJData tpj = DatHelper.ReadTPJ(jz); double hs = tpj.ZHHS; //层间增油 =(Q-Q2)*(100 - 井组措施前含水 + 年含水上升率 * 有效期 / 2) double cjzy = (Q - Q2) * (100 - hs + bll.NHSSSL * bll.TPYXQ / 2); //计算增油 = 调剖层增油 + 层间增油 bll.ZY = tpczy + cjzy; //从RLS1.DAT文件中读取开始日期和结束日期 string[] tpjpara = DatHelper.TPJParaRead(); DateTime startDT = DateTime.Parse(tpjpara[1]); DateTime endDT = DateTime.Parse(tpjpara[2]); //string startYearMonth = ""; //string endYearMonth = ""; //累注母液量:对应时间段内累注母液量的均值 sql = string.Format("Select * from water_well_month where JH = \"{0}\" and NY between #{1}# and #{2}# Order by NY", jz, startDT.ToString("yyyy/MM"), endDT.ToString("yyyy/MM")); DataTable dt = DbHelperOleDb.Query(sql.ToString()).Tables[0]; ob = dt.Compute("avg(LZMYL)", "LZMYL<>0"); double lzmyl = double.Parse(ob.ToString()); //累计注水量:对应时间段内存在累注母液量的累计注水量的均值 ob = dt.Compute("avg(LJZSL)", "LZMYL<>0"); double ljzsl = double.Parse(ob.ToString()); //调前累计注水量:上个月的累计注水量 startDT = startDT.AddMonths(-1); sql = string.Format("Select LJZSL from water_well_month where JH = \"{0}\" and NY=#{1}#", jz, startDT.ToString("yyyy/MM")); dt = DbHelperOleDb.Query(sql.ToString()).Tables[0]; if (dt.Rows.Count != 0) { bll.dqljzsl = double.Parse(dt.Rows[0]["LJZSL"].ToString()); } //计算见效时间 = (累计母液量 + 累计注水量 - 调前累计注水量)*10000 / 日注液量Q bll.JXSJ = (lzmyl + ljzsl - bll.dqljzsl) * 10000 / Q; return(bll); }
public object SelectScalar(string sql_string, MsDatParameters db_params) { return(DatHelper.SelectScalar(ConnectionString, sql_string, db_params)); }
//----------------------------------------------------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------------------------------------------------- public DataSet FillSchema() { return(DatHelper.FillSchema(ConnectionString, m_tblName)); }
public DataSet ExecuteDataSet(string sql_string, MsDatParameters db_params) { return(DatHelper.ExecuteDataSet(ConnectionString, sql_string, db_params)); }