Example #1
0
 /// <summary>
 /// Load all form info
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbClass, "Class", "ClassID", LoadFormData.ClassNames());
     UIMethods.FillListControl(cmbPrimary, "Colour", "ColourID", LoadFormData.ColourNames());
     UIMethods.FillListControl(cmbSecondary, "Colour", "ColourID", LoadFormData.ColourNames(), true);
     UIMethods.FillListControl(lstBreeds, "Breed", "BreedID", LoadFormData.BreedNames());
 }
Example #2
0
 /// <summary>
 /// Load all form info
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbSelectOwner, "OwnerName", "OwnerID", LoadFormData.OwnerNamesCombined());
     currentID = Convert.ToInt32(OwnerNavigation()["FirstID"]);
     LoadOwnerDetails();
     UIMethods.DisplayStatusMessage(((MDIParent)MdiParent).GetStatusLabel(), "Owners loaded");
 }
Example #3
0
 /// <summary>
 /// Fill the dogs list with the dogs that competed in the selected dog show
 /// </summary>
 private void LoadDogShowDetails()
 {
     GetUserData();
     cmbDogs.SelectedIndex = 0;
     UIMethods.FillListControl(lstDogs, "Dog", "DogID", LoadFormData.DogShowDogs(dogShowID));
     LoadDogShowDogsCount();
 }
        /// <summary>
        /// Search the dogs using any of the provided search terms.
        /// If a search term is blank will filter that field by all possiblites
        /// </summary>
        private void QueryDogs()
        {
            string dogName = DatabaseHelper.SanitizeUserInput(txtSearchName.Text);

            // If no breed is selected set to a wild card
            string breedID = cmbSearchBreed.SelectedIndex <= 0 ? "%%" : cmbSearchBreed.SelectedValue.ToString();

            // If the rdo male is check set a 1 if rdo female is checked set to 0 else set to 1, 0 which will show both
            string sex       = rdoSearchMale.Checked ? "1" : rdoSearchFemale.Checked ? "0" : "1, 0";
            string ownerName = DatabaseHelper.SanitizeUserInput(txtSearchOwner.Text);

            // If max weight is 0 set to filter max by 999
            decimal maxWeight = nudMaxWeight.Value == 0 ? 999 : nudMaxWeight.Value;
            decimal minWeight = nudMinWeight.Value;

            // If max height is 0 set to filter max by 999
            decimal maxHeight = nudMaxHeight.Value == 0 ? 999 : nudMaxHeight.Value;
            decimal minHeight = nudMinHeight.Value;

            string    sql = $@"SELECT DISTINCT Dogs.DogID, [Name] FROM Dogs 
	                            LEFT JOIN DogOwnership
		                            ON Dogs.DogID = DogOwnership.DogID
	                            LEFT JOIN Owners
		                            ON DogOwnership.OwnerID = Owners.OwnerID
	                            WHERE	Dogs.[Name] LIKE '%{dogName}%' AND
			                            Breed LIKE '{breedID}' AND
			                            SEX IN({sex}) AND
			                            FirstName + ' ' + COALESCE(MiddleName + ' ', '') + LastName LIKE '%{ownerName}%' AND
			                            {minHeight} < Height AND Height < {maxHeight} AND
			                            {minWeight} < [Weight] AND [Weight] < {maxWeight}
                                ORDER BY [Name];";
            DataTable dt  = DatabaseHelper.GetDataTable(sql);

            UIMethods.FillListControl(lstDogs, "Name", "DogID", dt);
        }
Example #5
0
 /// <summary>
 /// Load all form info
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbClass, "Class", "ClassID", LoadFormData.ClassNames());
     UIMethods.FillListControl(cmbPrimary, "Colour", "ColourID", LoadFormData.ColourNames());
     UIMethods.FillListControl(cmbSecondary, "Colour", "ColourID", LoadFormData.ColourNames(), true);
     UIMethods.FillListControl(lstBreeds, "Breed", "BreedID", LoadFormData.BreedNames());
     UIMethods.DisplayStatusMessage(((frmMDIParent)MdiParent).GetStatusLabel(), "Breeds info loaded");
 }
 /// <summary>
 /// Load all form info
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbBreed, "Breed", "BreedID", LoadFormData.BreedNames());
     UIMethods.FillListControl(cmbSearchBreed, "Breed", "BreedID", LoadFormData.BreedNames(), true);
     UIMethods.FillListControl(cmbOwner, "OwnerName", "OwnerID", LoadFormData.OwnerNamesCombined());
     UIMethods.FillListControl(lstDogs, "Name", "DogID", LoadFormData.DogNames());
     UIMethods.DisplayStatusMessage(((frmMDIParent)MdiParent).GetStatusLabel(), "Dogs info loaded");
 }
Example #7
0
        private void LoadOwnership()
        {
            ownerID = Convert.ToInt32(cmbOwners.SelectedValue);
            string sql = $@"SELECT Dogs.DogID, [Name] FROM DogOwnership
	                            LEFT JOIN Dogs
		                            ON Dogs.DogID = DogOwnership.DogID
	                            WHERE OwnerID = {ownerID};"    ;

            UIMethods.FillListControl(lstOwnership, "Name", "DogID", DatabaseHelper.GetDataTable(sql));
        }
        /// <summary>
        /// The selected owner ownership records
        /// </summary>
        private void LoadOwnership()
        {
            errorProvider.Clear();
            ownerID = Convert.ToInt32(cmbOwners.SelectedValue);
            string    sql = $@"SELECT	CAST(StartOfOwnership AS VARCHAR) + ':' + CAST(Dogs.DogID AS VARCHAR) AS ID, 
                                    CAST(StartOfOwnership AS VARCHAR) + ' ' + CHAR(151) + ' ' + CAST(Dogs.[Name] AS VARCHAR) AS Dog 
                            FROM DogOwnership
	                            LEFT JOIN Dogs
		                            ON Dogs.DogID = DogOwnership.DogID
	                             WHERE OwnerID = {ownerID}
                                 ORDER BY StartOfOwnership;";
            DataTable dt  = DatabaseHelper.GetDataTable(sql);

            UIMethods.FillListControl(lstOwnership, "Dog", "ID", dt);
        }
 /// <summary>
 /// Load form data
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(lstOwners, "OwnerName", "OwnerID", LoadFormData.OwnerNamesCombined());
 }
 /// <summary>
 /// Load Form data
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbDogs, "Name", "DogID", LoadFormData.DogNames());
     UIMethods.FillListControl(cmbOwners, "OwnerName", "OwnerID", LoadFormData.OwnerNamesCombined());
 }
        /// <summary>
        /// Fill the dogs list with the dogs that competed in the selected dog show
        /// </summary>
        private void GetDogs()
        {
            int id = Convert.ToInt32(cmbDogShows.SelectedValue);

            UIMethods.FillListControl(lstDogs, "Dog", "DogID", LoadFormData.DogShowDogs(id));
        }
 /// <summary>
 /// Load all of the form data
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbSelectedDogShow, "Name", "DogShowID", LoadFormData.DogShowNames());
 }
 /// <summary>
 /// Load the form info
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbDogToUpdate, "Name", "DogID", LoadFormData.DogNames());
     UIMethods.FillListControl(cmbBreed, "Breed", "BreedID", LoadFormData.BreedNames());
 }
Example #14
0
 /// <summary>
 /// Fill the breed and search breed comboboxes
 /// </summary>
 private void PopulateBreedsList()
 {
     UIMethods.FillListControl(cmbBreed, "Breed", "BreedID", LoadFormData.BreedNames(), true);
 }
Example #15
0
 /// <summary>
 /// Load all of the form data
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbDogs, "Name", "DogID", LoadFormData.DogNames(), true);
     UIMethods.FillListControl(cmbDogShow, "Name", "DogShowID", LoadFormData.DogShowNames());
 }
Example #16
0
 /// <summary>
 /// Load form Data
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(lstClasses, "Class", "ClassID", LoadFormData.ClassNames());
     UIMethods.DisplayStatusMessage(((frmMDIParent)MdiParent).GetStatusLabel(), "Classes loaded");
 }
 /// <summary>
 /// Load all form info
 /// </summary>
 public override void Reload()
 {
     UIMethods.FillListControl(cmbDogShows, "Name", "DogShowID", LoadFormData.DogShowNames());
     UIMethods.DisplayStatusMessage(((frmMDIParent)MdiParent).GetStatusLabel(), "Dog shows loaded");
 }