public static void updateDoc(infoGathDocJSON doc) { InfoGathering newInfoDoc = convertToDBAO(doc); using (var curDB = new HelpDesk_DB()) { //Update old document to historic InfoGathering oldDoc = InfoGathList[doc.index]; var originalDoc = curDB.InfoGatherings.Find(oldDoc.id); originalDoc.Status_id = 4; //historic //Transfer persisting information to new document newInfoDoc.Original_id = oldDoc.id; curDB.SaveChanges(); } using (var curDB = new HelpDesk_DB()) { curDB.InfoGatherings.Add(newInfoDoc); curDB.SaveChanges(); //update info gath list for find and navigate references InfoGathList = curDB.InfoGatherings.Where(p => p.Status_id == 2).OrderBy(p => p.searchableAlias).ToList(); } logUsage(); }
public static string convertSerializedJSON(SDDocumentation doc) { sdDocJSON docJSON = new sdDocJSON(); docJSON.id = doc.id; docJSON.index = DocumentList.IndexOf(doc); docJSON.alias = doc.alias; docJSON.documentTitle = doc.documentTitle; if (doc.DocumentLink_id != null) { using (var curDB = new HelpDesk_DB()) { DocumentLink pdfDoc = curDB.DocumentLinks.SingleOrDefault(p => p.Id == doc.DocumentLink_id); docJSON.documentLink = pdfDoc.link; docJSON.PDFaccess = pdfDoc.Access_id; } } docJSON.passwordTitle = doc.passwordTitle; if (doc.PasswordHyperlink_id != null) { using (var curDB = new HelpDesk_DB()) { DocumentLink pwDoc = curDB.DocumentLinks.SingleOrDefault(p => p.Id == doc.PasswordHyperlink_id); docJSON.passwordHyperlink = pwDoc.link; docJSON.PWaccess = pwDoc.Access_id; } } var json = new JavaScriptSerializer().Serialize(docJSON); return(json); }
protected void Page_Load(object sender, EventArgs e) { using (var curDB = new HelpDesk_DB()) { HyperlinkList = curDB.DocumentLinks.ToList(); } }
public static void updateDoc(JSON_Objects.ProblemRecordJSON doc) { ProblemTracker newRecord = convertToDBAO(doc); using (var curDB = new HelpDesk_DB()) { //update old document to historic ProblemTracker oldRecord = ProblemList[doc.index]; var originalDoc = curDB.ProblemTrackers.Find(oldRecord.id); originalDoc.ProblemStatus_id = 1; //historic //Transfer persisting information to new record newRecord.Original_id = oldRecord.Original_id; curDB.SaveChanges(); } using (var curDB = new HelpDesk_DB()) { curDB.ProblemTrackers.Add(newRecord); curDB.SaveChanges(); //update problemtracker list ProblemList = curDB.ProblemTrackers.Where(p => p.ProblemStatus_id == 2).ToList(); } log(); }
public static string convertSerializedJSON(InfoGathering doc) { infoGathDocJSON docJSON = new infoGathDocJSON(); docJSON.id = doc.id; docJSON.index = InfoGathList.IndexOf(doc); docJSON.searchableAlias = doc.searchableAlias; //Checks for 0 inputed into the databse because this isn't allowed to be null if (doc.infoGathLink_id != 0) { using (var curDB = new HelpDesk_DB()) { DocumentLink pdfDoc = curDB.DocumentLinks.SingleOrDefault(p => p.Id == doc.infoGathLink_id); if (pdfDoc != null) { docJSON.infoGathLink = pdfDoc.link; } else { docJSON.infoGathLink = ""; } } } docJSON.infoGathTitle = doc.infoGathTitle; docJSON.assignmentGroup = doc.assignmentGroup; docJSON.supportInfo = doc.supportInfo; docJSON.supportHours = doc.supportHours; docJSON.contactInfo = doc.contactInfo; doc.passwordAttributes = doc.passwordAttributes; doc.passwordTitle = doc.passwordTitle; if (doc.PasswordHyperlink_id != null) { using (var curDB = new HelpDesk_DB()) { DocumentLink pwDoc = curDB.DocumentLinks.SingleOrDefault(p => p.Id == doc.PasswordHyperlink_id); if (pwDoc != null) { docJSON.passwordHyperlink = pwDoc.link; } else { docJSON.passwordHyperlink = ""; } } } docJSON.aliases = doc.aliases; var json = new JavaScriptSerializer().Serialize(docJSON); return(json); }
public static void addUserInfo(string firstName, string lastName) { using (var curDB = new HelpDesk_DB()) { var user = curDB.NetworkLogins.FirstOrDefault(p => p.ntID == userName); user.firstName = firstName; user.lastName = lastName; curDB.SaveChanges(); } }
protected void logUsage() { using (var curDB = new HelpDesk_DB()) { UsageLog log = new UsageLog(); log.searchDateTime = DateTime.Now; log.NTID_id = (int)Session["userID"]; curDB.UsageLogs.Add(log); curDB.SaveChanges(); } }
protected static void logUsage() { using (var curDB = new HelpDesk_DB()) { InfoGathLog log = new InfoGathLog(); log.NTID_id = userID; log.dateTime = DateTime.Now; log.InfoGathering_id = curDB.InfoGatherings.OrderByDescending(e => e.id).First().id; //Last Function not allowed curDB.InfoGathLogs.Add(log); curDB.SaveChanges(); } }
public static void addNewProblem(ProblemTracker record) { using (var curDb = new HelpDesk_DB()) { curDb.ProblemTrackers.Add(record); curDb.SaveChanges(); //rebuild problem list for find references ProblemList = curDb.ProblemTrackers.Where(p => p.ProblemStatus_id == 2).ToList(); } log(); }
protected static void log() { using (var curDB = new HelpDesk_DB()) { SDDocLog log = new SDDocLog(); log.NTID_id = UserID; log.dateTime = DateTime.Now; log.SDDocumentation_id = curDB.SDDocumentations.OrderByDescending(e => e.id).First().id; //Last Fn not allowed curDB.SDDocLogs.Add(log); curDB.SaveChanges(); } }
protected static void log() { using (var curDB = new HelpDesk_DB()) { ProbTrackLog log = new ProbTrackLog(); log.NTID_id = UserID; log.dateTime = DateTime.Now; log.Problemtracker_id = ProblemList.Last().id; curDB.ProbTrackLogs.Add(log); curDB.SaveChanges(); } }
public static List <string> getEmailTmeplates() { List <string> emailListJSON = new List <string>(); using (var curDB = new HelpDesk_DB()) { List <EmailTemplate> emailList = curDB.EmailTemplates.ToList(); foreach (EmailTemplate email in emailList) { emailListJSON.Add(convertSerializedJSON(email)); } } return(emailListJSON); }
public static List <string> getFacilities() { List <string> facilityListJSON = new List <string>(); using (var curDB = new HelpDesk_DB()) { List <PhoneNumber> facilitytList = curDB.PhoneNumbers.ToList(); foreach (PhoneNumber facility in facilitytList) { facilityListJSON.Add(convertSerializedJSON(facility)); } } return(facilityListJSON); }
public static List <string> getAbbreviations() { List <string> abbreviationListJSON = new List <string>(); using (var curDB = new HelpDesk_DB()) { List <Abbreviation> abbreviationList = curDB.Abbreviations.ToList(); foreach (Abbreviation curAbbreviation in abbreviationList) { abbreviationListJSON.Add(convertSerializedJSON(curAbbreviation)); } } return(abbreviationListJSON); }
public static List <string> getHelpfulHyperlinks() { List <string> hyperlinkListJSON = new List <string>(); using (var curDB = new HelpDesk_DB()) { List <HelpfulHyperlink> linkList = curDB.HelpfulHyperlinks.ToList(); foreach (HelpfulHyperlink link in linkList) { hyperlinkListJSON.Add(convertSerializedJSON(link)); } } return(hyperlinkListJSON); }
public static List <string> getCategoryList(string categoryTitle) { List <string> docListJSON = new List <string>(); using (var curDB = new HelpDesk_DB()) { int categoryNumber = curDB.LearningCenterCategories.SingleOrDefault(p => p.name == categoryTitle).id; List <SDDocumentation> docList = curDB.SDDocumentations.Where(p => p.LearningCenterCategory_id == categoryNumber).ToList(); foreach (SDDocumentation doc in docList) { docListJSON.Add(convertSerializedJSON(doc)); } } return(docListJSON); }
/// <summary> /// Checks for uniqueness of document link, adds new unique docs to the db. Returns id of doc link found in the db. /// </summary> /// <param name="docLink"></param> /// <returns></returns> public static int addDocumentLink(DocumentLink docLink) { using (var curDB = new HelpDesk_DB()) { //Check if db contains the link to retain uniqueness if (curDB.DocumentLinks.Where(p => p.link == docLink.link).SingleOrDefault() == null) { //Add New Link curDB.DocumentLinks.Add(docLink); curDB.SaveChanges(); } //TODO: Update document access if its changed return(curDB.DocumentLinks.SingleOrDefault(p => p.link == docLink.link).Id); } }
public static List <string> refreshProblemTables() { List <string> problemListJSON = new List <string>(); using (var curDB = new HelpDesk_DB()) { List <ProbTrackLog> recentLogList = curDB.ProbTrackLogs.Where(p => p.dateTime >= refreshTimeStamp).ToList(); foreach (ProbTrackLog log in recentLogList) { int problemID = log.Problemtracker_id; ProblemTracker problem = curDB.ProblemTrackers.First(p => p.id == problemID); problemListJSON.Add(convertSerializedJSON(problem)); } } //update refresh time refreshTimeStamp = DateTime.Now; return(problemListJSON); }
public static List <string> findCurrentProblems() { List <string> problemListJSON = new List <string>(); using (var curDB = new HelpDesk_DB()) { foreach (ProblemTracker problem in ProblemList) { //Downtime/Deg Condition if (problem.ProblemCondition_id == 1) { problemListJSON.Add(convertSerializedJSON(problem)); } //Known Downtime else if (problem.ProblemCondition_id == 2 && problem.plannedStartDateTime != null) { //Only Show Known Downtimes within 24 hour range DateTime startTime = (DateTime)problem.plannedStartDateTime; DateTime testMinusDay = startTime.AddDays(-1); Boolean testcondition1 = (testMinusDay < DateTime.Now); Boolean testcondition2 = (DateTime.Now < startTime); if (startTime.AddDays(-1) < DateTime.Now && DateTime.Now < startTime) { problemListJSON.Add(convertSerializedJSON(problem)); } } //Resolved/Normal Condition else if (problem.ProblemCondition_id == 3 && problem.endDateTime != null) { //Show All resolved problems until 24 hours after end time DateTime endTime = (DateTime)problem.endDateTime; if (DateTime.Now < endTime.AddDays(1)) { problemListJSON.Add(convertSerializedJSON(problem)); } } } } return(problemListJSON); }
/// <summary> /// Adds new SD Doc to db as well updates its original id /// </summary> /// <param name="index"></param> /// <returns></returns> /// public static void addSDDocumentation(SDDocumentation doc) { using (var curDB = new HelpDesk_DB()) { curDB.SDDocumentations.Add(doc); curDB.SaveChanges(); } using (var curDB = new HelpDesk_DB()) { //Update original id var originalDoc = curDB.SDDocumentations.Find(doc.id); if (originalDoc != null) { originalDoc.Original_id = doc.id; curDB.SaveChanges(); } //Rebuilds document list for find reference DocumentList = curDB.SDDocumentations.Where(p => p.Status_id == 2).OrderBy(p => p.alias).ToList(); } }
/// <summary> /// Input string of the link, checks db for uniqueness. /// If unique its added to DocumentLinks. /// Returns id of document link. /// returns -1 for null documents. /// </summary> /// <param name="linkTitle"></param> /// <returns></returns> public static int addDocumentLink(string linkString) { DocumentLink docLink = new DocumentLink(); docLink.link = linkString; docLink.Access_id = 2; //All Info Gath Docs are private using (var curDB = new HelpDesk_DB()) { //Check for uniqueness of link if (curDB.DocumentLinks.Where(p => p.link == linkString).SingleOrDefault() == null) { //Add new link to DB curDB.DocumentLinks.Add(docLink); curDB.SaveChanges(); } //TODO: Update document acess if its changed return(curDB.DocumentLinks.SingleOrDefault(p => p.link == docLink.link).Id); } }
public static void addNewInfoGathering(InfoGathering doc) { using (var curDB = new HelpDesk_DB()) { curDB.InfoGatherings.Add(doc); curDB.SaveChanges(); } //update original id using (var curDB = new HelpDesk_DB()) { var originalDoc = curDB.InfoGatherings.Find(doc.id); if (originalDoc != null) { originalDoc.Original_id = doc.id; curDB.SaveChanges(); } //Rebuild document list for find references InfoGathList = curDB.InfoGatherings.Where(p => p.Status_id == 2).OrderBy(p => p.searchableAlias).ToList(); } logUsage(); }
protected void Page_Load(object sender, EventArgs e) { HelpDesk_DB db = new HelpDesk_DB(); string findItem = ""; //Dymanically Build SD Documentation Table if (Request.QueryString["find"] != null) { findItem = Request.QueryString["find"].ToString(); //TODO: Parameterize Query List <SDDocumentation> docList = db.SDDocumentations.SqlQuery("SELECT * FROM SDDocumentation WHERE alias LIKE @p0 AND Status_id = '2'", "%" + findItem + "%").ToList(); foreach (SDDocumentation doc in docList) { TableRow row = new TableRow(); SDDocumentationTable.Rows.Add(row); //Document Hyperlink if (doc.DocumentLink_id != null) { DocumentLink docLink = db.DocumentLinks.FirstOrDefault(p => p.Id == doc.DocumentLink_id); this.addCell(row, doc.documentTitle, docLink.link); } else { //blank cell this.addCell(row, ""); } //Password Hyperlink if (doc.PasswordHyperlink_id != null) { DocumentLink passwordDocLink = db.DocumentLinks.FirstOrDefault(p => p.Id == doc.PasswordHyperlink_id); this.addCell(row, doc.passwordTitle, passwordDocLink.link); } else { //blank cell this.addCell(row, ""); } } List <InfoGathering> infoGathList = db.InfoGatherings.SqlQuery("SELECT * FROM InfoGathering WHERE searchableAlias LIKE @p0 AND Status_id = '2'", "%" + findItem + "%").ToList <InfoGathering>(); foreach (InfoGathering infoDoc in infoGathList) { TableRow row = new TableRow(); InfoGatheringTable.Rows.Add(row); DocumentLink docLink = db.DocumentLinks.FirstOrDefault(p => p.Id == infoDoc.infoGathLink_id); //Check for nulls even though there shouldn't be any if (docLink != null) { this.addCell(row, infoDoc.infoGathTitle, docLink.link); } else { this.addCell(row, "N/A"); } this.addCell(row, infoDoc.assignmentGroup); this.addCell(row, infoDoc.supportInfo); this.addCell(row, infoDoc.supportHours); this.addCell(row, infoDoc.contactInfo); this.addCell(row, infoDoc.passwordAttributes); DocumentLink pwLink = db.DocumentLinks.FirstOrDefault(p => p.Id == infoDoc.PasswordHyperlink_id); if (pwLink != null) { this.addCell(row, infoDoc.passwordTitle, pwLink.link); } else { this.addCell(row, "N/A"); } this.addCell(row, infoDoc.aliases); } } }
public static void updateDoc(sdDocJSON doc) { SDDocumentation newSDDoc = new SDDocumentation(); newSDDoc.Status_id = 2; using (var curDB = new HelpDesk_DB()) { SDDocumentation oldDoc = DocumentList[doc.index]; var originalDoc = curDB.SDDocumentations.Find(oldDoc.id); originalDoc.Status_id = 4; //Historic //Transfer persisting information to new document newSDDoc.LearningCenterCategory_id = oldDoc.LearningCenterCategory_id; newSDDoc.Original_id = oldDoc.Original_id; if (oldDoc.learningCenterOrder != null) { newSDDoc.learningCenterOrder = oldDoc.learningCenterOrder; } curDB.SaveChanges(); //Rebuilds document list for find reference DocumentList = curDB.SDDocumentations.Where(p => p.Status_id == 2).OrderBy(p => p.alias).ToList(); } DocumentLink pdfLink = new DocumentLink(); pdfLink.link = doc.documentLink; pdfLink.Access_id = doc.PDFaccess; //Check for null document links if (doc.documentLink != "") { newSDDoc.DocumentLink_id = addDocumentLink(pdfLink); } DocumentLink pwLink = new DocumentLink(); pwLink.link = doc.passwordHyperlink; pwLink.Access_id = doc.PWaccess; //check for null pw links if (doc.passwordHyperlink != "") { newSDDoc.PasswordHyperlink_id = addDocumentLink(pwLink); } newSDDoc.alias = doc.alias; newSDDoc.documentTitle = doc.documentTitle; newSDDoc.passwordTitle = doc.passwordTitle; using (var curDB = new HelpDesk_DB()) { curDB.SDDocumentations.Add(newSDDoc); curDB.SaveChanges(); //Rebuilds document list for find reference DocumentList = curDB.SDDocumentations.Where(p => p.Status_id == 2).OrderBy(p => p.alias).ToList(); } log(); }