public override void Update <Titem>(Titem a) { Lend l = (Lend)(object)a; string sql = string.Format("UPDATE Lends SET subscriberId={0}, workerId={1}, itemId={2}, itemQuantity={3}, lendStartDate='{4}', lendFinishDate='{5}' WHERE lendId={6}", l.SUbscriberId, l.WorkerId, l.ItemId, l.ItemQuantity, l.StartDate, l.EndDate, l.Id); base.Update(sql); }
public override void Insert <Titem>(Titem a) { Lend l = (Lend)(object)a; string sql = string.Format("INSERT INTO Lends (lendId, subscriberId, workerId, itemId, itemQuantity, lendStartDate, lendFinishDate) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", l.Id, l.SUbscriberId, l.WorkerId, l.ItemId, l.ItemQuantity, l.StartDate, l.EndDate); base.Update(sql); }
// add/update private void lendsSubmit1_Click(object sender, EventArgs e) { Lend l = new Lend(); l.Id = int.Parse(lendsInput[0].Text); l.SUbscriberId = int.Parse(lendsInput[1].Text); l.WorkerId = int.Parse(lendsInput[2].Text); l.ItemId = int.Parse(lendsInput[3].Text); l.ItemQuantity = int.Parse(lendsInput[4].Text); l.StartDate = DateTime.Parse(lendsInput[5].Text); l.EndDate = DateTime.Parse(lendsInput[6].Text); UpdateDatabase(lends, l); lendsRefreshDataGridView(); }