Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }