/// <summary> /// DeleteAddressContext - Will do a soft delete (make inactive) by AddrID /// </summary> /// <param name="_cAddress"></param> public void DeleteAddressContext(sp_Vol_Address_DM _cAddress, sp_Vol_Addr_DM _cVolAddr) { using (VolTeerEntities context = new VolTeerEntities()) { try { var AddrToRemove = (from n in context.tblVolAddrs where n.AddrID == _cVolAddr.AddrID select n).FirstOrDefault(); if (AddrToRemove != null) context.tblVolAddrs.Remove(AddrToRemove); context.SaveChanges(); var AddressToRemove = (from n in context.tblVolAddresses where n.AddrID == _cAddress.AddrID select n).FirstOrDefault(); //context.tblVolAddresses.Remove(AddressToRemove); AddressToRemove.ActiveFlg = false; if (AddressToRemove != null) context.sp_Vol_Address_Update(AddressToRemove.AddrID, AddressToRemove.ActiveFlg, AddressToRemove.AddrLine1, AddressToRemove.AddrLine2, AddressToRemove.AddrLine3, AddressToRemove.City, AddressToRemove.St, AddressToRemove.Zip, AddressToRemove.Zip4, AddressToRemove.GeoCodeGetSet); context.SaveChanges(); } catch (Exception ex) { throw (ex); } } }
public void InsertVolunteerAvailability(ISchedulerInfo shedulerInfo, Appointment appointmentToInsert, sp_Availablity_DM cAvail) { using (VolTeerEntities context = new VolTeerEntities()) { try { var cVolAvail = new tblAvailability { VolID = cAvail.VolID, AddrID = cAvail.AddrID, AvailStart = appointmentToInsert.Start, AvailEnd = appointmentToInsert.End, Description = appointmentToInsert.Description, RecurrenceParentID = (int?)(appointmentToInsert.RecurrenceParentID), RecurrenceRule = appointmentToInsert.RecurrenceRule, Subject = appointmentToInsert.Subject }; context.tblAvailabilities.Add(cVolAvail); context.SaveChanges(); } catch (Exception ex) { } } }
/// <summary> /// InsertVolunteerContext - Will insert a record into Volunteer table via SProc /// </summary> /// <param name="_cVolunteer"></param> public sp_Volunteer_DM InsertVolunteerContext(ref sp_Volunteer_DM _cVolunteer) { try { using (VolTeerEntities context = new VolTeerEntities()) { var cVolunteer = new tblVolunteer { VolID = _cVolunteer.VolID, VolFirstName = _cVolunteer.VolFirstName, VolMiddleName = _cVolunteer.VolMiddleName, VolLastName = _cVolunteer.VolLastName, ActiveFlg = _cVolunteer.ActiveFlg }; context.tblVolunteers.Add(cVolunteer); context.SaveChanges(); // pass VolID back to BLL _cVolunteer.VolID = cVolunteer.VolID; return _cVolunteer; } } catch (Exception ex) { throw (ex); } }
public void DeleteContactEmailContext(sp_ContactEmail_DM contactemail) { using (VolTeerEntities context = new VolTeerEntities()) { var ContactEmailtoRemove = (from n in context.tblContactEmails where n.ContactID == contactemail.ContactID & n.EmailID == contactemail.EmailID select n).FirstOrDefault(); context.tblContactEmails.Remove(ContactEmailtoRemove); context.SaveChanges(); } }
public void DeleteEmailContext(sp_VendEmail_DM InputEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var VendEmailToRemove = (from n in context.tblVendEmails where n.EmailID == InputEmail.EmailID select n).FirstOrDefault(); context.tblVendEmails.Remove(VendEmailToRemove); context.SaveChanges(); } }
public void DeleteProjectEventContext(sp_ProjectEvent_DM InputProjectEvent) { using (VolTeerEntities context = new VolTeerEntities()) { var ProjectEventToRemove = (from n in context.tblProjectEvents where n.EventID == InputProjectEvent.EventID select n).FirstOrDefault(); context.tblProjectEvents.Remove(ProjectEventToRemove); context.SaveChanges(); } }
public void DeleteVendContactContext(sp_VendContact_DM vendcontact) { using (VolTeerEntities context = new VolTeerEntities()) { var VendContacttoRemove = (from n in context.tblVendContacts where n.ContactID == vendcontact.ContactID & n.VendorID == vendcontact.VendorID select n).FirstOrDefault(); context.tblVendContacts.Remove(VendContacttoRemove); context.SaveChanges(); } }
public void DeleteAddressContext(sp_VendorAddr_DM InputAddress) { using (VolTeerEntities context = new VolTeerEntities()) { var VendorAddrsToRemove = (from n in context.tblVendorAddrs where n.VendorID == InputAddress.VendorID select n).FirstOrDefault(); context.tblVendorAddrs.Remove(VendorAddrsToRemove); context.SaveChanges(); } }
/// <summary> /// InsertAddressContext - Will insert a record into Address table via SProc /// </summary> /// <param name="_cAddress"></param> public void InsertAddressContext(ref sp_Vol_Address_DM _cAddress, ref sp_Vol_Addr_DM _cVolAddr) { using (VolTeerEntities context = new VolTeerEntities()) { try { var cAddress = new tblVolAddress { AddrLine1 = _cAddress.AddrLine1, AddrLine2 = _cAddress.AddrLine2, AddrLine3 = _cAddress.AddrLine3, City = _cAddress.City, St = _cAddress.St, Zip = _cAddress.Zip, Zip4 = _cAddress.Zip4, GeoCodeGetSet = _cAddress.GeoCodeGetSet, ActiveFlg = _cAddress.ActiveFlg }; context.tblVolAddresses.Add(cAddress); context.SaveChanges(); var cVolAddr = new tblVolAddr { VolID = _cVolAddr.VolID, AddrID = cAddress.AddrID, PrimaryAddr = _cVolAddr.PrimaryAddr }; context.tblVolAddrs.Add(cVolAddr); context.SaveChanges(); //If the AddrID isn't null, set it equal to the return value if (cAddress.AddrID != null) _cAddress.AddrID = cAddress.AddrID; if (cVolAddr.AddrID != null) _cVolAddr.AddrID = cVolAddr.AddrID; } catch (Exception ex) { throw (ex); } } }
/// <summary> /// DeleteSkillContext - Will do a soft delete (make inactive) by SkillID /// </summary> /// <param name="_cSkill"></param> public void DeleteSkillContext(sp_Skill_DM _cSkill) { using (VolTeerEntities context = new VolTeerEntities()) { var SkillToRemove = (from n in context.tblSkills where n.SkillID == _cSkill.SkillID select n).FirstOrDefault(); context.tblSkills.Remove(SkillToRemove); context.SaveChanges(); } }
public void DeleteEventRatingContext(sp_EventRating_DM InputRating) { using (VolTeerEntities context = new VolTeerEntities()) { var RatingToRemove = (from n in context.tblEventRatings where n.RatingID == InputRating.RatingID select n).FirstOrDefault(); context.tblEventRatings.Remove(RatingToRemove); context.SaveChanges(); } }
/// <summary> /// DeleteVolunteerContext - Will do a soft delete (make inactive) by VolID /// </summary> /// <param name="_cVolunteer"></param> public void DeleteProjectContext(sp_Project_DM _cProject) { using (VolTeerEntities context = new VolTeerEntities()) { var ProjectToRemove = (from n in context.tblProjects where n.ProjectID == _cProject.ProjectID select n).FirstOrDefault(); context.tblProjects.Remove(ProjectToRemove); context.SaveChanges(); } }
/// <summary> /// DeleteEmailsContext - Will do a soft delete (make inactive) by EmailID /// </summary> /// <param name="_cVolunteer"></param> public void DeleteEmailsContext(sp_Email_DM _cEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var EmailsToRemove = (from n in context.tblVolEmails where n.EmailID == _cEmail.EmailID select n).FirstOrDefault(); context.tblVolEmails.Remove(EmailsToRemove); context.SaveChanges(); } }
/// <summary> /// DeleteAddressContext - Will do a soft delete (make inactive) by AddrID /// </summary> /// <param name="_cAddress"></param> public void DeleteAddressContext(sp_Vol_Address_DM _cAddress) { using (VolTeerEntities context = new VolTeerEntities()) { var AddressToRemove = (from n in context.tblVolAddresses where n.AddrID == _cAddress.AddrID select n).FirstOrDefault(); context.tblVolAddresses.Remove(AddressToRemove); context.SaveChanges(); } }
public void DeleteGroupContext(sp_Group_DM _cGroup) { using (VolTeerEntities context = new VolTeerEntities()) { var GroupToRemove = (from n in context.tblGroups where n.GroupID == _cGroup.GroupID select n).FirstOrDefault(); context.tblGroups.Remove(GroupToRemove); context.SaveChanges(); } }
/// <summary> /// DeleteVolunteerContext - Will do a soft delete (make inactive) by VolID /// </summary> /// <param name="_cVolunteer"></param> public void DeleteVolunteerContext(sp_Volunteer_DM _cVolunteer) { using (VolTeerEntities context = new VolTeerEntities()) { var VolunteerToRemove = (from n in context.tblVolunteers where n.VolID == _cVolunteer.VolID select n).FirstOrDefault(); context.tblVolunteers.Remove(VolunteerToRemove); context.SaveChanges(); } }
/// <summary> /// DeletePhonesContext - Will do a soft delete (make inactive) by PhoneID /// </summary> /// <param name="_cVolunteer"></param> public void DeletePhonesContext(sp_Phone_DM _cPhone) { using (VolTeerEntities context = new VolTeerEntities()) { var PhonesToRemove = (from n in context.tblVolPhones where n.PhoneID == _cPhone.PhoneID select n).FirstOrDefault(); PhonesToRemove.ActiveFlg = false; context.sp_Vol_Phone_Update(PhonesToRemove.PhoneID, PhonesToRemove.VolID, PhonesToRemove.PhoneNbr, PhonesToRemove.ActiveFlg, PhonesToRemove.PrimaryFlg); context.SaveChanges(); } }
/// <summary> /// DeleteVolunteerContext - Will do a soft delete (make inactive) by VolID /// </summary> /// <param name="_cVolunteer"></param> public void DeleteVolunteerContext(sp_Volunteer_DM _cVolunteer) { using (VolTeerEntities context = new VolTeerEntities()) { var VolunteerToRemove = (from n in context.tblVolunteers where n.VolID == _cVolunteer.VolID select n).FirstOrDefault(); VolunteerToRemove.ActiveFlg = false; context.sp_Volunteer_Update(VolunteerToRemove.VolID, VolunteerToRemove.ActiveFlg, VolunteerToRemove.VolFirstName, VolunteerToRemove.VolMiddleName, VolunteerToRemove.VolLastName); context.SaveChanges(); } }
public void DeleteSampleAddressContext(sp_Sample_Address_Select_DM lSampleAddress) { using (VolTeerEntities context = new VolTeerEntities()) { // Load the Address based on the AddrID var AddressToRemove = (from n in context.tblSampleAddresses where n.AddrID == lSampleAddress.AddrID select n).FirstOrDefault(); context.tblSampleAddresses.Remove(AddressToRemove); context.SaveChanges(); } }
/// <summary> /// DeleteEmailsContext - Will do a soft delete (make inactive) by EmailID /// </summary> /// <param name="_cVolunteer"></param> public void DeleteEmailsContext(sp_Email_DM _cEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var EmailsToRemove = (from n in context.tblVolEmails where n.EmailID == _cEmail.EmailID select n).FirstOrDefault(); //context.tblVolEmails.Remove(EmailsToRemove); EmailsToRemove.ActiveFlg = false; context.sp_Vol_Email_Update(EmailsToRemove.EmailID, EmailsToRemove.VolID, EmailsToRemove.EmailAddr, EmailsToRemove.ActiveFlg, EmailsToRemove.PrimaryFlg); context.SaveChanges(); } }
public void DeleteAddressContext(sp_Vol_Address_DM _cAddress, sp_GroupAddr_DM _cGroupAddr) { using (VolTeerEntities context = new VolTeerEntities()) { try { var AddrToRemove = (from n in context.tblGroupAddrs where n.AddrID == _cGroupAddr.AddrID select n).FirstOrDefault(); context.tblGroupAddrs.Remove(AddrToRemove); context.SaveChanges(); var AddressToRemove = (from n in context.tblVolAddresses where n.AddrID == _cAddress.AddrID select n).FirstOrDefault(); context.tblVolAddresses.Remove(AddressToRemove); context.SaveChanges(); } catch (Exception ex) { throw (ex); } } }
public void InsertContactEmailContext(sp_ContactEmail_DM contactemail) { using (VolTeerEntities context = new VolTeerEntities()) { var NewContactEmail = new tblContactEmail { ContactID = contactemail.ContactID, EmailID = contactemail.EmailID, PrimaryEmail = contactemail.PrimaryEmail }; context.tblContactEmails.Add(NewContactEmail); context.SaveChanges(); } }
public void UpdateEmailContext(sp_VendEmail_DM InputEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var existingEmail = context.tblVendEmails.Find(InputEmail.EmailID); if (InputEmail != null) { existingEmail.EmailAddr = InputEmail.EmailAddr; existingEmail.ActiveFlg = InputEmail.ActiveFlg; context.SaveChanges(); } } }
/// <summary> /// InsertSkillContext - Will insert a record into Skill table via SProc /// </summary> /// <param name="_cSkill"></param> public void InsertSkillContext(ref sp_Skill_DM _cSkill) { using (VolTeerEntities context = new VolTeerEntities()) { var cSkill = new tblSkill { SkillName = _cSkill.SkillName, MstrSkillID = _cSkill.MstrSkillID }; context.tblSkills.Add(cSkill); context.SaveChanges(); _cSkill.SkillID = cSkill.SkillID; } }
public void DeleteVolunteerAvailability(ISchedulerInfo shedulerInfo, Appointment appointmentToDelete, sp_Availablity_DM cAvail) { using (VolTeerEntities context = new VolTeerEntities()) { var cVolAvail = new tblAvailability { VolID = cAvail.VolID, AddrID = cAvail.AddrID, AvailID = cAvail.AvailID }; context.tblAvailabilities.Remove(cVolAvail); context.SaveChanges(); } }
public void DeleteVolunteerAvailability(sp_Availablity_DM _cVolAvail) { using (VolTeerEntities context = new VolTeerEntities()) { var cVolAvail = new tblAvailablity { VolID = _cVolAvail.VolID, AddrID = _cVolAvail.AddrID, AvailDateID = _cVolAvail.AvailDateID }; context.tblAvailablities.Remove(cVolAvail); context.SaveChanges(); } }
public void InsertVendContactContext(sp_VendContact_DM vendcontact) { using (VolTeerEntities context = new VolTeerEntities()) { var NewVendContact = new tblVendContact { VendorID = vendcontact.VendorID, ContactID = vendcontact.ContactID, PrimaryContact = vendcontact.PrimaryContact }; context.tblVendContacts.Add(NewVendContact); context.SaveChanges(); } }
public int InsertEmailContext(sp_VendEmail_DM InputEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var NewEmail = new tblVendEmail { EmailAddr = InputEmail.EmailAddr, ActiveFlg = InputEmail.ActiveFlg }; context.tblVendEmails.Add(NewEmail); context.SaveChanges(); //Return the id of the newly created record return NewEmail.EmailID; } }
public void UpdateProjectEventContactContext(sp_ProjectEventContact_DM InputProjectEventContact) { using (VolTeerEntities context = new VolTeerEntities()) { var existingProjectEventContact = context.tblProjectEventContacts.Find(InputProjectEventContact.EventID); if (InputProjectEventContact != null) { existingProjectEventContact.EventID = InputProjectEventContact.EventID; existingProjectEventContact.ContactID = InputProjectEventContact.ContactID; existingProjectEventContact.PrimaryContact = InputProjectEventContact.PrimaryContact; context.SaveChanges(); } } }
public int InsertAddressContext(sp_VendorAddr_DM InputAddress) { using (VolTeerEntities context = new VolTeerEntities()) { var NewAddress = new tblVendorAddr { AddrID = InputAddress.AddrID, HQ = InputAddress.HQ }; context.tblVendorAddrs.Add(NewAddress); context.SaveChanges(); //Return the id of the newly created record return NewAddress.AddrID; } }