public static int Save(int instructorId, EmailAddress emailToSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (instructorId <= 0)
            {
                saveBrokenRules.Add("Instructor", "Invalid Id");
            }

            //make sure email type is in correct format
            ValidateEmail(emailToSave, ref saveBrokenRules);

            //email type is required
            if (emailToSave.EmailType.EntityTypeId <= 0)
            {
                saveBrokenRules.Add("Email Address Type", "Type is required.");
            }
            if (saveBrokenRules.Count() > 0)
            {
                throw new BLLException("There was an error saving Email", saveBrokenRules);
            }
            else
            {
                // Validation successful - call data access layer to save
                return(EmailAddressDAL.Save(instructorId, emailToSave));
            }
        }
        public static int SAVE(int personId, EmailAddress emailToSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (personId <= 0)
                saveBrokenRules.Add("Person", "Invalid ID.");

            //make sure Email is in the correct format
            ValidateEmail(emailToSave, ref saveBrokenRules);

            //email type is required
            if(emailToSave.EmailType.EntityTypeId <=0)
            {
                saveBrokenRules.Add("Email Address Type", "Type is Required.");
            }

            //check for validation errors
            if(saveBrokenRules.Count() > 0)
            {
                throw new BLLException("There was an error saving Email.", saveBrokenRules);
            }
            else 
            {
                //validation success - call DAL to save
                return EmailAddressDAL.Save(personId, emailToSave);
            }
        }
        private bool ValidateForm()
        {
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            if (drpEntity.SelectedValue.Trim().ToInt() == 0)
            {
                brokenRules.Add("Entity", "Please select a valid Entity from the drop-down list");
                returnValue = false;
            }
            if (string.IsNullOrEmpty(txtEntityName.Text.Trim()))
            {
                brokenRules.Add("Lookup Name", "Required Field");
                returnValue = false;
            }
            if (!returnValue)
            {
                if (brokenRules.Count() == 1)
                {
                    this.DisplayLocalMessage("There is an error with your submission. Please correct and try again", brokenRules);
                }
                else
                {
                    this.DisplayLocalMessage("There were some errors with your submission. Please correct and try again.", brokenRules);
                }
            }
            return(returnValue);
        }
Ejemplo n.º 4
0
        public static int SaveMake(VehicleMake vehicleMaketoSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (vehicleMaketoSave == null)
                saveBrokenRules.Add("Vehicle Make", "Invalid vehicleMake object.");
            else
            {
                if (string.IsNullOrEmpty(vehicleMaketoSave.VehicleMakeName))
                    saveBrokenRules.Add("Vehicle Make Name", "Value is Required.");
            }
            if (saveBrokenRules.Count() > 0)
                throw new BLLException("Validation rules failed.", saveBrokenRules);
            else
            {
                //check to make sure name dosent exist
                VehicleMake tempMake = GetMake(vehicleMaketoSave.VehicleMakeName);
                if (tempMake == null)
                    return VehicleMakeDAL.Save(vehicleMaketoSave);
                else
                    return
                        tempMake.VehicleMakeId;
            }

        }
Ejemplo n.º 5
0
        public static int Save(int entityId, EntityType entityTypeToSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (entityId <= 0)
            {
                saveBrokenRules.Add("Entity", "Invalid Id for Entity Relationship");
            }

            //make sure email type is in correct format
            // ValidateEmail(emailToSave, ref saveBrokenRules);

            //email type is required
            if (string.IsNullOrEmpty(entityTypeToSave.EntityTypeName))
            {
                saveBrokenRules.Add("Entity Type Name", "Name is required.");
            }

            if (saveBrokenRules.Count() > 0)
            {
                throw new BLLException("There was an error saving Email", saveBrokenRules);
            }
            else
            {
                // Validation successful - call data access layer to save
                return(EntityTypeDAL.Save(entityId, entityTypeToSave));
            }
        }
        private void DisplayLocalMessage(string message, BrokenRuleCollection brokenRules)
        {
            customMessageArea.Visible = true;
            customMessageArea.Message = message;

            if (brokenRules.Count() > 0)
            {
                customMessageArea.BrokenRules = brokenRules;
            }

            customMessageArea.Display();
        }
Ejemplo n.º 7
0
        private void DisplayLocalMessage(string message, BrokenRuleCollection brokenRules)
        {
            CustomMessageArea.Visible = true;
            CustomMessageArea.Message = message;

            if (brokenRules.Count() > 0)
            {
                CustomMessageArea.BrokenRules = brokenRules;
            }

            // Executes Display() method to render to screen
            CustomMessageArea.Display();
        }
Ejemplo n.º 8
0
        public static int Save(string entityName, string entityTypeValue)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (string.IsNullOrEmpty(entityName))
                saveBrokenRules.Add("Entity", "Invalid Entity Name.");

            if (string.IsNullOrEmpty(entityTypeValue))
                saveBrokenRules.Add("Entity Type", "Value is required");

            if (saveBrokenRules.Count() > 0)
                throw new BLLException("Validation rules failed.", saveBrokenRules);
            else
            {
                Entity tempEntity = EntityManager.GetItem(entityName);
                return EntityTypeDAL.Save(tempEntity.EntityId, new EntityType(entityTypeValue));
            }
        }
        public static int Save(Gym gymToSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (string.IsNullOrEmpty(gymToSave.GymName))
            {
                saveBrokenRules.Add("Gym Name", "Name is required.");
            }

            if (saveBrokenRules.Count() > 0)
            {
                throw new BLLException("There was an error saving Gym", saveBrokenRules);
            }
            else
            {
                return(GymDAL.Save(gymToSave));
            }
        }
Ejemplo n.º 10
0
        public static int Save(int entityId, EntityType entityTypeToSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (entityId <= 0)
                saveBrokenRules.Add("Entity", "Invalid Entity Id.");

            if (entityTypeToSave == null)
                saveBrokenRules.Add("Entity Type", "Invalid EntityType object.");
            else
            {
                if (string.IsNullOrEmpty(entityTypeToSave.EntityTypeValue))
                    saveBrokenRules.Add("Entity Type", "Value is Required.");
            }
            if (saveBrokenRules.Count() > 0)
                throw new BLLException("Validation rules Failed", saveBrokenRules);
            else
                return EntityTypeDAL.Save(entityId, entityTypeToSave);
        }
Ejemplo n.º 11
0
        public static int SaveGame(int lotteryId, LotteryGameValue gameToSave)
        {
            //notes:    instantiate BrokenRules collection and check for any validation errors
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (lotteryId <= 0)
                saveBrokenRules.Add("Lottery", "Invalid Lottery Game Id");

            if (gameToSave == null)
                saveBrokenRules.Add("Game Name", "Invalid GameName objects.");

            else
            {
                if (string.IsNullOrEmpty(gameToSave.GameName))
                    saveBrokenRules.Add("Game Name", "Game Name is required");
            }

            if (saveBrokenRules.Count() > 0)
                throw new BLLException("Validation rules failed.", saveBrokenRules);
            else
                return LotteryGameDAL.Save2(lotteryId, gameToSave);
        }
Ejemplo n.º 12
0
        public static int Save(int drawingDateId, int gameId, DrawingDateBO drawingDateToSave)
        {
            //Instantiates a brokenRules collection and check for any validation errors
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (gameId <= 0)
            {
                saveBrokenRules.Add("Drawing date", "Invalid game id");
            }

            ValidateDrawingDate(drawingDateToSave, ref saveBrokenRules);

            if (saveBrokenRules.Count() > 0)
            {
                throw new BLLException("There was an error saving email.", saveBrokenRules);
            }
            else
            {
                //Call DAL to save
                return DrawingDateDAL.Save(drawingDateId, gameId, drawingDateToSave);
            }
        }
Ejemplo n.º 13
0
        public static int SaveModel(int vehicleMakeId, VehicleModel vehicleModeltoSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (vehicleMakeId<=0)
                saveBrokenRules.Add("Vehicle Make Id", "Vehicle Model must be associated with a valid VehicleMake Id .");

            if (vehicleModeltoSave == null)
                saveBrokenRules.Add("Vehicle Model", "Invalid VehicleModel Object.");
            else
            {
                if (string.IsNullOrEmpty(vehicleModeltoSave.VehicleModelName))
                    saveBrokenRules.Add("Vehicle Model Name", "Value is Required.");
            }
            if (saveBrokenRules.Count() > 0)
                throw new BLLException("Validation rules failed.", saveBrokenRules);
            else
            {
                vehicleModeltoSave.Make = new VehicleMake { VehicleMakeId = vehicleMakeId };
                return VehicleModelDAL.Save(vehicleModeltoSave);
            }

        }
        private bool ValidateForm()
        {
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            if (string.IsNullOrEmpty(txtGymName.Text.Trim()))
            {
                brokenRules.Add("Gym Name", "Required Field");
                returnValue = false;
            }
            if (!returnValue)
            {
                if (brokenRules.Count() == 1)
                {
                    this.DisplayLocalMessage("There is an error with your submission. Please correct and try again", brokenRules);
                }
                else
                {
                    this.DisplayLocalMessage("There were some errors with your submission. Please correct and try again", brokenRules);
                }
            }
            return(returnValue);
        }
Ejemplo n.º 15
0
        public static int SaveModel(string vehicleMakeName, VehicleModel vehicleModeltoSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (string.IsNullOrEmpty(vehicleMakeName))
                saveBrokenRules.Add("Vehicle Make Name", "Vehicle Model must be associated with a valid Vehicle Make Name.");

            if (vehicleModeltoSave == null)
                saveBrokenRules.Add("Vehicle Model", "Invaild VehicleModel object.");
            else
            {
                if (string.IsNullOrEmpty(vehicleModeltoSave.VehicleModelName))
                    saveBrokenRules.Add("Vehicle Make Name", "Value is Required.");
            }
            if (saveBrokenRules.Count() > 0)
                throw new BLLException("Validation rules failed.", saveBrokenRules);
            else
            {
                //check to make sure name dosent exist
                VehicleMake itemMake = GetMake(vehicleMakeName);
                if (itemMake == null)
                {
                    itemMake = new VehicleMake();
                    itemMake.VehicleMakeId = SaveMake(new VehicleMake{VehicleMakeName = vehicleMakeName});
                }
               
                vehicleModeltoSave.Make = itemMake;
                return VehicleModelDAL.Save(vehicleModeltoSave);
               
            }

        }
        private bool ValidateForm()
        {
            //Create bool for our return value and instantiate a new brokenRuleCollection object
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            //Validate our form controls required fields
            if (string.IsNullOrEmpty(txtFirstName.Text.Trim()))
            {
                brokenRules.Add("First Name", "Required Field");
            }
            if (string.IsNullOrEmpty(txtLastName.Text.Trim()))
            {
                brokenRules.Add("Last Name", "Required Field");
            }

            //Validate dates if user entered in data
            if (string.IsNullOrEmpty(txtBirthDate.Text.Trim()))
            {
                if (txtBirthDate.Text == "" || Convert.ToDateTime(txtBirthDate.Text.Trim()) == DateTime.MinValue)
                {
                    brokenRules.Add("Date of Birth", "Please enter a valid date.");
                }
            }
            if (string.IsNullOrEmpty(txtDateOfHire.Text.Trim()))
            {
                if (txtBirthDate.Text == "" || Convert.ToDateTime(txtDateOfHire.Text.Trim()) == DateTime.MinValue)
                {
                    brokenRules.Add("Date of Hire", "Please enter a valid date.");
                }
            }
            if (string.IsNullOrEmpty(txtDateOfTermination.Text.Trim()))
            {
                if (txtBirthDate.Text == "" || Convert.ToDateTime(txtDateOfTermination.Text.Trim()) == DateTime.MinValue)
                {
                    brokenRules.Add("Date of Termination", "Please enter a valid date.");
                }
            }

            //Check if broken rules collection has any items
            if (brokenRules.Count() > 0)
            {
                //Bind the collection to the list control
                MessageList.DataSource = brokenRules;
                MessageList.DataBind();

                //Check to see if there were mutliple errors - display appropriate message
                if (brokenRules.Count() == 1)
                {
                    //Display main error message to user
                    this.DisplayLocalMessage("There was an error processing your form. Please correct and try saving again");
                }
                else
                {
                    this.DisplayLocalMessage("There was some errors processing your form. Please correct and try saving again");
                }
                returnValue = false;
            }
            return returnValue;
        }
Ejemplo n.º 17
0
        private bool ValidateForm()
        {
            PageMessageArea.Visible = true;

            //Create bool for our return value and instantiate a new brokenRuleCollection object
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            //Validate our form controls required fields
            if (string.IsNullOrEmpty(txtMatch.Text.Trim()))
            {
                brokenRules.Add("Match", "Required Field");
            }
            if (string.IsNullOrEmpty(txtWin.Text.Trim()))
            {
                brokenRules.Add("Win", "Required Field");
            }
            if (string.IsNullOrEmpty(txtOdds.Text.Trim()))
            {
                brokenRules.Add("Odds", "Required Field");
            }

            //Check if broken rules collection has any items
            if (brokenRules.Count() > 0)
            {
                //Bind the collection to the list control
                MessageList.DataSource = brokenRules;
                MessageList.DataBind();

                //Check to see if there were mutliple errors - display appropriate message
                if (brokenRules.Count() == 1)
                {
                    //Display main error message to user
                    this.DisplayLocalMessage("There was an error processing your form. Please correct and try saving again");
                }
                else
                {
                    this.DisplayLocalMessage("There was some errors processing your form. Please correct and try saving again");
                }
                returnValue = false;
            }
            return returnValue;
        }
        private bool ValidateForm()
        {
            PageMessageArea.Visible = true;

            //Create bool for our return value and instantiate a new brokenRuleCollection object
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            //Validate that the game id is greater than zero
            if (_gameId <= 0)
            {
                brokenRules.Add("Game Id", "Please select a game to add drawing information for.");
            }

            //Validate our form controls required fields
            if (string.IsNullOrEmpty(txtDrawingDate.Text.Trim()))
            {
                brokenRules.Add("Drawing Date", "Required Field");
            }
            if (string.IsNullOrEmpty(txtJackpotAmount.Text.Trim()))
            {
                brokenRules.Add("Jackpot", "Required Field");
            }

            //find dynamic textboxes for validating required fields
            int i = 1;
            while (i <= _intForCreatingTextBoxes)
            {
                //Find the textbox control by the ID, which I gave them IDs 1-6
                TextBox txtWinningNumber = (TextBox)Panel1.FindControl("txtBox" + i.ToString());
                HiddenField hdnWinningNumberId = (HiddenField)Panel1.FindControl("id" + i.ToString());
                string txtBoxName = "Textbox" + i.ToString();

                if (string.IsNullOrEmpty(txtWinningNumber.Text))
                {
                    brokenRules.Add(txtBoxName, "Required Field");
                }

                //Validate number value integer inputs and if user entered correct integers format and if integer is greater than zero
                int value;
                if (int.TryParse(txtWinningNumber.Text, out value))
                {
                    if (value < 0)
                    {
                        brokenRules.Add(txtBoxName, "Please enter a valid integer greater than zero.");
                    }
                }

                i++;
            }

            //Validate Drawing date and make sure it is in correct date format
            if (string.IsNullOrEmpty(txtDrawingDate.Text.Trim()))
            {
                if (txtDrawingDate.Text == "" || Convert.ToDateTime(txtDrawingDate.Text.Trim()) == DateTime.MinValue)
                {
                    brokenRules.Add("Drawing Date", "Please enter a valid date.");
                }
            }
            /*
            DateTime dateValue;
            if (DateTime.TryParse(txtDrawingDate.Text, out dateValue))
            {
                if (dateValue > DateTime.Now)
                {
                    brokenRules.Add("Drawing Date " + dateValue.ToShortDateString(), "cannot be greater than current date.");
                }
            }
            */

            //Validate jackpot integer inputs and if user entered correct integers format and if integer is greater than zero
            int value2;
            if (int.TryParse(txtJackpotAmount.Text, out value2))
            {
                if (value2 < 0)
                {
                    brokenRules.Add("Jackpot", "Please enter a valid integer greater than zero.");
                }
            }

            ////Check if broken rules collection has any items////
            if (brokenRules.Count() > 0)
            {
                //Bind the collection to the list control
                MessageList.DataSource = brokenRules;
                MessageList.DataBind();

                //Check to see if there were mutliple errors - display appropriate message
                if (brokenRules.Count() == 1)
                {
                    //Display main error message to user
                    this.DisplayLocalMessage("There was an error processing your form. Please correct and try saving again");
                }
                else
                {
                    this.DisplayLocalMessage("There was some errors processing your form. Please correct and try saving again");
                }
                returnValue = false;
            }
            return returnValue;
        }
Ejemplo n.º 19
0
        private bool ValidateForm()
        {
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            //validate our form controls
            //required feilds
            if (string.IsNullOrEmpty(FirstName.Text.Trim()))
                brokenRules.Add("First Name", "Required feild.");

            if (string.IsNullOrEmpty(LastName.Text.Trim()))
                brokenRules.Add("Last Name", "Required feild.");

            //Valid Dates if user entered in data
            if (!string.IsNullOrEmpty(BirthDate.Text.Trim()))
            {
                if (BirthDate.Text.Trim().ToDate() == DateTime.MinValue)//trim?
                    brokenRules.Add("Date of Birth", "Please enter a valid date.");

            }
            if (!string.IsNullOrEmpty(HireDate.Text.Trim()))
            {
                if (HireDate.Text.Trim().ToDate() == DateTime.MinValue)
                    brokenRules.Add("Date of Hire", "Please enter a valid date.");

            }
            if (!string.IsNullOrEmpty(TermDate.Text.Trim()))
            {
                if (TermDate.Text.Trim().ToDate() == DateTime.MinValue)
                    brokenRules.Add("Date of Termination", "Please enter a valid date.");

            }

            //check if broken rulles collection has any items
            if (brokenRules.Count() > 0)
            {
                CustomMessageArea.BrokenRules = brokenRules;

                //execute display() method to render to screen
                CustomMessageArea.Display();

                if (brokenRules.Count() == 1)
                {
                    this.DisplayLocalMessage("There was an error processing your form. Please correct and try saving again.");
                }
                else
                {
                    this.DisplayLocalMessage("There were Some errors processing your form. Please correct and try saving again.");
                }
                returnValue = false;
            }
            return returnValue;
        }
Ejemplo n.º 20
0
        public static int SaveDrawing(int lotteryDrawingId, LotteryDrawing drawingToSave)
        {
            //notes:    instantiate BrokenRules collection and check for any validation errors
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (lotteryDrawingId <= 0)
                saveBrokenRules.Add("Drawing", "Drawing must be associated with a valid Drawing");

            if (drawingToSave == null)
                saveBrokenRules.Add("Drawing", "Invalid Drawing object.");

            else
            {
                if (string.IsNullOrEmpty(drawingToSave.PrizeAmount))
                    saveBrokenRules.Add("PrizeAmount", "Value is required");
            }

            if (saveBrokenRules.Count() > 0)
                throw new BLLException("Validation rules failed.", saveBrokenRules);
            else
            {
                drawingToSave.PrizeAmount = new LotteryDrawing { LotteryDrawingId = lotteryDrawingId };
                return LotteryDrawingDAL.Save(drawingToSave);
            }
        }
Ejemplo n.º 21
0
 public static void ShouldContains(this BrokenRuleCollection brokenRuleCollection, string owner, int brokenRulesCount)
 {
     brokenRuleCollection.Count(b => b.Owner == owner).ShouldEqual(brokenRulesCount);
 }
Ejemplo n.º 22
0
        private bool ValidateForm()
        {
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            if (GameList.SelectedValue.Trim().ToInt() == 0)
            {
                brokenRules.Add("Lottery Game", "Please select a valid Lottery Game from the drop-down list.");
                returnValue = false;
            }

            if(string.IsNullOrEmpty(GameValueField.Text.Trim()))
            {
                brokenRules.Add("Lookup Value", "Required field.");
                    returnValue = false;
            }

            if (!returnValue)
            {
                if(brokenRules.Count() == 1)
                    this.DisplayLocalMessage("There is an error with your submission. Please correct and try again.", brokenRules);
                else
                    this.DisplayLocalMessage("There were some errors with your submission. Please correct and try again.", brokenRules);
            }

            return returnValue;
        }
Ejemplo n.º 23
0
        private void DisplayLocalMessage(string message, BrokenRuleCollection brokenRules)
        {
            CustomMessageArea.Visible = true;
            CustomMessageArea.Message = message;

            if (brokenRules.Count() > 0)
                CustomMessageArea.BrokenRules = brokenRules;

            //notes:    execute Display() method to render to screen
            CustomMessageArea.Display();
        }
        private bool ValidateForm()
        {
            PageMessageArea.Visible = true;

            //Create bool for our return value and instantiate a new brokenRuleCollection object
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            //Validate our form controls required fields
            if (string.IsNullOrEmpty(txtMovieTitle.Text.Trim()))
            {
                brokenRules.Add("Movie Title", "Required Field");
            }
            if (string.IsNullOrEmpty(txtYearReleased.Text.Trim()))
            {
                brokenRules.Add("Year Released", "Required Field");
            }

            //Validate integer inputs and if user entered correct integers format and if integer is greater than zero
            int value;
            if (int.TryParse(txtYearReleased.Text, out value))
            {
                if (value <= 0)
                {
                    brokenRules.Add("Year Released", "Please enter a valid integer greater than zero.");
                }
            }
            else
            {
                brokenRules.Add("Year Released", "Only numeric values allowed.");
            }

            //Check if broken rules collection has any items
            if (brokenRules.Count() > 0)
            {
                //Bind the collection to the list control
                MessageList.DataSource = brokenRules;
                MessageList.DataBind();

                //Check to see if there were mutliple errors - display appropriate message
                if (brokenRules.Count() == 1)
                {
                    //Display main error message to user
                    this.DisplayLocalMessage("There was an error processing your form. Please correct and try saving again");
                }
                else
                {
                    this.DisplayLocalMessage("There was some errors processing your form. Please correct and try saving again");
                }
                returnValue = false;
            }
            return returnValue;
        }
Ejemplo n.º 25
0
        private bool ValidateForm()
        {
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            //notes: validate form controls
            //notes: required fields
            if (string.IsNullOrEmpty(DrawingDate.Text.Trim()))
                brokenRules.Add("Drawing Date", "Required field.");

            if (string.IsNullOrEmpty(PrizeAmount.Text.Trim()))
                brokenRules.Add("Jackpot Amount", "Required field.");

            //notes:    check if broken rules collection has any items
            if (brokenRules.Count() > 0)
            {
                //notes:    bind the collection to the list control
                MessageList.DataSource = brokenRules;
                MessageList.DataBind();

                //notes:    check to see if there were multiple errors - diplay message
                if (brokenRules.Count() == 1)
                {
                    //notes:    display main error message to user
                    this.DisplayLocalMessage("There was an error processing your form. Please correct and try saving again.");
                }
                else
                {
                    //notes:    display main error message to user
                    this.DisplayLocalMessage("There were some errors processing your form. Please correct and try saving again.");
                }
                returnValue = false;
            }

            //notes:    return the value of the variable
            return returnValue;
        }
        private bool ValidateForm()
        {
            bool returnValue = true;
            BrokenRuleCollection brokenRules = new BrokenRuleCollection();

            if (string.IsNullOrEmpty(txtFirstName.Text.Trim()))
            {
                brokenRules.Add("First Name", "Required field");
            }

            if (string.IsNullOrEmpty(txtLastName.Text.Trim()))
            {
                brokenRules.Add("Last Name", "Required field");
            }

            if (drpEmployeeType.SelectedValue == "0")
            {
                brokenRules.Add("Employee Type", "Select an Employee Type from the drop down list");
            }

            if (drpGender.SelectedValue == "0")
            {
                brokenRules.Add("Gender", "Select a Gender from the drop down list");
            }

            if (!string.IsNullOrEmpty(txtBirthDate.Text.Trim()))
            {
                if (txtBirthDate.Text.Trim().ToDate() == DateTime.MinValue)
                {
                    brokenRules.Add("Date Of Birth", "Please enter a valid date.");
                }
            }

            if (!string.IsNullOrEmpty(txtHireDate.Text.Trim()))
            {
                if (txtHireDate.Text.Trim().ToDate() == DateTime.MinValue)
                {
                    brokenRules.Add("Date Of Hire", "Please enter a valid date.");
                }
            }
            if (!string.IsNullOrEmpty(txtTermDate.Text.Trim()))
            {
                if (txtTermDate.Text.Trim().ToDate() == DateTime.MinValue)
                {
                    brokenRules.Add("Date Of Term", "Please enter a valid date.");
                }
            }
            if (brokenRules.Count() > 0)
            {
                MessageList.DataSource = brokenRules;
                MessageList.DataBind();

                if (brokenRules.Count() == 1)
                {
                    this.DisplayLocalMessage("There was an error processing your form. Please correct and try saving again");
                }
                else
                {
                    this.DisplayLocalMessage("There was some error processing your form. Please correct and try saving again");
                }
                returnValue = false;
            }
            return(returnValue);
        }