Beispiel #1
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 #2
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 #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
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 #6
0
        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);
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        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);
        }
Beispiel #11
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 #12
0
        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);
        }
Beispiel #13
0
        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);
        }
Beispiel #14
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 #15
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 #16
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 #17
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 #18
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 #19
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 #20
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 #21
0
        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);
        }
Beispiel #22
0
        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);
        }
Beispiel #23
0
        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);
        }
Beispiel #24
0
        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);
        }
Beispiel #25
0
        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);
        }
Beispiel #26
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 #27
0
        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);
        }
Beispiel #28
0
        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);
        }
Beispiel #29
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 #30
0
        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);
        }