public void DeleteGood(Good item) { string query = "delete from [Store].[dbo].[Goods] where Id = " + item.Id.ToString(); using (SqlCommand _dbCommand = new SqlCommand()) { _dbCommand.CommandText = query; AL.duiQuery(query); } }
public void SaveGood(Good item) { string query ; if (item.Id != 0) { query = "update [Store].[dbo].[Goods] set title='" + item.Title + "', Amount = " + item.Amount.ToString() + " where Id = " + item.Id.ToString(); } else { query = "insert into [Store].[dbo].[Goods] ([Title], [Amount]) values ('" + item.Title + "'," + item.Amount.ToString() + ")"; } using (SqlCommand _dbCommand = new SqlCommand()) { _dbCommand.CommandText = query; AL.duiQuery(query); } }
private void Button_Click(object sender, RoutedEventArgs e) { switch (IsEdit) { case EWStatus.Create:{ int Amount; try { Amount = Convert.ToInt32(tb_Amount.Text); } catch(Exception ex){ MessageBox.Show("Amount value incorrect", "Attention!"); return; } Good item = new Good(0, tb_Title.Text.ToString(), Convert.ToDateTime(null), Amount); //WCFStoreServiceManager.StoreServiceClient client = new StoreServiceClient(); //client.SaveGood(item); WCFClient wcfc = new WCFClient(); wcfc.SaveGood(item); this.Close(); break; } case EWStatus.Edit:{ int Amount; try { Amount = Convert.ToInt32(tb_Amount.Text); } catch(Exception ex){ MessageBox.Show("Amount value incorrect","Attention!"); return; } Good item = new Good(GoodToEdit.Id, tb_Title.Text.ToString(), Convert.ToDateTime(null), Amount); //WCFStoreServiceManager.StoreServiceClient client = new StoreServiceClient(); //client.SaveGood(item); WCFClient wcfc = new WCFClient(); wcfc.SaveGood(item); this.Close(); break; } } }
public void DeleteGood(Good item) { SA.DeleteGood(item); }
public void SaveGood(Good item) { SA.SaveGood(item); }
public void DeleteGood(Good item) { chanel.DeleteGood(item); }
public void SaveGood(Good item) { chanel.SaveGood(item); }