Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #3
0
        public bool InactivateSurvey(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.SurveyActive = false;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }