Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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;
                }
            }
        }
Example #4
0
 public void DeleteGood(Good item)
 {
     SA.DeleteGood(item);
 }
Example #5
0
 public void SaveGood(Good item) {
     SA.SaveGood(item);
 }
Example #6
0
 public void DeleteGood(Good item) {
     chanel.DeleteGood(item);
 }
Example #7
0
 public void SaveGood(Good item) {
     chanel.SaveGood(item);
 }