public bool UpdateSurveyLocation(FishSurveyLocation item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Fish_SurveyLocation efItem = context.Fish_SurveyLocation.Where(b => b.SurveyID == item.SurveyID && b.SurveyNumber == item.SurveyNumber).FirstOrDefault(); if (efItem == null) { return(result); } efItem.GeneratorID = item.GeneratorID; efItem.LocationDetails = item.LocationDetails; efItem.SurveyDate = item.SurveyDate; efItem.SurveyDurationSeconds = item.SurveyDurationSeconds; efItem.SurveyLocationComments = item.SurveyLocationComments; efItem.SurveyLocationActive = item.SurveyLocationActive; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool CreateGenerator(FishGenerator item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { byte newid = context.Fish_Generator.OrderByDescending(u => u.GeneratorID).FirstOrDefault().GeneratorID; newid++; Fish_Generator efItem = new Fish_Generator() { GeneratorID = newid, GeneratorActive = true, GeneratorName = item.GeneratorName }; context.Fish_Generator.Add(efItem); if (context.SaveChanges() > 0) { result = true; } } } catch (Exception e) { throw e; } return(result); }
public bool InactivateSurveyLocation(FishSurveyLocation item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Fish_SurveyLocation efItem = context.Fish_SurveyLocation.Where(b => b.SurveyID == item.SurveyID && b.SurveyNumber == item.SurveyNumber).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SurveyLocationActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool UpdateGenerator(FishGenerator item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Fish_Generator efItem = context.Fish_Generator.Where(b => b.GeneratorID == item.GeneratorID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.GeneratorName = item.GeneratorName; efItem.GeneratorActive = item.GeneratorActive; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool CreateSurveyor(BirdSurveyor item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { byte newid = context.Bird_Surveyor.OrderByDescending(u => u.SurveyorID).FirstOrDefault().SurveyorID; newid++; Bird_Surveyor efItem = new Bird_Surveyor() { SurveyorID = newid, SurveyorActive = true, SurveyorName = item.SurveyorName }; context.Bird_Surveyor.Add(efItem); if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool CreateClimate(WeatherClimate item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { byte newid = context.Weather_Climate.OrderByDescending(u => u.ClimateID).FirstOrDefault().ClimateID; newid++; Weather_Climate efItem = new Weather_Climate() { ClimateID = newid, ClimateActive = true, ClimateName = item.ClimateName }; context.Weather_Climate.Add(efItem); if (context.SaveChanges() > 0) { result = true; } } } catch (Exception e) { throw e; } return(result); }
public bool CreateSurveyDetail(PhytoSurveyDetails item) { try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { var efitem = context.Phyto_SurveyDetail.Where(s => s.SurveyID == item.SurveyID && s.SpeciesID == item.SpeciesID).FirstOrDefault(); //item already exists if (efitem != null) { return(false); } Phyto_SurveyDetail efItem = new Phyto_SurveyDetail() { SpeciesID = item.SpeciesID, SurveyCount = item.SurveyCount, SurveyID = item.SurveyID, SurveyDetailActive = item.SurveyDetailActive }; context.Phyto_SurveyDetail.Add(efItem); if (context.SaveChanges() > 0) { return(true); } } } catch (Exception e) { throw e; } return(false); }
public int CreateDivision(PhytoDivision item) { byte newid; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { newid = context.Phyto_Division.OrderByDescending(u => u.DivisionID).FirstOrDefault().DivisionID; newid++; Phyto_Division efItem = new Phyto_Division() { DivisionID = newid, DivisionActive = item.DivisionActive, DivisionName = item.DivisionName, DivisionCommonName = item.DivisionCommonName }; context.Phyto_Division.Add(efItem); if (context.SaveChanges() > 0) { return(newid); } } } catch (Exception e) { throw e; } return(newid); }
public bool InactivateDivision(PhytoDivision item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Phyto_Division efItem = context.Phyto_Division.Where(b => b.DivisionID == item.DivisionID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.DivisionActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool UpdateClimate(WeatherClimate item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Weather_Climate efItem = context.Weather_Climate.Where(b => b.ClimateID == item.ClimateID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.ClimateName = item.ClimateName; efItem.ClimateActive = item.ClimateActive; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool UpdateSurveyDetail(FishSurveyDetails item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Fish_SurveyDetail efItem = context.Fish_SurveyDetail.Where(b => b.SurveyID == item.SurveyID && b.SurveyNumber == item.SurveyNumber && b.SurveyDetailID == item.SurveyDetailID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SpeciesSizeMillimeters = item.SpeciesSizeMillimeters; efItem.SpeciesWeightOunces = item.SpeciesWeightPounds; efItem.SpeciesWeightPounds = item.SpeciesWeightPounds; efItem.SpeciesID = item.SpeciesID; efItem.SurveyDetailActive = item.SurveyDetailActive; // These other values are computed by the DB: // SpeciesWeightLbs, SpeciesSizeInches,SpeciesSizeInchGroup if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public int CreateSurvey(PhytoSurvey item) { int newid = 0; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { newid = context.Phyto_Survey.OrderByDescending(u => u.SurveyID).FirstOrDefault().SurveyID; newid++; Phyto_Survey efItem = new Phyto_Survey() { SurveyID = newid, SamplePointAreaID = item.SamplePointAreaID, SourceID = LIMS_SOURCEID, LocationDetails = item.LocationDetails, SurveyDate = item.SurveyDate, SurveyActive = item.SurveyActive }; context.Phyto_Survey.Add(efItem); if (context.SaveChanges() > 0) { return(newid); } } } catch (Exception e) { throw e; } return(newid); }
public bool CreateSamplePoint(SamplePoint item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { int newid = context.Lims_SamplePoint.OrderByDescending(u => u.SamplePointID).FirstOrDefault().SamplePointID; newid++; Lims_SamplePoint efItem = new Lims_SamplePoint() { SamplePointID = newid, SamplePointActive = true, SamplePointName = item.SamplePointName, SourceID = item.SourceID }; context.Lims_SamplePoint.Add(efItem); if (context.SaveChanges() > 0) { result = true; } } } catch (Exception e) { throw e; } return(result); }
public int CreateSurvey(BirdSurvey item) { int newid = 0; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { newid = context.Bird_Survey.OrderByDescending(u => u.SurveyID).FirstOrDefault().SurveyID; newid++; Bird_Survey efItem = new Bird_Survey() { SurveyID = newid, ClimateID = item.ClimateID, SamplePointAreaID = item.SamplePointAreaID, SourceID = item.SourceID == 0? LIMS_SOURCEID:item.SourceID, SurveyDate = item.SurveyDate, SurveyorID = item.SurveyorID }; context.Bird_Survey.Add(efItem); if (context.SaveChanges() > 0) { return(newid); } } } catch (Exception e) { throw e; } return(newid); }
public bool CreateSurveyDetail(BirdSurveyDetails item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Bird_SurveyDetail efItem = new Bird_SurveyDetail() { SurveyID = item.SurveyID, SpeciesID = item.SpeciesID, SurveyDetailCount = item.SurveyDetailCount }; context.Bird_SurveyDetail.Add(efItem); if (context.SaveChanges() > 0) { return(true); } } } catch (Exception e) { throw e; } return(result); }
public bool InactivateProfile(LakeProfile item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Lake_Profile efItem = context.Lake_Profile.Where(b => b.ProfileID == item.ProfileID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.ProfileActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool UpdateParameter(LakeParameter item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Lake_Parameter efItem = context.Lake_Parameter.Where(b => b.ParameterID == item.ParameterID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.ParameterActive = item.ParameterActive; efItem.ParameterFullName = item.ParameterFullName; efItem.ParameterName = item.ParameterName; efItem.ParameterTestMethod = item.ParameterTestMethod; efItem.ParameterUnit = item.ParameterUnit; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool InactivateProfileDetails(LakeProfileDetail item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Lake_ProfileDetail efItem = context.Lake_ProfileDetail.Where(u => u.ProfileID == item.ProfileID && u.DepthFeet == item.DepthFeet && u.ParameterID == item.ParameterID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.ProfileDetailActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool CreateProfileDetails(LakeProfileDetail item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { //create 4 rows for each parameter for (byte i = 1; i < 5; i++) { Lake_ProfileDetail efItem = new Lake_ProfileDetail() { DepthFeet = item.DepthFeet, ParameterID = i, ProfileID = item.ProfileID /*ParameterValue = item.ParameterValue, * ProfileDetailNotes = item.ProfileDetailNotes, * ProfileDetailActive = item.ProfileDetailActive */ }; context.Lake_ProfileDetail.Add(efItem); if (context.SaveChanges() > 0) { result = true; } } } } catch (Exception e) { throw e; } return(result); }
public int CreateSurvey(FishSurvey item) { int newid = 0; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { newid = context.Fish_Survey.OrderByDescending(u => u.SurveyID).FirstOrDefault().SurveyID; newid++; Fish_Survey efItem = new Fish_Survey() { SurveyID = newid, SamplePointAreaID = item.SamplePointAreaID, SourceID = LIMS_SOURCEID, SurveyComments = item.SurveyComments, SurveyYear = item.SurveyYear }; context.Fish_Survey.Add(efItem); if (context.SaveChanges() > 0) { return(newid); } } } catch (Exception e) { throw e; } return(newid); }
public bool UpdateSurvey(PhytoSurvey item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Phyto_Survey efItem = context.Phyto_Survey.Where(b => b.SurveyID == item.SurveyID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SamplePointAreaID = item.SamplePointAreaID; efItem.SourceID = LIMS_SOURCEID; efItem.SurveyDate = item.SurveyDate; efItem.LocationDetails = item.LocationDetails; efItem.SurveyActive = item.SurveyActive; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool InactivateSpeciesGroup(FishSpeciesGroup item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Fish_SpeciesGroup efItem = context.Fish_SpeciesGroup.Where(b => b.SpeciesGroupID == item.SpeciesGroupID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SpeciesGroupActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool InactivateSurveyDetail(PhytoSurveyDetails item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Phyto_SurveyDetail efItem = context.Phyto_SurveyDetail.Where(b => b.SurveyID == item.SurveyID && b.SpeciesID == item.SpeciesID ).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SurveyDetailActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool InactivateSurveyor(BirdSurveyor item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Bird_Surveyor efItem = context.Bird_Surveyor.Where(b => b.SurveyorID == item.SurveyorID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SurveyorActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool UpdateSamplePointArea(SamplePointArea item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Lims_SamplePointArea efItem = context.Lims_SamplePointArea.Where(b => b.SamplePointAreaID == item.SamplePointAreaID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SamplePointAreaName = item.SamplePointAreaName; efItem.SamplePointAreaActive = item.SamplePointAreaActive; efItem.SourceID = item.SourceID; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool UpdateSpecies(PhytoSpecies item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Phyto_Species efItem = context.Phyto_Species.Where(b => b.SpeciesID == item.SpeciesID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SpeciesName = item.SpeciesName; efItem.SpeciesActive = item.SpeciesActive; efItem.DivisionID = item.DivisionID; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool InactivateSamplePoint(SamplePoint item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Lims_SamplePoint efItem = context.Lims_SamplePoint.Where(b => b.SamplePointID == item.SamplePointID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.SamplePointActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public bool CreateSpecies(PhytoSpecies item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { short newid = context.Phyto_Species.OrderByDescending(u => u.SpeciesID).FirstOrDefault().SpeciesID; newid++; Phyto_Species efItem = new Phyto_Species() { SpeciesID = newid, SpeciesActive = true, SpeciesName = item.SpeciesName, DivisionID = item.DivisionID }; context.Phyto_Species.Add(efItem); if (context.SaveChanges() > 0) { result = true; } } } catch (Exception e) { throw e; } return(result); }
public bool CreateSpeciesGroup(FishSpeciesGroup item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { byte newid = context.Fish_SpeciesGroup.OrderByDescending(u => u.SpeciesGroupID).FirstOrDefault().SpeciesGroupID; newid++; Fish_SpeciesGroup efItem = new Fish_SpeciesGroup() { SpeciesGroupID = newid, SpeciesGroupActive = true, SpeciesGroupName = item.SpeciesGroupName }; context.Fish_SpeciesGroup.Add(efItem); if (context.SaveChanges() > 0) { result = true; } } } catch (Exception e) { throw e; } return(result); }
public short CreateSurveyDetail(FishSurveyDetails item) { short newid = 0; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { var lastItem = context.Fish_SurveyDetail.Where(s => s.SurveyID == item.SurveyID && s.SurveyNumber == item.SurveyNumber) .OrderByDescending(u => u.SurveyDetailID).FirstOrDefault(); if (lastItem != null) { newid = lastItem.SurveyDetailID; newid++; } Fish_SurveyDetail efItem = new Fish_SurveyDetail() { SurveyDetailID = newid, SurveyID = item.SurveyID, SurveyNumber = item.SurveyNumber, SpeciesSizeMillimeters = item.SpeciesSizeMillimeters, SpeciesWeightOunces = item.SpeciesWeightOunces, SpeciesWeightPounds = item.SpeciesWeightPounds, SpeciesID = item.SpeciesID, SurveyDetailActive = item.SurveyDetailActive }; // These other values are computed by the DB: // SpeciesWeightLbs, SpeciesSizeInches,SpeciesSizeInchGroup context.Fish_SurveyDetail.Add(efItem); if (context.SaveChanges() > 0) { return(newid); } } } catch (Exception e) { throw e; } return(newid); }