示例#1
0
        private void AddUslugaClick(object sender, EventArgs e)
        {
            AddUsluga f = new AddUsluga();

            if (f.ShowDialog() == DialogResult.OK)
            {
                using (InzynierkaDBEntities db = new InzynierkaDBEntities())
                {
                    db.Uslugi.Add(f.nowaUsluga);
                    db.SaveChanges();
                }
            }
        }
示例#2
0
        private void EditUslugaClick(object sender, EventArgs e)
        {
            int    rowID = Convert.ToInt32(ShowUslugi.selectedRow.Cells["id"].Value.ToString());
            Uslugi u;

            using (InzynierkaDBEntities db = new InzynierkaDBEntities())
            {
                u = db.Uslugi.Where(x => x.usluga_id == rowID).First();
            }

            AddUsluga f = new AddUsluga(u);

            if (f.ShowDialog() == DialogResult.OK)
            {
                string updateQuery =
                    "UPDATE Uslugi SET " +
                    "nazwa = '" + f.nowaUsluga.nazwa + "', " +
                    "koszt_brutto = " + f.nowaUsluga.koszt_brutto + " " +
                    "WHERE usluga_id = " + u.usluga_id + ";";
                SQL.DoQuery(updateQuery);
            }
        }