示例#1
0
 private void button1_Click(object sender, EventArgs e)
 {
     GetFromDict dicts = new GetFromDict();
     var online =  dicts.find(textBox1.Text);
     textBox2.Text = online.tureng.literal;
     textBox3.Text = online.zargan.literal;
     textBox4.Text = online.tureng.related;
     textBox5.Text = online.zargan.related;
 }
示例#2
0
        public bool onlineDictInsert(string enstr)
        {
            bool result = false;
            if (!isWordExistsinDBdict(enstr))
            {
                GetFromDict dict = new GetFromDict();
                var rslt = dict.find(enstr);
                if (rslt != null)
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = @" INSERT INTO [onlineDictionary]([enstr],[literalzargan],[relatedzargan],[literaltureng],[relatedtureng])
                                            OUTPUT inserted.id
                                            VALUES(@enstr, @literalzargan, @relatedzargan, @literaltureng, @relatedtureng)";
                    cmd.Parameters.Add("@enstr", SqlDbType.NVarChar).Value = enstr;
                    cmd.Parameters.Add("@literalzargan", SqlDbType.NVarChar).Value = rslt.zargan.literal;
                    cmd.Parameters.Add("@relatedzargan", SqlDbType.NVarChar).Value = rslt.zargan.related;
                    cmd.Parameters.Add("@literaltureng", SqlDbType.NVarChar).Value = rslt.tureng.literal;
                    cmd.Parameters.Add("@relatedtureng", SqlDbType.NVarChar).Value = rslt.tureng.related;

                    sqlinsert(cmd);
                    Console.WriteLine(enstr + " - online Dictionary inserted ");
                    result = true;
                }
            }
            return result;
        }