protected void Page_Load(object sender, EventArgs e) { mCustomer = (PetfirstCustomer)Session["Customer"]; mthisPet = (Pet)Session["Pet"]; HandleMenuItems(); if (!string.IsNullOrEmpty(Request.QueryString["new_pet"]) && mCustomer != null)//if there is query srtring passed { bAddPet = true; //adding a new pet only CancelLink.HRef = "customizeplan.aspx?canceladd=true"; } if (!string.IsNullOrEmpty(Request.QueryString["current_pet"])) { bSamePet = true; } if (!Page.IsPostBack) { if(bSamePet) { txtZip.Text = mCustomer.MembershipInfo.Zip; txtPetName.Text = mthisPet.PetName; DateTime today = DateTime.Today; int age = today.Year - mthisPet.Birthday.Year; //if (mthisPet.Birthday > today.AddYears(-age)) age--; ddlAge.SelectedIndex = age; load_breeds(mthisPet.SpeciesId); if (mthisPet.BreedId == 54) { ddlBreed.SelectedValue = "10000"; //+ mthisPet.WeightId).ToString(); rbRadioButtonListMixed.SelectedValue = mthisPet.WeightId.ToString(); } else { ddlBreed.SelectedValue = mthisPet.BreedId.ToString(); } rblSpecies.SelectedValue = mthisPet.SpeciesId.ToString(); } else { InitiatePetfirstCustomer(); InitiateNewPet(); rblSpecies.SelectedValue = "1"; load_breeds(1); ddlBreed.SelectedIndex = 0; rbRadioButtonListMixed.SelectedValue = "1"; } } lblYourPet.Text = mthisPet.PetName; if (bAddPet) { txtZip.Text = mCustomer.MembershipInfo.Zip; txtZip.Enabled = false; } this.Master.NumberofPets = mCustomer.MyPets.Count.ToString(); }
private void InitiateNewPet() { mthisPet = new Pet(); this.Master.PhoneNumber = mCustomer.CallCenter; if (!string.IsNullOrEmpty(Request.QueryString["pet_name"])) //Check for Pet Name from main page. { mthisPet.PetName = txtPetName.Text = (string)Request.QueryString["pet_name"]; } else if (bAddPet) { mthisPet.PetName = "Your Next Pet"; txtPetName.Text = ""; } else { mthisPet.PetName = "Your Pet"; txtPetName.Text = ""; } mthisPet.Birthday = DateTime.Now; mthisPet.Gender = "M"; mthisPet.GenderFull = "Male"; mthisPet.SpeciesId = 1; mthisPet.SpeciesName = "Dog"; mthisPet.BreedId = 0; }
private void DetermineBreedWeighID(ref Pet p) { //kp: 2015-06-29 //int sId =1; //if(btnCat.CssClass.Contains("active")) // sId = 2; int sId = int.Parse (rblSpecies.SelectedValue); //end 2015-06-29 int bId = int.Parse(ddlBreed.SelectedValue); int wId = 0; bool changeBreedId = false; if (bId == 10001)//fake breedid for mixed { wId = 1; changeBreedId = true; } else if (bId == 10002) { wId = 2; changeBreedId = true; } else if (bId == 10003) { wId = 3; changeBreedId = true; } if (changeBreedId) { if (sId == 1) bId = 54; //mixed breedid for dog else bId = 2; //mixed breedid for cat } p.BreedId = bId; p.WeightId = wId; }
private void SavePet(bool Update, ref Pet mypet) { //2015-06-29 mypet.Birthday = new DateTime(int.Parse(ddlYear.SelectedValue), int.Parse(ddlMonth.SelectedValue), 1); //mypet.Birthday = GetBirthday(txtbirthday.Text); //end 2015-06-29 mypet.BreedName = ddlBreed.SelectedItem.Text; //kp: 2015-06-29 //mypet.ColorId = int.Parse(ddlColor.SelectedValue); //mypet.ColorName = ddlColor.SelectedItem.Text; mypet.ColorId = 146; //default to any mypet.ColorName = "Any"; //if (btnMale.CssClass.Contains("active")) //{ // mypet.Gender = "M"; // mypet.GenderFull = "Male"; //} //else //{ // mypet.Gender = "F"; // mypet.GenderFull = "Female"; //} //if(btnYes.CssClass.Contains("active")) // mypet.SpayedOrNeutered = true; //else // mypet.SpayedOrNeutered = false; ////if (btnYes.Checked) //// mypet.SpayedOrNeutered = true; ////else //// mypet.SpayedOrNeutered = false; //if (btnDog.CssClass.Contains("active")) //{ // mypet.SpeciesId = 1; // mypet.SpeciesName = "Dog"; //} //else //{ // mypet.SpeciesId = 2; // mypet.SpeciesName = "Cat"; //} mypet.Gender = rblGender.SelectedValue; mypet.SpayedOrNeutered = bool.Parse(rblSpay.SelectedValue); mypet.SpeciesId =int.Parse( rblSpecies.SelectedValue); if(mypet.SpeciesId ==1) mypet.SpeciesName = "Dog"; else mypet.SpeciesName = "Cat"; //end 2015-06-29 DetermineBreedWeighID(ref mypet); if (!Update) { mypet.PetName = txtPetName.Text.Trim(); mCustomer.MyPets.Add(mypet); } }
private QuoteServiceReference.Pet CreateQuotePet(Pet p) { return new QuoteServiceReference.Pet() { Name = p.PetName, BirthDate = p.Birthday, BreedId = p.BreedId, SpeciesId = p.SpeciesId, ColorId = p.ColorId, ChipNumber = string.Empty, Gender = p.Gender, //male: 1 female =2 WeightId = p.WeightId, SpayedOrNeutered = p.SpayedOrNeutered }; }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { if (mCustomer != null) { try { var mypet = (from p in mCustomer.MyPets where p.PetName.ToLower().Equals(txtPetName.Text.ToLower()) select p).FirstOrDefault(); if (mypet != null) { SavePet(true, ref mypet);//update//note: this is different than current, not allow pets have same name if (mypet.Enrolled) { int quoteId = mypet.QuoteId; List<Pet> lstEnrolled = (from p in mCustomer.MyPets where p.QuoteId == quoteId select p).ToList(); //first check if there is senior pet in family plan bool bSenior = false; string seniorName = ""; if (lstEnrolled.Count > 1) { foreach (Pet p in lstEnrolled) { if (p.Age > 9) { bSenior = true; seniorName = p.PetName; break; } } } if (bSenior) { lblError.Text = string.Format("Pet {0} is considered senior pet, senior pet is not allowed to be in the family plan, please remove this pet from the enrolled plan before edit", seniorName); return; } else { //requote PetfirstBL pfBl = new PetfirstBL(); DoRequote(pfBl, lstEnrolled); } } } else { mypet = new Pet(); mypet.Enrolled = false; SavePet(false, ref mypet); } try { using (PetfirstData pfData = new PetfirstData()) { pfData.SavePet(mypet, mCustomer.CustomerId); } } catch (Exception ex) { LoggingError("Saving Pet", ex.ToString()); }//don't do anything if store data fails if (this.Request.Url.AbsoluteUri.ToLower().Contains("addpets_xs.aspx")) { Response.Redirect("~/AddPets.aspx", false); Context.ApplicationInstance.CompleteRequest(); } else { bindPets(); ResetInput(); DetermineButtonText(); } } catch (Exception ex) { displayError("saving pet", ex.ToString(), true); } } } }
public bool LoadFastQuote(ref PetfirstCustomer mCustomer, ref Pet thispet) { bool bReturn = false; string sMemberCodeString = ""; sMemberCodeString += mCustomer.DiscountMilitarySelected ? "M" : ""; sMemberCodeString += mCustomer.DiscountInternetPurchase ? "I" : ""; sMemberCodeString += mCustomer.DiscountVetSelected ? "A" : ""; try { if (thispet.preQuotes == null) { thispet.preQuotes = new DataTable(); } thispet.preQuotes.Clear(); using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["PFQuoteDB"].ConnectionString)) { using (var cmd = new SqlCommand("usp_GetPreQuotes", con)) { cmd.Parameters.Add("@StateID", SqlDbType.TinyInt); cmd.Parameters["@StateID"].Value = (byte)mCustomer.MembershipInfo.StateId; cmd.Parameters.Add("@BreedID", SqlDbType.Int); cmd.Parameters.Add("@Age", SqlDbType.Int); cmd.Parameters["@Age"].Value = thispet.Age; cmd.Parameters.Add("@WeightID", SqlDbType.TinyInt); cmd.Parameters.Add("@EnrollmentCode", SqlDbType.VarChar, 20).Value = mCustomer.EnrollmentCode; cmd.Parameters.Add("@MemberCodeString", SqlDbType.VarChar, 20).Value = sMemberCodeString; if (thispet.SpeciesId == 2) { cmd.Parameters["@WeightID"].Value = (byte)1; cmd.Parameters["@BreedID"].Value = 2; } else if (thispet.SpeciesId == 1 && thispet.BreedId == 54) { cmd.Parameters["@WeightID"].Value = (byte)thispet.WeightId; cmd.Parameters["@BreedID"].Value = thispet.BreedId; } else { cmd.Parameters["@WeightID"].Value = (byte)0; cmd.Parameters["@BreedID"].Value = thispet.BreedId; } using (var da = new SqlDataAdapter(cmd)) { cmd.CommandType = CommandType.StoredProcedure; da.Fill(thispet.preQuotes); if (thispet.preQuotes.Rows.Count > 0) { bReturn = true; } } } } } catch (Exception ex) { bReturn = false; mCustomer.WebserviceErrorMsg = ex.Message; } return (bReturn); }
private PolicyServiceReference.Pet CreatePolicyRequestPet(Pet p) { return new PolicyServiceReference.Pet() { Name = p.PetName, BirthDate = p.Birthday, BreedId = p.BreedId, SpeciesId = p.SpeciesId, ColorId = p.ColorId, ChipNumber = string.Empty, Gender = p.Gender, WeightId = p.WeightId, SpayedOrNeutered = p.SpayedOrNeutered }; }
public void SavePet(Pet pet, int custId) { wsQPet dbPet = null; bool bAdd = false; if (pet.PetId == 0) { dbPet = new wsQPet(); bAdd = true; dbPet.CreateDate = DateTime.Now; } else dbPet = GetPetById(pet.PetId); if (dbPet != null) { dbPet.Birthdate = pet.Birthday; dbPet.BreedId = pet.BreedId; dbPet.BreedName = pet.BreedName; dbPet.ColorId = pet.ColorId; dbPet.ColorName = pet.ColorName; dbPet.PetName = pet.PetName; dbPet.Gender = pet.Gender; dbPet.QCustomerID = custId; dbPet.QPlanID = pet.QPlanId; dbPet.SpayedOrNeutered = pet.SpayedOrNeutered; dbPet.SpeciesId = pet.SpeciesId; dbPet.SpeciesName = pet.SpeciesName; dbPet.WeightId = pet.WeightId; if(!bAdd) dbPet.ModifyDate = DateTime.Now; else context.wsQPets.AddObject(dbPet); context.SaveChanges(); if (pet.PetId == 0) pet.PetId = dbPet.QPetID; } }
public bool GetFastQuote(ref PetfirstCustomer mCustomer, ref Pet thispet, bool bNewQuote) { bool bReturn = false; //Load from prequote; if (bNewQuote) { bReturn = LoadFastQuote(ref mCustomer, ref thispet); } if (thispet.preQuotes != null) { Int16 nPlanID = (Int16)thispet.PlanId; decimal dDeductible = thispet.DeductibleAmount; decimal dCopay = (1 - thispet.Reimbursement); Boolean b125 = false; Boolean b250 = false; Boolean b400 = false; switch (thispet.Routine) { case "routine125": b125 = true; break; case "routine250": b250 = true; break; case "routine400": b400 = true; break; default: break; } try { FastQuoteResponse thisQuote = (from qr in thispet.preQuotes.AsEnumerable() where dDeductible == qr.Field<decimal>("Deductible") && dCopay == qr.Field<decimal>("Copay") && nPlanID == qr.Field<Int16>("PlanId") && b125 == qr.Field<Boolean>("Routine125") && b250 == qr.Field<Boolean>("Routine250") && b400 == qr.Field<Boolean>("Routine400") select new FastQuoteResponse { QuoteID = qr.Field<int>("QuoteID"), FilingID = qr.Field<int>("FilingID"), AnnualPremiumAmount = qr.Field<decimal>("AnnualPremiumAmount"), AdminFee = qr.Field<decimal>("AdminFee"), RecurringMonthlyAmount = qr.Field<decimal>("ReccuringMonthlyAmount"), FirstMonthPremiumAmount = qr.Field<decimal>("FirstMonthPremiumAmount"), AnnualSavings = qr.Field<decimal>("AnnualSavings"), AnnualDiscountAmount = qr.Field<decimal>("AnnualDiscountAmount") }).FirstOrDefault(); if (thisQuote == null) { bReturn = false; } else { thispet.FirstMonthPaymentTotal = thisQuote.FirstMonthPremiumAmount; thispet.FirstMonthTax = thisQuote.AdminFee; thispet.RecurringMonthPaymentTotal = thisQuote.RecurringMonthlyAmount; thispet.RecurringMonthTax = thisQuote.AdminFee; thispet.InternetDiscountAmount = thisQuote.AnnualDiscountAmount; thispet.EBDiscountAmount = 0; thispet.MilitaryDiscountAmount = 0; thispet.VetDiscountAmount = 0; thispet.AnnualPaymentTotal = thisQuote.AnnualPremiumAmount; if (mCustomer.Underwriter == 4) { thispet.FirstMonthPremiumOnly = thisQuote.FirstMonthPremiumAmount - thisQuote.AdminFee; thispet.RecurringMonthPremiumOnly = thisQuote.RecurringMonthlyAmount - thisQuote.AdminFee; } else { thispet.FirstMonthPremiumOnly = thisQuote.FirstMonthPremiumAmount - thisQuote.AdminFee; thispet.RecurringMonthPremiumOnly = thisQuote.RecurringMonthlyAmount - thisQuote.AdminFee; } thispet.QuoteId = thisQuote.QuoteID; thispet.Enrolled = true; thispet.OldQuoteData = false; if (thisQuote.FilingID > 47) thispet.MultiPetAvailable = true; bReturn = true; } } catch (Exception ex) { bReturn = false; } } return (bReturn); }
public void RetrieveSavedData(ref PetfirstCustomer mCustomer) { wsQCustomer dbCustomer = GetCustomerById(mCustomer.CustomerId); if (dbCustomer != null) { mCustomer.BillingInfo.City = dbCustomer.BillCity; mCustomer.BillingInfo.FirstName = dbCustomer.BillFirstName; mCustomer.BillingInfo.LastName = dbCustomer.BillLastName; mCustomer.BillingInfo.State = dbCustomer.BillState; if(dbCustomer.BillStateId !=null) mCustomer.BillingInfo.StateId = (int)dbCustomer.BillStateId; mCustomer.BillingInfo.Address1 = dbCustomer.BillStreetAddress; mCustomer.BillingInfo.Address2 = dbCustomer.BillStreetAddress2; mCustomer.BillingInfo.Zip = dbCustomer.BillZipcode; mCustomer.MembershipInfo.City = dbCustomer.City; mCustomer.MembershipInfo.FirstName = dbCustomer.FirstName; mCustomer.MembershipInfo.LastName = dbCustomer.LastName; mCustomer.MembershipInfo.State = dbCustomer.State; if(dbCustomer.StateId !=null) mCustomer.MembershipInfo.StateId = (int)dbCustomer.StateId; mCustomer.MembershipInfo.Address1 = dbCustomer.StreetAddress; mCustomer.MembershipInfo.Address2 = dbCustomer.StreetAddress2; mCustomer.MembershipInfo.Zip = dbCustomer.Zipcode; mCustomer.MembershipInfo.Email = dbCustomer.Email; mCustomer.EnrollmentCode = dbCustomer.EnrollmentCode; mCustomer.MembershipInfo.Phone = dbCustomer.Phone; if(dbCustomer.PaymentFrequency !=null) mCustomer.PayFrequency = (short)dbCustomer.PaymentFrequency; } int custId =mCustomer.CustomerId; ////kp:2015-05-04 Retrieve Quote DateTime endDate = DateTime.Today.AddDays(90);// prinsloo wants to data from 90 days back//TODO: verify with Prinsloo //end 2015-05-04 //retrieve pets if (custId != 0) { mCustomer.MyPets.Clear(); //find the pets that does not have a policy but have plandata var lstDbPet1 = (from p in context.wsQPets join pl in context.wsQPlans on p.QPlanID equals pl.QPlanID where p.QCustomerID == custId && (pl.PolicyNumber.Equals("") || pl.PolicyNumber == null) && pl.CreateDate <= endDate select p).ToList(); //list of pets that does not have a quote yet var lstDbPet2 = (from p in context.wsQPets where p.QCustomerID == custId && (p.QPlanID==0 ||p.QPlanID ==null) //&& p.CreateDate <=endDate select p).ToList(); var lstDbPet = lstDbPet1.Concat(lstDbPet2).ToList(); //this filter dup //var lstDbPet = new List<wsQPet>(lstDbPet1); //lstDbPet.AddRange(lstDbPet2.Where(p2 => lstDbPet1.All(p1 => p1.QPetID != p2.QPetID))); foreach (wsQPet dbPet in lstDbPet) { Pet pet = new Pet(); pet.PetId = dbPet.QPetID; if(dbPet.Birthdate !=null) pet.Birthday =(DateTime) dbPet.Birthdate; if (dbPet.BreedId != null) { pet.BreedId = (int)dbPet.BreedId; pet.BreedName = dbPet.BreedName; } if (dbPet.ColorId != null) { pet.ColorId = (int)dbPet.ColorId; pet.ColorName = dbPet.ColorName; } pet.PetName = dbPet.PetName; pet.Gender = dbPet.Gender; if (dbPet.Gender.Equals("M")) pet.GenderFull = "Male"; else if (dbPet.Gender.Equals("F")) pet.GenderFull = "Female"; custId = dbPet.QCustomerID; if(dbPet.QPlanID !=null) pet.QPlanId =(int) dbPet.QPlanID; if(dbPet.SpayedOrNeutered !=null) pet.SpayedOrNeutered = (bool)dbPet.SpayedOrNeutered; if (dbPet.SpeciesId != null) { pet.SpeciesId = (int)dbPet.SpeciesId; pet.SpeciesName = dbPet.SpeciesName; } if(dbPet.WeightId!=null) pet.WeightId =(int) dbPet.WeightId; if (dbPet.QPlanID !=null) { pet.QPlanId = (int)dbPet.QPlanID; } else pet.Enrolled = false; if (dbPet.ModifyDate == null) pet.ModifiedDate = dbPet.CreateDate; else pet.ModifiedDate = (DateTime)dbPet.ModifyDate; mCustomer.MyPets.Add(pet); } //retrieve plans var lstDbPlan = (from p in context.wsQPets join pl in context.wsQPlans on p.QPlanID equals pl.QPlanID where p.QCustomerID == custId && (pl.PolicyNumber.Equals("") || pl.PolicyNumber == null) && pl.CreateDate <= endDate ////kp: 2015-05-21 delete standard plan site wide && pl.PlanId >=61 //only retrieve lifetime ////end 2015-05-21 select pl).ToList(); foreach (wsQPlan dbQPlan in lstDbPlan) { foreach (Pet p in mCustomer.MyPets) { int count = 0; if (p.QPlanId == dbQPlan.QPlanID) { count++; if (dbQPlan.Deductible != null) p.DeductibleAmount = (decimal)dbQPlan.Deductible; p.LeadId = dbQPlan.LeadId; if (dbQPlan.PlanId != null) p.PlanId = (int)dbQPlan.PlanId; if (dbQPlan.PlanTypeId != null) p.PlanType = dbQPlan.PlanTypeId.ToString(); p.PlanName = dbQPlan.PlanName; if (dbQPlan.QuoteId != null) p.QuoteId = (int)dbQPlan.QuoteId; if (dbQPlan.Limit != null) p.LimitAmount = (decimal)dbQPlan.Limit; if (dbQPlan.Reimbursement != null) p.Reimbursement = (decimal)dbQPlan.Reimbursement; p.Breeder = dbQPlan.RiderBreeders; if (dbQPlan.RiderHereditary100) p.Hereditary = "hereditary100"; else if (dbQPlan.RiderHereditary25) p.Hereditary = "hereditary25"; p.PrescriptionFood = dbQPlan.RiderPrescriptionFood; if (dbQPlan.RiderRoutine125) p.Routine = "routine125"; else if (dbQPlan.RiderRoutine250) p.Routine = "routine250"; else if (dbQPlan.RiderRoutine400) p.Routine = "routine400"; if (dbQPlan.AnnualPayment != null) p.AnnualPaymentTotal = (decimal)dbQPlan.AnnualPayment; if (dbQPlan.FirstMonthPayment != null) p.FirstMonthPaymentTotal = (decimal)dbQPlan.FirstMonthPayment; if (dbQPlan.FirstMonthTax != null) p.FirstMonthTax = (decimal)dbQPlan.FirstMonthTax; if (dbQPlan.RecurringMonthPayment != null) p.RecurringMonthPaymentTotal = (decimal)dbQPlan.RecurringMonthPayment; if (dbQPlan.RecurringMonthTax != null) p.RecurringMonthTax = (decimal)dbQPlan.RecurringMonthTax; if (dbQPlan.PolicyId != null) p.PolicyId = (Int64)dbQPlan.PolicyId; p.Enrolled = true; p.OldQuoteData = true; //retrieved old quote amount ////kp: 2015-05-04 retrieve quote if (dbQPlan.ModifyDate == null) p.ModifiedDate = dbQPlan.CreateDate; else p.ModifiedDate = (DateTime)dbQPlan.ModifyDate; //concat rider name to display on the page string ridername = string.Empty; bool hasRider = false; //routine if (p.Routine.Equals("routine125")) { hasRider = true; ridername = "Routine Care 125"; } else if (p.Routine.Equals("routine250")) { hasRider = true; ridername = "Routine Care 250"; } else if (p.Routine.Equals("routine400")) { hasRider = true; ridername = "Routine Care 400"; } //prescrption food if (hasRider && p.PrescriptionFood) { ridername += "<br />" + "Prescription Food"; } else if (p.PrescriptionFood) { hasRider = true; ridername = "Prescription Food"; } //hereditary if (hasRider && p.Hereditary.Equals("hereditary25")) { ridername += "<br />" + "Hereditary & Chronic 25%"; } else if (hasRider && p.Hereditary.Equals("hereditary100")) { ridername += "<br />" + "Hereditary & Chronic 100%"; } else if (p.Hereditary.Equals("hereditary25")) { hasRider = true; ridername = "Hereditary & Chronic 25%"; } else if (p.Hereditary.Equals("hereditary100")) { hasRider = true; ridername = "Hereditary & Chronic 100%"; } //breeder if (hasRider && p.Breeder) { ridername += "<br />" + "Breeder Coverage"; } else if (p.Breeder) { ridername = "Breeder Coverage"; } p.RiderName = ridername; ////end 2015-05-04 } if (count > 1) p.IsFamilyPlan = true; } } } }
protected void Page_Load(object sender, EventArgs e) { HandleMenuItems(); mCustomer = (PetfirstCustomer)Session["Customer"]; mthisPet = (Pet)Session["Pet"]; if (mCustomer == null) { Response.Redirect("Default.aspx", false); Context.ApplicationInstance.CompleteRequest(); } else { if (!Page.IsPostBack) { if (mCustomer != null) { ListsManager lm = new ListsManager(); PopulatePlanDetails(lm); } if (mthisPet != null) { if(!string.IsNullOrEmpty(Request.QueryString["canceladd"])) //see if we are cancelling add pet. If so, then load latest pet. { mthisPet = mCustomer.MyPets.ElementAtOrDefault(mCustomer.MyPets.Count - 1); mCustomer.MyPets.RemoveAt(mCustomer.MyPets.Count - 1); } string jd; PetName.Text = mthisPet.PetName + "'s"; ddlLimit.SelectedValue = mthisPet.LimitAmount.ToString("C0"); ddlDeductible.SelectedValue = mthisPet.DeductibleAmount.ToString("C0"); ddlReimburse.SelectedValue = jd = (mthisPet.Reimbursement.ToString("P0").Replace(" ", "")); ddlRoutine.SelectedValue = GetRiderNameFromValue(mthisPet.Routine); lblDiscounts.Text = (mthisPet.InternetDiscountAmount + mthisPet.EBDiscountAmount + mthisPet.MilitaryDiscountAmount + mthisPet.VetDiscountAmount).ToString("C2"); } } if (mthisPet != null) { UpdateLabels(); } this.Master.NumberofPets = (mCustomer.MyPets.Count + 1).ToString(); } #region debug // if (mCustomer != null && mthisPet != null) // { // CustomerDebug.Text = String.Format(@" First Name: [{0}], Last Name: [{1}], Add1: [{2}], Add2: [{3}], City: [{4}], State: [{5}], StateCode: [{6}], // Zip: [{7}], Phone: [{8}], Email: [{9}], CustomerID: [{10}], CallCenter: [{11}], EC: [{12}], Pay Freq: [{13}], // CC Num: [{14}], Sec Code: [{15}], Exp: [{16}/{17}], LifeTimeActive: [{18}] DISCOUNTS: EBEC: [{19}], Vet: [{20}], // Military: [{21}], MilBranchID [{22}], MilStatusID[{23}]", // mCustomer.MembershipInfo.FirstName, // mCustomer.MembershipInfo.LastName, // mCustomer.MembershipInfo.Address1, // mCustomer.MembershipInfo.Address2, // mCustomer.MembershipInfo.City, // mCustomer.MembershipInfo.State, // mCustomer.MembershipInfo.StateId, // mCustomer.MembershipInfo.Zip, // mCustomer.MembershipInfo.Phone, // mCustomer.MembershipInfo.Email, // mCustomer.CustomerId, // mCustomer.CallCenter, // mCustomer.EnrollmentCode, // mCustomer.PayFrequency, // mCustomer.CcNumber, // mCustomer.SecCode, // mCustomer.ExpirationMonth, // mCustomer.ExpirationYear, // mCustomer.LifeTimeActive, // mCustomer.EBEnrollmentCodeDiscount, // mCustomer.VetDiscount, // mCustomer.MilitaryDiscount, // mCustomer.MilitaryBranchID, // mCustomer.MilitaryStatusID // ); // CurrentPetDebug.Text = String.Format(@"ID: [{0}], Name: [{1}], SpeciesID: [{2}], SpeciesName: [{3}], BreedID: [{4}], BreedName: [{5}], Age: [{6}], // BirthDay: [{7}], WeightID: [{8}], Gender: [{9}], GenderFull: [{10}], Limit Amount: [{11}], Deductible Amount: [{12}], Reimbursement: [{13}], // Rider Name: [{14}], Routine: [{15}], AnnualPaymentTotal: [{16}], FirstMonthlyPaymentTotal: [{17}], FirstMonthlyPremiumOnly: [{18}], // FirstMonthTax: [{19}], RecurringMonthPaymentTotal: [{20}], RecurringMonthPremiumOnly: [{21}], RecurringMonthTax [{22}], PolicyNumber[{23}], // PolicyID: [{24}], PlanType: [{25}], PlanName: [{26}], PlanID: [{27}], SpayedNeutered: [{28}]", // mthisPet.PetId, // mthisPet.PetName, // mthisPet.SpeciesId, // mthisPet.SpeciesName, // mthisPet.BreedId, // mthisPet.BreedName, // mthisPet.Age, // mthisPet.Birthday, // mthisPet.WeightId, // mthisPet.Gender, // mthisPet.GenderFull, // mthisPet.LimitAmount, // mthisPet.DeductibleAmount, // mthisPet.Reimbursement, // mthisPet.RiderName, // mthisPet.Routine, // mthisPet.AnnualPaymentTotal, // mthisPet.FirstMonthPaymentTotal, // mthisPet.FirstMonthPremiumOnly, // mthisPet.FirstMonthTax, // mthisPet.RecurringMonthPaymentTotal, // mthisPet.RecurringMonthPremiumOnly, // mthisPet.RecurringMonthTax, // mthisPet.PolicyNumber, // mthisPet.PolicyId, // mthisPet.PlanType, // mthisPet.PlanName, // mthisPet.PlanId, // mthisPet.SpayedOrNeutered); // } #endregion }
protected void Page_Load(object sender, EventArgs e) { HandleMenuItems(); bCurrentCustomer = false; if (!string.IsNullOrEmpty(Request.QueryString["current_customer"])) { bCurrentCustomer = true; } mCustomer = (PetfirstCustomer)Session["Customer"]; mthisPet = (Pet)Session["Pet"]; if (mCustomer == null) { Response.Redirect("Default.aspx", false); Context.ApplicationInstance.CompleteRequest(); } else { if (!Page.IsPostBack) { if (bCurrentCustomer) { chkInternetDiscount.Checked = mCustomer.DiscountInternetPurchase; MilitaryBlock.Visible = mCustomer.DiscountMilitaryAvailable; chkMilitary.Checked = mCustomer.DiscountMilitarySelected; chkEmployeeGroup.Checked = mCustomer.DiscountEBEnrollmentCode; txtEmployer.Text = mCustomer.EBEnrollmentCodeCompany; VetBlock.Visible = mCustomer.DiscountVetAvailable; chkVetEmp.Checked = mCustomer.DiscountVetSelected; txtEmail.Text = mCustomer.MembershipInfo.Email; load_militarybranches(); ddlBranch.SelectedIndex = mCustomer.MilitaryBranchID; load_militarystatus(); rblServiceType.SelectedIndex = mCustomer.MilitaryStatusID; bCurrentCustomer = true; } else { chkInternetDiscount.Checked = mCustomer.DiscountInternetPurchase; PetfirstData pfData = new PetfirstData(); chkEmployeeGroup.Checked = mCustomer.DiscountEBEnrollmentCode = pfData.IsCorporateDiscount(mCustomer.EnrollmentCode); MilitaryBlock.Visible = mCustomer.DiscountMilitaryAvailable; VetBlock.Visible = mCustomer.DiscountVetAvailable; load_militarystatus(); load_militarybranches(); } } this.Master.NumberofPets = mCustomer.MyPets.Count.ToString(); } }
private void SavePetAttributes(ref Pet pet) { string planName = ""; pet.PlanType = (mCustomer.LifeTimeActive ? "2" : "1"); //pet.PlanType =rblPlanType.SelectedValue; //string planName = rblPlanType.SelectedValue.Equals("1") ? "Standard" : "Lifetime"; planName = (mCustomer.LifeTimeActive ? "Lifetime" : "Standard"); pet.PlanName = string.Concat(planName, " ", ddlLimit.SelectedValue.Replace("$", ""));//sarah want to display the , but not the $ pet.LimitAmount = decimal.Parse(ddlLimit.SelectedValue.Replace("$", "")); pet.DeductibleAmount = decimal.Parse(ddlDeductible.SelectedValue.Replace("$", "")); pet.Reimbursement = decimal.Parse(ddlReimburse.SelectedValue.Replace("%", "")) / 100; //rider special handle if (pnlRoutine.Visible) pet.Routine = rblRoutine.SelectedValue; if(pnlBreeder.Visible) pet.Breeder = cbBreeder.Checked; if(pnlPrescription.Visible) pet.PrescriptionFood = cbPrescription.Checked; if(pnlHereditary.Visible) pet.Hereditary = rblHereditary.SelectedValue; ////kp: 2015-05-04 retrieve quote- phase1 leftover item: show rider name to plan repeater string riderName = string.Empty; bool hasRider = false; if (pnlRoutine.Visible&&rblRoutine.SelectedValue.Equals("routine125")) { hasRider = true; riderName = "Routine Care 125"; } else if(pnlRoutine.Visible&&rblRoutine.SelectedValue.Equals("routine250")) { hasRider = true; riderName = "Routine Care 250"; } else if (pnlRoutine.Visible && rblRoutine.SelectedValue.Equals("routine400")) { hasRider = true; riderName = "Routine Care 400"; } if (pnlPrescription.Visible && cbPrescription.Checked && hasRider) { riderName += "<br />" + "Prescription Food"; } else if (pnlPrescription.Visible && cbPrescription.Checked) { hasRider = true; riderName = "Prescription Food"; } //Hereditary if (pnlHereditary.Visible && !rblHereditary.SelectedItem.Text.ToLower().Equals("none") && hasRider) { riderName += "<br />" + rblHereditary.SelectedItem.Text; } else if (pnlHereditary.Visible && !rblHereditary.SelectedItem.Text.ToLower().Equals("none")) { hasRider = true; riderName = rblHereditary.SelectedItem.Text; } //breeder if (pnlBreeder.Visible && cbBreeder.Checked && hasRider) { riderName += "<br />" + "Breeder Coverage"; } else if (pnlBreeder.Visible && cbBreeder.Checked) { riderName = "Breeder Coverage"; } pet.RiderName = riderName; ////end 2015-05-04 }
private bool LoadCustomerInfo(ref PetfirstCustomer mCustomer, string scustomerLookup) { bool bReturn = true; SqlConnection con = GetConnection(); SqlDataReader sdr = null; SqlCommand cmd = new SqlCommand("usp_pricecompare_tmpcustomer_get_by_customer_id", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@customer_id", SqlDbType.BigInt)); cmd.Parameters["@customer_id"].Value = Int32.Parse(scustomerLookup); try { con.Open(); sdr = cmd.ExecuteReader(); while (sdr.Read()) { mCustomer.MembershipInfo.FirstName = sdr.GetString(CTFIRSTNAME); mCustomer.MembershipInfo.LastName = sdr.GetString(CTLASTNAME); mCustomer.EnrollmentCode = sdr.GetString(CTENROLLMENTCODE); using (PetfirstData pfData = new PetfirstData()) { mCustomer.CallCenter = pfData.GetPhoneNumber(mCustomer.EnrollmentCode); } mCustomer.MembershipInfo.Email = sdr.GetString(CTEMAIL); mCustomer.MembershipInfo.Zip = sdr.GetString(CTZIP); mCustomer.MembershipInfo.Phone = sdr.GetString(CTPHONE); if ((sdr.GetString(CTPAYFREQUENCY)).ToString().Contains("monthly") == true) { mCustomer.PayFrequency = 1; } else { mCustomer.PayFrequency = 2; } CoreServiceClient csc = new CoreServiceClient(); CoreServiceGetStateByZipResponse resp = csc.GetStateByZip(mCustomer.MembershipInfo.Zip); if (string.IsNullOrEmpty(resp.Error.ErrorText)) { mCustomer.MembershipInfo.StateId = resp.State.Id; mCustomer.MembershipInfo.City = resp.State.CityName; mCustomer.MembershipInfo.State = resp.State.StateName; } Pet myPet = new Pet(); myPet.Birthday = sdr.GetDateTime(CTPETBIRTHDAY); myPet.ColorId = 146; //Any Breed// myPet.ColorName = "Any"; if ((sdr.GetString(CTSPECIESNAME)).ToString().Contains("dog") == true) { myPet.SpeciesId = 1; myPet.SpeciesName = "Dog"; } else { myPet.SpeciesId = 2; myPet.SpeciesName = "Cat"; } myPet.BreedId = sdr.GetInt32(CTBREEDID); myPet.WeightId = sdr.GetByte(CTWEIGHTID); myPet.PetName = sdr.GetString(CTPETNAME); myPet.GenderFull = sdr.GetString(CTPETGENDER); myPet.GenderFull.Trim(); if (myPet.GenderFull.Contains("female")) { myPet.Gender = "F"; } else { myPet.Gender = "M"; } myPet.DeductibleAmount = sdr.GetDecimal(CTDEDUCTIBLE); myPet.Reimbursement = sdr.GetDecimal(CTREIMBURSEMENT); myPet.SpayedOrNeutered = sdr.GetBoolean(CTSPAYORNEUTER); //stored procedure will take care of figuring out if this is true or not. mCustomer.DiscountVetAvailable = true; mCustomer.DiscountMilitaryAvailable = true; mCustomer.DiscountMilitarySelected = sdr.GetBoolean(CTMILITARY); mCustomer.DiscountVetSelected = sdr.GetBoolean(CTVETPROFFESIONAL); mCustomer.MyPets.Add(myPet); try { using (PetfirstData pfData = new PetfirstData()) { pfData.SaveCustomer(mCustomer); } } catch { throw; } } con.Close(); } catch (Exception ex) { bReturn = false; LoggingError(ex.Message, ex.StackTrace); } finally { if (con != null) { con.Close(); con.Dispose(); con = null; } if (cmd != null) { cmd.Dispose(); cmd = null; } } return (bReturn); }