private bool IsCorrectClassGender(Dogs dog) { bool correctGender = false; ShowEntryClasses sec = new ShowEntryClasses(_connString, new Guid(Show_Entry_Class_ID)); DogGender dg = new DogGender(_connString, (int)dog.Dog_Gender_ID); switch (dg.Description) { case "Dog": if (sec.Class_Gender == Constants.CLASS_GENDER_DB || sec.Class_Gender == Constants.CLASS_GENDER_D) { correctGender = true; } break; case "Bitch": if (sec.Class_Gender == Constants.CLASS_GENDER_DB || sec.Class_Gender == Constants.CLASS_GENDER_B) { correctGender = true; } break; default: break; } return(correctGender); }
private void PopulateGenderList() { DogGender dogGender = new DogGender(_connString); List <DogGender> lkpDog_Gender = dogGender.GetDog_Gender(); lstGender.DataSource = lkpDog_Gender; lstGender.DataBind(); }
private bool CorrectGenderForClass(short?class_Gender, string sex) { bool retVal = true; DogGender dg = new DogGender(Utils.ConnectionString()); int dog_Gender = dg.GetDog_Gender(sex); if ((dog_Gender == 2 && class_Gender == 3) || (dog_Gender == 3 && class_Gender == 2)) { retVal = false; } return(retVal); }
private void PopulateSire() { Guid sire_ID = new Guid(Sire_ID); Dogs dog = new Dogs(_connString, sire_ID); txtSireKCName.Text = dog.Dog_KC_Name; txtSirePetName.Text = dog.Dog_Pet_Name; if (dog.Dog_Breed_ID != null && dog.Dog_Breed_ID != 1) { int dog_Breed_ID = Int32.Parse(dog.Dog_Breed_ID.ToString()); DogBreeds dogBreeds = new DogBreeds(_connString, dog_Breed_ID); txtSireBreed.Text = dogBreeds.Description; } if (dog.Dog_Gender_ID != null && dog.Dog_Gender_ID != 1) { int dog_Gender_ID = Int32.Parse(dog.Dog_Gender_ID.ToString()); DogGender dogGender = new DogGender(_connString, dog_Gender_ID); txtSireGender.Text = dogGender.Description; } divGetSire.Visible = false; divChangeSire.Visible = true; divSireDetails.Visible = true; }
private void PopulateDam() { Guid dam_ID = new Guid(Dam_ID); Dogs dog = new Dogs(_connString, dam_ID); txtDamKCName.Text = dog.Dog_KC_Name; txtDamPetName.Text = dog.Dog_Pet_Name; if (dog.Dog_Breed_ID != null && dog.Dog_Breed_ID != 1) { int dog_Breed_ID = Int32.Parse(dog.Dog_Breed_ID.ToString()); DogBreeds dogBreeds = new DogBreeds(_connString, dog_Breed_ID); txtDamBreed.Text = dogBreeds.Description; } if (dog.Dog_Gender_ID != null && dog.Dog_Gender_ID != 1) { int dog_Gender_ID = Int32.Parse(dog.Dog_Gender_ID.ToString()); DogGender dogGender = new DogGender(_connString, dog_Gender_ID); txtDamGender.Text = dogGender.Description; } divGetDam.Visible = false; divChangeDam.Visible = true; divDamDetails.Visible = true; }
private void PopulateDogClassesGrid(string entrantID) { string connString = Utils.ConnectionString(); Guid entrant_ID = new Guid(entrantID); DogClasses dogClasses = new DogClasses(connString); List <DogClasses> dcList = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); DataTable dt = new DataTable(); DataColumn dcDogClassID = new DataColumn("DogClassID"); DataColumn dcEntrantID = new DataColumn("EntrantID"); DataColumn dcDogID = new DataColumn("DogID"); DataColumn dcKCName = new DataColumn("KCName"); DataColumn dcBreed = new DataColumn("Breed"); DataColumn dcGender = new DataColumn("Gender"); DataColumn dcRegNo = new DataColumn("RegNo"); DataColumn dcDOB = new DataColumn("DOB"); DataColumn dcMeritPoints = new DataColumn("MeritPoints"); DataColumn dcBreeder = new DataColumn("Breeder"); DataColumn dcSire = new DataColumn("Sire"); DataColumn dcDam = new DataColumn("Dam"); DataColumn dcEntryClassName = new DataColumn("EntryClassName"); DataColumn dcPreferredPart = new DataColumn("PreferredPart"); DataColumn dcFinalClassName = new DataColumn("FinalClassName"); DataColumn dcHandler = new DataColumn("Handler"); DataColumn dcRingNo = new DataColumn("RingNo"); DataColumn dcRunningOrder = new DataColumn("RunningOrder"); DataColumn dcSpecialRequest = new DataColumn("SpecialRequest"); dt.Columns.Add(dcDogClassID); dt.Columns.Add(dcEntrantID); dt.Columns.Add(dcDogID); dt.Columns.Add(dcKCName); dt.Columns.Add(dcBreed); dt.Columns.Add(dcGender); dt.Columns.Add(dcRegNo); dt.Columns.Add(dcDOB); dt.Columns.Add(dcMeritPoints); dt.Columns.Add(dcBreeder); dt.Columns.Add(dcSire); dt.Columns.Add(dcDam); dt.Columns.Add(dcEntryClassName); dt.Columns.Add(dcPreferredPart); dt.Columns.Add(dcFinalClassName); dt.Columns.Add(dcHandler); dt.Columns.Add(dcRingNo); dt.Columns.Add(dcRunningOrder); dt.Columns.Add(dcSpecialRequest); object[] dogRow = new object[19]; foreach (DogClasses dc in dcList) { Dogs dog = new Dogs(connString, (Guid)dc.Dog_ID); ShowEntryClasses sec = new ShowEntryClasses(connString, (Guid)dc.Show_Entry_Class_ID); ClassNames cn = new ClassNames(connString, (int)sec.Class_Name_ID); DogBreeds db = new DogBreeds(connString, (int)dog.Dog_Breed_ID); DogGender dg = new DogGender(connString, (int)dog.Dog_Gender_ID); dogRow[0] = dc.Dog_Class_ID; dogRow[1] = entrant_ID; dogRow[2] = dog.Dog_ID; dogRow[3] = dog.Dog_KC_Name; dogRow[4] = db.Description; dogRow[5] = dg.Description; dogRow[6] = dog.Reg_No; DateTime DOB = (DateTime)dog.Date_Of_Birth; dogRow[7] = string.Format("{0}/{1}/{2}", DOB.Day, DOB.Month, DOB.Year); dogRow[8] = dog.Merit_Points; dogRow[9] = dog.Breeder; dogRow[10] = dog.Sire; dogRow[11] = dog.Dam; dogRow[12] = string.Concat(sec.Class_No, " - ", cn.Class_Name_Description); dogRow[13] = dc.Preferred_Part.ToString(); if (dc.Show_Final_Class_ID != null && dc.Show_Final_Class_ID != new Guid()) { ShowFinalClasses sfc = new ShowFinalClasses(connString, (Guid)dc.Show_Final_Class_ID); dogRow[14] = sfc.Show_Final_Class_Description; } else { dogRow[14] = "Not Yet Assigned"; } People handler = new People(connString, (Guid)dc.Handler_ID); dogRow[15] = handler.Person_FullName; dogRow[16] = string.IsNullOrWhiteSpace(dc.Ring_No.ToString()) ? "Not Yet Assigned" : dc.Ring_No.ToString(); dogRow[17] = string.IsNullOrWhiteSpace(dc.Running_Order.ToString()) ? "Not Yet Assigned" : dc.Running_Order.ToString(); dogRow[18] = dc.Special_Request; dt.Rows.Add(dogRow); } dgvDogClasses.DataSource = dt; dgvDogClasses.Columns["DogClassID"].Visible = false; dgvDogClasses.Columns["EntrantID"].Visible = false; dgvDogClasses.Columns["DogID"].Visible = false; //dgvDogClasses.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //dgvDogClasses.AutoSize = true; }
private void PopulateDogGridView(List <Dogs> tblDogs, int pageNo) { if (tblDogs == null) { tblDogs = Common.Dog_GridViewData; } List <Dogs> newDogs = new List <Dogs>(); int itemsperPage = Int32.Parse(WebConfigurationManager.AppSettings["GridItemsPerPage"]); int startRowIndex = (pageNo - 1) * itemsperPage; int currentIndex = 0; int itemsRead = 0; int totalRecords = tblDogs.Count; foreach (Dogs row in tblDogs) { if (itemsRead < itemsperPage && currentIndex < totalRecords && currentIndex >= startRowIndex) { Dogs newDog = new Dogs(_connString); newDog.Dog_ID = row.Dog_ID; newDog.Dog_KC_Name = row.Dog_KC_Name; newDog.Dog_Pet_Name = row.Dog_Pet_Name; if (!row.IsReg_NoNull) { newDog.Reg_No = row.Reg_No; } DogBreeds dogBreeds = new DogBreeds(_connString, Convert.ToInt32(row.Dog_Breed_ID)); newDog.Dog_Breed_Description = dogBreeds.Description; DogGender dogGender = new DogGender(_connString, Convert.ToInt32(row.Dog_Gender_ID)); newDog.Dog_Gender = dogGender.Description; newDogs.Add(newDog); itemsRead++; } currentIndex++; } lblTotalPages.Text = CalculateTotalPages(totalRecords).ToString(); lblCurrentPage.Text = CurrentPage.ToString(); if (CurrentPage == 1) { Btn_Previous.Enabled = false; if (Int32.Parse(lblTotalPages.Text) > 0) { Btn_Next.Enabled = true; } else { Btn_Next.Enabled = false; } } else { Btn_Previous.Enabled = true; if (CurrentPage == Int32.Parse(lblTotalPages.Text)) { Btn_Next.Enabled = false; } else { Btn_Next.Enabled = true; } } DogGridView.DataSource = newDogs; DogGridView.DataBind(); }
private void PopulateDog() { Guid current_dog_ID = new Guid(Current_Dog_ID); Dogs dog = new Dogs(_connString, current_dog_ID); txtKCName.Text = dog.Dog_KC_Name; txtPetName.Text = dog.Dog_Pet_Name; lblNLWU.Text = string.Format("Tick this box if {0} is no longer with us.", dog.Dog_Pet_Name); if (dog.Dog_Breed_ID != null) { int dog_Breed_ID = Int32.Parse(dog.Dog_Breed_ID.ToString()); DogBreeds dogBreeds = new DogBreeds(_connString, dog_Breed_ID); txtDogBreed.Text = dogBreeds.Description; } if (dog.Dog_Gender_ID != null) { int dog_Gender_ID = Int32.Parse(dog.Dog_Gender_ID.ToString()); DogGender dogGender = new DogGender(_connString, dog_Gender_ID); txtDogGender.Text = dogGender.Description; } if (dog.Reg_No != null) { Reg_No = dog.Reg_No.ToString(); Common.Reg_No = Reg_No; txtRegNo.Text = Reg_No; } if (dog.Date_Of_Birth != null) { string format = "yyyy-MM-dd"; Date_Of_Birth = DateTime.Parse(dog.Date_Of_Birth.ToString()).ToString(format); Common.Date_Of_Birth = Date_Of_Birth; txtDogDOB.Text = Date_Of_Birth; } if (dog.Merit_Points != null) { Merit_Points = dog.Merit_Points.ToString(); Common.Merit_Points = Merit_Points; txtMeritPoints.Text = Merit_Points; } else { Merit_Points = "0"; Common.Merit_Points = Merit_Points; txtMeritPoints.Text = Merit_Points; } if (dog.NLWU != null) { NLWU = (bool)dog.NLWU; Common.NLWU = NLWU; chkNLWU.Checked = NLWU; } DogDams dogDams = new DogDams(_connString); List <DogDams> lnkDogDams; lnkDogDams = dogDams.GetDogDamsByDog_ID(dog.Dog_ID); if (lnkDogDams.Count != 0) { Dam_ID = lnkDogDams[0].Dam_ID.ToString(); Common.Dam_ID = Dam_ID; PopulateDam(); } DogSires dogSires = new DogSires(_connString); List <DogSires> lnkDogSires; lnkDogSires = dogSires.GetDogSiresByDog_ID(dog.Dog_ID); if (lnkDogSires.Count != 0) { Sire_ID = lnkDogSires[0].Sire_ID.ToString(); Common.Sire_ID = Sire_ID; PopulateSire(); } }
private int?GetGender(string sex) { DogGender gender = new DogGender(Utils.ConnectionString()); return(gender.GetDog_Gender(sex)); }