Ejemplo n.º 1
0
        // Helper method to validate record details
        private bool ValidateRecord(SaleCl record)  /*****M*/
        {
            string validationErrors = string.Empty;
            bool   hasErrors        = false;

            if (string.IsNullOrWhiteSpace(record.Date))
            {
                hasErrors        = true;
                validationErrors = "Name must not be empty\n";
            }

            if (string.IsNullOrWhiteSpace(record.Date))
            {
                hasErrors        = true;
                validationErrors = "Surname must not be empty\n";
            }

            // Email address is a series of characters that do not include a space or @
            // followed by @
            // followed by a series of characters that do not include a space or @
            // followed by .
            // followed by a series of characters that do not include a space or

            this.LastError = validationErrors;
            return(!hasErrors);
        }
Ejemplo n.º 2
0
 // Utility method for copying the details of a record
 private void CopyRecord(SaleCl source, SaleCl destination)  /*****M*/
 {
     destination.SalesID = source.SalesID;
     destination.EmpID   = source.EmpID;
     destination.CustID  = source.CustID;
     destination.Date    = source.Date;
 }
Ejemplo n.º 3
0
        // Create a new (empty) record
        // and put the form into Adding mode
        private void Add()
        {
            SaleCl newRecord = new SaleCl {
                SalesID = 0
            };                                              /*****2*/

            this.recordList.Insert(recordIndex, newRecord);
            this.IsAdding = true;
            this.OnPropertyChanged(nameof(Current));
        }
Ejemplo n.º 4
0
 private SaleCl oldRecord;  /*****/
 private void Edit()
 {
     this.oldRecord = new SaleCl();  /*****/
     this.CopyRecord(this.Current, this.oldRecord);
     this.IsEditing = true;
 }