Beispiel #1
0
        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);
        }
Beispiel #2
0
        public bool UpdateSpeciesGroup(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.SpeciesGroupName   = item.SpeciesGroupName;
                    efItem.SpeciesGroupActive = item.SpeciesGroupActive;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public bool InactivateSurvey(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.SurveyActive = false;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        public bool InactivateSpecies(BirdSpecies item)
        {
            bool result = false;

            try
            {
                using (RCID_DWHEntities context = new RCID_DWHEntities())
                {
                    Bird_Species efItem = context.Bird_Species.Where(b => b.SpeciesID == item.SpeciesID).FirstOrDefault();

                    if (efItem == null)
                    {
                        return(result);
                    }

                    efItem.SpeciesActive = false;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Beispiel #7
0
        public bool InactivateGenerator(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.GeneratorActive = false;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        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);
        }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        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);
        }
Beispiel #13
0
        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);
        }
Beispiel #14
0
        public bool InactivateSurveyDetail(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.SurveyDetailActive = false;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Beispiel #15
0
        public IEnumerable <FishSurveyDetails> GetSurveyDetails(int locationID, int surveyID)
        {
            using (RCID_DWHEntities context = new RCID_DWHEntities())
            {
                var efList = from surveyDetails in context.Fish_SurveyDetail
                             join species in context.Fish_Species
                             on surveyDetails.SpeciesID equals species.SpeciesID
                             where surveyDetails.SurveyID == surveyID &&
                             surveyDetails.SurveyNumber == locationID
                             select new FishSurveyDetails
                {
                    SpeciesID              = species.SpeciesID,
                    SpeciesName            = species.SpeciesName,
                    SpeciesSizeInches      = surveyDetails.SpeciesSizeInches,
                    SpeciesSizeInchGroup   = surveyDetails.SpeciesSizeInchGroup,
                    SpeciesSizeMillimeters = surveyDetails.SpeciesSizeMillimeters,
                    SpeciesWeightLbs       = surveyDetails.SpeciesWeightLbs,
                    SpeciesWeightOunces    = surveyDetails.SpeciesWeightOunces,
                    SpeciesWeightPounds    = surveyDetails.SpeciesWeightPounds,
                    SurveyNumber           = surveyDetails.SurveyNumber,
                    SurveyDetailID         = surveyDetails.SurveyDetailID,
                    SurveyID           = surveyDetails.SurveyID,
                    SurveyDetailActive = surveyDetails.SurveyDetailActive
                };

                return(efList.ToList());
            }
        }
Beispiel #16
0
        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);
        }
Beispiel #17
0
        public bool UpdateSurvey(FishSurvey item)
        {
            bool result = false;

            try
            {
                using (RCID_DWHEntities context = new RCID_DWHEntities())
                {
                    Fish_Survey efItem = context.Fish_Survey.Where(b => b.SurveyID == item.SurveyID).FirstOrDefault();

                    if (efItem == null)
                    {
                        return(result);
                    }

                    efItem.SamplePointAreaID = item.SamplePointAreaID;
                    efItem.SourceID          = LIMS_SOURCEID;
                    efItem.SurveyYear        = item.SurveyYear;
                    efItem.SurveyComments    = item.SurveyComments;
                    efItem.SurveyActive      = item.SurveyActive;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Beispiel #18
0
        public bool CreateSpecies(BirdSpecies item)
        {
            bool result = false;

            try
            {
                using (RCID_DWHEntities context = new RCID_DWHEntities())
                {
                    short newid = context.Bird_Species.OrderByDescending(u => u.SpeciesID).FirstOrDefault().SpeciesID;
                    newid++;

                    Bird_Species efItem = new Bird_Species()
                    {
                        SpeciesID     = newid,
                        SpeciesActive = true,
                        SpeciesName   = item.SpeciesName
                    };

                    context.Bird_Species.Add(efItem);

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception e) { throw e; }
            return(result);
        }
Beispiel #19
0
        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);
        }
Beispiel #20
0
        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);
        }
Beispiel #21
0
        public bool UpdateSurvey(BirdSurvey item)
        {
            bool result = false;

            try
            {
                using (RCID_DWHEntities context = new RCID_DWHEntities())
                {
                    Bird_Survey efItem = context.Bird_Survey.Where(b => b.SurveyID == item.SurveyID).FirstOrDefault();

                    if (efItem == null)
                    {
                        return(result);
                    }

                    efItem.ClimateID         = item.ClimateID;
                    efItem.SamplePointAreaID = item.SamplePointAreaID;
                    efItem.SourceID          = LIMS_SOURCEID;
                    efItem.SurveyDate        = item.SurveyDate;
                    efItem.SurveyorID        = item.SurveyorID;
                    efItem.SurveyActive      = item.SurveyActive;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception e) { }
            return(result);
        }
Beispiel #22
0
        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);
        }
Beispiel #23
0
        public bool UpdateSurveyor(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.SurveyorName   = item.SurveyorName;
                    efItem.SurveyorActive = item.SurveyorActive;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Beispiel #24
0
 public FishGenerator GetGeneratorByName(string name)
 {
     using (RCID_DWHEntities context = new RCID_DWHEntities())
     {
         var efitem = context.Fish_Generator.Where(s => s.GeneratorName.ToUpper().Equals(name.ToUpper())).FirstOrDefault();
         return(mapper.Map <Fish_Generator, FishGenerator>(efitem));
     }
 }
Beispiel #25
0
 public BirdSurveyor GetSurveyorByName(string name)
 {
     using (RCID_DWHEntities context = new RCID_DWHEntities())
     {
         var efitem = context.Bird_Surveyor.Where(s => s.SurveyorName.ToUpper().Equals(name.ToUpper())).FirstOrDefault();
         return(mapper.Map <Bird_Surveyor, BirdSurveyor>(efitem));
     }
 }
Beispiel #26
0
 public BirdSpecies GetSpeciesByName(string name)
 {
     using (RCID_DWHEntities context = new RCID_DWHEntities())
     {
         var efitem = context.Bird_Species.Where(s => s.SpeciesName.ToUpper().Equals(name.ToUpper())).FirstOrDefault();
         return(mapper.Map <Bird_Species, BirdSpecies>(efitem));
     }
 }
Beispiel #27
0
 public SamplePointArea GetSamplePointAreaByName(string name)
 {
     using (RCID_DWHEntities context = new RCID_DWHEntities())
     {
         var efitem = context.Lims_SamplePointArea.Where(s => s.SamplePointAreaName.ToUpper().Equals(name.ToUpper())).Where(s => s.SourceID == LIMS_SOURCEID).FirstOrDefault();
         return(Mapper.Map <Lims_SamplePointArea, SamplePointArea>(efitem));
     }
 }
Beispiel #28
0
 public FishSpeciesGroup GetSpeciesGroupByName(string name)
 {
     using (RCID_DWHEntities context = new RCID_DWHEntities())
     {
         var efitem = context.Fish_SpeciesGroup.Where(s => s.SpeciesGroupName.ToUpper().Equals(name.ToUpper())).FirstOrDefault();
         return(mapper.Map <Fish_SpeciesGroup, FishSpeciesGroup>(efitem));
     }
 }
Beispiel #29
0
        public IEnumerable <SamplePoint> GetAllSamplePoints()
        {
            using (RCID_DWHEntities context = new RCID_DWHEntities())
            {
                var efList = context.Lims_SamplePoint.ToList();

                return(Mapper.Map <List <Lims_SamplePoint>, List <SamplePoint> >(efList));
            }
        }
Beispiel #30
0
        public IEnumerable <WeatherClimate> GetAllClimates()
        {
            using (RCID_DWHEntities context = new RCID_DWHEntities())
            {
                var efList = context.Weather_Climate.ToList();

                return(Mapper.Map <List <Weather_Climate>, List <WeatherClimate> >(efList));
            }
        }