Beispiel #1
0
        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 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 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 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 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();
        }
Beispiel #7
0
        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();
            }
        }
Beispiel #8
0
        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();
            }
        }
Beispiel #9
0
        /// <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);
            }
        }
Beispiel #10
0
        /// <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();
            }
        }
Beispiel #11
0
        /// <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);
            }
        }
Beispiel #12
0
        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();
        }
Beispiel #13
0
        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();
        }