コード例 #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtId.Text == "" || txtName.Text == "" || textPrice.Text == "" || textArea.Text == "" ||
         textAddress.Text == "" || textYear.Text == "" || textRooms.Text == "")
     {
         MessageBox.Show("Check your inputs please");
     }
     else
     {
         Property property     = SaveScreenInEntity();
         Property propertyRead = Commons.ReadFromDisk(property.Id);
         if (propertyRead != null)
         {
             MessageBox.Show("The property with ID : " + propertyRead.Id.ToString() + " already exist");
         }
         else
         {
             Commons.SaveOnDiskAsJson(property);
         }
     }
 }
コード例 #2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (txtId.Text == "" || txtName.Text == "" || textPrice.Text == "" || textArea.Text == "" ||
         textAddress.Text == "" || textYear.Text == "" || textRooms.Text == "")
     {
         MessageBox.Show("Check your inputs please");
     }
     else
     {
         Property property     = SaveScreenInEntity();
         Property propertyRead = Commons.ReadFromDisk(property.Id);
         if (propertyRead != null)
         {
             Commons.DeleteFromDisk(property.Id);
             Commons.SaveOnDiskAsJson(property);
             MessageBox.Show("Input Changed");
         }
         else
         {
             Commons.SaveOnDiskAsJson(property);
         }
     }
 }