// get datasource public List <RW_FULL_COF_TANK> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <RW_FULL_COF_TANK> list = new List <RW_FULL_COF_TANK>(); RW_FULL_COF_TANK obj = null; String sql = " Use [rbi] Select [ID]" + ",[CoFValue]" + ",[CoFCategory]" + ",[ProdCost]" + ",[CoFMatrixValue]" + "From [dbo].[RW_FULL_COF_TANK] "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj = new RW_FULL_COF_TANK(); obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.CoFValue = reader.GetFloat(1); } if (!reader.IsDBNull(2)) { obj.CoFCategory = reader.GetString(2); } if (!reader.IsDBNull(3)) { obj.ProdCost = reader.GetFloat(3); } if (!reader.IsDBNull(4)) { obj.CoFMatrixValue = reader.GetFloat(4); } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(list); }
private void initData_CA(int ID) { RW_ASSESSMENT_BUS busAssess = new RW_ASSESSMENT_BUS(); COMPONENT_MASTER_BUS busCompMaster = new COMPONENT_MASTER_BUS(); int[] temp = busAssess.getEquipmentID_ComponentID(ID); int compTypeID = busCompMaster.getComponentTypeID(temp[1]); Console.WriteLine("comTypeID=" + compTypeID + " " + temp[1]); if (compTypeID == 12) { initData_Tank(ID); tabCATankBottom.PageVisible = true; tabCAShell.PageVisible = false; tabCA.PageVisible = false; tabCATankShell.PageVisible = false; TabArea.PageVisible = false; } else if (compTypeID == 8) { initData_Shell(ID); tabCA.PageVisible = false; tabCATankBottom.PageVisible = false; tabCAShell.PageVisible = false; tabCATankShell.PageVisible = true; TabArea.PageVisible = false; } else if (compTypeID == 13) { initData_Shell(ID); tabCA.PageVisible = false; tabCATankBottom.PageVisible = false; TabArea.PageVisible = false; tabCAShell.PageVisible = true; tabCATankShell.PageVisible = true; #region table RW_FULL_COF_TANK RW_FULL_COF_TANK_BUS COFBus = new RW_FULL_COF_TANK_BUS(); RW_FULL_COF_TANK obj = COFBus.getData(ID); txtProdCost.Text = obj.ProdCost.ToString(); txtEquipOutageMultiplier.Text = obj.EquipOutageMultiplier.ToString(); txtEquip.Text = obj.equipcost.ToString(); txtDensity.Text = obj.popdens.ToString(); txtInjury.Text = obj.injcost.ToString(); #endregion } else { riskCA(ID); ShowDataOutputCA(ID); tabCATankBottom.PageVisible = false; tabCAShell.PageVisible = false; tabCA.PageVisible = true; tabCATankShell.PageVisible = false; } }
public void delete(RW_FULL_COF_TANK obj) { DAL.delete(obj.ID); }
public void edit(RW_FULL_COF_TANK obj) { DAL.edit(obj.ID, obj.CoFValue, obj.CoFCategory, obj.ProdCost, obj.CoFMatrixValue); }
public void editInput(RW_FULL_COF_TANK obj) { DAL.editInput(obj.ID, obj.ProdCost, obj.EquipOutageMultiplier, obj.equipcost, obj.popdens, obj.injcost, obj.CoFMatrixValue); }
public void add(RW_FULL_COF_TANK obj) { DAL.add(obj.ID, obj.CoFValue, obj.CoFCategory, obj.ProdCost, obj.EquipOutageMultiplier, obj.equipcost, obj.popdens, obj.injcost, obj.CoFMatrixValue); }
public RW_FULL_COF_TANK getData(int ID) { RW_FULL_COF_TANK obj = new RW_FULL_COF_TANK(); SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); String sql = "USE [rbi]" + "" + "SELECT [ID]" + ",[CoFValue]" + ",[CoFCategory]" + ",[ProdCost]" + ",[EquipOutageMultiplier]" + ",[equipcost]" + ",[popdens]" + ",[injcost]" + ",[CoFMatrixValue]" + "From [dbo].[RW_FULL_COF_TANK] "; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (reader.HasRows) { obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.CoFValue = (float)reader.GetDouble(1); } if (!reader.IsDBNull(2)) { obj.CoFCategory = reader.GetString(2); } if (!reader.IsDBNull(3)) { obj.ProdCost = (float)reader.GetDouble(3); } if (!reader.IsDBNull(4)) { obj.EquipOutageMultiplier = (float)reader.GetDouble(4); } if (!reader.IsDBNull(5)) { obj.equipcost = (float)reader.GetDouble(5); } if (!reader.IsDBNull(6)) { obj.popdens = (float)reader.GetDouble(6); } if (!reader.IsDBNull(7)) { obj.injcost = (float)reader.GetDouble(7); } if (!reader.IsDBNull(8)) { obj.CoFMatrixValue = (float)reader.GetDouble(8); } } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL!"); } finally { conn.Close(); conn.Dispose(); } return(obj); }