예제 #1
0
 private async void saveButton_Click(object sender, RoutedEventArgs e)
 {
     if (dt.Rows.Count == 0)
     {
         await this.ShowMessageAsync("Error", "Please enter items you need to register", MessageDialogStyle.Affirmative);
     }
     else
     {
         try
         {
             int affectedLines = 0;
             affectedLines = handleDatabase.executeItemEntry(dt);
             handleDatabase.enterStockDetails(dt);
             NewItemGrid.Columns.Clear();
             dt.Clear();
             if (affectedLines > 0)
             {
                 await this.ShowMessageAsync("Successfull", "New Supplier have been Successfully Entered", MessageDialogStyle.Affirmative);
             }
             else
             {
                 await this.ShowMessageAsync("Error", "Sorry Can not add, Please Try again", MessageDialogStyle.Affirmative);
             }
         }
         catch (SqlException sqlException)
         {
             Console.WriteLine(sqlException);
         }
     }
 }