public IQueryable<ImageClass> GetGalleryByID(int _Id) { //create an insteance of the data context class called objGalleryImageDC NorthBayDataContext objGalleryImageDC = new NorthBayDataContext(); var allgallery = objGalleryImageDC.ImageClasses.Where(x => x.ID == _Id).Select(x => x); return allgallery; }
public bool commitInsert(string _unitno, string _streetno, string _streetname, string _city, string _province, string _pcode, string _tnumber, string _email, decimal _latitude, decimal _longitude, string _imageurl) { //creating an instance of our LINQ object NorthBayDataContext objLocationsDC = new NorthBayDataContext(); //to ensure all data will be disposed when finished using (objLocationsDC) { //create an instance of our table object Framework.Database.Location objnewLocation = new Framework.Database.Location(); //set table columns to the new values that will be passed from the *.aspx page objnewLocation.UnitNo = _unitno; objnewLocation.StreetNo = _streetno; objnewLocation.StreetName = _streetname; objnewLocation.City = _city; objnewLocation.Province = _province; objnewLocation.Pcode = _pcode; objnewLocation.Tnumber = _tnumber; objnewLocation.Email = _email; objnewLocation.Latitude = _latitude; objnewLocation.Longitude = _longitude; objnewLocation.ImageUrl = _imageurl; //insert command objLocationsDC.Locations.InsertOnSubmit(objnewLocation); //commit insert against database objLocationsDC.SubmitChanges(); return true; } }
public bool commitDelete(int _CareerId) { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); using (objCareersDC) { try { var objDelPro = objCareersDC.Careers.Single(x => x.CareerId == _CareerId); //delete command objCareersDC.Careers.DeleteOnSubmit(objDelPro); //commit delete against database objCareersDC.SubmitChanges(); return true; } catch (SqlException sqlEx) { if (sqlEx.ErrorCode == 547) throw; } catch (Exception ex) { throw (ex); //General error logic } return false; } }
public bool commitInsert(string _title, string _description, string _category, string _postdate, string _enddate, Boolean _active) { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); //to ensure all data will be disposed when finished using (objCareersDC) { //create an instance of our table object Framework.Database.Career objnewCareer = new Framework.Database.Career(); //set table columns to the new values that will be passed from the *.aspx page objnewCareer.Title = _title; objnewCareer.Description = _description; objnewCareer.Category = _category; objnewCareer.PostDate = TextHelper.ToDateTime(_postdate) ?? DateTime.Now; //DateTime.ParseExact(_postdate, "dd/MM/yyyy hh:mm tt", null); //DateTime.Parse(_postdate); objnewCareer.EndDate = TextHelper.ToDateTime(_enddate) ?? DateTime.Now; //DateTime.ParseExact(_enddate, "dd/MM/yyyy hh:mm tt", null); //DateTime.Parse(_enddate); objnewCareer.Active = _active; //insert command objCareersDC.Careers.InsertOnSubmit(objnewCareer); //commit insert against database objCareersDC.SubmitChanges(); return true; } }
public IQueryable<ImageClass> getgallery() { //create an insteance of the data context class called objGalleryImageDC NorthBayDataContext objGalleryImageDC = new NorthBayDataContext(); //creating anonymous variable with value being instance of LINQ object var allgallery = objGalleryImageDC.ImageClasses.Select(x => x); //return IQueryable<product> for databound control to bind to return allgallery; }
public bool commitDelete(int _Id) { //create an insteance of the data context class called objGalleryImageDC NorthBayDataContext objGalleryImageDC = new NorthBayDataContext(); using (objGalleryImageDC) { var objDelGallery = objGalleryImageDC.ImageClasses.Single(x => x.ID == _Id); //delete command objGalleryImageDC.ImageClasses.DeleteOnSubmit(objDelGallery); //commit delete aginst db objGalleryImageDC.SubmitChanges(); return true; } }
public bool commitDelete(int _locationId) { //creating an instance of our LINQ object NorthBayDataContext objLocationsDC = new NorthBayDataContext(); using (objLocationsDC) { var objDelLocation = objLocationsDC.Locations.Single(x => x.LocationId == _locationId); //delete command objLocationsDC.Locations.DeleteOnSubmit(objDelLocation); //commit delete against database objLocationsDC.SubmitChanges(); return true; } }
//public bool commitUpdate(int _Id, string _imageFile, string _FileName) public bool commitUpdate(int _Id, string _FileName) { //create an insteance of the data context class called objGalleryImageDC NorthBayDataContext objGalleryImageDC = new NorthBayDataContext(); using (objGalleryImageDC) { var objUGallery = objGalleryImageDC.ImageClasses.Single(x => x.ID == _Id); objUGallery.ID = _Id; //objUGallery.FilePath = _imageFile; objUGallery.FileName = _FileName; //commit update against db objGalleryImageDC.SubmitChanges(); return true; } }
public bool commitUpdate(int _CareerId, string _title, string _description, string _category, DateTime _postdate, DateTime _enddate, Boolean _active) { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); using (objCareersDC) { var objUpdCareer = objCareersDC.Careers.Single(x => x.CareerId == _CareerId); objUpdCareer.Title = _title; objUpdCareer.Description = _description; objUpdCareer.Category = _category; objUpdCareer.PostDate = _postdate; objUpdCareer.EndDate = _enddate; objUpdCareer.Active = _active; objCareersDC.SubmitChanges(); return true; } }
public bool commitInsert(string _imageFile, string _FileName) { //create an insteance of the data context class called objGalleryImageDC NorthBayDataContext objGalleryImageDC = new NorthBayDataContext(); //to ensure all data will be disposed when finished using (objGalleryImageDC) { //create an instance of the table ImageClass objNewGalleryImage = new ImageClass(); //set table column to new values being passed from *.aspx card_image //objNewCardImage.id = _id; objNewGalleryImage.FilePath = _imageFile; objNewGalleryImage.FileName = _FileName; //insert command objGalleryImageDC.ImageClasses.InsertOnSubmit(objNewGalleryImage); //commit insert against db objGalleryImageDC.SubmitChanges(); return true; } }
public IQueryable<object> allLocations() { //creating an instance of our LINQ object NorthBayDataContext objLocationsDC = new NorthBayDataContext(); var allLocations = from x in objLocationsDC.Locations select new { LocationId = x.LocationId, Name = "North Bay Regional Health Centre", Address = x.StreetNo + " " + x.StreetName, City = x.City, Province = x.Province, Pcode = x.Pcode, Tnumber = x.Tnumber, Email = x.Email, ImageUrl = x.ImageUrl, }; return allLocations; }
public IQueryable<Framework.Database.Location> getLocations() { //creating an instance of our LINQ object NorthBayDataContext objLocationsDC = new NorthBayDataContext(); //creating anonymous various with its value being the instance of our LINQ object var allLocations = objLocationsDC.Locations.Select(x => x);//method syntax return allLocations; }
public IQueryable<Framework.Database.Location> getLocationById(int _LocationId) { //creating an instance of our LINQ object NorthBayDataContext objLocationsDC = new NorthBayDataContext(); var locationById = objLocationsDC.Locations.Where(x => x.LocationId == _LocationId).Select(x => x); return locationById; }
public IQueryable<object> getLocationAddresses() { //creating an instance of our LINQ object NorthBayDataContext objLocationsDC = new NorthBayDataContext(); var locationAddresses = from x in objLocationsDC.Locations select new { LocationId = x.LocationId, Address = "North Bay Regional Health Centre, " + x.StreetNo + " " + x.StreetName + ", " + x.City }; return locationAddresses; }
public IQueryable<String> getCareerCategories() { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); //creating anonymous various with its value being the instance of our LINQ object var distinctCategories = objCareersDC.Careers.Select(x => x.Category).Distinct(); return distinctCategories; }
public string getCareerByID(int _CareerId) { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); var title = objCareersDC.Careers.Where(x => x.CareerId == _CareerId).Select(x => x.Title).SingleOrDefault(); //SELECT * FROM products WHERE id = _id return title; }
public IQueryable<Framework.Database.Career> getCareersByID(int _CareerId) { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); var allCareers = objCareersDC.Careers.Where(x => x.CareerId == _CareerId).Select(x => x); //SELECT * FROM products WHERE id = _id return allCareers; }
public bool commitInsert(int _careerid, string _fname, string _lname, string _unitno, string _streetno, string _streetname, string _city, string _province, string _pcode, string _tnumber, string _email, string _resumeurl) { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); //to ensure all data will be disposed when finished using (objCareersDC) { //create an instance of our table object Applicant objnewApplicant = new Applicant(); //set table columns to the new values that will be passed from the *.aspx page objnewApplicant.CareerId = _careerid; objnewApplicant.Fname = _fname; objnewApplicant.Lname = _lname; objnewApplicant.UnitNo = _unitno; objnewApplicant.StreetNo = _streetno; objnewApplicant.StreetName = _streetname; objnewApplicant.City = _city; objnewApplicant.Province = _province; objnewApplicant.Pcode = _pcode; objnewApplicant.Tnumber = _tnumber; objnewApplicant.Email = _email; objnewApplicant.ResumeUrl = _resumeurl; //insert command objCareersDC.Applicants.InsertOnSubmit(objnewApplicant); //commit insert against database objCareersDC.SubmitChanges(); return true; } }
public IQueryable<Applicant> getApplicants() { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); //creating anonymous various with its value being the instance of our LINQ object var allApplicants = objCareersDC.Applicants.Select(x => x);//method syntax return allApplicants; }
public Array getEvents() { //creating an instance of our LINQ object NorthBayDataContext objEventsDC = new NorthBayDataContext(); //creating anonymous various with its value being the instance of our LINQ object var allEvents = objEventsDC.Events.Select(x => x); //method syntax // CalendarEvent item; Framework.Database.Event[] EventsArray = allEvents.ToArray(); return EventsArray; }
public IQueryable<Framework.Database.Event> getEventByID(int _eventid) { //creating an instance of our LINQ object NorthBayDataContext objEventsDC = new NorthBayDataContext(); var eventById = objEventsDC.Events.Where(x => x.EventId == _eventid).Select(x => x); //SELECT * FROM events WHERE id = _id return eventById; }
public bool commitUpdate(int _eventid, string _title, string _description, DateTime _eventdate, string _imageurl, int _eventtype) { //creating an instance of our LINQ object NorthBayDataContext objEventsDC = new NorthBayDataContext(); using (objEventsDC) { var objUpdEvent = objEventsDC.Events.Single(x => x.EventId == _eventid); //set table columns to the new values that will be passed from the *.aspx page objUpdEvent.EventId = _eventid; objUpdEvent.Title = _title; objUpdEvent.Description = _description; objUpdEvent.EventDate = _eventdate; objUpdEvent.ImageUrl = _imageurl; objUpdEvent.EventType = _eventtype; objEventsDC.SubmitChanges(); return true; } }
public bool commitInsert(string _title, string _description, DateTime _eventdate, string _imageurl, int _eventtype) { //creating an instance of our LINQ object NorthBayDataContext objEventsDC = new NorthBayDataContext(); using (objEventsDC) { //create an instance of our table object Framework.Database.Event objNewEvent = new Framework.Database.Event(); //set table columns to the new values that will be passed from the *.aspx page objNewEvent.Title = _title; objNewEvent.Description = _description; objNewEvent.EventDate = _eventdate; objNewEvent.ImageUrl = _imageurl; objNewEvent.EventType = _eventtype; //insert command objEventsDC.Events.InsertOnSubmit(objNewEvent); objEventsDC.SubmitChanges(); return true; } }
public IQueryable<Applicant> getApplicantByID(int _ApplicantId) { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); var allApplicants = objCareersDC.Applicants.Where(x => x.ApplicantId == _ApplicantId).Select(x => x); //SELECT * FROM products WHERE id = _id return allApplicants; }
public bool commitUpdate(int _locationId, string _unitno, string _streetno, string _streetname, string _city, string _province, string _pcode, string _tnumber, string _email, decimal _latitude, decimal _longitude, string _imageurl) { //creating an instance of our LINQ object NorthBayDataContext objLocationsDC = new NorthBayDataContext(); using (objLocationsDC) { var objUpdLocation = objLocationsDC.Locations.Single(x => x.LocationId == _locationId); //set table columns to the new values that will be passed from the *.aspx page objUpdLocation.UnitNo = _unitno; objUpdLocation.StreetNo = _streetno; objUpdLocation.StreetName = _streetname; objUpdLocation.City = _city; objUpdLocation.Province = _province; objUpdLocation.Pcode = _pcode; objUpdLocation.Tnumber = _tnumber; objUpdLocation.Email = _email; objUpdLocation.Latitude = _latitude; objUpdLocation.Longitude = _longitude; objUpdLocation.ImageUrl = _imageurl; objLocationsDC.SubmitChanges(); return true; } }
public IQueryable<Framework.Database.Career> getCareersByCategory(string _Category) { //creating an instance of our LINQ object NorthBayDataContext objCareersDC = new NorthBayDataContext(); var careersByCategory = objCareersDC.Careers.Where(x => x.Category == _Category).Select(x => x); //SELECT * FROM products WHERE id = _id return careersByCategory; }