Exemplo n.º 1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            string turkce=textBox2.Text;
            if (textBox1.Text != "" && turkce != "" && comboBox1.SelectedItem != null && comboBox2.SelectedItem != null)
            {
                if (textBox3.Text.Count() > 0)
                {

                    turkce += "," + textBox3.Text;
                }
                if (textBox4.Text.Count() > 0)
                {
                    turkce += "," + textBox4.Text;
                }

                WordEntity we = new WordEntity();
                we.Ingilizce = textBox1.Text;
                we.Turkce = turkce;
                we.Tur = (comboBox1.SelectedItem as WordKindEntity).WordKindId;
                we.Kaynak=(comboBox2.SelectedItem as SourceEntity).SourceId;
                we.Ornek = textBox5.Text == "" ? null : textBox5.Text;

                wl.AddWord(we ,bagcum);
                lstwords.Add(we);

            }
            else
            {
                MessageBox.Show("eksik");
            }
        }
Exemplo n.º 2
0
 public Uyari(WordEntity gelen)
 {
     klm = new WordEntity();
     klm = gelen;
     InitializeComponent();
     Loaded += new RoutedEventHandler(Uyari_Loaded);
 }
Exemplo n.º 3
0
        public void AddWord(WordEntity we,string bagcum)
        {
            using (SqlConnection conn = new SqlConnection(bagcum))
            {
                SqlCommand cmd = conn.CreateCommand();

                IDataParameter Eng = new SqlParameter();
                Eng.ParameterName = "@Eng";
                Eng.Value = (object)we.Ingilizce ?? DBNull.Value;
                Eng.DbType = DbType.String;
                cmd.Parameters.Add(Eng);

                IDataParameter Tr = new SqlParameter();
                Tr.ParameterName = "@Tr";
                Tr.Value = (object)we.Turkce ?? DBNull.Value;
                Tr.DbType = DbType.String;
                cmd.Parameters.Add(Tr);

                IDataParameter Kind = new SqlParameter();
                Kind.ParameterName = "@Kind";
                Kind.Value = (object)we.Tur ?? DBNull.Value;
                Kind.DbType = DbType.Int32;
                cmd.Parameters.Add(Kind);

                IDataParameter Src = new SqlParameter();
                Src.ParameterName = "@Src";
                Src.Value = (object)we.Kaynak ?? DBNull.Value;
                Src.DbType = DbType.Int32;
                cmd.Parameters.Add(Src);

                IDataParameter Orn = new SqlParameter();
                Orn.ParameterName = "@Orn";
                Orn.Value = (object)we.Ornek ?? DBNull.Value;
                Orn.DbType = DbType.String;
                cmd.Parameters.Add(Orn);

                cmd.CommandText = "insert into WordsDB(WordEnglish,WordTurkish,WordKindId,SourceId,Ornek) values (@Eng,@Tr,@Kind,@Src,@Orn)";
                conn.Open();
                cmd.ExecuteNonQuery();
            }
        }
Exemplo n.º 4
0
 public void AddWord(WordEntity we,string bagcum)
 {
     dic.AddWord(we,bagcum);
 }
Exemplo n.º 5
0
        public System.Collections.ObjectModel.ObservableCollection<WordEntity> GetWord(string bagcum, int aranan)
        {
            System.Collections.ObjectModel.ObservableCollection<WordEntity> lst = new System.Collections.ObjectModel.ObservableCollection<WordEntity>();

            using (SqlConnection connection = new SqlConnection(bagcum))
            {
                SqlCommand command = connection.CreateCommand();
                command.CommandText = "select * from WordsDB where SourceId="+aranan;
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        WordEntity we = new WordEntity();
                        we.WordId = reader.GetInt32(0);
                        we.Ingilizce = reader.GetString(1);
                        we.Turkce = reader.GetString(2);
                        we.Tur = reader.GetInt32(3);
                        we.Kaynak = reader.GetInt32(4);
                        we.Ornek = (reader.IsDBNull(5) ? "" : reader.GetString(5));
                        lst.Add(we);

                        //lst.Add(new WordEntity()
                        //{
                        //    WordId = reader.GetInt32(0),
                        //    Ingilizce = reader.GetString(1),
                        //    Turkce = reader.GetString(2),
                        //    Tur = reader.GetInt32(3),
                        //    Kaynak = reader.GetInt32(4),
                        //    Ornek = reader.GetString(5)
                        //});
                    }
                }
                return lst;
            }
        }