Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string          mdName = d_name.Text;
            string          loc    = loca.Text;
            string          st     = stret.Text;
            string          mDate;
            string          mDesc;
            string          mId;
            string          dbprovider = controler.m.getDBprovider();
            String          strSql     = "SELECT * FROM [domain] WHERE [dname]= '" + mdName + "'";
            OleDbConnection conn       = new OleDbConnection(dbprovider);
            MySearchList    sl         = new MySearchList(controler);

            if (!CheckClearly(mdName, loc, st))
            {
            }
            else
            {
                try
                {
                    conn.Open();
                    OleDbCommand    cmd    = new OleDbCommand(strSql, conn);
                    OleDbDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        string mcity   = reader.GetString(6);
                        string mstreet = reader.GetString(7);
                        if (mcity == loc && mstreet == st)
                        {
                            mId   = reader.GetValue(0).ToString();
                            mDesc = reader.GetString(2);
                            mDate = reader.GetString(1);
                            sl.addToList(mId, mdName, mDesc, mDate);
                        }
                    }
                    conn.Close();
                    this.Hide();
                    if (sl.listCount() == -1)
                    {
                        MessageBox.Show("domain didn't exist search one more time or add it");
                        this.Show();
                        d_name.Focus();
                    }
                    else
                    {
                        MessageBox.Show("you must fill Yes if you want to sent request to the partners in this domain at  (yes/no) column else fill No");
                        sl.setStext(mstring.Text);
                        sl.Show();
                    }
                }
                catch
                {
                    // MessageBox.Show("domain didn't exist search one more time or add it");
                    //  name_do.Clear();
                    //  name_do.Focus();
                    //  location.Clear();
                }
            }
        }
Пример #2
0
        public void setMail(String Mail)
        {
            mail.Text = Mail;
            string          dbprovider = controler.m.getDBprovider();
            String          strSql     = "SELECT * FROM [users] WHERE [email]= '" + Mail + "'";
            OleDbConnection conn       = new OleDbConnection(dbprovider);
            MySearchList    sl         = new MySearchList(controler);

            try
            {
                conn.Open();
                OleDbCommand    cmd    = new OleDbCommand(strSql, conn);
                OleDbDataReader reader = cmd.ExecuteReader();
                reader.Read();
                fn.Text     = reader.GetString(1);
                ln.Text     = reader.GetString(2);
                city.Text   = reader.GetString(3);
                street.Text = reader.GetString(4);
                string   t        = reader.GetString(5);
                string[] telArray = t.Split('-');
                firBox.Text = telArray[0];
                tel.Text    = telArray[1];
                age.Text    = reader.GetInt32(6).ToString();
                genbox.Text = reader.GetString(7);
                meter.Text  = reader.GetString(8);
                pass.Text   = reader.GetString(9);
                string   birth     = reader.GetString(10);
                string[] birthDate = birth.Split('/');
                dayBox1.Text        = birthDate[0];
                monBox2.Text        = birthDate[1];
                year.Text           = birthDate[2];
                smok.Checked        = reader.GetBoolean(reader.GetOrdinal("smoking"));
                havePet.Checked     = reader.GetBoolean(12);
                org.Text            = reader.GetInt32(13).ToString();
                education.Text      = reader.GetString(14);
                dustAllergy.Checked = reader.GetBoolean(reader.GetOrdinal("dustellrgy"));
                perBox4.Checked     = reader.GetBoolean(reader.GetOrdinal("perfumellergy"));
                mynote.Text         = (reader["notes"].ToString());
                conn.Close();
                MainForm mf = new MainForm(controler);
                this.Hide();
                mf.Show();
            }
            catch
            {
                MessageBox.Show("can't update");
            }
        }