// GET: Links public ActionResult Index() { LinksData linksData = new LinksData(); var linkList = linksData.GetLinks(); return(View(linkList)); }
public ActionResult Remove(LinksData linkModel) { string URL = linkModel.URL; using (portaldatabaseEntities db = new portaldatabaseEntities()) { //sql query to delete link from db db.Database.ExecuteSqlCommand("Delete from dbo.links where URL = '" + URL + "'"); return(RedirectToAction("Index", "Links_Management")); } }
/// <summary> /// Clears out all values stored in the dictionaries. /// </summary> public static void ClearAll() { Configurations.Clear(); Projects.Clear(); FamilyData.Clear(); SheetsData.Clear(); WorksetsData.Clear(); ModelsData.Clear(); TriggerRecords.Clear(); ViewsData.Clear(); StylesData.Clear(); LinksData.Clear(); GroupsData.Clear(); }
public bool checkExistingLink(LinksData userModel) { using (portaldatabaseEntities db = new portaldatabaseEntities()) { var URL = db.Links.Where(x => x.URL == userModel.URL).FirstOrDefault(); //check if URL exists in the database already if (URL == null) //not in db { return(false); } else { return(true); //return true if URL is in db } } }
public ActionResult Register(LinksData linkModel) { using (portaldatabaseEntities db = new portaldatabaseEntities()) { //Set the URL name Link newLink = new Link(); newLink.URL = linkModel.URL; //Check if link already exists in server if (checkExistingLink(linkModel) == false && newLink.URL != null) //check if not in the db and the URL is not null { //Call function to add to the database AddLink(newLink); return(RedirectToAction("Index", "Links_Management")); } else { return(RedirectToAction("Index", "Links_Management")); } } }
public ActionResult EditRole(LinksData LinkModel, Role RoleModel, Status_Entity StatusModel) { string URLname = LinkModel.URL; string Rolename = RoleModel.Role_Name; string Statusname = StatusModel.Status; //All fields have to be filled out to edit role if (URLname == null || Rolename == null || Statusname == null) { return(RedirectToAction("Index", "Links_Management")); } else { //updating the role for the link using (portaldatabaseEntities db = new portaldatabaseEntities()) { db.Database.ExecuteSqlCommand("update dbo.links set RoleID = (select RoleID from dbo.Roles where" + " Roles.Role_Name = '" + Rolename + "'), StatusID = (select StatusID from dbo.Status where Status.Status = '" + Statusname + "')" + " where links.URL = '" + URLname + "'"); } return(RedirectToAction("Index", "Links_Management")); } }
public List<LinksData> GenerateLinks2(int startyear, string id, int interval) { string url1 = "http://markets.ft.com/RESEARCH/Remote/UK/InteractiveChart/DrawInteractiveChart?"; DateTime dstart; DateTime dend; DateTime now = DateTime.Now; List<LinksData> lds = new List<LinksData>(); List<string> urls = new List<string>(); bool quit = false; int a = 0; // http://markets.ft.com/research/InteractiveChart?symbol=205778&options={"StartDate":"01/15/2008","EndDate":"06/24/2013","LowerIndicator":[{"Args":[{"Type":0,"Value":14}],"Code":21,"UID":696010770}],"UpperIndicator":[],"Overlay":[2,1,0],"ChartStyle":3,"ChartScale":1,"CursorStyle":1,"Interval":6,"Duration":10,"Comparison":[],"PortfolioName":null,"Width":950,"Height":400,"ActiveTool":null} // date format is US, even though in interactive format is UK for (; ; ) { // if 2 - 1-1-86 to 31-12-87 // 1-1-88 to 31-12-89 // 1-1-90 to 31-12-91 dstart = new DateTime(startyear + (a * interval), 1, 1); dend = new DateTime((startyear + interval - 1) + (a * interval), 12, 31); if (dend.Year >= now.Year) { dend = new DateTime(now.Year, 12, 31); quit = true; } string url2 = @"symbol=zzz&options={""StartDate"":""xxx"",""EndDate"":""yyy"",""LowerIndicator"":[],""UpperIndicator"":[],""Overlay"":[0,1,2],""ChartStyle"":3,""ChartScale"":1,""CursorStyle"":1,""Interval"":6,""Duration"":9,""Comparison"":[],""PortfolioName"":null,""Width"":950,""Height"":400,""ActiveTool"":null}"; url2 = url2.Replace("xxx", dstart.ToShortDateString()); url2 = url2.Replace("yyy", dend.ToShortDateString()); url2 = url2.Replace("zzz", id); string finalurl = url1 + url2; LinksData ld = new LinksData(); ld.url = finalurl; ld.filename = id + "." + a + ".txt"; lds.Add(ld); if (quit) break; a++; } return lds; }