예제 #1
0
        /// <summary>
        /// Get video questions and answers based on
        /// video ID.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="videoid">string</param>
        /// <param name="langid">string</param>
        /// <returns></returns>
        public string GetHelpVideos(string sessionKey, string videoid)
        {
            string retValue = string.Empty;
            int count = 0;
            List<HelpVideo> lstvideos = new List<HelpVideo>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();

            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetHelpVideos");

                    if (!string.IsNullOrEmpty(videoid)) { db.AddInParameter(dbCommand, "@VideoID", DbType.String, videoid); }
                    else { db.AddInParameter(dbCommand, "@VideoID", DbType.String, null); }

                    DataSet dsHelpContent = db.ExecuteDataSet(dbCommand);

                    if (dsHelpContent.Tables.Count > 0)
                    {
                        DataTable tHelpContent = dsHelpContent.Tables[0];

                        foreach (DataRow dr in tHelpContent.Rows)
                        {
                            HelpVideo video = new HelpVideo();
                            if (dr["HelpVideoID"] != DBNull.Value) { video.HelpVideoID = Int32.Parse(dr["HelpVideoID"].ToString()); }
                            if (dr["HelpModuleID"] != DBNull.Value) { video.HelpModuleID = Int32.Parse(dr["HelpModuleID"].ToString()); }
                            if (dr["HelpModuleName"] != DBNull.Value) { video.HelpModuleName = dr["HelpModuleName"].ToString(); }
                            if (dr["AudioURL"] != DBNull.Value) { video.AudioURL = dr["AudioURL"].ToString(); }
                            if (dr["VideoTitle"] != DBNull.Value) { video.VideoTitle = dr["VideoTitle"].ToString(); }
                            if (dr["VideoURL"] != DBNull.Value) { video.VideoURL = dr["VideoURL"].ToString(); }
                            lstvideos.Add(video);
                            count++;
                        }
                    }
                    responseObject.ResultObjectJSON = Serializer.ObjectToJSON(lstvideos);
                    responseObject.ResultCode = "SUCCESS";
                    responseObject.ResultObjectRecordCount = count;
                    if (responseObject.ResultObjectRecordCount <= 0) { responseObject.ResultMessage = "No records found."; }
                }
                catch (Exception ex)
                {
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetQuestions", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return Serializer.ObjectToJSON(responseObject);
        }
예제 #2
0
        /// <summary>
        /// Get All or specific Help Content 
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="helpcontentid">string</param>
        /// <returns>string</returns>
        public string GetHelpContent(string sessionKey, string helpsubjectid, string helpcontentid)
        {
            string retValue = string.Empty;
            int count = 0;
            ContentObject contentobject = new ContentObject();
            List<HelpContent> lsthelpcontent = new List<HelpContent>();
            List<HelpSubject> lsthelpsubject = new List<HelpSubject>();
            List<HelpVideo> lsthelpvideo = new List<HelpVideo>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();

            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetHelpContent");

                    if (!string.IsNullOrEmpty(helpsubjectid)) { db.AddInParameter(dbCommand, "@HelpSubjectID", DbType.String, helpsubjectid); }
                    else { db.AddInParameter(dbCommand, "@HelpSubjectID", DbType.String, null); }

                    if (!string.IsNullOrEmpty(helpcontentid)) { db.AddInParameter(dbCommand, "@HelpContentID", DbType.String, helpcontentid); }
                    else { db.AddInParameter(dbCommand, "@HelpContentID", DbType.String, null); }

                    DataSet dsHelpContent = db.ExecuteDataSet(dbCommand);

                    if (dsHelpContent.Tables.Count > 0)
                    {
                        DataTable tHelpContent = dsHelpContent.Tables[0];

                        foreach (DataRow dr in tHelpContent.Rows)
                        {
                            HelpSubject helpsubject = new HelpSubject();
                            if (dr["HelpSubjectID"] != DBNull.Value) { helpsubject.HelpSubjectID = Int32.Parse(dr["HelpSubjectID"].ToString()); }
                            if (dr["Title"] != DBNull.Value) { helpsubject.Title = dr["Title"].ToString(); }
                            if (dr["AudioURL"] != DBNull.Value) { helpsubject.AudioURL = dr["AudioURL"].ToString(); }
                            lsthelpsubject.Add(helpsubject);
                            count++;
                        }
                        contentobject.HelpSubjects = lsthelpsubject;
                    }
                    if (dsHelpContent.Tables.Count > 1)
                    {
                        DataTable tHelpContent = dsHelpContent.Tables[1];

                        foreach (DataRow dr in tHelpContent.Rows)
                        {
                            HelpContent helpcontent = new HelpContent();
                            if (dr["HelpContentID"] != DBNull.Value) { helpcontent.HelpContentID = Int32.Parse(dr["HelpContentID"].ToString()); }
                            if (dr["HelpSubjectID"] != DBNull.Value) { helpcontent.HelpSubjectID = Int32.Parse(dr["HelpSubjectID"].ToString()); }
                            if (dr["HelpContentTitle"] != DBNull.Value) { helpcontent.HelpContentTitle = dr["HelpContentTitle"].ToString(); }
                            if (dr["TitleAudioURL"] != DBNull.Value) { helpcontent.TitleAudioURL = dr["TitleAudioURL"].ToString(); }
                            if (dr["HTMLContent"] != DBNull.Value) { helpcontent.HTMLContent = dr["HTMLContent"].ToString(); }
                            if (dr["HTMLContentAudioURL"] != DBNull.Value) { helpcontent.HTMLContentAudioURL = dr["HTMLContentAudioURL"].ToString(); }
                            lsthelpcontent.Add(helpcontent);
                        }
                        contentobject.HelpContents = lsthelpcontent;
                    }
                    if (dsHelpContent.Tables.Count > 2)
                    {
                        DataTable tHelpVideo = dsHelpContent.Tables[2];

                        foreach (DataRow dr in tHelpVideo.Rows)
                        {
                            HelpVideo helpvideo = new HelpVideo();
                            if (dr["HelpVideoID"] != DBNull.Value) { helpvideo.HelpVideoID = Int32.Parse(dr["HelpVideoID"].ToString()); }
                            //if (dr["HelpContentID"] != DBNull.Value) { helpvideo.HelpContentID = Int32.Parse(dr["HelpContentID"].ToString()); }
                            if (dr["VideoURL"] != DBNull.Value) { helpvideo.VideoURL = dr["VideoURL"].ToString(); }
                            lsthelpvideo.Add(helpvideo);
                        }
                        contentobject.HelpVideos = lsthelpvideo;
                    }
                    responseObject.ResultObjectJSON = Serializer.ObjectToJSON(contentobject);
                    responseObject.ResultCode = "SUCCESS";
                    responseObject.ResultObjectRecordCount = count;
                    if (responseObject.ResultObjectRecordCount <= 0) { responseObject.ResultMessage = "No records found."; }
                }
                catch (Exception ex)
                {
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetHelpContent", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return Serializer.ObjectToJSON(contentobject);
        }