Пример #1
0
 private void UpdateService_Click(object sender, RoutedEventArgs e)
 {
     if (this.price.Text == "" || this.id.Text == "" || this.name.Text == "" || this.charges.Text == "" || this.phone.Text == "")
     {
         Status.Content = "Some Fields are Missing!";
     }
     else
     {
         Service newService = new Service();
         newService.id             = this.id.Text;
         newService.price          = Int32.Parse(this.price.Text);
         newService.catagory       = this.catagory.Text;
         newService.size           = Int32.Parse(this.size.Text);
         newService.color          = this.color.Text;
         newService.brand          = this.brand.Text;
         newService.purchaseDate   = this.dpDate.SelectedDate.Value.Date;
         newService.serviceDate    = this.ServiceDate.SelectedDate.Value.Date;
         newService.returnDate     = this.ReturnDate.SelectedDate.Value.Date;
         newService.serviceCharges = Int32.Parse(this.charges.Text);
         newService.customerName   = this.name.Text;
         newService.address        = this.address.Text;
         newService.phone          = this.phone.Text;
         PLayer newLayer = new PLayer();
         int    count    = newLayer.UpdateService(newService);
         if (count > 0)
         {
             Status.Content                = "Service Updated...";
             this.id.Text                  = "";
             this.price.Text               = "";
             this.catagory.Text            = "";
             this.size.Text                = "";
             this.color.Text               = "";
             this.brand.Text               = "";
             this.dpDate.SelectedDate      = DateTime.Today;
             this.name.Text                = "";
             this.phone.Text               = "";
             this.charges.Text             = "";
             this.address.Text             = "";
             this.ServiceDate.SelectedDate = DateTime.Today;
             this.ReturnDate.SelectedDate  = DateTime.Today.AddDays(15);
         }
         else
         {
             Status.Content                = "An Error Occurred...";
             this.id.Text                  = "";
             this.price.Text               = "";
             this.catagory.Text            = "";
             this.size.Text                = "";
             this.color.Text               = "";
             this.brand.Text               = "";
             this.dpDate.SelectedDate      = DateTime.Today;
             this.name.Text                = "";
             this.phone.Text               = "";
             this.charges.Text             = "";
             this.address.Text             = "";
             this.ServiceDate.SelectedDate = DateTime.Today;
             this.ReturnDate.SelectedDate  = DateTime.Today.AddDays(15);
         }
     }
 }