예제 #1
0
        private void yangiUyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewHouse yangiUy = new NewHouse();

            yangiUy.ShowDialog();
            if (yangiUy.DialogResult == DialogResult.OK)
            {
                string sql = $"INSERT INTO Uylar (Viloyat, Tuman,Mahalla, Kocha, Uy, Xonadon, Tur, Qavat, Xona,Narx, Telefon)" +
                             $" VALUES('{yangiUy.Vil}', '{yangiUy.Tum}','{yangiUy.Mah}','{yangiUy.Koch}'," +
                             $"'{yangiUy.Uy.ToString()}', '{yangiUy.Xon.ToString()}','{yangiUy.Tur}'," +
                             $"'{yangiUy.Qavat.ToString()}','{yangiUy.Xona.ToString()}','{yangiUy.Narx}', '{yangiUy.Tel}')";
                datatable = DB.db.Query(sql);

                //MessageBox.Show(sql);
                datatable          = DB.db.Query("select * from Uylar");
                dgvMain.DataSource = datatable;
            }
        }
예제 #2
0
        private void изменитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewHouse yangiUy = new NewHouse(dgvMain.CurrentRow);

            yangiUy.ShowDialog();
            if (yangiUy.DialogResult == DialogResult.OK)
            {
                string sql = $"UPDATE Uylar SET Viloyat='{yangiUy.Vil}', Tuman='{yangiUy.Tum}'," +
                             $" Mahalla='{yangiUy.Mah}',Kocha='{yangiUy.Koch}', Uy='{yangiUy.Uy.ToString()}', " +
                             $" Xonadon='{yangiUy.Xon.ToString()}', Tur='{yangiUy.Tur}'," +
                             $" Qavat='{yangiUy.Qavat.ToString()}', Xona='{yangiUy.Xona.ToString()}'," +
                             $" Narx='{yangiUy.Narx}',Telefon='{yangiUy.Tel}'" +
                             $" WHERE Id={dgvMain.CurrentRow.Cells[0].Value.ToString()}";
                datatable = DB.db.Query(sql);
                //MessageBox.Show(sql);

                File.Copy(yangiUy.PicPath, dataPath + $"\\{dgvMain.CurrentRow.Cells[0].Value.ToString()}.jpg", true);
                datatable          = DB.db.Query("select * from Uylar");
                dgvMain.DataSource = datatable;
            }
        }