コード例 #1
0
        public void Validate(ClientOrder clientOrder)
        {
            if (string.IsNullOrEmpty(clientOrder.PFirstName) == true)
            {
                this.Add(new OrderValidation("First Name", false, "The first name cannot be blank"));
            }
            if (string.IsNullOrEmpty(clientOrder.PLastName) == true)
            {
                this.Add(new OrderValidation("Last Name", false, "The last name cannot be blank"));
            }
            if (string.IsNullOrEmpty(clientOrder.PSex) == true)
            {
                this.Add(new OrderValidation("Gender", false, "The gender cannot be blank"));
            }
            if (clientOrder.PBirthdate.HasValue == false)
            {
                this.Add(new OrderValidation("Birthdate", false, "The birthdate cannot be blank"));
            }
            if (string.IsNullOrEmpty(clientOrder.PPhone) == true)
            {
                this.Add(new OrderValidation("Phone Number", false, "The phone number cannot be blank"));
            }
            if (string.IsNullOrEmpty(clientOrder.PCounty) == true)
            {
                this.Add(new OrderValidation("County", false, "The county cannot be blank"));
            }

            if (CanSubmit() == true)
            {
                clientOrder.Submitted     = true;
                clientOrder.SubmittedBy   = AuthenticatedUser.Instance.DisplayName;
                clientOrder.DateSubmitted = DateTime.Now;
            }
            else
            {
                clientOrder.Submitted     = false;
                clientOrder.SubmittedBy   = null;
                clientOrder.DateSubmitted = null;
            }
        }
コード例 #2
0
        public ClientOrder Clone()
        {
            ClientOrder result = (ClientOrder)this.MemberwiseClone();

            return(result);
        }