public void ProcessRequest(HttpContext context)
        {
            string response = "";
               string functionCall = "";
               string callback = "";
               ResponseObjectForAnything obj = new ResponseObjectForAnything();
               List<SteviArt.Common.DTO.File> lstuploadfile = new List<File>();

            if (context.Request.QueryString != null)
            {
                if (context.Request.QueryString["func"] != null)
                    functionCall = context.Request.QueryString["func"].ToLower();
                else
                {
                    response = "Error! Function Call ('func=...') parameter was not provided.";
                    goto WriteResponse;
                }
                 //assign the local variable for the callback param...
                callback = context.Request.QueryString["callback"];
                //we use this in some of the calls...
                String ThisCallersIPaddress = "127.0.0.1";
                if (context.Request.ServerVariables["remote_addr"] != null)
                {
                    ThisCallersIPaddress = context.Request.ServerVariables["remote_addr"].ToString();
                }

                switch (functionCall)
                {
                    case "uploadfile":
                        if (context.Request.Files.Count > 0)
                        {
                            HttpFileCollection files = context.Request.Files;
                            string[] uplaodedfiles = new string[files.Count];
                            for (int i = 0; i < files.Count; i++)
                            {
                                File uploadedfile = new File();
                                HttpPostedFile file = files[i];
                                string fname;
                                if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE" || HttpContext.Current.Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
                                {
                                    string[] testfiles = file.FileName.Split(new char[] { '\\' });
                                    fname = testfiles[testfiles.Length - 1];
                                }
                                else
                                {
                                    fname = file.FileName;
                                }
                                fname=System.IO.Path.Combine(context.Server.MapPath("~/uploads/"), fname);
                                file.SaveAs(fname);
                                uploadedfile.FilePath = fname;
                                lstuploadfile.Add(uploadedfile);
                            }
                        }
                        context.Response.ContentType = "text/plain";
                        obj.ResultCode = "SUCCESS";
                        response = SteviArt.Common.Utilities.Serializer.ObjectToJSON(lstuploadfile);
                        break;
                }
            }

            WriteResponse:

            if (context.Request.QueryString["callback"] != null)
            {
            context.Response.Write(callback.ToString() + "(" + response + ")");
            }
            else
            {
            context.Response.Write(response);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get department list.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="departmentid">string</param>
        /// <returns>string</returns>
        public string GetPrivateProject(string sessionKey, string privateprojectid, string approvalstatusid)
        {
            string retValue = string.Empty;
            List<PrivateProject> lstdepartment = new List<PrivateProject>();
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            int count = 0;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetPrivateProject");
                    if (!string.IsNullOrEmpty(privateprojectid)) { db.AddInParameter(dbCommand, "@PrivateProjectID", DbType.Int32, Int32.Parse(privateprojectid)); }
                    else { db.AddInParameter(dbCommand, "@PrivateProjectID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(approvalstatusid)) { db.AddInParameter(dbCommand, "@ApprovalStatusID", DbType.Int32, Int32.Parse(approvalstatusid)); }
                    else { db.AddInParameter(dbCommand, "@ApprovalStatusID", DbType.Int32, null); }

                    DataSet dsStates = db.ExecuteDataSet(dbCommand);

                    if (dsStates.Tables.Count > 0)
                    {
                        DataTable tState = dsStates.Tables[0];

                        foreach (DataRow dr in tState.Rows)
                        {
                            PrivateProject department = new PrivateProject();
                            if (dr["PrivateProjectID"] != DBNull.Value) { department.PrivateProjectID = Int32.Parse(dr["PrivateProjectID"].ToString()); }
                            if (dr["PersonID"] != DBNull.Value) { department.PersonID = Int32.Parse(dr["PersonID"].ToString()); }
                            if (dr["ApprovalStatusID"] != DBNull.Value) { department.ApprovalStatusID = Int32.Parse(dr["ApprovalStatusID"].ToString()); }
                            if (dr["ApprovalStatusName"] != DBNull.Value) { department.ApprovalStatusName = dr["ApprovalStatusName"].ToString(); }
                            if (dr["VideoFileName"] != DBNull.Value) { department.VideoFileName = dr["VideoFileName"].ToString(); }
                            if (dr["PhotoURL"] != DBNull.Value) { department.PhotoURL = dr["PhotoURL"].ToString(); }
                            if (dr["CreatedDate"] != DBNull.Value) { department.CreatedDate = Convert.ToDateTime(dr["CreatedDate"].ToString()); }
                            if (dr["IsEnabled"] != DBNull.Value) { department.IsEnabled = Convert.ToBoolean(dr["IsEnabled"].ToString()); }
                            lstdepartment.Add(department);
                            count++;
                        }
                        obj.ResultObjectJSON = Serializer.ObjectToJSON(lstdepartment);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultObjectRecordCount = count;
                        if (obj.ResultObjectRecordCount <= 0) { obj.ResultMessage = "No records found."; }
                    }
                }
                catch (Exception ex)
                {
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetDepartments", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return Serializer.ObjectToJSON(obj);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        /// <summary>
        /// This method creates the session for logged in user
        /// and returns all information needed to show on app
        /// and website landing page.
        /// </summary>
        /// <param name="userName">string</param>
        /// <param name="password">string</param>
        /// <param name="deviceToken">string</param>
        /// <returns>SessionResponseObject</returns>
        public string CreateSession(string emailID, string password, string deviceToken)
        {
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            SessionResponseObject sessionObject = new SessionResponseObject();
            int count = 0;

            try
            {
                Database db = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = db.GetStoredProcCommand("usp_CreateSession");
                db.AddInParameter(dbCommand, "@Username", DbType.String, emailID);
                string password1 = BitConverter.ToString(SHA1.Create().ComputeHash(Encoding.Default.GetBytes(password + ""))).Replace("-", "");
                db.AddInParameter(dbCommand, "@Password", DbType.String, BitConverter.ToString(SHA1.Create().ComputeHash(Encoding.Default.GetBytes(password + ""))).Replace("-", ""));
                db.AddInParameter(dbCommand, "@DeviceToken", DbType.String, deviceToken);

                DataSet dsAuth = db.ExecuteDataSet(dbCommand);

                if (dsAuth.Tables.Count > 0)
                {
                    DataTable tUser = dsAuth.Tables[0];
                    Session session = new Session();
                    if (tUser.Rows.Count > 0)
                    {
                        if (tUser.Rows[0]["SessionKey"] != DBNull.Value) { session.SessionKey = tUser.Rows[0]["SessionKey"].ToString(); }
                        if (tUser.Rows[0]["SessionID"] != DBNull.Value) { session.ID = Int32.Parse(tUser.Rows[0]["SessionID"].ToString()); }
                        count++;
                    }
                    sessionObject.session = session;
                }

                if (dsAuth.Tables.Count > 1)
                {
                    DataTable tUser = dsAuth.Tables[1];
                    Person person = new Person();
                    if (tUser.Rows.Count > 0)
                    {
                        if (tUser.Rows[0]["PersonID"] != DBNull.Value) { person.PersonID = Int32.Parse(tUser.Rows[0]["PersonID"].ToString()); }
                        if (tUser.Rows[0]["PersonTypeID"] != DBNull.Value) { person.PersonTypeID = Int32.Parse(tUser.Rows[0]["PersonTypeID"].ToString()); }
                        if (tUser.Rows[0]["PreferredLanguageID"] != DBNull.Value) { person.PreferredLanguageID = Int32.Parse(tUser.Rows[0]["PreferredLanguageID"].ToString()); }
                        if (tUser.Rows[0]["FirstName"] != DBNull.Value) { person.FirstName = tUser.Rows[0]["FirstName"].ToString(); }
                        if (tUser.Rows[0]["LastName"] != DBNull.Value) { person.LastName = tUser.Rows[0]["LastName"].ToString(); }
                        if (tUser.Rows[0]["Username"] != DBNull.Value) { person.Username = tUser.Rows[0]["Username"].ToString(); }
                        if (tUser.Rows[0]["ProfilePicPath"] != DBNull.Value) { person.ProfilePicPath = tUser.Rows[0]["ProfilePicPath"].ToString(); }
                        if (tUser.Rows[0]["Email"] != DBNull.Value) { person.Email = tUser.Rows[0]["Email"].ToString(); }
                    }
                    sessionObject.person = person;
                }
                string sessionresponse = Serializer.ObjectToJSON(sessionObject);
                responseObject.ResultObjectJSON = sessionresponse;
                responseObject.ResultCode = "SUCCESS";
                responseObject.ResultObjectRecordCount = count;
                if (responseObject.ResultObjectRecordCount == 0) { responseObject.ResultMessage = "Invalid Email Id or Password"; }
            }
            catch (Exception exception)
            {
                sessionObject.ResultCode = "ERROR";
                sessionObject.ResultMessage = "Invalid Email Id or Password";
                CustomException exc = new CustomException(exception.ToString(), this.ToString(), "CreateSession", System.DateTime.Now);
                ExceptionManager.PublishException(exc);
            }
            return Serializer.ObjectToJSON(responseObject);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Get country list.
        /// </summary>
        /// <returns></returns>
        public string GetCountries()
        {
            string retValue = string.Empty;
            List<Country> lstcountry = new List<Country>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            int count = 0;
            try
            {
                Database db = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = db.GetStoredProcCommand("usp_GetCountries");

                DataSet dsCountries = db.ExecuteDataSet(dbCommand);

                if (dsCountries.Tables.Count > 0)
                {
                    DataTable tCountry = dsCountries.Tables[0];

                    foreach (DataRow dr in tCountry.Rows)
                    {
                        Country country = new Country();
                        if (dr["CountryID"] != DBNull.Value) { country.CountryID = Int32.Parse(dr["CountryID"].ToString()); }
                        if (dr["CountryName"] != DBNull.Value) { country.CountryName = dr["CountryName"].ToString(); }
                        lstcountry.Add(country);
                        count++;
                    }
                    responseObject.ResultCode = "SUCCESS";
                    responseObject.ResultObjectJSON = Serializer.ObjectToJSON(lstcountry);
                    responseObject.ResultObjectRecordCount = count;
                    if (responseObject.ResultObjectRecordCount == 0) { responseObject.ResultMessage = "No records found"; }
                }
            }
            catch (Exception ex)
            {
                CustomException exc = new CustomException(ex.ToString(), this.ToString(), "IsValidSession", System.DateTime.Now);
                ExceptionManager.PublishException(exc);
            }
            return Serializer.ObjectToJSON(responseObject);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Get session key by email ID
        /// </summary>
        /// <param name="emailID">string</param>
        /// <returns>string</returns>
        public ResponseObjectForAnything GetUserFromSession(string sessionKey)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            bool isValid = true;
            List<Person> lstPerson = new List<Person>();
            int count = 0;

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetUserFromSession");
                    db.AddInParameter(dbCommand, "@SessionKey", DbType.String, sessionKey);

                    DataSet dsPerson = db.ExecuteDataSet(dbCommand);
                    if (dsPerson.Tables.Count > 0)
                    {
                        DataTable tPerson = dsPerson.Tables[0];
                        foreach (DataRow dr in tPerson.Rows)
                        {
                            Person person = new Person();
                            if (dr["PersonID"] != DBNull.Value) { person.PersonID = Int32.Parse(dr["PersonID"].ToString()); }
                            if (dr["PersonTypeID"] != DBNull.Value) { person.PersonTypeID = Int32.Parse(dr["PersonTypeID"].ToString()); }
                            if (dr["PreferredLanguageID"] != DBNull.Value) { person.PreferredLanguageID = Int32.Parse(dr["PreferredLanguageID"].ToString()); }
                            if (dr["FirstName"] != DBNull.Value) { person.FirstName = dr["FirstName"].ToString(); }
                            if (dr["LastName"] != DBNull.Value) { person.LastName = dr["LastName"].ToString(); }
                            if (dr["Username"] != DBNull.Value) { person.Username = dr["Username"].ToString(); }
                            if (dr["Email"] != DBNull.Value) { person.Email = dr["Email"].ToString(); }
                            if (dr["CountryID"] != DBNull.Value) { person.CountryID = Int32.Parse(dr["CountryID"].ToString()); }
                            if (dr["StateID"] != DBNull.Value) { person.StateID = Int32.Parse(dr["StateID"].ToString()); }
                            if (dr["ProfilePicPath"] != DBNull.Value) { person.ProfilePicPath = dr["ProfilePicPath"].ToString(); }
                            if (dr["PersonGroupID"] != DBNull.Value) { person.PersonGroupID = Int32.Parse(dr["PersonGroupID"].ToString()); }
                            if (dr["GroupName"] != DBNull.Value) { person.GroupName = dr["GroupName"].ToString(); }
                            if (dr["PersonType"] != DBNull.Value) { person.PersonType = dr["PersonType"].ToString(); }
                            if (dr["PointsEarned"] != DBNull.Value) { person.PointsEarned = Int32.Parse(dr["PointsEarned"].ToString()); }
                            if (dr["AvgFeedback"] != DBNull.Value) { person.AvgFeedback = Convert.ToDecimal(dr["AvgFeedback"].ToString()); }
                            lstPerson.Add(person);
                            count++;
                        }
                    }
                    obj.ResultCode = "SUCCESS";
                    obj.ResultObjectJSON = Serializer.ObjectToJSON(lstPerson);
                    obj.ResultObjectRecordCount = count;
                    if (obj.ResultObjectRecordCount == 0) { obj.ResultMessage = "Invalid session."; }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetUserFromSession", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return obj;
        }
Exemplo n.º 8
0
        /// <summary>
        /// This method is used to save groups.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="groupid">string</param>
        /// <param name="langid">string</param>
        /// <param name="title">string</param>
        /// <param name="audiofilePath">string</param>
        /// <param name="isEdit">string</param>
        /// <returns>string</returns>
        public string SaveTrainingVideo(string sessionKey, string videoid, string subjectid, string langid, string title, string videofilePath, string pointsearned, string audiourl)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SaveVideo");
                    if (videoid != "0") { db.AddInParameter(dbCommand, "@VideoID", DbType.Int32, Int32.Parse(videoid)); }
                    else { db.AddInParameter(dbCommand, "@VideoID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(subjectid)) { db.AddInParameter(dbCommand, "@SubjectID", DbType.Int32, Int32.Parse(subjectid)); }
                    else { db.AddInParameter(dbCommand, "@SubjectID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(langid)) { db.AddInParameter(dbCommand, "@LangID", DbType.Int32, Int32.Parse(langid)); }
                    else { db.AddInParameter(dbCommand, "@LangID", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@Title", DbType.String, title);
                    db.AddInParameter(dbCommand, "@VideoURL", DbType.String, videofilePath);
                    db.AddInParameter(dbCommand, "@PointsEarned", DbType.Int32, Int32.Parse(pointsearned));
                    db.AddInParameter(dbCommand, "@AudioURL", DbType.String, audiourl);

                    if (videoid == "0")
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                            obj.ResultCode = "SUCCESS";
                        else
                            obj.ResultCode = "ERROR";
                        obj.ResultObjectID = pId;
                        obj.ResultObjectRecordCount = pId;
                        if (obj.ResultObjectRecordCount <= 0) { obj.ResultMessage = "Unable to save training video."; }
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message;
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SaveGroups", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Get task types.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="taskid">string</param>
        /// <returns>string</returns>
        public string GetTaskType(string sessionKey, string taskypeid)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            bool isValid = true;
            List<TaskType> lsttasktypes = new List<TaskType>();
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }
            int count = 0;
            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetTaskType");
                    if (!string.IsNullOrEmpty(taskypeid)) { db.AddInParameter(dbCommand, "@TaskTypeID", DbType.Int32, Int32.Parse(taskypeid)); }
                    else { db.AddInParameter(dbCommand, "@TaskTypeID", DbType.Int32, null); }

                    DataSet dsTaskType = db.ExecuteDataSet(dbCommand);
                    if(dsTaskType.Tables.Count > 0)
                    {
                        DataTable tTaskType = dsTaskType.Tables[0];
                        foreach(DataRow dr in tTaskType.Rows)
                        {
                            TaskType tasktype = new TaskType();
                            if (dr["TaskTypeID"] != DBNull.Value) { tasktype.TaskTypeID = Int32.Parse(dr["TaskTypeID"].ToString()); }
                            if (dr["langid"] != DBNull.Value) { tasktype.langid = Int32.Parse(dr["langid"].ToString()); }
                            if (dr["PointsEarned"] != DBNull.Value) { tasktype.PointsEarned = Int32.Parse(dr["PointsEarned"].ToString()); }
                            if (dr["Title"] != DBNull.Value) { tasktype.Title = dr["Title"].ToString(); }
                            if (dr["IconURL"] != DBNull.Value) { tasktype.IconURL = dr["IconURL"].ToString(); }
                            if (dr["AudioURL"] != DBNull.Value) { tasktype.AudioURL = dr["AudioURL"].ToString(); }
                            if (dr["MinQuota"] != DBNull.Value) { tasktype.MinQuota = Int32.Parse(dr["MinQuota"].ToString()); }
                            lsttasktypes.Add(tasktype);
                            count++;
                        }
                    }
                    obj.ResultObjectJSON = Serializer.ObjectToJSON(lsttasktypes);
                    obj.ResultCode = "SUCCESS";
                    obj.ResultObjectRecordCount = count;
                    if (obj.ResultObjectRecordCount <= 0) { obj.ResultMessage = "No records found."; }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetTaskType", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Delete tasks.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="taskid">string</param>
        /// <returns>string</returns>
        public string GetTrainingVideos(string sessionKey, string videoid, string subjectid)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            int count = 0;
            bool isValid = true;
            List<SteviArt.Common.DTO.TrainingVideo> lsttasks = new List<SteviArt.Common.DTO.TrainingVideo>();
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

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

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

                    DataSet dsTask = db.ExecuteDataSet(dbCommand);
                    if (dsTask.Tables.Count > 0)
                    {
                        DataTable tTask = dsTask.Tables[0];
                        foreach (DataRow dr in tTask.Rows)
                        {
                            SteviArt.Common.DTO.TrainingVideo task = new SteviArt.Common.DTO.TrainingVideo();
                            if (dr["TrainingVideoID"] != DBNull.Value) { task.TrainingVideoID = Int32.Parse(dr["TrainingVideoID"].ToString()); }
                            if (dr["SubjectID"] != DBNull.Value) { task.SubjectID = Int32.Parse(dr["SubjectID"].ToString()); }
                            if (dr["langid"] != DBNull.Value) { task.langid = Int32.Parse(dr["langid"].ToString()); }
                            if (dr["VideoTitle"] != DBNull.Value) { task.VideoTitle = dr["VideoTitle"].ToString(); }
                            if (dr["VideoURL"] != DBNull.Value) { task.VideoURL = dr["VideoURL"].ToString(); }
                            if (dr["PointsEarned"] != DBNull.Value) { task.PointsEarned = Int32.Parse(dr["PointsEarned"].ToString()); }
                            if (dr["AudioURL"] != DBNull.Value) { task.AudioURL = dr["AudioURL"].ToString(); }
                            lsttasks.Add(task);
                            count++;
                        }
                    }
                    obj.ResultCode = "SUCCESS";
                    obj.ResultObjectJSON = Serializer.ObjectToJSON(lsttasks);
                    obj.ResultObjectRecordCount = count;
                    if (obj.ResultObjectRecordCount == 0) { obj.ResultMessage = "No records found."; }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetTask", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Delete tasks.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="taskid">string</param>
        /// <returns>string</returns>
        public string GetTask(string sessionKey, string personid, string taskid, string duedate, string tasktypeid)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            int count = 0;
            bool isValid = true;
            List<SteviArt.Common.DTO.Task> lsttasks = new List<SteviArt.Common.DTO.Task>();
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }
            //ResponseObjectForAnything responseObject = GetUserFromSession(sessionKey);

            //List<Person> person = (List<Person>)Serializer.JSONStringToObject<List<Person>>(responseObject.ResultObjectJSON);

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

                    if (!string.IsNullOrEmpty(personid)) { db.AddInParameter(dbCommand, "@TaskID", DbType.Int32, Int32.Parse(taskid)); }
                    else { db.AddInParameter(dbCommand, "@TaskID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(personid)) { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, personid); }
                    else { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(duedate)) { db.AddInParameter(dbCommand, "@DueDate", DbType.DateTime, Convert.ToDateTime(duedate)); }
                    else { db.AddInParameter(dbCommand, "@DueDate", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(tasktypeid)) { db.AddInParameter(dbCommand, "@TaskTypeID", DbType.Int32, Int32.Parse(tasktypeid)); }
                    else { db.AddInParameter(dbCommand, "@TaskTypeID", DbType.Int32, null); }
                    DataSet dsTask = db.ExecuteDataSet(dbCommand);
                    if (dsTask.Tables.Count > 0)
                    {
                        DataTable tTask = new DataTable();
                        foreach (DataRow dr in tTask.Rows)
                        {
                            SteviArt.Common.DTO.Task task = new SteviArt.Common.DTO.Task();
                            if (dr["TaskID"] != DBNull.Value) { task.TaskID = Int32.Parse(dr["TaskID"].ToString()); }
                            if (dr["TaskTypeID"] != DBNull.Value) { task.TaskTypeID = Int32.Parse(dr["TaskTypeID"].ToString()); }
                            if (dr["langid"] != DBNull.Value) { task.langid = Int32.Parse(dr["langid"].ToString()); }
                            if (dr["IsCompleted"] != DBNull.Value) { task.IsCompleted = Convert.ToBoolean(dr["IsCompleted"].ToString()); }
                            if (dr["LastCompletionDate"] != DBNull.Value) { task.LastCompletionDate = Convert.ToDateTime(dr["LastCompletionDate"].ToString()); }
                            if (dr["DueDate"] != DBNull.Value) { task.DueDate = Convert.ToDateTime(dr["DueDate"].ToString()); }
                            if (dr["CreatedDate"] != DBNull.Value) { task.CreatedDate = Convert.ToDateTime(dr["CreatedDate"].ToString()); }
                            if (dr["Title"] != DBNull.Value) { task.Title = dr["Title"].ToString(); }
                            if (dr["AssignedToPersonID"] != DBNull.Value) { task.AssignedToPersonID = Int32.Parse(dr["AssignedToPersonID"].ToString()); }
                            if (dr["PercentComplete"] != DBNull.Value) { task.PercentComplete = Convert.ToDecimal(dr["PercentComplete"].ToString()); }
                            if (dr["AudioURL"] != DBNull.Value) { task.AudioURL = dr["AudioURL"].ToString(); }
                            lsttasks.Add(task);
                            count++;
                        }
                    }
                    obj.ResultCode = "SUCCESS";
                    obj.ResultObjectJSON = Serializer.ObjectToJSON(lsttasks);
                    obj.ResultObjectRecordCount = count;
                    if (obj.ResultObjectRecordCount == 0) { obj.ResultMessage = "No records found."; }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetTask", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Get department list.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="subjectid">string</param>
        /// <returns>string</returns>
        public string GetSubjects(string sessionKey, string subjectid)
        {
            string retValue = string.Empty;
            List<HelpSubject> lstdepartment = new List<HelpSubject>();
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            int count = 0;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetHelpSubject");
                    if (!string.IsNullOrEmpty(subjectid)) { db.AddInParameter(dbCommand, "@SubjectID", DbType.Int32, Convert.ToInt32(subjectid)); }
                    else { db.AddInParameter(dbCommand, "@SubjectID", DbType.Int32, null); }

                    DataSet dsStates = db.ExecuteDataSet(dbCommand);

                    if (dsStates.Tables.Count > 0)
                    {
                        DataTable tState = dsStates.Tables[0];

                        foreach (DataRow dr in tState.Rows)
                        {
                            HelpSubject subject = new HelpSubject();
                            if (dr["HelpSubjectID"] != DBNull.Value) { subject.HelpSubjectID = Int32.Parse(dr["HelpSubjectID"].ToString()); }
                            if (dr["langid"] != DBNull.Value) { subject.langid = Int32.Parse(dr["langid"].ToString()); }
                            if (dr["Title"] != DBNull.Value) { subject.Title = dr["Title"].ToString(); }
                            if (dr["AudioURL"] != DBNull.Value) { subject.AudioURL = dr["AudioURL"].ToString(); }
                            if (dr["alias"] != DBNull.Value) { subject.alias = dr["alias"].ToString(); }
                            if (dr["IconURL"] != DBNull.Value) { subject.IconURL = dr["IconURL"].ToString(); }
                            lstdepartment.Add(subject);
                            count++;
                        }
                        obj.ResultObjectJSON = Serializer.ObjectToJSON(lstdepartment);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultObjectRecordCount = count;
                        if (obj.ResultObjectRecordCount <= 0) { obj.ResultMessage = "No records found."; }
                    }
                }
                catch (Exception ex)
                {
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "GetDepartments", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return Serializer.ObjectToJSON(obj);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Get state list.
        /// </summary>
        /// <returns></returns>
        public string GetStates(string countryid)
        {
            string retValue = string.Empty;
            List<State> lststate = new List<State>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            int count = 0;
            try
            {
                Database db = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = db.GetStoredProcCommand("usp_GetStates");
                db.AddInParameter(dbCommand, "@CountryID", DbType.Int32, Int32.Parse(countryid));

                DataSet dsStates = db.ExecuteDataSet(dbCommand);

                if (dsStates.Tables.Count > 0)
                {
                    DataTable tState = dsStates.Tables[0];

                    foreach (DataRow dr in tState.Rows)
                    {
                        State state = new State();
                        if (dr["StateID"] != DBNull.Value) { state.StateID = Int32.Parse(dr["StateID"].ToString()); }
                        if (dr["StateName"] != DBNull.Value) { state.StateName = dr["StateName"].ToString(); }
                        lststate.Add(state);
                        count++;
                    }
                }
                responseObject.ResultObjectJSON = Serializer.ObjectToJSON(lststate);
                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(), "GetStates", System.DateTime.Now);
                ExceptionManager.PublishException(exc);
            }
            return Serializer.ObjectToJSON(responseObject);
        }
Exemplo n.º 14
0
        /// <summary>
        /// save tasks
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <param name="helpcotentid"></param>
        /// <param name="subjectid"></param>
        /// <param name="langid"></param>
        /// <param name="title"></param>
        /// <param name="htmlcontent"></param>
        /// <param name="audioURL"></param>
        /// <returns></returns>
        public string SaveTask(string sessionKey, string taskid, string tasktypeid, string iscompleted, string lastcompletiondate, string duedate, string assignedtopersonid,
                               string isnotifiedafterassigned, string assignedbypersonid, string percentcomplete, string langid, string title, string audiourl, string numbercompleted)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SaveTask");
                    if (!string.IsNullOrEmpty(taskid)) { db.AddInParameter(dbCommand, "@TaskID", DbType.Int32, Int32.Parse(taskid)); }
                    else { db.AddInParameter(dbCommand, "@TaskID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(tasktypeid)) { db.AddInParameter(dbCommand, "@TaskTypeID", DbType.Int32, Int32.Parse(tasktypeid)); }
                    else { db.AddInParameter(dbCommand, "@TaskTypeID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(iscompleted)) { db.AddInParameter(dbCommand, "@IsCompleted", DbType.Boolean, Convert.ToBoolean(iscompleted)); }
                    else { db.AddInParameter(dbCommand, "@IsCompleted", DbType.Boolean, null); }
                    if (!string.IsNullOrEmpty(lastcompletiondate)) { db.AddInParameter(dbCommand, "@LastCompletionDate", DbType.DateTime, DateTime.ParseExact(lastcompletiondate,"yyyy-MM-dd", DateTimeFormatInfo.CurrentInfo)); }
                    else { db.AddInParameter(dbCommand, "@LastCompletionDate", DbType.DateTime, null); }
                    if (!string.IsNullOrEmpty(duedate)) { db.AddInParameter(dbCommand, "@DueDate", DbType.DateTime, Convert.ToDateTime(duedate)); }
                    else { db.AddInParameter(dbCommand, "@DueDate", DbType.DateTime, null); }

                    if (!string.IsNullOrEmpty(assignedtopersonid)) { db.AddInParameter(dbCommand, "@AssignedToPersonID", DbType.Int32, Int32.Parse(assignedtopersonid)); }
                    else { db.AddInParameter(dbCommand, "@AssignedToPersonID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(isnotifiedafterassigned)) { db.AddInParameter(dbCommand, "@IsNotifiedAfterAssigned", DbType.Boolean, Convert.ToBoolean(isnotifiedafterassigned)); }
                    else { db.AddInParameter(dbCommand, "@IsNotifiedAfterAssigned", DbType.Boolean, false); }
                    if (!string.IsNullOrEmpty(assignedbypersonid)) { db.AddInParameter(dbCommand, "@AssignedByPersonID", DbType.Int32, Int32.Parse(assignedbypersonid)); }
                    else { db.AddInParameter(dbCommand, "@AssignedByPersonID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(numbercompleted)) { db.AddInParameter(dbCommand, "@NumberCompleted", DbType.Int32, Int32.Parse(numbercompleted)); }
                    else { db.AddInParameter(dbCommand, "@NumberCompleted", DbType.Boolean, 0); }
                    if (!string.IsNullOrEmpty(langid)) { db.AddInParameter(dbCommand, "@langid", DbType.Int32, Int32.Parse(langid)); }
                    else { db.AddInParameter(dbCommand, "@langid", DbType.Boolean, null); }

                    db.AddInParameter(dbCommand, "@Title", DbType.String, title);
                    db.AddInParameter(dbCommand, "@AudioURL", DbType.String, audiourl);

                    if (taskid == null)
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                        {
                            obj.ResultCode = "SUCCESS";
                            obj.ResultMessage = "Task has been saved successfully.";
                        }
                        else
                            obj.ResultCode = "ERROR";
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultMessage = "Task has been saved successfully.";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SaveGroups", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Assign videos to contents
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="helpcontentid">string</param>
        /// <param name="videoid">string</param>
        /// <param name="videourl">string</param>
        /// <returns>string</returns>
        public string SaveContentVideo(string sessionKey, string helpcontentid, string videoid, string videourl)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SaveContentVideo");
                    if (!string.IsNullOrEmpty(helpcontentid)) { db.AddInParameter(dbCommand, "@HelpContentID", DbType.Int32, Int32.Parse(helpcontentid)); }
                    else { db.AddInParameter(dbCommand, "@HelpContentID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(videoid)) { db.AddInParameter(dbCommand, "@VideoID", DbType.Int32, Int32.Parse(videoid)); }
                    else { db.AddInParameter(dbCommand, "@SubjectID", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@VideoURL", DbType.String, videourl);

                    if (helpcontentid == null)
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                        {
                            obj.ResultCode = "SUCCESS";
                            obj.ResultMessage = "Video been saved successfully.";
                        }
                        else
                            obj.ResultCode = "ERROR";
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultMessage = "Video has been saved successfully.";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SaveGroups", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 16
0
        /// <summary>
        /// Save task types.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="tasktypeid">string</param>
        /// <param name="pointsearned">string</param>
        /// <param name="goalpathiconurl">string</param>
        /// <param name="langid">string</param>
        /// <param name="title">string</param>
        /// <param name="description">string</param>
        /// <param name="audiourl">string</param>
        /// <returns>string</returns>
        public string SaveTaskType(string sessionKey, string tasktypeid, string pointsearned, string goalpathiconurl, string langid, string title,
                                   string audiourl, string minquota)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SaveTaskType");
                    if (tasktypeid != "0") { db.AddInParameter(dbCommand, "@TaskTypeID", DbType.Int32, Int32.Parse(tasktypeid)); }
                    else { db.AddInParameter(dbCommand, "@TaskTypeID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(pointsearned)) { db.AddInParameter(dbCommand, "@PointsEarned", DbType.Int32, Int32.Parse(pointsearned)); }
                    else { db.AddInParameter(dbCommand, "@PointsEarned", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@IconURL", DbType.String, goalpathiconurl);
                    if (!string.IsNullOrEmpty(langid)) { db.AddInParameter(dbCommand, "@langid", DbType.Int32, Int32.Parse(langid)); }
                    else { db.AddInParameter(dbCommand, "@langid", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@Title", DbType.String, title);
                    db.AddInParameter(dbCommand, "@AudioURL", DbType.String, audiourl);
                    if (!string.IsNullOrEmpty(pointsearned)) { db.AddInParameter(dbCommand, "@MinQuota", DbType.Int32, Int32.Parse(minquota)); }
                    else { db.AddInParameter(dbCommand, "@MinQuota", DbType.Int32, null); }

                    if (tasktypeid == "0")
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                        {
                            obj.ResultCode = "SUCCESS";
                            obj.ResultMessage = "Task types have been saved successfully.";
                        }
                        else
                            obj.ResultCode = "ERROR";
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultMessage = "Task types have been saved successfully.";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SaveTaskType", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Save department method.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="departmentid">string</param>
        /// <param name="langid">string</param>
        /// <param name="title">string</param>
        /// <param name="audiofilePath">string</param>
        /// <returns>string</returns>
        public string SaveDepartment(string sessionKey, string departmentid, string langid, string title, string audiofilePath, string iconpathurl, string isenabled, string filename)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SaveDepartment");
                    if (!string.IsNullOrEmpty(departmentid)) { db.AddInParameter(dbCommand, "@DepartmentID", DbType.Int32, Int32.Parse(departmentid)); }
                    else { db.AddInParameter(dbCommand, "@DepartmentID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(langid)) { db.AddInParameter(dbCommand, "@langid", DbType.Int32, Int32.Parse(langid)); }
                    else { db.AddInParameter(dbCommand, "@langid", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@Title", DbType.String, title);
                    db.AddInParameter(dbCommand, "@AudioURL", DbType.String, audiofilePath);
                    db.AddInParameter(dbCommand, "@IconURL", DbType.String, iconpathurl);
                    db.AddInParameter(dbCommand, "@IsEnabled", DbType.Boolean, Convert.ToBoolean(isenabled));
                    db.AddInParameter(dbCommand, "@FileName", DbType.Boolean, filename);

                    if (departmentid == null)
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                        {
                            obj.ResultCode = "SUCCESS";
                            obj.ResultMessage = "Department have been saved successfully.";
                        }
                        else
                            obj.ResultCode = "ERROR";
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultMessage = "Department have been saved successfully.";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SaveGroups", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 18
0
        /// <summary>
        /// Save video question and answers.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="videoid">string</param>
        /// <param name="questiontext">string</param>
        /// <param name="langid">string</param>
        /// <param name="answers">string</param>
        /// <param name="correctanswer">string</param>
        /// <param name="points">string</param>
        /// <returns>string</returns>
        public string SaveVideoQuestions(string sessionKey, string questionid, string videoid, string questiontext, string langid, string correctanswer, string audioURL, string points)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SaveVideoQuestions");
                    if (!string.IsNullOrEmpty(videoid)) { db.AddInParameter(dbCommand, "@QuestionID", DbType.Int32, Int32.Parse(questionid)); }
                    else { db.AddInParameter(dbCommand, "@QuestionID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(videoid)) { db.AddInParameter(dbCommand, "@VideoID", DbType.Int32, Int32.Parse(videoid)); }
                    else { db.AddInParameter(dbCommand, "@VideoID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(langid)) { db.AddInParameter(dbCommand, "@LangID", DbType.Int32, Int32.Parse(langid)); }
                    else { db.AddInParameter(dbCommand, "@LangID", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@QuestionText", DbType.String, questiontext);
                    db.AddInParameter(dbCommand, "@AudioURL", DbType.String, audioURL);
                    db.AddInParameter(dbCommand, "@CorrectAnswer", DbType.String, correctanswer);
                    db.AddInParameter(dbCommand, "@Points", DbType.Int32, Int32.Parse(points));

                    if (videoid == null)
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                        {
                            obj.ResultCode = "SUCCESS";
                            obj.ResultMessage = "Questions have been saved successfully.";
                        }
                        else
                            obj.ResultCode = "ERROR";
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultMessage = "Questions have been saved successfully.";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SaveGroups", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 19
0
        /// <summary>
        /// Save department method.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="departmentid">string</param>
        /// <param name="langid">string</param>
        /// <param name="title">string</param>
        /// <param name="audiofilePath">string</param>
        /// <returns>string</returns>
        public string SaveLanguage(string sessionKey, string langid, bool isenabled)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SaveLanguage");
                    if (langid != "0") { db.AddInParameter(dbCommand, "@langid", DbType.Int32, Int32.Parse(langid)); }
                    else { db.AddInParameter(dbCommand, "@langid", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@isenabled", DbType.Boolean, isenabled);

                    db.ExecuteNonQuery(dbCommand);
                    obj.ResultCode = "SUCCESS";
                    obj.ResultMessage = "Language have been saved successfully.";
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SaveLanguages", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 20
0
        /// <summary>
        /// Delete questions
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="questionid">string</param>
        /// <returns>string</returns>
        public string DeleteVideoQuestions(string sessionKey, string questionid)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_DeleteQuestion");
                    db.AddInParameter(dbCommand, "@QuestionID", DbType.Int32, Int32.Parse(questionid));

                    db.ExecuteNonQuery(dbCommand);
                    obj.ResultCode = "SUCCESS";
                    obj.ResultMessage = "Questions have been deleted successfully.";
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "DeleteContentVideo", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Get persons list.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="personId">string</param>
        /// <param name="personTypeId">string</param>
        /// <param name="persongroupid">string</param>
        /// <param name="langid">string</param>
        /// <param name="firstname">string</param>
        /// <param name="lastname">string</param>
        /// <param name="username">string</param>
        /// <param name="password">string</param>
        /// <param name="email">string</param>
        /// <param name="countryid">string</param>
        /// <param name="stateid">string</param>
        /// <param name="telhome">string</param>
        /// <param name="telwork">string</param>
        /// <param name="telmobile">string</param>
        /// <param name="profilepicture">string</param>
        /// <param name="personcode">string</param>
        /// <param name="jobtitle">string</param>
        /// <returns>string</returns>
        public string SavePerson(string sessionKey, string personId, string personTypeId, string persongroupid, string langid, string firstname, string lastname,
                                 string username, string password, string email, string profilepicture, string audioURL, string devicetoken)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SavePerson");
                    db.AddInParameter(dbCommand, "@SessionKey", DbType.String, sessionKey);
                    if (personId != "0") { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, Int32.Parse(personId)); }
                    else { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, null); }
                    if (personTypeId != "0") { db.AddInParameter(dbCommand, "@PersonTypeID", DbType.Int32, Int32.Parse(personTypeId)); }
                    else { db.AddInParameter(dbCommand, "@PersonTypeID", DbType.Int32, null); }
                    if (persongroupid != "0") { db.AddInParameter(dbCommand, "@PersonGroupID", DbType.Int32, Int32.Parse(persongroupid)); }
                    else { db.AddInParameter(dbCommand, "@PersonGroupID", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@PreferredLanguageID", DbType.Int32, Int32.Parse(langid));
                    db.AddInParameter(dbCommand, "@FirstName", DbType.String, firstname);
                    db.AddInParameter(dbCommand, "@LastName", DbType.String, lastname);
                    db.AddInParameter(dbCommand, "@Username", DbType.String, username);
                    db.AddInParameter(dbCommand, "@Password", DbType.String, CalculateMD5Hash(password));
                    db.AddInParameter(dbCommand, "@Email", DbType.String, email);
                    db.AddInParameter(dbCommand, "@ProfilePictureURL", DbType.String, profilepicture);
                    db.AddInParameter(dbCommand, "@AudioURL", DbType.String, audioURL);
                    db.AddInParameter(dbCommand, "@RegisteredToken", DbType.String, devicetoken);

                    if (personId == "0")
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                            obj.ResultCode = "SUCCESS";
                        else
                            obj.ResultCode = "ERROR";
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SavePerson", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 22
0
        /// <summary>
        /// Get groups.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="groupid">string</param>
        /// <returns>string</returns>
        public string GetGroups(string sessionKey, string groupid)
        {
            string retValue = string.Empty;
            List<Group> lstgroup = new List<Group>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            bool isValid = true;
            int count = 0;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetGroups");
                    db.AddInParameter(dbCommand, "@GroupID", DbType.Int32, groupid);

                    DataSet dsStates = db.ExecuteDataSet(dbCommand);

                    if (dsStates.Tables.Count > 0)
                    {
                        DataTable tState = dsStates.Tables[0];

                        foreach (DataRow dr in tState.Rows)
                        {
                            Group group = new Group();
                            if (dr["GroupID"] != DBNull.Value) { group.GroupID = Int32.Parse(dr["GroupID"].ToString()); }
                            if (dr["langid"] != DBNull.Value) { group.langid = Int32.Parse(dr["langid"].ToString()); }
                            if (dr["Title"] != DBNull.Value) { group.Title = dr["Title"].ToString(); }
                            if (dr["AudioURL"] != DBNull.Value) { group.AudioURL = dr["AudioURL"].ToString(); }
                            if (dr["IconURL"] != DBNull.Value) { group.IconURL = dr["IconURL"].ToString(); }
                            lstgroup.Add(group);
                            count++;
                        }
                        responseObject.ResultObjectJSON = Serializer.ObjectToJSON(lstgroup);
                        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(), "GetDeaprtments", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            return Serializer.ObjectToJSON(responseObject);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Save person completed quiz.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="personcompletedquizid">string</param>
        /// <param name="helpvideoquizid">string</param>
        /// <param name="personid">string</param>
        /// <param name="completeddate">string</param>
        /// <returns>string</returns>
        public string SavePersonCompletedQuiz(string sessionKey, string personcompletedquizid, string helpvideoquizid, string personid, string completeddate)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SavePersonCompletedQuiz");
                    if (!string.IsNullOrEmpty(personcompletedquizid)) { db.AddInParameter(dbCommand, "@PersonCompletedQuizID", DbType.Int32, Int32.Parse(personcompletedquizid)); }
                    else { db.AddInParameter(dbCommand, "@PersonCompletedQuizID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(helpvideoquizid)) { db.AddInParameter(dbCommand, "@HelpVideoQuizID", DbType.Int32, Int32.Parse(helpvideoquizid)); }
                    else { db.AddInParameter(dbCommand, "@HelpVideoQuizID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(personid)) { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, Int32.Parse(personid)); }
                    else { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(completeddate)) { db.AddInParameter(dbCommand, "@CompletedDate", DbType.Int32, Convert.ToDateTime(completeddate)); }
                    else { db.AddInParameter(dbCommand, "@CompletedDate", DbType.Int32, null); }

                    if (personcompletedquizid == null)
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                        {
                            obj.ResultCode = "SUCCESS";
                            obj.ResultMessage = "Completed quiz details have been saved successfully.";
                        }
                        else
                            obj.ResultCode = "ERROR";
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultMessage = "Completed quiz details have been saved successfully.";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SavePersonFeedback", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 24
0
        //public string GetPersonFeedbackType(string sessionKey)
        //{
        //    string retValue = string.Empty;
        //    int count = 0;
        //    List<PersonFeedback> lstfeedbacktype = new List<PersonFeedback>();
        //    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_GetPersonFeedbackType");
        //            DataSet dsHelpContent = db.ExecuteDataSet(dbCommand);
        //            if (dsHelpContent.Tables.Count > 0)
        //            {
        //                DataTable tHelpContent = dsHelpContent.Tables[0];
        //                foreach (DataRow dr in tHelpContent.Rows)
        //                {
        //                    PersonFeedback feedback = new PersonFeedback();
        //                    if (dr["PersonFeedbackID"] != DBNull.Value) { feedback.PersonFeedbackID = Int32.Parse(dr["PersonFeedbackID"].ToString()); }
        //                    if (dr["Title"] != DBNull.Value) { feedback. = dr["Title"].ToString(); }
        //                    if (dr["PointsEarned"] != DBNull.Value) { feedback.PointsEarned = Int32.Parse(dr["PointsEarned"].ToString()); }
        //                    lstfeedbacktype.Add(feedback);
        //                    count++;
        //                }
        //            }
        //            responseObject.ResultObjectJSON = Serializer.ObjectToJSON(lstfeedbacktype);
        //            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(), "GetFeedbacktype", System.DateTime.Now);
        //            ExceptionManager.PublishException(exc);
        //        }
        //    }
        //    return Serializer.ObjectToJSON(responseObject);
        //}
        /// <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 GetHelpVideoQuizes(string sessionKey, string videoid, string langid)
        {
            string retValue = string.Empty;
            int count = 0;
            QuestionObject questionobject = new QuestionObject();
            List<HelpVideoQuiz> lstquestions = new List<HelpVideoQuiz>();
            List<HelpVideoAnswers> lstanswers = new List<HelpVideoAnswers>();
            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_GetHelpVideoQuestions");

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

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

                    DataSet dsHelpContent = db.ExecuteDataSet(dbCommand);

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

                        foreach (DataRow dr in tHelpContent.Rows)
                        {
                            HelpVideoQuiz helpquiz = new HelpVideoQuiz();
                            if (dr["HelpVideoQuizID"] != DBNull.Value) { helpquiz.HelpVideoQuizID = Int32.Parse(dr["HelpVideoQuizID"].ToString()); }
                            if (dr["HelpVideoID"] != DBNull.Value) { helpquiz.HelpVideoID = Int32.Parse(dr["HelpVideoID"].ToString()); }
                            if (dr["QuestionText"] != DBNull.Value) { helpquiz.QuestionText = dr["QuestionText"].ToString(); }
                            if (dr["AudioURL"] != DBNull.Value) { helpquiz.AudioURL = dr["AudioURL"].ToString(); }
                            if (dr["CorrectAnswerID"] != DBNull.Value) { helpquiz.CorrectAnswerID = Int32.Parse(dr["CorrectAnswerID"].ToString()); }
                            if (dr["Points"] != DBNull.Value) { helpquiz.Points = Int32.Parse(dr["Points"].ToString()); }
                            lstquestions.Add(helpquiz);
                            count++;
                        }
                        questionobject.Questions = lstquestions;
                    }
                    if (dsHelpContent.Tables.Count > 1)
                    {
                        DataTable tHelpContent = dsHelpContent.Tables[1];

                        foreach (DataRow dr in tHelpContent.Rows)
                        {
                            HelpVideoAnswers helpanswers = new HelpVideoAnswers();
                            if (dr["HelpVideoQuizAnswerID"] != DBNull.Value) { helpanswers.HelpVideoQuizAnswerID = Int32.Parse(dr["HelpVideoQuizAnswerID"].ToString()); }
                            if (dr["AnswerTitle"] != DBNull.Value) { helpanswers.AnswerTitle = dr["AnswerTitle"].ToString(); }
                            if (dr["AnswerAudioFileURL"] != DBNull.Value) { helpanswers.AnswerAudioFileURL = dr["AnswerAudioFileURL"].ToString(); }
                            lstanswers.Add(helpanswers);
                        }
                        questionobject.Answers = lstanswers;
                    }
                    responseObject.ResultObjectJSON = Serializer.ObjectToJSON(questionobject);
                    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(questionobject);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Save person types (roles)
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="persontypeid">string</param>
        /// <param name="persontype">string</param>
        /// <returns>string</returns>
        public string SavePersonType(string sessionKey, string persontypeid, string persontype)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SavePersonType");
                    if (!string.IsNullOrEmpty(persontypeid)) { db.AddInParameter(dbCommand, "@PersonTypeID", DbType.Int32, Int32.Parse(persontypeid)); }
                    else { db.AddInParameter(dbCommand, "@PersonTypeID", DbType.Int32, null); }
                    db.AddInParameter(dbCommand, "@PersonType", DbType.String, persontype);

                    if (persontypeid == null)
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                            obj.ResultCode = "SUCCESS";
                        else
                            obj.ResultCode = "ERROR";
                        obj.ResultObjectID = pId;
                        obj.ResultObjectRecordCount = pId;
                        if (obj.ResultObjectRecordCount <= 0) { obj.ResultMessage = "Unable to save group."; }
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SavePersonType", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 26
0
        /// <summary>
        /// Get all supported languages.
        /// </summary>
        /// <returns>string</returns>
        public string GetLanguages(bool isAll)
        {
            string retValue = string.Empty;
            List<Language> lstlang = new List<Language>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            int count = 0;

            try
            {
                Database db = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = db.GetStoredProcCommand("usp_GetLanguages");
                db.AddInParameter(dbCommand, "@isAll", DbType.Boolean, isAll);
                DataSet dsLang = db.ExecuteDataSet(dbCommand);

                if (dsLang.Tables.Count > 0)
                {
                    DataTable tState = dsLang.Tables[0];

                    foreach (DataRow dr in tState.Rows)
                    {
                        Language lang = new Language();
                        if (dr["langid"] != DBNull.Value) { lang.langid = Int32.Parse(dr["langid"].ToString()); }
                        if (dr["alias"] != DBNull.Value) { lang.alias = dr["alias"].ToString(); }
                        if (dr["isenabled"] != DBNull.Value) { lang.isenabled = Convert.ToBoolean(dr["isenabled"].ToString()); }
                        lstlang.Add(lang);
                        count++;
                    }
                    responseObject.ResultObjectJSON = Serializer.ObjectToJSON(lstlang);
                    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(), "GetStates", System.DateTime.Now);
                ExceptionManager.PublishException(exc);
            }
            return Serializer.ObjectToJSON(responseObject);
        }
Exemplo n.º 27
0
        public string SavePrivateProject(string sessionKey, string privateprojectid, string personid, string isenabled, string videofilename, string photourl, string approvalstatusid)
        {
            string retValue = string.Empty;
            ResponseObjectForAnything obj = new ResponseObjectForAnything();
            Int32 pId = -1;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }
            if (approvalstatusid == "0") { approvalstatusid = "4"; }

            if (isValid)
            {
                try
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_SavePrivateProject");
                    if (privateprojectid != "0") { db.AddInParameter(dbCommand, "@PrivateProjectID", DbType.Int32, Int32.Parse(privateprojectid)); }
                    else { db.AddInParameter(dbCommand, "@PrivateProjectID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(personid)) { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, Int32.Parse(personid)); }
                    else { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(approvalstatusid)) { db.AddInParameter(dbCommand, "@ApprovalStatusID", DbType.Int32, Int32.Parse(approvalstatusid)); }
                    else { db.AddInParameter(dbCommand, "@ApprovalStatusID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(isenabled)) { db.AddInParameter(dbCommand, "@IsEnabled", DbType.Boolean, Convert.ToBoolean(isenabled)); }
                    else { db.AddInParameter(dbCommand, "@IsEnabled", DbType.Boolean, null); }
                    db.AddInParameter(dbCommand, "@VideoFileName", DbType.String, videofilename);
                    db.AddInParameter(dbCommand, "@VideoURL", DbType.String, photourl);

                    if (privateprojectid == string.Empty || privateprojectid == "0")
                    {
                        pId = Int32.Parse(db.ExecuteScalar(dbCommand).ToString());
                        obj.ResultObjectID = pId;
                        if (pId > 0)
                        {
                            obj.ResultCode = "SUCCESS";
                            obj.ResultMessage = "Private Project have been enabled successfully.";
                        }
                        else
                            obj.ResultCode = "ERROR";
                    }
                    else
                    {
                        db.ExecuteNonQuery(dbCommand);
                        obj.ResultCode = "SUCCESS";
                        obj.ResultMessage = "Private Project have been saved successfully.";
                    }
                }
                catch (Exception ex)
                {
                    obj.ResultCode = "ERROR";
                    obj.ResultMessage = ex.Message.ToString();
                    CustomException exc = new CustomException(ex.ToString(), this.ToString(), "SavePersonFeedback", System.DateTime.Now);
                    ExceptionManager.PublishException(exc);
                }
            }
            retValue = Serializer.ObjectToJSON(obj);
            return retValue;
        }
Exemplo n.º 28
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (cmbService.SelectedValue == "getstates")
     {
         txtResult.Text = w.GetStates(txtCountryID.Text);
     }
     if (cmbService.SelectedValue == "getcountries")
     {
         txtResult.Text = w.GetCountries();
     }
     if (cmbService.SelectedValue == "savegroups")
     {
         //txtResult.Text = w.SaveGroups(txtSessionKey.Text, null, "0", "Admin", @"http:\\steviart.azurewebsites.net\uploads\Elevator Shaft Or Tunnel-SoundBible.com-1359236004.wav");
     }
     if (cmbService.SelectedValue == "savepersontype")
     {
         txtResult.Text = w.SavePersonType(txtSessionKey.Text, txtPersonTypeID.Text, txtPersonType.Text);
     }
     if (cmbService.SelectedValue == "saveperson")
     {
         ResponseObjectForAnything obj = new ResponseObjectForAnything();
         string filename = obj.ResultMessage;
         //txtResult.Text = w.SavePerson(txtSessionKey.Text, txtPersonID.Text, txtPersonTypeID.Text, txtPersonGroupID.Text, cmbLanguage.SelectedValue, txtFirstName.Text,
         //    txtLastName.Text, txtDisplayName.Text, txtPassword.Text, txtEmail.Text, txtTelHome.Text, txtTelWork.Text, txtTelMobile.Text, filename, txtPersonCode.Text,
         //    txtJobTitle.Text, txtPersonAddressID.Text, txtAddressID.Text, txtAddressTypeID.Text, txtAddress1.Text, txtAddress2.Text, txtAddress3.Text, txtCity.Text, txtPinCode.Text,
         //    txtStateID.Text, txtCountryID.Text);
     }
     if (cmbService.SelectedValue == "getlanguages")
     {
         //txtResult.Text = w.GetLanguages();
     }
     if (cmbService.SelectedValue == "savesubject")
     {
         txtResult.Text = w.SaveSubject(txtSessionKey.Text, txtSubjectID.Text, txtDepartmentID.Text, cmbLanguage.SelectedValue, txtSubject.Text, @"http:\\steviart.azurewebsites.net\uploads\Elevator Shaft Or Tunnel-SoundBible.com-1359236004.wav");
     }
     if (cmbService.SelectedValue == "savedepartment")
     {
         //txtResult.Text = w.SaveDepartment(txtSessionKey.Text, txtDepartmentID.Text, cmbLanguage.SelectedValue, txtDepartment.Text, @"http:\\steviart.azurewebsites.net\uploads\Elevator Shaft Or Tunnel-SoundBible.com-1359236004.wav");
     }
     if (cmbService.SelectedValue == "saveprivateproject")
     {
         //txtResult.Text = w.SavePrivateProject(txtSessionKey.Text, txtPrivateProjectID.Text, txtPersonID.Text, txtPrivateProjectStatusID.Text, FileUpload1.FileName, @"http:\\steviart.azurewebsites.net\uploads\Elevator Shaft Or Tunnel-SoundBible.com-1359236004.wav",
         //                                      txtLangId.Text, txtTitle.Text, txtDescription.Text, "", "");
     }
     if (cmbService.SelectedValue == "savevideoquestion")
     {
         txtResult.Text = w.SaveVideoQuestions(txtSessionKey.Text, null, txtQuestionID.Text, null, txtLangId.Text, "1", @"http:\\steviart.azurewebsites.net\uploads\Elevator Shaft Or Tunnel-SoundBible.com-1359236004.wav", "10");
     }
     if (cmbService.SelectedValue == "savevideoanswers")
     {
         txtResult.Text = w.SaveVideoAnswers(txtSessionKey.Text, null, txtLangId.Text, txtQuestionID.Text, "A", @"http:\\steviart.azurewebsites.net\uploads\Elevator Shaft Or Tunnel-SoundBible.com-1359236004.wav");
     }
     if (cmbService.SelectedValue == "savepersonfeedback")
     {
         txtResult.Text = w.SavePersonFeedback(txtSessionKey.Text, null, txtPersonID.Text, "Awesome person", "1");
     }
     if (cmbService.SelectedValue == "savecontentvideo")
     {
         txtResult.Text = w.SaveContentVideo(txtSessionKey.Text, txtContentID.Text, txtVideoID.Text, @"http:\\steviart.azurewebsites.net\uploads\robotic.mp4");
     }
     if (cmbService.SelectedValue == "getdepartments")
     {
         //txtResult.Text = w.GetDepartments(txtSessionKey.Text, txtDepartmentID.Text);
     }
     if (cmbService.SelectedValue == "getpersons")
     {
         //txtResult.Text = w.GetPersons(txtSessionKey.Text, txtPersonID.Text, DateTime.Today.ToString());
     }
     if (cmbService.SelectedValue == "gethelpcontent")
     {
         txtResult.Text = w.GetHelpContent(txtSessionKey.Text, txtSubjectID.Text, txtContentID.Text);
     }
     if (cmbService.SelectedValue == "createsession")
     {
         txtResult.Text = w.CreateSession(txtEmail.Text, txtPassword.Text, txtDevice.Text);
     }
     if (cmbService.SelectedValue == "deletecontent")
     {
         txtResult.Text = w.DeleteContent(txtSessionKey.Text, txtContentID.Text);
     }
     if (cmbService.SelectedValue == "deletecontentvideo")
     {
         txtResult.Text = w.DeleteContentVideo(txtSessionKey.Text, txtVideoID.Text);
     }
     if (cmbService.SelectedValue == "deletegroups")
     {
         txtResult.Text = w.DeleteGroups(txtSessionKey.Text, txtPersonGroupID.Text);
     }
     if (cmbService.SelectedValue == "deleteperson")
     {
         txtResult.Text = w.DeletePerson(txtSessionKey.Text, txtPersonID.Text);
     }
     if (cmbService.SelectedValue == "deletesubject")
     {
         txtResult.Text = w.DeleteSubject(txtSessionKey.Text, txtSubjectID.Text);
     }
     if (cmbService.SelectedValue == "deletevideoanswers")
     {
         txtResult.Text = w.DeleteVideoAnswers(txtSessionKey.Text, txtAnswerID.Text);
     }
     if (cmbService.SelectedValue == "deletevideoquestions")
     {
         txtResult.Text = w.DeleteVideoQuestions(txtSessionKey.Text, txtQuestionID.Text);
     }
     if(cmbService.SelectedValue == "getsubjects")
     {
         //txtResult.Text = w.GetSubjects(txtSessionKey.Text, txtSubjectID.Text, txtDepartmentID.Text);
     }
     if (cmbService.SelectedValue == "getuserfromsession")
     {
         ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
         responseObject = w.GetUserFromSession(txtSessionKey.Text);
         txtResult.Text = responseObject.ResultObjectJSON;
     }
     if(cmbService.SelectedValue == "savetask")
     {
         //txtResult.Text = w.SaveTask(txtSessionKey.Text, txtTelHome.Text, txtTelMobile.Text, "false", "", "2015-10-27", "1", "false", "2", "20", "0", "test", "test description", "steviart.azurewebsites.net/uploads/Elevator Shaft Or Tunnel-SoundBible.com-1359236004.wav", "10");
     }
     if (cmbService.SelectedValue == "savepersonfeedback")
     {
         txtResult.Text = w.SavePersonFeedback(txtSessionKey.Text, null, txtPersonID.Text, "2", "1");
     }
     //if (cmbService.SelectedValue == "GetSubCategories")
     //{
     //    MasterlistEngine master = new MasterlistEngine();
     //    txtResult.Text = master.GetSubCategoryListJSON(txtCategory.Text);
     //}
     //if (cmbService.SelectedValue == "CreateSession")
     //{
     //    AuthenticationEngine auth = new AuthenticationEngine();
     //    txtResult.Text = auth.CreateSessionJSON(txtEmail.Text, txtPassword.Text, "Anshu-PC");
     //}
     //if(cmbService.SelectedValue =="Logout")
     //{
     //    AuthenticationEngine auth = new AuthenticationEngine();
     //    txtResult.Text = auth.LogoutJSON(txtSessionKey.Text, "Anshu-PC");
     //}
     //if (cmbService.SelectedValue == "GetUserFromSession")
     //{
     //    AuthenticationEngine auth = new AuthenticationEngine();
     //    txtResult.Text = auth.GetUserFromSessionJSON(txtSessionKey.Text);
     //}
     //if (cmbService.SelectedValue == "PostProblem")
     //{
     //    ProblemEngine probEngine = new ProblemEngine();
     //    txtResult.Text = probEngine.SaveProblemJSON(txtSessionKey.Text, txtProblemId.Text, "true", txtCompanyId.Text, txtHeading.Text, txtCategory.Text,
     //                                                txtSubCategory.Text, txtProduct.Text, txtModel.Text, txtDescription.Text, txtPurchaseMonth.Text, txtPurchaseYear.Text,
     //                                                txtProductStatus.Text, txtResolutionNeeded.Text, txtHashTags.Text, "false", "false", "130 High St", "Main St", "", "London", "", "", "WV100BA", "true");
     //}
     //if (cmbService.SelectedValue == "UploadFiles")
     //{
     //    FileEngine file = new FileEngine();
     //    HttpContext context = HttpContext.Current;
     //    byte[] filearray = FileUpload1.FileBytes;
     //    txtResult.Text = file.UploadFilesJSON(txtSessionKey.Text,  filearray, Path.GetFileName(FileUpload1.FileName), context, txtFileType.Text, txtProblemId.Text, txtResolutionId.Text, txtProblemMediaId.Text, txtResolutionMediaId.Text);
     //}
     //if (cmbService.SelectedValue == "EditBid")
     //{
     //    BidEngine bid = new BidEngine();
     //    txtResult.Text = bid.SaveBids(txtSessionKey.Text, txtProblemId.Text, null, txtDescription.Text, "1", txtLink1.Text, txtTitle1.Text, txtLink2.Text, txtTitle2.Text, "1", "500", null, "20/09/2015,10:00,11:00;21/09/2015,17:00,19:00", "false");
     //}
 }
Exemplo n.º 29
0
        /// <summary>
        /// Get persons list.
        /// </summary>
        /// <param name="sessionKey">string</param>
        /// <param name="personId">string</param>
        /// <param name="personTypeId">string</param>
        /// <param name="persongroupid">string</param>
        /// <param name="langid">string</param>
        /// <param name="firstname">string</param>
        /// <param name="lastname">string</param>
        /// <param name="username">string</param>
        /// <param name="password">string</param>
        /// <param name="email">string</param>
        /// <param name="countryid">string</param>
        /// <param name="stateid">string</param>
        /// <param name="telhome">string</param>
        /// <param name="telwork">string</param>
        /// <param name="telmobile">string</param>
        /// <param name="profilepicture">string</param>
        /// <param name="personcode">string</param>
        /// <param name="jobtitle">string</param>
        /// <returns>string</returns>
        public string GetPersons(string sessionKey, string personId, string duedate, string persontypeid)
        {
            PersonObject personobj = new PersonObject();
            List<Person> lstPerson = new List<Person>();
            List<Address> lstAddress = new List<Address>();
            List<PersonCompletedQuiz> lstcompletedquiz = new List<PersonCompletedQuiz>();
            List<SteviArt.Common.DTO.Task> lsttasks = new List<Common.DTO.Task>();
            List<PrivateProject> lstprivateprojs = new List<PrivateProject>();
            List<PersonFeedback> lstfeedback = new List<PersonFeedback>();
            ResponseObjectForAnything responseObject = new ResponseObjectForAnything();
            int count = 0;
            bool isValid = true;
            if (!string.IsNullOrEmpty(sessionKey)) { isValid = IsValidSession(sessionKey); }

            try
            {
                if (isValid)
                {
                    Database db = DatabaseFactory.CreateDatabase();
                    DbCommand dbCommand = db.GetStoredProcCommand("usp_GetPerson");
                    if (!string.IsNullOrEmpty(personId)) { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, Int32.Parse(personId)); }
                    else { db.AddInParameter(dbCommand, "@PersonID", DbType.Int32, null); }
                    if (!string.IsNullOrEmpty(duedate)) { db.AddInParameter(dbCommand, "@DueDate", DbType.DateTime, Convert.ToDateTime(duedate)); }
                    else { db.AddInParameter(dbCommand, "@DueDate", DbType.DateTime, null); }
                    if (!string.IsNullOrEmpty(persontypeid)) { db.AddInParameter(dbCommand, "@PersonTypeID", DbType.Int32, Int32.Parse(persontypeid)); }
                    else { db.AddInParameter(dbCommand, "@PersonTypeID", DbType.Int32, null); }

                    DataSet dsPersons = db.ExecuteDataSet(dbCommand);

                    if (dsPersons.Tables.Count > 0)
                    {
                        DataTable tUser = dsPersons.Tables[0];
                        foreach (DataRow dr in tUser.Rows)
                        {
                            Person person = new Person();
                            if (dr["PersonID"] != DBNull.Value) { person.PersonID = Int32.Parse(dr["PersonID"].ToString()); }
                            if (dr["PersonTypeID"] != DBNull.Value) { person.PersonTypeID = Int32.Parse(dr["PersonTypeID"].ToString()); }
                            if (dr["PreferredLanguageID"] != DBNull.Value) { person.PreferredLanguageID = Int32.Parse(dr["PreferredLanguageID"].ToString()); }
                            if (dr["FirstName"] != DBNull.Value) { person.FirstName = dr["FirstName"].ToString(); }
                            if (dr["LastName"] != DBNull.Value) { person.LastName = dr["LastName"].ToString(); }
                            if (dr["Username"] != DBNull.Value) { person.Username = dr["Username"].ToString(); }
                            if (dr["Email"] != DBNull.Value) { person.Email = dr["Email"].ToString(); }
                            if (dr["ProfilePicPath"] != DBNull.Value) { person.ProfilePicPath = dr["ProfilePicPath"].ToString(); }
                            if (dr["PersonGroupID"] != DBNull.Value) { person.PersonGroupID = Int32.Parse(dr["PersonGroupID"].ToString()); }
                            if (dr["GroupName"] != DBNull.Value) { person.GroupName = dr["GroupName"].ToString(); }
                            if (dr["PersonType"] != DBNull.Value) { person.PersonType = dr["PersonType"].ToString(); }
                            if (dr["RegisteredToken"] != DBNull.Value) { person.RegisteredToken = dr["RegisteredToken"].ToString(); }
                            if (dr["PointsEarned"] != DBNull.Value) { person.PointsEarned = Convert.ToInt32(dr["PointsEarned"].ToString()); }
                            if (dr["AvgFeedback"] != DBNull.Value) { person.AvgFeedback = Convert.ToDecimal(dr["AvgFeedback"].ToString()); }
                            if (dr["FullName"] != DBNull.Value) { person.FullName = dr["FullName"].ToString(); }
                            if (dr["AudioURL"] != DBNull.Value) { person.AudioURL = dr["AudioURL"].ToString(); }
                            if (dr["GroupAudioURL"] != DBNull.Value) { person.GroupAudioURL = dr["GroupAudioURL"].ToString(); }
                            lstPerson.Add(person);
                            count++;
                        }
                        personobj.Persons = lstPerson;
                    }
                    if(dsPersons.Tables.Count > 1)
                    {
                        DataTable tPersonQuiz = dsPersons.Tables[1];
                        foreach(DataRow dr in tPersonQuiz.Rows)
                        {
                            PersonCompletedQuiz completedquiz = new PersonCompletedQuiz();
                            if (dr["PersonCompletedQuizID"] != DBNull.Value) { completedquiz.PersonCompletedQuizID = Int32.Parse(dr["PersonCompletedQuizID"].ToString()); }
                            if (dr["VideoID"] != DBNull.Value) { completedquiz.VideoID = Int32.Parse(dr["VideoID"].ToString()); }
                            if (dr["VideoTitle"] != DBNull.Value) { completedquiz.VideoTitle = dr["VideoTitle"].ToString(); }
                            if (dr["CompletedDate"] != DBNull.Value) { completedquiz.CompletedDate = Convert.ToDateTime(dr["CompletedDate"].ToString()); }
                            if (dr["PointsEarned"] != DBNull.Value) { completedquiz.PointsEarned = Int32.Parse(dr["PointsEarned"].ToString()); }
                            lstcompletedquiz.Add(completedquiz);
                        }
                        personobj.PersonCompletedQuiz = lstcompletedquiz;
                    }
                    if (dsPersons.Tables.Count > 2)
                    {
                        DataTable tTasks = dsPersons.Tables[2];
                        foreach(DataRow dr in tTasks.Rows)
                        {
                            Common.DTO.Task task = new Common.DTO.Task();
                            if (dr["Title"] != DBNull.Value) { task.Title = dr["Title"].ToString(); }
                            if (dr["LastCompletionDate"] != DBNull.Value) { task.LastCompletionDate = Convert.ToDateTime(dr["LastCompletionDate"].ToString()); }
                            if (dr["PercentComplete"] != DBNull.Value) { task.PercentComplete = Decimal.Parse(dr["PercentComplete"].ToString()); }
                            if (dr["IsCompleted"] != DBNull.Value) { task.IsCompleted = Convert.ToBoolean(dr["IsCompleted"].ToString()); }
                            if (dr["DueDate"] != DBNull.Value) { task.DueDate = Convert.ToDateTime(dr["DueDate"].ToString()); }
                            lsttasks.Add(task);
                        }
                        personobj.Task = lsttasks;
                    }
                    if (dsPersons.Tables.Count > 3)
                    {
                        DataTable tPrivateProj = dsPersons.Tables[3];
                        foreach(DataRow dr in tPrivateProj.Rows)
                        {
                            Common.DTO.PrivateProject privateproj = new PrivateProject();
                            if (dr["PhotoURL"] != DBNull.Value) { privateproj.PhotoURL = dr["PhotoURL"].ToString(); }
                            if (dr["CreatedDate"] != DBNull.Value) { privateproj.CreatedDate = Convert.ToDateTime(dr["CreatedDate"].ToString()); }
                            if (dr["PersonID"] != DBNull.Value) { privateproj.PersonID = Int32.Parse(dr["PersonID"].ToString()); }
                            if (dr["ApprovalStatusName"] != DBNull.Value) { privateproj.ApprovalStatusName = dr["ApprovalStatusName"].ToString(); }
                            lstprivateprojs.Add(privateproj);
                        }
                        personobj.PrivateProject = lstprivateprojs;
                    }
                    if(dsPersons.Tables.Count > 4)
                    {
                        DataTable tFeedback = dsPersons.Tables[4];
                        foreach (DataRow dr in tFeedback.Rows)
                        {
                            Common.DTO.PersonFeedback feedback = new PersonFeedback();
                            if (dr["PersonFeedbackID"] != DBNull.Value) { feedback.PersonFeedbackID = Int32.Parse(dr["PersonFeedbackID"].ToString()); }
                            if (dr["PersonID"] != DBNull.Value) { feedback.PersonID = Int32.Parse(dr["PersonID"].ToString()); }
                            if (dr["PersonName"] != DBNull.Value) { feedback.PersonName = dr["PersonName"].ToString(); }
                            if (dr["Feedback"] != DBNull.Value) { feedback.Feedback = Convert.ToDecimal(dr["Feedback"].ToString()); }
                            if (dr["FeedbackSubmitterID"] != DBNull.Value) { feedback.FeedbackSubmitterID = Int32.Parse(dr["FeedbackSubmitterID"].ToString()); }
                            if (dr["FeedbackSubmitterName"] != DBNull.Value) { feedback.FeedbackSubmitterName = dr["FeedbackSubmitterName"].ToString(); }
                            if (dr["RankTopicID"] != DBNull.Value) { feedback.RankTopicID = Int32.Parse(dr["RankTopicID"].ToString()); }
                            if (dr["RankTopic"] != DBNull.Value) { feedback.RankTopic = dr["RankTopic"].ToString(); }
                            lstfeedback.Add(feedback);
                        }
                        personobj.PersonFeedback = lstfeedback;
                    }
                }
                responseObject.ResultObjectJSON = Serializer.ObjectToJSON(personobj);
                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(), "GetPersons", System.DateTime.Now);
                ExceptionManager.PublishException(exc);
            }
            return Serializer.ObjectToJSON(responseObject);
        }