/// <summary> /// 生成C库 /// </summary> public override void newC() { string strID = this.gridList.CurrentRow.Cells["ID"].Value.ToString(); string crudeIndex = this.gridList.CurrentRow.Cells["原油编号"].Value.ToString(); int ID = 0; if (int.TryParse(strID, out ID)) { OilDataSearchAccess dataSearchAccess = new OilDataSearchAccess(); List <OilDataSearchEntity> dataList = dataSearchAccess.Get("oilInfoID =" + ID).ToList(); if (dataList.Count > 0) { DialogResult r = MessageBox.Show("原油" + crudeIndex + "的查询库数据已经存在是否替换?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (r == DialogResult.Yes) { dataSearchAccess.deleteData("Delete from OilDataSearch where oilInfoID =" + ID); OilInfoBEntity oilB = OilBll.GetOilByCrudeIndex(crudeIndex); OilInfoEntity oilA = OilBll.GetOilById(crudeIndex); if (oilA == null) { OilBll.SaveC(oilB); } else { OilBll.SaveC(oilA, oilB); } MessageBox.Show("原油" + crudeIndex + "生成查询库成功!", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); FrmMain frmMain = this.MdiParent as FrmMain; DatabaseC.FrmOilDataC child = (DatabaseC.FrmOilDataC)frmMain.GetChildFrm(crudeIndex + "C"); if (child != null) { MessageBox.Show("原油" + crudeIndex + "的数据窗体需关闭重新打开才有效!", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); } } } else { DialogResult r = MessageBox.Show("是否保存数据到快速查询库!", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (r == DialogResult.Yes) { dataSearchAccess.deleteData("Delete from OilDataSearch where oilInfoID =" + ID); OilInfoBEntity oilB = OilBll.GetOilByCrudeIndex(crudeIndex); OilInfoEntity oilA = OilBll.GetOilById(crudeIndex); if (oilA == null) { OilBll.SaveC(oilB); } else { OilBll.SaveC(oilA, oilB); } MessageBox.Show("原油" + crudeIndex + "生成查询库成功!", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); FrmMain frmMain = this.MdiParent as FrmMain; DatabaseC.FrmOilDataC child = (DatabaseC.FrmOilDataC)frmMain.GetChildFrm(crudeIndex + "C"); if (child != null) { MessageBox.Show("原油" + crudeIndex + "的数据窗体需关闭重新打开才有效!", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); } } } } else { MessageBox.Show("应用库无此条原油!", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public override void InitTable(string oilId, EnumTableType tableType, string dropDownTypeCode = null) { var oil = OilBll.GetOilByCrudeIndex(oilId); InitTable(oil, tableType, dropDownTypeCode); }