public API_COMPONENT_TYPE getData1()
        {
            API_COMPONENT_TYPE api = new API_COMPONENT_TYPE();

            api.APIComponentTypeName = cbAPIComponentType.Text;
            return(api);
        }
Beispiel #2
0
 public void edit(API_COMPONENT_TYPE obj)
 {
     DAL.edit(obj.APIComponentTypeID, obj.APIComponentTypeName, obj.GFFSmall, obj.GFFMedium,
              obj.GFFLarge, obj.GFFRupture, obj.GFFTotal, obj.HoleCostSmall, obj.HoleCostMedium,
              obj.HoleCostLarge, obj.HoleCostRupture, obj.OutageSmall, obj.OutageMedium, obj.OutageLarge,
              obj.OutageRupture);
 }
        public List <API_COMPONENT_TYPE> getDataSource()
        {
            SqlConnection conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            List <API_COMPONENT_TYPE> list = new List <API_COMPONENT_TYPE>();
            API_COMPONENT_TYPE        obj  = null;
            String sql = " Use [rbi] Select [APIComponentTypeID]" +
                         ",[APIComponentTypeName]" +
                         ",[GFFSmall]" +
                         ",[GFFMedium]" +
                         ",[GFFLarge]" +
                         ",[GFFRupture]" +
                         ",[GFFTotal]" +
                         ",[HoleCostSmall]" +
                         ",[HoleCostMedium]" +
                         ",[HoleCostLarge]" +
                         ",[HoleCostRupture]" +
                         ",[OutageSmall]" +
                         ",[OutageMedium]" +
                         ",[OutageLarge]" +
                         ",[OutageRupture]" +
                         "From [dbo].[API_COMPONENT_TYPE]";

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj = new API_COMPONENT_TYPE();
                            obj.APIComponentTypeID   = reader.GetInt32(0);
                            obj.APIComponentTypeName = reader.GetString(1);
                            obj.GFFSmall             = (float)reader.GetDouble(2);
                            obj.GFFMedium            = (float)reader.GetDouble(3);
                            obj.GFFLarge             = (float)reader.GetDouble(4);
                            obj.GFFRupture           = (float)reader.GetDouble(5);
                            obj.GFFTotal             = (float)reader.GetDouble(6);
                            obj.HoleCostSmall        = (float)reader.GetDouble(7);
                            obj.HoleCostMedium       = (float)reader.GetDouble(8);
                            obj.HoleCostLarge        = (float)reader.GetDouble(9);
                            obj.HoleCostRupture      = (float)reader.GetDouble(10);
                            obj.OutageSmall          = (float)reader.GetDouble(11);
                            obj.OutageMedium         = (float)reader.GetDouble(12);
                            obj.OutageLarge          = (float)reader.GetDouble(13);
                            obj.OutageRupture        = (float)reader.GetDouble(14);
                            list.Add(obj);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "GET DATA FAIL!");
            }
            finally
            {
                conn.Close();
            }
            return(list);
        }
Beispiel #4
0
 public void delete(API_COMPONENT_TYPE obj)
 {
     DAL.delete(obj.APIComponentTypeID);
 }