private void Excute() { if (AppConstant.ValidateInput(RegistrationNo)) { try { var id = SlotID.Split('-').ToList(); PMSService.Insert(new Vehicle_Parking() { RegistrationId = RegistrationNo, ArrivalTime = EntryTime.ToLocalTime(), DepartTime = null, SlotId = Convert.ToInt16(id.ElementAtOrDefault(1)), TotalFare = null, VehicleType = VehicleType.ToString(), Floor = id.ElementAt(0).ToString() }); } catch (Exception ex) { Debug.WriteLine(ex.Message); } MessageBoxResult messageBoxResult = MessageBox.Show("Data inserted Successfully!", "Saved", MessageBoxButton.OK); if (messageBoxResult == MessageBoxResult.OK) { ClearForm(); } } else { MessageBox.Show("Enter valid Registration No!", "Oops"); } }
public string this[string columnName] { get { string result = null; if (columnName == "SlotID") { if (string.IsNullOrEmpty(SlotID)) { result = "SlotId cannot be empty."; return(result); } } if (columnName == "EntryTime") { if (string.IsNullOrEmpty(EntryTime.ToString())) { result = "Entry Time cannot be empty"; return(result); } } if (columnName == "RegistrationNo") { if (string.IsNullOrEmpty(RegistrationNo)) { result = "RegistrationNo cannot be empty"; return(result); } if (!AppConstant.ValidateInput(RegistrationNo)) { result = "Invalid registration number!"; return(result); } } return(null); } }
private bool CanExecute() { return(!String.IsNullOrEmpty(RegistrationNo) && AppConstant.ValidateInput(RegistrationNo)); }