Beispiel #1
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 #2
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 #3
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);
        }