Ejemplo n.º 1
0
 public void SetDTO()
 {
     DataModelItemEntity = new DataModelItemDTO
     {
         Id        = null,
         Name      = Name,
         DataModel = CurrentDataModel.GetDTO()
     };
 }
Ejemplo n.º 2
0
        public List <DataModelItemDTO> SelectDataItems(DataModelDTO dto)
        {
            try
            {
                _db.Connection.Open();

                string sql = "SELECT * FROM data_model_item WHERE id_data_model = @id";

                MySqlCommand comm = _db.Connection.CreateCommand();
                comm.CommandText = sql;
                comm.Parameters.AddWithValue("@id", dto.Id);
                MySqlDataReader reader = comm.ExecuteReader();

                List <DataModelItemDTO> items = new List <DataModelItemDTO>();

                int    id;
                string name;

                while (reader.Read())
                {
                    id   = int.Parse(reader["id"].ToString());
                    name = reader["name"].ToString();

                    DataModelItemDTO itemdto = new DataModelItemDTO
                    {
                        Id   = id,
                        Name = name
                    };

                    items.Add(itemdto);
                }

                return(items);
            }
            catch (MySqlException ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                _db.Close();
            }
        }
Ejemplo n.º 3
0
 public void NewDataModelItem(DataModelItemDTO dto)
 {
     mDataModelItem.Insert(dto);
 }
Ejemplo n.º 4
0
 public DataModelItem()
 {
     mDataModelItem      = new DataModelItemDAO();
     DataModelItemEntity = new DataModelItemDTO();
 }