public string Delete(string username) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); string Response= ""; username = username.Replace("'", "''"); try { return_val = dbs.DeleteDatabase("Rider",username); } catch (Exception ex) { Response = ("Error in the Delete process the Rider(user) database " + ex.Message); lf.Main("Users", Response); return "Error"; } lf.Main("Users", Response); if (return_val <= 0) { Response = "The Rider " + username + " was not Deleted from the Database"; lf.Main("Users", Response); return "Error"; } else { Response = "The Rider " + username + " was Deleted from the Database"; lf.Main("Users", Response); return "Success"; } }
public string updateDB([FromBody]Rides rds) { LogFiles lf = new LogFiles(); if (DateTime.Now.Day.CompareTo(Convert.ToDateTime(rds.RideDate).Day) < 0 || DateTime.Now.Month.CompareTo(Convert.ToDateTime(rds.RideDate).Month) != 0) { lf.Main("Rides", "The Ride Date:" + rds.RideDate + " Can't be in the future or in a diffetent month "); return "Error"; } int return_val = 0; DBservices dbs = new DBservices(); List<Object> mlist = new List<Object>(); mlist.Add(rds); try { return_val = dbs.InsertDatabase(mlist); } catch (Exception ex) { string Response = ("Error while trying to INSERT the new Ride to the database " + ex.Message); lf.Main("Rides", Response); return "Error"; } if (return_val == 0) { return "Error"; } return "Success"; }
public string Delete(string username, string routename) { DBservices dbs = new DBservices(); int return_val = 0; LogFiles lf = new LogFiles(); username = username.Replace("'", "''"); string Response = ""; try { return_val = dbs.DeleteDatabase("Routes",username, routename); } catch (Exception ex) { Response = ("Error in the Delete process of the Route " + routename + " of " + username + ", " + ex.Message); lf.Main("Routes", Response); return "Error"; } Response = "The Route " + routename + " was Deleted from the Database"; lf.Main("Routes", Response); if (return_val == 0) { return "Error"; } return "Success"; }
public string DeleteEvent(string eventname) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); string Response = ""; eventname = eventname.Replace("'", "''"); try { return_val = dbs.DeleteDatabase("Event", eventname); } catch (Exception ex) { Response = ("Error in the Delete process the Event from an event database " + ex.Message); lf.Main("UserEvent", Response); return "Error"; } Response = "The Event " + eventname + " was Deleted from the Event"; lf.Main("UserEvent", Response); if (return_val == 0) { return "Error"; } return "Success"; }
public string DeleteOrganization(string orgname) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); string Response = ""; orgname = orgname.Replace("'", "''"); try { return_val = dbs.DeleteDatabase("Organizations", orgname); } catch (Exception ex) { Response = ("Error in the Delete process the Organization from the database " + ex.Message); lf.Main("Organizations", Response); return "Error"; } Response = "The Organization " + orgname + " was Deleted from the Event"; lf.Main("Organizations", Response); if (return_val == 0) { return "Error"; } return "Success"; }
public string DeleteGroup(string grpname, string orgname) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); string Response = ""; grpname = grpname.Replace("'", "''"); orgname = orgname.Replace("'", "''"); try { return_val = dbs.DeleteDatabase("Groups", grpname, orgname); } catch (Exception ex) { Response = ("Error in the Delete process the group from an event database " + ex.Message); lf.Main("Groups", Response); return "Error"; } Response = "The Group " + grpname + " was Deleted from the Databse"; lf.Main("Groups", Response); if (return_val == 0) { return "Error"; } return "Success"; }
public string Put(string cap_usr, string new_cap_usr) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); Rider rdr = new Rider(); try { return_val = dbs.updateRiderInDatabase(rdr, cap_usr, new_cap_usr); } catch (Exception ex) { string Response = ("Error while trying to switch the Captain(user) " + cap_usr + " in the database: " + ex.Message); lf.Main("Users", Response); return "Error"; } if (return_val == 0) { return "Error"; } return "Success"; }
public string Post([FromBody]Competition cmpt) { DBservices dbs = new DBservices(); int return_val = 0; LogFiles lf = new LogFiles(); List<Object> mlist = new List<Object>(); mlist.Add(cmpt); try { return_val = dbs.InsertDatabase(mlist); } catch (Exception ex) { string Response = ("Error updating the Competition database " + ex.Message); lf.Main("Competition", Response); return "Error"; } if (return_val == 0) { return "Error"; } return "Success"; }
public string Put(string CompetitionDate, [FromBody]Competition cmpt) { string userName = string.Empty; if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { if (User.Identity.IsAuthenticated) userName = User.Identity.Name; } DBservices dbs = new DBservices(); int return_val = 0; LogFiles lf = new LogFiles(); List<Object> mlist = new List<Object>(); mlist.Add(cmpt); try { return_val = dbs.updateCompetitionInDatabase(cmpt, CompetitionDate); } catch (Exception ex) { string Response = ("Error updating the Competition database " + ex.Message); lf.Main("Competition", Response); return "Error"; } if (return_val == 0) { return "Error"; } return "Success"; }
public string updateDB([FromBody]Group grp) { DBservices dbs = new DBservices(); int return_val = 0; LogFiles lf = new LogFiles(); List<Object> mlist = new List<Object>(); mlist.Add(grp); try { return_val = dbs.InsertDatabase(mlist); } catch (Exception ex) { string Response = ("Error updating the Group database " + ex.Message); lf.Main("Groups", Response); return "Error"; } if (return_val == 0) { return "Error"; } return "Success"; }
public string Put(string username, [FromBody]Rider rdr) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); username = username.Replace("'", "''"); try { return_val = dbs.updateRiderInDatabase(rdr,username); } catch (Exception ex) { string Response = ("Error while trying to Update the Rider(user) " + username + " to the database " + ex.Message); lf.Main("Users", Response); return "Error"; } if ( return_val == 0 ){return "Error";} return "Success"; }
public string updateDB([FromBody]Rider rdr) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); try { return_val = dbs.insertRider(rdr); } catch (Exception ex) { string Response = ("Error while trying to INSERT the new Rider(user) to the database " + ex.Message); lf.Main("Users", Response); return "Error"; } if (return_val != 3) { return "Error"; } return "Success"; }
public string updateDB([FromBody]Routes rut) { DBservices dbs = new DBservices(); int return_val = 0; LogFiles lf = new LogFiles(); List<Object> mlist = new List<Object>(); mlist.Add(rut); try { return_val = dbs.InsertDatabase(mlist); } catch (Exception ex) { string Response = ("Error while trying to INSERT the new Route to the database " + ex.Message); lf.Main("Routes", Response); return "Error"; } if (return_val == 0) { return "Error"; } return "Success"; }
public string RiderInEvent(string eventname, string username) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); eventname = eventname.Replace("'", "''"); username = username.Replace("'", "''"); try { return_val = dbs.updateRiderIneventDatabase(eventname, username); } catch (Exception ex) { string Response = ("Error while trying to Update the Rider(user) " + username + " to the event " + eventname + ", "+ ex.Message); lf.Main("UsersEvents", Response); return "Error"; } if ( return_val == 0 ){return "Error";} return "Success"; }
public string Put(string eventname, [FromBody]Event evt) { int return_val = 0; LogFiles lf = new LogFiles(); DBservices dbs = new DBservices(); eventname = eventname.Replace("'", "''"); try { return_val = dbs.updateEventInDatabase(evt, eventname); } catch (Exception ex) { string Response = ("Error while trying to Update the Event " + eventname + " to the database " + ex.Message); lf.Main("Events", Response); return "Error"; } if (return_val == 0) { return "Error"; } return "Success"; }