private void btnRegisterRegister_Click(object sender, RoutedEventArgs e) { DBAction.AddData adduser = new DBAction.AddData(); adduser.AddUser(NameRegister.Text.Trim(), SurnameRegister.Text.Trim(), LoginRegister.Text.Trim(), PasswordRegister.Text.Trim()); //var getallfitusers = from a in database.Users // where a.Login == LoginRegister.Text // select a; //List<ViewModel.UserViewModel> getallfitusers = new List<ViewModel.UserViewModel>(); //DBAction.GetData getusers = new DBAction.GetData(); //getallfitusers = getusers.GetFitUsers(LoginRegister.Text); //if (getallfitusers.Count() > 0) //{ // MessageBox.Show("Podany login jest zajęty"); // // LoginRegister.Clear(); //} //else //{ // DBAction.AddData adduser = new DBAction.AddData(); // adduser.AddUser(NameRegister.Text.Trim(), SurnameRegister.Text.Trim(), LoginRegister.Text.Trim(), PasswordRegister.Text.Trim()); // this.Close(); //} //} }
private void btnOkAddBox_Click(object sender, RoutedEventArgs e) { int iduser = currentuser.UserID; try { DBAction.AddData addbox = new DBAction.AddData(); addbox.AddBox(iduser, int.Parse(tbNumberAddBox.Text), tbNameAddBox.Text.Trim(), tbDescriptionAddBox.Text.Trim()); this.Close(); } catch (Exception) { MessageBox.Show("Blędne dane! Kod pudełka musi być liczbą!"); tbNumberAddBox.Clear(); } }
private void btnChooseBoxesList_Click(object sender, RoutedEventArgs e) { try { currentitem.BoxID = GetSelectedItemId(); DBAction.AddData addcurrentitem = new DBAction.AddData(); addcurrentitem.AddItemWhileTransfer(currentitem.BoxID); DBAction.DeleteData deletetransfer = new DBAction.DeleteData(); deletetransfer.DeleteWhileTransferItem(currentitem.ItemID); MessageBox.Show("Przedmiot został przeniesiony"); this.Close(); } catch (Exception) { MessageBox.Show("Nie wybrano pudełka!"); } }
private void GetAndSaveItemPhoto(int currentitemID) { FileStream Stream = new FileStream(tbFilePathItems.Text, FileMode.Open, FileAccess.Read); StreamReader Reader = new StreamReader(Stream); Byte[] ImgData = new Byte[Stream.Length - 1]; Stream.Read(ImgData, 0, (int)Stream.Length - 1); DBAction.AddData addphoto = new DBAction.AddData(); addphoto.SaveItemPhoto(ImgData); this.Hide(); Items showagain = new Items(); showagain.ShowDialog(); this.Close(); var image = DBAction.ImageData.LoadImage(ImgData); imageItems.Source = image; }
private void btnOkAddItem_Click(object sender, RoutedEventArgs e) { int idbox = currentbox.BoxID; //int idbox = currentbox.BoxID; //var items = database.Boxes // .ToList() // .Where(x => x.BoxID == idbox) // .Select(x => ViewModel.ItemViewModel.Create(x.Name, x.Number, x.Description)) // .ToList(); try { DBAction.AddData additem = new DBAction.AddData(); additem.AddItem(idbox, int.Parse(tbNumberAddItem.Text), tbNameAddItem.Text.Trim(), tbDescriptionAddItem.Text.Trim()); this.Close(); } catch (Exception) { MessageBox.Show("Błędne dane. Pole 'Liczba rzeczy' musi być liczbą!"); tbNumberAddItem.Clear(); } }