private void savePet() { DateTime?birth = null; if (ddlYear.SelectedIndex != 0) { if (ddlMonth.SelectedIndex != 0) { birth = new DateTime(Int16.Parse(ddlYear.SelectedValue), Int16.Parse(ddlMonth.SelectedValue), 1); } else { birth = null; } } if (Session["PET_NUMBER"] == null) { Pet pet = new Pet(); if (pet.AddPet(txtName.Text, (rblSexList.SelectedIndex == 0) ? 'M' : 'F', chbFixed.Checked, txtBreed.Text, birth, Convert.ToInt32(Session["OWNER_NUMBER"]), rblPetSizeList.SelectedValue[0], txtPetNotes.Text) != HulkHvkBLL.e.insertFail) { addVaccinations(); } else { lblCUDErrorORWarning.Text = "Error: We could not add your pet due to a serverside error <br /> we are currently working on a solution, please try again in 15 minutes"; } } else { Pet tempPet = new Pet(Convert.ToInt32(Session["PET_NUMBER"]), txtName.Text, (rblSexList.SelectedIndex == 0) ? 'M' : 'F', chbFixed.Checked, txtBreed.Text, birth, Convert.ToInt32(Session["OWNER_NUMBER"]), 0, rblPetSizeList.SelectedValue[0], txtPetNotes.Text); if (tempPet.Update(Convert.ToInt32(Session["PET_NUMBER"]), tempPet.name, tempPet.sex, tempPet._fixed, tempPet.breed, Convert.ToDateTime(tempPet.birthdate), tempPet.ownerNumber, Convert.ToChar(tempPet.size), tempPet.special_notes) != HulkHvkBLL.e.updateFail) { addVaccinations(); } else { lblCUDErrorORWarning.Text = "Error: We could not add your pet's vaccinations due to a serverside error <br /> we are currently working on a solution, please try again in 15 minutes"; } } }