public void AddCityClimate(Default.Container container, CityClimateInfo cityClimate) { if (container.ClimateInfo.Where(ci => ci.CityID == cityClimate.CityID && ci.Month == cityClimate.Month).Count() != 0) { return; } container.AddToClimateInfo(cityClimate); var serviceResponse = container.SaveChanges(); }
public void AddCountry(Default.Container container, Country country) { if (container.Countries.Where(c => c.CountryName == country.CountryName).Count() != 0) { return; } container.AddToCountries(country); var serviceResponse = container.SaveChanges(); }
public void AddCity(Default.Container container, City city) { if (container.Cities.Where(c => c.CityName == city.CityName && c.CountryID == city.CountryID).Count() != 0) { return; } container.AddToCities(city); var serviceResponse = container.SaveChanges(); }
public void UpdateCountry(Default.Container container, int id, string countryName) { var country = container.Countries.Where(c => c.CountryID == id).SingleOrDefault(); if (country != null) { country.CountryName = countryName; container.UpdateObject(country); container.SaveChanges(); } }
public void UpdateCity(Default.Container container, int id, string cityName) { var city = container.Cities.Where(c => c.CityID == id).SingleOrDefault(); if (city != null) { city.CityName = cityName; container.UpdateObject(city); container.SaveChanges(); } }
public void UpdateCityClimate(Default.Container container, int id, double awgTemp) { var CityClimate = container.ClimateInfo.Where(c => c.CityClimateInfoID == id).SingleOrDefault(); if (CityClimate != null) { CityClimate.AvgTemperature = awgTemp; container.UpdateObject(CityClimate); container.SaveChanges(); } }
public void DeleteCountry(Default.Container container, int id) { try { var country = container.Countries.Where(c => c.CountryID == id).Single(); if (country != null) { container.DeleteObject(country); container.SaveChanges(); } } catch (DataServiceQueryException) { return; } }
public void DeleteCityClimate(Default.Container container, int id) { try { var CityClimate = container.ClimateInfo.Where(c => c.CityClimateInfoID == id).Single(); if (CityClimate != null) { container.DeleteObject(CityClimate); container.SaveChanges(); } } catch (DataServiceQueryException) { return; } }
private static void AddPatient(Default.Container container) { var patient = new testClient.Org.Naima.Services.Cases.Models.Patient() { Name = "ABD", Id = 2, LocationId = 2 }; container.AddToPatients(patient); var serviceResponse = container.SaveChanges(); foreach (var operationResponse in serviceResponse) { Console.WriteLine("Response: {0}", operationResponse.StatusCode); } }
private static void AddCase(Default.Container container) { var c1 = new testClient.Org.Naima.Services.Cases.Models.Case() { Status = "Open", Id = 1, PatientId = 1, DoctorId = 1, CareProviderId = 1 }; var c2 = new testClient.Org.Naima.Services.Cases.Models.Case() { Status = "Closed", Id = 2, PatientId = 1, DoctorId = 2, CareProviderId = 2 }; var c3 = new testClient.Org.Naima.Services.Cases.Models.Case() { Status = "Open", Id = 3, PatientId = 2, DoctorId = 2, CareProviderId = 2 }; container.AddToCases(c1); container.AddToCases(c2); container.AddToCases(c3); var serviceResponse = container.SaveChanges(); foreach (var operationResponse in serviceResponse) { Console.WriteLine("Response: {0}", operationResponse.StatusCode); } }
private static void AddCareProvider(Default.Container container) { var cp1 = new testClient.Org.Naima.Services.Cases.Models.CareProvider() { Name = "Ramlal", Id = 1, LocationId = 1 }; var cp2 = new testClient.Org.Naima.Services.Cases.Models.CareProvider() { Name = "Mohan", Id = 2, LocationId = 2 }; container.AddToCareProviders(cp1); container.AddToCareProviders(cp2); var serviceResponse = container.SaveChanges(); foreach (var operationResponse in serviceResponse) { Console.WriteLine("Response: {0}", operationResponse.StatusCode); } }
private static void AddDoctor(Default.Container container) { var doc1 = new testClient.Org.Naima.Services.Cases.Models.Doctor() { Name = "Dr Arvind", Id = 1, LocationId = 1 }; var doc2 = new testClient.Org.Naima.Services.Cases.Models.Doctor() { Name = "Dr Kumar", Id = 2, LocationId = 2 }; container.AddToDoctors(doc2); container.AddToDoctors(doc1); var serviceResponse = container.SaveChanges(); foreach (var operationResponse in serviceResponse) { Console.WriteLine("Response: {0}", operationResponse.StatusCode); } }
/// <summary> /// When submit button on form is clicked submit record /// to REST database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SubmitBtn_Click(object sender, EventArgs e) { if (!FormInvalid()) { Applicant newApplicant = new Applicant(); newApplicant.FirstName = FirstNameTxt.Text; newApplicant.MiddleName = MiddleNameTxt.Text; newApplicant.LastName = LastNameTxt.Text; newApplicant.DOB = DataOfBirthDateTimePicker.Value; newApplicant.Gender = GenderCbo.Text.Substring(0, 1); newApplicant.StreetAddress1 = StreetAddressTxt.Text; newApplicant.City = CityTxt.Text; newApplicant.CountryCode = ((Country)CountryCbo.SelectedItem).CountryCode; newApplicant.PhoneHome = "5555555555"; newApplicant.Email = EmailTxt.Text; newApplicant.Citizenship = ((Citizenship)CitizenshipCbo.SelectedItem).CitizenshipId; if (((Citizenship)CitizenshipCbo.SelectedItem).CitizenshipId == 5) { newApplicant.CitizenshipOther = ((Country)CitizenshipOtherCbo.SelectedItem).CountryCode; } newApplicant.HasCriminalConviction = PastCriminalConvictionChk.Checked; newApplicant.OnChildAbuseRegistry = ChildAbuseRegChk.Checked; newApplicant.HasDisciplinaryAction = PastDiscActionChk.Checked; newApplicant.IsAfricanCanadian = AfricanCanadianChk.Checked; newApplicant.IsFirstNations = FirstNationsChk.Checked; newApplicant.IsCurrentALP = ALPStudentChk.Checked; newApplicant.HasDisability = DocumentedDisabilityChk.Checked; newApplicant.Password = "******"; try{ container.AddToApplicants(newApplicant); container.SaveChanges(); NSCCModelDB.Application newApplication = new NSCCModelDB.Application(); newApplication.ApplicationDate = DateTime.Now; newApplication.ApplicantId = newApplicant.ApplicantId; newApplication.Paid = false; container.AddToApplications(newApplication); container.SaveChanges(); ProgramChoice newProgramChoice = new ProgramChoice(); newProgramChoice.ApplicationId = newApplication.ApplicationId; newProgramChoice.CampusId = ((ComboBoxItem)CampusChoice1Cbo.SelectedItem).Value; // newProgramChoice.ProgramId = ((Program) ProgramChoice1Cbo.SelectedItem).ProgramId; //dont work? newProgramChoice.ProgramId = (int)ProgramChoice1Cbo.SelectedValue; newProgramChoice.Preference = 1; container.AddToProgramChoices(newProgramChoice); container.SaveChanges(); ProgramChoice newProgramChoice2 = new ProgramChoice(); newProgramChoice2.ApplicationId = newApplication.ApplicationId; newProgramChoice2.CampusId = ((ComboBoxItem)CampusChoice2Cbo.SelectedItem).Value; // newProgramChoice2.ProgramId = ((Program) ProgramChoice1Cbo.SelectedItem).ProgramId; //dont work? newProgramChoice2.ProgramId = (int)ProgramChoice2Cbo.SelectedValue; newProgramChoice2.Preference = 2; container.AddToProgramChoices(newProgramChoice2); container.SaveChanges(); ErrorLbl.Text = "Successfully Added new Record"; } catch (Exception ex) { ErrorLbl.Text = ex.Message; } } }