public Pet_type Insert_Pet_type_select(int ID) { Pet_type = Pet_type.Select(ID); Insert_Pet_Species_txt.Text = Convert.ToString(Pet_type.Pet_Species); Insert_Pet_Type_txt.Text = Convert.ToString(Pet_type.Pet_Type); Insert_Pet_Breed_txt.Text = Convert.ToString(Pet_type.Pet_Breed); return Pet_type; }
public Pet_type Insert_Pet_type_select(int ID) { Pet_type = Pet_type.Select(ID); Insert_Pet_Species_txt.Text = Convert.ToString(Pet_type.Pet_Species); Insert_Pet_Type_txt.Text = Convert.ToString(Pet_type.Pet_Type); Insert_Pet_Breed_txt.Text = Convert.ToString(Pet_type.Pet_Breed); return(Pet_type); }
public Pet_type Delete_Pet_type_select(int ID) { Pet_type = Pet_type.Select(ID); Delete_Pet_Type_ID_txt_lbl.Text = Convert.ToString(Pet_type.Pet_Type_ID); Delete_Pet_Species_txt_lbl.Text = Convert.ToString(Pet_type.Pet_Species); Delete_Pet_Type_txt_lbl.Text = Convert.ToString(Pet_type.Pet_Type); Delete_Pet_Breed_txt_lbl.Text = Convert.ToString(Pet_type.Pet_Breed); return Pet_type; }
public Pet_type Delete_Pet_type_select(int ID) { Pet_type = Pet_type.Select(ID); Delete_Pet_Type_ID_txt_lbl.Text = Convert.ToString(Pet_type.Pet_Type_ID); Delete_Pet_Species_txt_lbl.Text = Convert.ToString(Pet_type.Pet_Species); Delete_Pet_Type_txt_lbl.Text = Convert.ToString(Pet_type.Pet_Type); Delete_Pet_Breed_txt_lbl.Text = Convert.ToString(Pet_type.Pet_Breed); return(Pet_type); }
public Pet_type Pet_type_insert() { Pet_type.Pet_Species = Insert_Pet_Species_txt.Text; Pet_type.Pet_Type = Insert_Pet_Type_txt.Text; Pet_type.Pet_Breed = Insert_Pet_Breed_txt.Text; Pet_type = Pet_type.Insert(Pet_type); Insert_Pet_type_GridView.DataBind(); Update_Pet_type_GridView.DataBind(); Delete_Pet_type_GridView.DataBind(); return Pet_type; }
public Pet_type Pet_type_insert() { Pet_type.Pet_Species = Insert_Pet_Species_txt.Text; Pet_type.Pet_Type = Insert_Pet_Type_txt.Text; Pet_type.Pet_Breed = Insert_Pet_Breed_txt.Text; Pet_type = Pet_type.Insert(Pet_type); Insert_Pet_type_GridView.DataBind(); Update_Pet_type_GridView.DataBind(); Delete_Pet_type_GridView.DataBind(); return(Pet_type); }
public Pet_type Pet_type_update(int ID) { Pet_type = Pet_type.Select(ID); Pet_type.Pet_Type_ID = Convert.ToInt32(Update_Pet_Type_ID_txt.Text); Pet_type.Pet_Species = Update_Pet_Species_txt.Text; Pet_type.Pet_Type = Update_Pet_Type_txt.Text; Pet_type.Pet_Breed = Update_Pet_Breed_txt.Text; Pet_type.Update(Pet_type); Insert_Pet_type_GridView.DataBind(); Update_Pet_type_GridView.DataBind(); Delete_Pet_type_GridView.DataBind(); return(Pet_type); }
public Pet_type Pet_type_update(int ID) { Pet_type = Pet_type.Select(ID); Pet_type.Pet_Type_ID = Convert.ToInt32(Update_Pet_Type_ID_txt.Text); Pet_type.Pet_Species = Update_Pet_Species_txt.Text; Pet_type.Pet_Type = Update_Pet_Type_txt.Text; Pet_type.Pet_Breed = Update_Pet_Breed_txt.Text; Pet_type.Update(Pet_type); Insert_Pet_type_GridView.DataBind(); Update_Pet_type_GridView.DataBind(); Delete_Pet_type_GridView.DataBind(); return Pet_type; }
protected void Update_Select_Record(object sender, EventArgs e) { Pet_type = Update_Pet_type_select(Convert.ToInt32(Update_Pet_type_GridView.SelectedValue)); }
protected void UPDATE(object sender, EventArgs e) { Pet_type = Pet_type_update(Convert.ToInt32(Update_Pet_type_GridView.SelectedValue)); }
protected void INSERT(object sender, EventArgs e) { Pet_type = Pet_type_insert(); }
protected void Insert_Select_Record(object sender, EventArgs e) { Pet_type = Insert_Pet_type_select(Convert.ToInt32(Insert_Pet_type_GridView.SelectedValue)); }
//////////////////////////////////////// ///////////////////////////////////////////// //////////////////Start Client///////////////////// ///////////////////////////////////////////// //////////////////////////////////////// //find client - search button //select a pet and display data protected void gvPetSearchresult_SelectedIndexChanged(object sender, EventArgs e) { pet = pet.Select(Convert.ToInt32(Update_gvPetSearchresult.SelectedDataKey.Value)); GlobalVariables.Pet_Record_ID = Convert.ToInt32(Update_gvPetSearchresult.SelectedDataKey.Value); Pet_Type = Pet_Type.Select(pet.Pet_Type_ID); Pet_Missing = Pet_Missing.Select(pet.Pet_Record_ID); Pet_Deceased = Pet_Deceased.Select(pet.Pet_Record_ID); ClientWPets = ClientWPets.Select(pet.Pet_Record_ID); Location = Location.Select(ClientWPets.Location_ID); //////////////////////////////////////////////////////////////////////////////////// //Pet GlobalVariables.Pet_Deceased_ID = Pet_Deceased.Pet_Deceased_ID; GlobalVariables.Pet_Type_ID = pet.Pet_Type_ID; GlobalVariables.Pet_Missing_ID = Pet_Missing.Pet_Missing_ID; GlobalVariables.CLIENTWPETS_ID = ClientWPets.CLIENTWPETS_ID; GlobalVariables.Location_ID = ClientWPets.Location_ID; //Pet Update_petName_txt.Text = pet.Pet_Name; Update_petDateOfBirth_txt.Text = pet.Pet_Date_Of_Birth.ToShortDateString(); Update_petRFID_txt.Text = Convert.ToString(pet.Pet_RFID); pet.Date_Modified = DateTime.Now; //pet.Date_Created = CANT CHANGE!!! Update_petDiscription_txt.Text = pet.Pet_Description; Update_petGender_DDL.SelectedValue = Convert.ToString(pet.Pet_Gender); Update_petColor_txt.Text = pet.Pet_Color; Update_petVetID_txt.Text = pet.Pet_Vet_ID; Update_petLicenseTag_txt.Text = pet.Pet_License_Tag; Update_petTatooNumber_txt.Text = pet.Pet_Tatoo_No; Update_petConditionID_ddl.SelectedValue = pet.Pet_Condition; Update_petStatusID_txt.Text = pet.Pet_Status; Update_petNeutered_DDL.SelectedValue = Convert.ToString(pet.Pet_Sterilized); Update_petWeight_txt.Text = Convert.ToString(pet.Pet_Weight); //PetType Update_petSpecies_ddl.SelectedValue = Pet_Type.Pet_Species; Update_petType_ddl.SelectedValue = Pet_Type.Pet_Type; Update_petBreed_txt.Text = Pet_Type.Pet_Breed; if (Pet_Missing.Pet_Missing_ID != 0) { //Missing Update_DateMissing_txt.Text = Pet_Missing.Date_Missing.ToShortDateString(); Update_collarDescription_txt.Text = Pet_Missing.Collar_Description; Update_TimeLost_txt.Text = Convert.ToString(Pet_Missing.Time_Lost); Update_lostExplanation_txt.Text = Pet_Missing.Lost_Explanation; Update_LengthOwned_txt.Text = Convert.ToString(Pet_Missing.Length_Owned); Update_RewardAmt_txt.Text = Convert.ToString(Pet_Missing.Reward_Amt); Update_Breeder_txt.Text = Pet_Missing.Breeder; } if (Pet_Deceased.Pet_Deceased_ID != 0) { //Pet_Deceased Update_DateDeceased_txt.Text = Convert.ToString(Pet_Deceased.Date_Deceased); Update_funeral_txt.Text = Pet_Deceased.Funeral; Update_cemetaryName_txt.Text = Pet_Deceased.Cemetary_Name; Update_serviceType_DDL.SelectedValue = Convert.ToString(Pet_Deceased.Deceased_Type); Pet_Deceased.Date_Modified = DateTime.Now; if (Update_serviceType_DDL.SelectedValue == "F") { Update_cemetaryName_L.Visible = true; Update_cemetaryName_txt.Visible = true; Update_funeral_txt.Visible = true; Update_funeral_L.Visible = true; } else { Update_cemetaryName_L.Visible = false; Update_cemetaryName_txt.Visible = false; Update_funeral_txt.Visible = false; Update_funeral_L.Visible = false; } } //Location Update_address_txt.Text = Location.location_desc; Update_city_txt.Text = Location.city; Update_state_txt.Text = Location.state; Update_zip_txt.Text = Convert.ToString(Location.zip); Update_county_txt.Text = Location.county; Update_LocationDiscription_txt.Text = Location.location_desc; Update_long_txt.Text = Convert.ToString(Location.n_long); Update_lat_txt.Text = Convert.ToString(Location.n_lat); if (GlobalVariables.Pet_Missing_ID == 0 || GlobalVariables.Pet_Missing_ID == null) { Update_PetMissingInfoHead.Visible = false; Update_PetMissingInfoBody.Visible = false; Update_missingYes.Checked = false; Update_locationknown_L.Text = "Where is the Pet Located?"; } else { Update_missingYes.Checked = true; Update_PetMissingInfoHead.Visible = true; Update_PetMissingInfoBody.Visible = true; Update_deceasedYes.Checked = false; Update_deceasedYes.Checked = false; Update_PetDeceasedInfoHead.Visible = false; Update_PetDeceasedInfoBody.Visible = false; Update_PetSearchSelected_L.Text += "</br>" + "== STATUS: Missing as of " + Convert.ToString(Pet_Missing.Date_Missing) + " =="; Update_locationknown_L.Text = "Where was the Pet Last Seen?"; } if (GlobalVariables.Pet_Deceased_ID == 0 || GlobalVariables.Pet_Deceased_ID == null) { Update_PetDeceasedInfoHead.Visible = false; Update_PetDeceasedInfoBody.Visible = false; Update_deceasedYes.Checked = false; Update_locationknown_L.Text = "Where is the Pet Located?"; } else { Update_deceasedYes.Checked = true; Update_PetDeceasedInfoHead.Visible = true; Update_PetDeceasedInfoBody.Visible = true; Update_missingYes.Checked = false; Update_PetMissingInfoHead.Visible = false; Update_PetMissingInfoBody.Visible = false; Update_PetSearchSelected_L.Text += "</br>" + "== STATUS: Deceased as of " + Convert.ToString(Pet_Deceased.Date_Deceased) + " =="; Update_locationknown_L.Text = "Where is the Pets Resting Place?"; } }
//////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////start Add functions/////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //update the pet records -- update btn protected void Insert(object sender, EventArgs e) { if (Insert_GVcases.SelectedValue == null) { Insert_lbl_pet_Error.Text = "You must first select a case to continue"; return; } else if (Insert_gvClientSearchresult.SelectedValue == null) { Insert_lbl_pet_Error.Text = "You must first select a client to continue"; return; } else if (Insert_DDL_Call_Center.SelectedValue == "-1" ) { Insert_lbl_pet_Error.Text = "Please a call center to contuinue."; return; } else if (Insert_DDlDisasters.SelectedValue == "-1") { Insert_lbl_pet_Error.Text = "Please a disaster to contuinue."; return; } else { //Location Location.type = decideLocationType(); Location.city = Insert_city_txt.Text; Location.state = Insert_state_txt.Text; Location.zip = Convert.ToInt32(Insert_zip_txt.Text); Location.county = Insert_county_txt.Text; Location.location_desc = Insert_LocationDiscription_txt.Text; Location.n_long = Convert.ToDecimal(Insert_long_txt.Text); Location.s_long = 0; Location.e_long = 0; Location.w_long = 0; Location.n_lat = Convert.ToDecimal(Insert_lat_txt.Text); Location.s_lat = 0; Location.e_lat = 0; Location.w_lat = 0; Location = Location.Insert(Location); //PetType exchange Pet_Type.Pet_Type = Insert_petType_ddl.SelectedValue; Pet_Type.Pet_Breed = Insert_petBreed_txt.Text; Pet_Type.Pet_Species = Insert_petSpecies_ddl.SelectedValue; Pet_Type = Pet_Type.Insert(Pet_Type); pet.Pet_Type_ID = Pet_Type.Pet_Type_ID; pet.Pet_Name = Insert_petName_txt.Text; if (Insert_petDateOfBirth_txt.Text != "") { pet.Pet_Date_Of_Birth = Convert.ToDateTime(Insert_petDateOfBirth_txt.Text); } else { pet.Pet_Date_Of_Birth = Convert.ToDateTime("9/9/9"); } pet.Pet_RFID = Insert_petRFID_txt.Text; pet.Date_Modified = DateTime.Now; pet.Date_Created = DateTime.Now; pet.Pet_Description = Insert_petDiscription_txt.Text; pet.Pet_Gender = Convert.ToString(Insert_petGender_DDL.SelectedValue); pet.Pet_Color = Insert_petColor_txt.Text; pet.Pet_Vet_ID = Insert_petVetID_txt.Text; pet.Pet_License_Tag = Insert_petLicenseTag_txt.Text; pet.Pet_Tatoo_No = Insert_petTatooNumber_txt.Text; pet.Pet_Sterilized = Convert.ToString(Insert_petNeutered_DDL.SelectedValue); if (Insert_petWeight_txt.Text != "") { pet.Pet_Weight = Convert.ToInt32(Insert_petWeight_txt.Text); } if (Insert_petCondition_ddl.SelectedValue != "-1") { pet.Pet_Condition = Insert_petCondition_ddl.SelectedValue; } pet.Pet_Status = Insert_petStatus_txt.Text; pet.Pet_Location_Found_ID = 0; if (Insert_Image_Name.Text != "") { //========= //Save image to server then DB Object string fileName = pet.Pet_Record_ID + "_" + pet.Pet_Name + ".jpg"; string smallPath = Server.MapPath("Pet_Images/100x100/" + fileName); string mediumPath = Server.MapPath("Pet_Images/200x200/" + fileName); string originalPath = Server.MapPath("Pet_Images/Original/" + fileName); string originalTempPath = Server.MapPath("Pet_Images/Original/" + Insert_Image_Name.Text); //create clone image to re-size System.Drawing.Image small_pet_picture = System.Drawing.Image.FromFile(originalTempPath); //resize small_pet_picture = resizeImage(small_pet_picture, new Size(100, 100)); //Convert back to byte[] array byte[] small_pet_picture_bytes = imageToByteArray(small_pet_picture); //create clone image to re-size System.Drawing.Image medium_pet_picture = System.Drawing.Image.FromFile(originalTempPath); //resize medium_pet_picture = resizeImage(medium_pet_picture, new Size(200, 200)); //Convert back to byte[] array byte[] medium_pet_picture_bytes = imageToByteArray(medium_pet_picture); //create clone image to re-size System.Drawing.Image original_pet_picture = System.Drawing.Image.FromFile(originalTempPath); //Convert to byte[] array byte[] original_pet_picture_bytes = imageToByteArray(original_pet_picture); //save resized images File.WriteAllBytes(@smallPath, small_pet_picture_bytes); File.WriteAllBytes(@mediumPath, medium_pet_picture_bytes); File.WriteAllBytes(@originalPath, original_pet_picture_bytes); //save to database pet.Pet_Picture = imageToByteArray(System.Drawing.Image.FromFile(originalPath)); } else { pet.Pet_Picture = new byte[0]; } pet = pet.Insert(pet); if (Insert_missingYes.Checked == true) { //Pet_Missing exchange Pet_Missing.Pet_Missing_ID = pet.Pet_Record_ID; Pet_Missing.Date_Reported = DateTime.Now; Pet_Missing.Date_Created = DateTime.Now; Pet_Missing.Date_Missing = Convert.ToDateTime(Insert_DateMissing_txt.Text); Pet_Missing.Time_Lost = Convert.ToDateTime(Insert_TimeLost_txt.Text); Pet_Missing.Collar_Description = Insert_collarDescription_txt.Text; Pet_Missing.Lost_Explanation = Insert_lostExplanation_txt.Text; if (Insert_LengthOwned_txt.Text != "") { Pet_Missing.Length_Owned = Convert.ToInt32(Insert_LengthOwned_txt.Text); } if (Insert_RewardAmt_txt.Text != "") { Pet_Missing.Reward_Amt = Convert.ToDecimal(Insert_RewardAmt_txt.Text); } Pet_Missing.Breeder = Insert_Breeder_txt.Text; Pet_Missing.Date_Modified = DateTime.Now; Pet_Missing.Last_Known_Location_ID = Location.Location_ID; Pet_Missing = Pet_Missing.Insert(Pet_Missing); } if (Insert_deceasedYes.Checked == true) { if (Insert_DateDeceased_txt.Text == "" || Insert_serviceType_DDL.SelectedValue == "-1") { Insert_lbl_pet_Error.Text = "Please fill out The Date Found and or Service Type."; return; } else { //Pet_Deceased exchange Pet_Deceased.Pet_Deceased_ID = pet.Pet_Record_ID; Pet_Deceased.Date_Deceased = Convert.ToDateTime(Insert_DateDeceased_txt.Text); Pet_Deceased.Funeral = Insert_funeral_txt.Text; Pet_Deceased.Cemetary_Name = Insert_cemetaryName_txt.Text; Pet_Deceased.Deceased_Type = Insert_serviceType_DDL.SelectedValue; Pet_Deceased.Date_Created = DateTime.Now; Pet_Deceased.Date_Modified = DateTime.Now; Pet_Deceased.Location_ID = Location.Location_ID; Pet_Deceased = Pet_Deceased.Insert(Pet_Deceased); } } //ClientWPets ClientWPets.Pet_Record_ID = pet.Pet_Record_ID; ClientWPets.Client_id = Convert.ToInt32(Insert_gvClientSearchresult.SelectedValue); ClientWPets.Location_ID = Location.Location_ID; ClientWPets.cp_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); ClientWPets.ownership = Convert.ToString("y"); ClientWPets = ClientWPets.Insert(ClientWPets); //////////////////////////////////////// encounter.case_id = Convert.ToInt32(Insert_GVcases.SelectedValue); //encounter.agency_id.Equals(DBNull.Value); encounter.call_center_id = Convert.ToInt32(Insert_DDL_Call_Center.SelectedValue); encounter.client_id = Convert.ToInt32(Insert_gvClientSearchresult.SelectedValue); encounter.create_date = DateTime.Now; if (GlobalVariables.Pet_Deceased_ID != null || GlobalVariables.Pet_Deceased_ID != 0) { encounter.close_date = DateTime.Now; } else { //encounter.close_date = Convert.ToDateTime("9/9/9"); } encounter.disaster_id = Convert.ToInt32(Insert_DDlDisasters.SelectedValue); encounter.Location_ID = Location.Location_ID; encounter.Pet_Record_ID = pet.Pet_Record_ID; encounter.Insert(encounter); Insert_lbl_pet_Error.Text = "The pet has been successfully saved."; } }