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 _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 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 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 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 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 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 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 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(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; } }