コード例 #1
0
ファイル: Program.cs プロジェクト: eleite/Sos
        private static void MigrarCategoria()
        {
            var mConn = new MySqlConnection(" Persist __ Security Info=False;server=localhost;database=sos_cadastrar;uid=sos_sos;pwd=123mudar");

            try
            {
                //abre a conexao
                mConn.Open();
            }
            catch
            {
            }

            //verificva se a conexão esta aberta
            if (mConn.State == ConnectionState.Open)
            {
                //cria um adapter usando a instrução SQL para acessar a tabela Clientes
                var mAdapter = new MySqlCommand("SELECT * FROM categoria_site", mConn);
                var dr = mAdapter.ExecuteReader(CommandBehavior.CloseConnection);
                using (var repositorio = new Sos.Negocio.Repositorio.Customizacao.Repositorio())
                {
                    while (dr.Read())
                    {
                        var categoria = new CategoriaProduto();
                        categoria.Nome = dr["nome"].ToString();
                        repositorio.Add(categoria);
                    }
                    repositorio.Save();
                }

            }
        }
コード例 #2
0
ファイル: ModelSos.Designer.cs プロジェクト: eleite/Sos
 /// <summary>
 /// Create a new CategoriaProduto object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="nome">Initial value of the Nome property.</param>
 public static CategoriaProduto CreateCategoriaProduto(global::System.Int32 id, global::System.String nome)
 {
     CategoriaProduto categoriaProduto = new CategoriaProduto();
     categoriaProduto.Id = id;
     categoriaProduto.Nome = nome;
     return categoriaProduto;
 }
コード例 #3
0
ファイル: ModelSos.Designer.cs プロジェクト: eleite/Sos
 /// <summary>
 /// Deprecated Method for adding a new object to the CategoriaProduto EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCategoriaProduto(CategoriaProduto categoriaProduto)
 {
     base.AddObject("CategoriaProduto", categoriaProduto);
 }