public Pet_Deceased Insert_Pet_Deceased_select(int ID) { Pet_Deceased = Pet_Deceased.Select(ID); Insert_Date_Deceased_txt.Text = Convert.ToString(Pet_Deceased.Date_Deceased); Insert_Location_ID_txt.Text = Convert.ToString(Pet_Deceased.Location_ID); Insert_Funeral_txt.Text = Convert.ToString(Pet_Deceased.Funeral); Insert_Cemetary_Name_txt.Text = Convert.ToString(Pet_Deceased.Cemetary_Name); Insert_Deceased_Type_txt.Text = Convert.ToString(Pet_Deceased.Deceased_Type); Insert_Date_Created_txt.Text = Convert.ToString(Pet_Deceased.Date_Created); Insert_Date_Modified_txt.Text = Convert.ToString(Pet_Deceased.Date_Modified); return(Pet_Deceased); }
public Pet_Deceased Insert_Pet_Deceased_select(int ID) { Pet_Deceased = Pet_Deceased.Select(ID); Insert_Date_Deceased_txt.Text = Convert.ToString(Pet_Deceased.Date_Deceased); Insert_Location_ID_txt.Text = Convert.ToString(Pet_Deceased.Location_ID); Insert_Funeral_txt.Text = Convert.ToString(Pet_Deceased.Funeral); Insert_Cemetary_Name_txt.Text = Convert.ToString(Pet_Deceased.Cemetary_Name); Insert_Deceased_Type_txt.Text = Convert.ToString(Pet_Deceased.Deceased_Type); Insert_Date_Created_txt.Text = Convert.ToString(Pet_Deceased.Date_Created); Insert_Date_Modified_txt.Text = Convert.ToString(Pet_Deceased.Date_Modified); return Pet_Deceased; }
public Pet_Deceased Pet_Deceased_insert() { Pet_Deceased.Date_Deceased = Convert.ToDateTime(Insert_Date_Deceased_txt.Text); Pet_Deceased.Location_ID = Convert.ToInt32(Insert_Location_ID_txt.Text); Pet_Deceased.Funeral = Insert_Funeral_txt.Text; Pet_Deceased.Cemetary_Name = Insert_Cemetary_Name_txt.Text; Pet_Deceased.Deceased_Type = Insert_Deceased_Type_txt.Text; Pet_Deceased.Date_Created = Convert.ToDateTime(Insert_Date_Created_txt.Text); Pet_Deceased.Date_Modified = Convert.ToDateTime(Insert_Date_Modified_txt.Text); Pet_Deceased = Pet_Deceased.Insert(Pet_Deceased); Insert_Pet_Deceased_GridView.DataBind(); Update_Pet_Deceased_GridView.DataBind(); Delete_Pet_Deceased_GridView.DataBind(); return(Pet_Deceased); }
public Pet_Deceased Pet_Deceased_update(int ID) { Pet_Deceased = Pet_Deceased.Select(ID); Pet_Deceased.Pet_Deceased_ID = Convert.ToInt32(Update_Pet_Deceased_ID_txt.Text); Pet_Deceased.Date_Deceased = Convert.ToDateTime(Update_Date_Deceased_txt.Text); Pet_Deceased.Location_ID = Convert.ToInt32(Update_Location_ID_txt.Text); Pet_Deceased.Funeral = Update_Funeral_txt.Text; Pet_Deceased.Cemetary_Name = Update_Cemetary_Name_txt.Text; Pet_Deceased.Deceased_Type = Update_Deceased_Type_txt.Text; Pet_Deceased.Date_Created = Convert.ToDateTime(Update_Date_Created_txt.Text); Pet_Deceased.Date_Modified = Convert.ToDateTime(Update_Date_Modified_txt.Text); Pet_Deceased.Update(Pet_Deceased); Insert_Pet_Deceased_GridView.DataBind(); Update_Pet_Deceased_GridView.DataBind(); Delete_Pet_Deceased_GridView.DataBind(); return(Pet_Deceased); }
public Pet_Deceased Pet_Deceased_insert() { Pet_Deceased.Date_Deceased = Convert.ToDateTime(Insert_Date_Deceased_txt.Text); Pet_Deceased.Location_ID = Convert.ToInt32(Insert_Location_ID_txt.Text); Pet_Deceased.Funeral = Insert_Funeral_txt.Text; Pet_Deceased.Cemetary_Name = Insert_Cemetary_Name_txt.Text; Pet_Deceased.Deceased_Type = Insert_Deceased_Type_txt.Text; Pet_Deceased.Date_Created = Convert.ToDateTime(Insert_Date_Created_txt.Text); Pet_Deceased.Date_Modified = Convert.ToDateTime(Insert_Date_Modified_txt.Text); Pet_Deceased = Pet_Deceased.Insert(Pet_Deceased); Insert_Pet_Deceased_GridView.DataBind(); Update_Pet_Deceased_GridView.DataBind(); Delete_Pet_Deceased_GridView.DataBind(); return Pet_Deceased; }
protected void Update_Select_Record(object sender, EventArgs e) { Pet_Deceased = Update_Pet_Deceased_select(Convert.ToInt32(Update_Pet_Deceased_GridView.SelectedValue)); }
protected void UPDATE(object sender, EventArgs e) { Pet_Deceased = Pet_Deceased_update(Convert.ToInt32(Update_Pet_Deceased_GridView.SelectedValue)); }
protected void INSERT(object sender, EventArgs e) { Pet_Deceased = Pet_Deceased_insert(); }
public Pet_Deceased Pet_Deceased_update(int ID) { Pet_Deceased = Pet_Deceased.Select(ID); Pet_Deceased.Pet_Deceased_ID = Convert.ToInt32(Update_Pet_Deceased_ID_txt.Text); Pet_Deceased.Date_Deceased = Convert.ToDateTime(Update_Date_Deceased_txt.Text); Pet_Deceased.Location_ID = Convert.ToInt32(Update_Location_ID_txt.Text); Pet_Deceased.Funeral = Update_Funeral_txt.Text; Pet_Deceased.Cemetary_Name = Update_Cemetary_Name_txt.Text; Pet_Deceased.Deceased_Type = Update_Deceased_Type_txt.Text; Pet_Deceased.Date_Created = Convert.ToDateTime(Update_Date_Created_txt.Text); Pet_Deceased.Date_Modified = Convert.ToDateTime(Update_Date_Modified_txt.Text); Pet_Deceased.Update(Pet_Deceased); Insert_Pet_Deceased_GridView.DataBind(); Update_Pet_Deceased_GridView.DataBind(); Delete_Pet_Deceased_GridView.DataBind(); return Pet_Deceased; }
//update the pet records -- update btn protected void update(object sender, EventArgs e) { if (Update_GVcases.SelectedValue == null) { Update_lbl_pet_Error.Text = "You must first select a case to continue"; return; } else if (Update_gvClientSearchresult.SelectedValue == null) { Update_lbl_pet_Error.Text = "You must first select a client to continue"; return; } if (Update_DDL_Call_Center.SelectedValue == "-1") { Update_lbl_pet_Error.Text = "Please a call center to contuinue."; return; } else if (Update_DDlDisasters.SelectedValue == "-1") { Update_lbl_pet_Error.Text = "Please a disaster to contuinue."; return; } else { person = person.Select(Convert.ToInt32(Update_gvClientSearchresult.SelectedDataKey.Value)); client = client.Select(Convert.ToInt32(Update_gvClientSearchresult.SelectedDataKey.Value)); //PetType exchange Pet_Type.Pet_Type_ID = GlobalVariables.Pet_Type_ID; Pet_Type.Pet_Type = Update_petType_ddl.SelectedValue; Pet_Type.Pet_Breed = Update_petBreed_txt.Text; Pet_Type.Pet_Species = Update_petSpecies_ddl.SelectedValue; //Pet exchange pet.Pet_Record_ID = Convert.ToInt32(Update_gvPetSearchresult.SelectedDataKey.Value); pet.Pet_Type_ID = GlobalVariables.Pet_Type_ID; pet.Pet_Name = Update_petName_txt.Text; pet.Pet_Location_Found_ID = 1; if (Update_petDateOfBirth_txt.Text != "") { pet.Pet_Date_Of_Birth = Convert.ToDateTime(Update_petDateOfBirth_txt.Text); } pet.Pet_RFID = Update_petRFID_txt.Text; pet.Date_Modified = DateTime.Now; pet.Date_Created = DateTime.Now; pet.Pet_Description = Update_petDiscription_txt.Text; pet.Pet_Gender = Convert.ToString(Update_petGender_DDL.SelectedValue); pet.Pet_Color = Update_petColor_txt.Text; pet.Pet_Vet_ID = Update_petVetID_txt.Text; pet.Pet_License_Tag = Update_petLicenseTag_txt.Text; pet.Pet_Tatoo_No = Update_petTatooNumber_txt.Text; pet.Pet_Sterilized = Convert.ToString(Update_petNeutered_DDL.SelectedValue); pet.Pet_Weight = Convert.ToInt32(Update_petWeight_txt.Text); pet.Pet_Condition = Update_petConditionID_ddl.SelectedValue; pet.Pet_Status = Update_petStatusID_txt.Text; if (Update_Image_Name.Text != "") { //========= //Save Image to server then DB Object string fileName = Update_gvPetSearchresult.SelectedDataKey.Value + "_" + Update_petName_txt.Text + ".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/" + Update_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]; } //ClientWPets ClientWPets.CLIENTWPETS_ID = GlobalVariables.CLIENTWPETS_ID; ClientWPets.Pet_Record_ID = pet.Pet_Record_ID; ClientWPets.Client_id = client.client_id; ClientWPets.Location_ID = GlobalVariables.Location_ID; ClientWPets.cp_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); ClientWPets.ownership = Convert.ToString("y"); //Location Location.Location_ID = GlobalVariables.Location_ID; Location.type = decideLocationType(); Location.city = Update_city_txt.Text; Location.state = Update_state_txt.Text; Location.zip = Convert.ToInt32(Update_zip_txt.Text); Location.county = Update_county_txt.Text; Location.location_desc = Update_LocationDiscription_txt.Text; Location.n_long = Convert.ToDecimal(Update_long_txt.Text); Location.s_long = 0; Location.e_long = 0; Location.w_long = 0; Location.n_lat = Convert.ToDecimal(Update_lat_txt.Text); Location.s_lat = 0; Location.e_lat = 0; Location.w_lat = 0; //update if (Pet_Deceased.Pet_Deceased_ID == 0 && Update_deceasedYes.Checked == true) { if (Update_DateDeceased_txt.Text == "" || Update_serviceType_DDL.SelectedValue == "-1") { Update_lbl_pet_Error.Text = "Please fill out The Date Found and or Service Type."; } else { //Pet_Deceased exchange Pet_Deceased.Pet_Deceased_ID = pet.Pet_Record_ID; Pet_Deceased.Date_Deceased = Convert.ToDateTime(Update_DateDeceased_txt.Text); Pet_Deceased.Funeral = Update_funeral_txt.Text; Pet_Deceased.Cemetary_Name = Update_cemetaryName_txt.Text; Pet_Deceased.Deceased_Type = Update_serviceType_DDL.SelectedValue; Pet_Deceased.Date_Modified = DateTime.Now; Pet_Deceased.Date_Created = DateTime.Now; Pet_Deceased.Location_ID = Location.Location_ID; Pet_Deceased = Pet_Deceased.Insert(Pet_Deceased); } } if (GlobalVariables.Pet_Deceased_ID != 0 && Update_deceasedYes.Checked == true) { if (Update_DateDeceased_txt.Text == "" || Update_serviceType_DDL.SelectedValue == "") { Update_lbl_pet_Error.Text = "Please fill out The Date Found and or Service Type."; } else { //Pet_Deceased exchange Pet_Deceased.Pet_Deceased_ID = pet.Pet_Record_ID; Pet_Deceased.Date_Deceased = Convert.ToDateTime(Update_DateDeceased_txt.Text); Pet_Deceased.Funeral = Update_funeral_txt.Text; Pet_Deceased.Cemetary_Name = Update_cemetaryName_txt.Text; Pet_Deceased.Deceased_Type = Update_serviceType_DDL.SelectedValue; Pet_Deceased.Location_ID = Location.Location_ID; //Pet_Deceased.Date_Created == null Pet_Deceased.Date_Modified = DateTime.Now; Pet_Deceased.Update(Pet_Deceased); } } if (GlobalVariables.Pet_Missing_ID == 0 && Update_missingYes.Checked == true) { //Pet_Missing exchange Pet_Missing.Pet_Missing_ID = pet.Pet_Record_ID; Pet_Missing.Last_Known_Location_ID = Location.Location_ID; Pet_Missing.Date_Reported = DateTime.Now; Pet_Missing.Date_Created = DateTime.Now; Pet_Missing.Date_Missing = Convert.ToDateTime(Update_DateMissing_txt.Text); Pet_Missing.Time_Lost = Convert.ToDateTime(Update_TimeLost_txt.Text); Pet_Missing.Collar_Description = Update_collarDescription_txt.Text; Pet_Missing.Lost_Explanation = Update_lostExplanation_txt.Text; if (Update_LengthOwned_txt.Text != "") { Pet_Missing.Length_Owned = Convert.ToInt32(Update_LengthOwned_txt.Text); } if (Update_RewardAmt_txt.Text != "") { Pet_Missing.Reward_Amt = Convert.ToDecimal(Update_RewardAmt_txt.Text); } Pet_Missing.Breeder = Update_Breeder_txt.Text; Pet_Missing.Date_Modified = DateTime.Now; Pet_Missing = Pet_Missing.Insert(Pet_Missing); } if (GlobalVariables.Pet_Missing_ID != 0 && Update_missingYes.Checked == true) { //Pet_Missing exchange Pet_Missing.Pet_Missing_ID = pet.Pet_Record_ID; Pet_Missing.Last_Known_Location_ID = Location.Location_ID; Pet_Missing.Date_Reported = DateTime.Now; Pet_Missing.Date_Created = DateTime.Now; Pet_Missing.Date_Missing = Convert.ToDateTime(Update_DateMissing_txt.Text); Pet_Missing.Time_Lost = Convert.ToDateTime(Update_TimeLost_txt.Text); Pet_Missing.Collar_Description = Update_collarDescription_txt.Text; Pet_Missing.Lost_Explanation = Update_lostExplanation_txt.Text; if (Update_LengthOwned_txt.Text != "") { Pet_Missing.Length_Owned = Convert.ToInt32(Update_LengthOwned_txt.Text); } if (Update_RewardAmt_txt.Text != "") { Pet_Missing.Reward_Amt = Convert.ToDecimal(Update_RewardAmt_txt.Text); } Pet_Missing.Breeder = Update_Breeder_txt.Text; Pet_Missing.Date_Modified = DateTime.Now; Pet_Missing.Update(Pet_Missing); } pet.Update(pet); Pet_Type.Update(Pet_Type); Location.Update(Location); ClientWPets.Update(ClientWPets); //////////////////////////////////////// encounter.case_id = GlobalVariables.CaseID; encounter.agency_id = 0; encounter.call_center_id = Convert.ToInt32(Update_DDL_Call_Center.SelectedValue); encounter.client_id = GlobalVariables.ClientID; 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(Update_DDlDisasters.SelectedValue); encounter.Location_ID = Location.Location_ID; encounter.Pet_Record_ID = pet.Pet_Record_ID; encounter.Insert(encounter); Update_lbl_pet_Error.Text = "The selected pets informatin has been successfully updated."; } }
//////////////////////////////////////// ///////////////////////////////////////////// //////////////////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?"; } }
protected void Insert_Select_Record(object sender, EventArgs e) { Pet_Deceased = Insert_Pet_Deceased_select(Convert.ToInt32(Insert_Pet_Deceased_GridView.SelectedValue)); }