public bool InactivateSamplePointArea(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.SamplePointAreaActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public void SaveSurveys(List <BirdSurvey> toSave) { int newID; foreach (BirdSurvey survey in toSave) { survey.ClimateID = this.GetWeatherIDByDate(survey.SurveyDate); SamplePointArea spa = _generalRepo.GetSamplePointAreaByName(survey.SamplePointAreaName); survey.SamplePointAreaID = spa.SamplePointAreaID; survey.SourceID = spa.SourceID; survey.SurveyorID = _birdRepo.GetSurveyorByName(survey.SurveyorName).SurveyorID; newID = _birdRepo.CreateSurvey(survey); foreach (BirdSurveyDetails detail in survey.Details) { detail.SurveyID = newID; detail.SpeciesID = _birdRepo.GetSpeciesByName(detail.SpeciesName).SpeciesID; _birdRepo.CreateSurveyDetail(detail); } } }
public bool CreateSamplePointArea(SamplePointArea item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { short newid = context.Lims_SamplePointArea.OrderByDescending(u => u.SamplePointAreaID).FirstOrDefault().SamplePointAreaID; newid++; Lims_SamplePointArea efItem = new Lims_SamplePointArea() { SamplePointAreaID = newid, SamplePointAreaActive = true, SamplePointAreaName = item.SamplePointAreaName, SourceID = item.SourceID }; context.Lims_SamplePointArea.Add(efItem); if (context.SaveChanges() > 0) { result = true; } } } catch (Exception e) { throw e; } return(result); }
public string DeleteSamplePointArea(SamplePointArea item) { string msg = string.Empty; item.SamplePointAreaActive = false; try { if (ModelState.IsValid) { _genSvc.InactivateSamplePointArea(item); msg = "Sample Point Area inactivated succesfully"; } else { msg = "Data validation not successfull"; } } catch (Exception e) { msg = "Delete Sample Point Area. An error has ocurred"; } return(msg); }
public string CreateSamplePointArea([Bind(Exclude = "SamplePointAreaID")] SamplePointArea item) { string msg = string.Empty; try { if (ModelState.IsValid) { _genSvc.CreateSamplePointArea(item); msg = "Sample Point Area created succesfully"; } else { msg = "Data validation not successfull"; } } catch (Exception e) { msg = "Create Sample Point Area. An error has ocurred"; } return(msg); }
public string EditSamplePointArea(SamplePointArea item) { string msg = string.Empty; try { if (ModelState.IsValid) { _genSvc.UpdateSamplePointArea(item); msg = "Sample Point Area saved succesfully"; } else { msg = "Data validation not successfull"; } } catch (Exception e) { msg = "Edit Sample Point Area. An error has ocurred"; } return(msg); }
public bool UpdateSamplePointArea(SamplePointArea item) { return(_genRepo.UpdateSamplePointArea(item)); }
public bool InactivateSamplePointArea(SamplePointArea item) { return(_genRepo.InactivateSamplePointArea(item)); }