public void riskCA(int ID) { RW_FULL_FCOF_BUS fullPoFBus = new RW_FULL_FCOF_BUS(); RW_FULL_FCOF fullPoF = fullPoFBus.getData(ID); txtProductionCost.Text = fullPoF.prodcost.ToString(); txtEquipmentCost.Text = fullPoF.equipcost.ToString(); txtPopdens.Text = fullPoF.popdens.ToString(); txtInjureCost.Text = fullPoF.injcost.ToString(); txtEnvironmentCost.Text = fullPoF.envcost.ToString(); txtFC.Text = fullPoF.FCoFValue.ToString(); txtCA.Text = fullPoF.FCoFCategory; }
public void delete(RW_FULL_FCOF obj) { DAL.delete(obj.ID); }
public void edit(RW_FULL_FCOF obj) { DAL.edit(obj.ID, obj.FCoFValue, obj.FCoFCategory, obj.AIL, obj.envcost, obj.equipcost, obj.prodcost, obj.popdens, obj.injcost, obj.FCoFMatrixValue); }
public RW_FULL_FCOF getData(int ID) { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); RW_FULL_FCOF obj = new RW_FULL_FCOF(); String sql = "SELECT ID,FCoFValue,FCoFCategory,AIL,envcost,equipcost,prodcost,popdens,injcost, FCoFMatrixValue FROM rbi.dbo.RW_FULL_FCOF WHERE ID = '" + ID + "'"; 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.FCoFValue = (float)reader.GetDouble(1); } if (!reader.IsDBNull(2)) { obj.FCoFCategory = reader.GetString(2); } if (!reader.IsDBNull(3)) { obj.AIL = Convert.ToInt32(reader.GetBoolean(3)); } if (!reader.IsDBNull(4)) { obj.envcost = (float)reader.GetDouble(4); } if (!reader.IsDBNull(5)) { obj.equipcost = (float)reader.GetDouble(5); } if (!reader.IsDBNull(6)) { obj.prodcost = (float)reader.GetDouble(6); } if (!reader.IsDBNull(7)) { obj.popdens = (float)reader.GetDouble(7); } if (!reader.IsDBNull(8)) { obj.injcost = (float)reader.GetDouble(8); } if (!reader.IsDBNull(9)) { obj.FCoFMatrixValue = (float)reader.GetDouble(9); } } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL !"); } finally { conn.Close(); conn.Dispose(); } return(obj); }
/// ge tdatasource /// public List <RW_FULL_FCOF> getDataSource() { SqlConnection conn = MSSQLDBUtils.GetDBConnection(); conn.Open(); List <RW_FULL_FCOF> list = new List <RW_FULL_FCOF>(); RW_FULL_FCOF obj = null; String sql = " Use [rbi] Select [ID]" + ",[FCoFValue]" + ",[FCoFCategory]" + ",[AIL]" + ",[envcost]" + ",[equipcost]" + ",[prodcost]" + ",[popdens]" + ",[injcost]" + ",[FCoFMatrixValue]" + "From [dbo].[RW_FULL_FCOF] "; 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_FCOF(); obj.ID = reader.GetInt32(0); if (!reader.IsDBNull(1)) { obj.FCoFValue = reader.GetFloat(1); } if (!reader.IsDBNull(2)) { obj.FCoFCategory = reader.GetString(2); } obj.AIL = reader.GetInt32(3); if (!reader.IsDBNull(4)) { obj.envcost = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { obj.equipcost = reader.GetFloat(5); } if (!reader.IsDBNull(6)) { obj.prodcost = reader.GetFloat(6); } if (!reader.IsDBNull(7)) { obj.popdens = reader.GetFloat(7); } if (!reader.IsDBNull(8)) { obj.injcost = reader.GetFloat(8); } if (!reader.IsDBNull(9)) { obj.FCoFMatrixValue = reader.GetFloat(9); } list.Add(obj); } } } } catch (Exception e) { MessageBox.Show(e.ToString(), "GET DATA FAIL"); } finally { conn.Close(); conn.Dispose(); } return(list); }
public void add(RW_FULL_FCOF obj) { DAL.add(obj.ID, obj.FCoFValue, obj.FCoFCategory, obj.AIL, obj.EquipOutageMultiplier, obj.envcost, obj.equipcost, obj.prodcost, obj.popdens, obj.injcost, obj.FCoFMatrixValue); }