Esempio n. 1
0
        public bool GetOrganization(object[] lStrValue)
        {
            try
            {
                clsGlobalVariable.strExceptionReport = string.Empty;
                string     statusCode   = string.Empty;
                string     result       = string.Empty;
                clsGeneric oGeneric     = new clsGeneric();
                string     URI          = string.Empty;
                Hashtable  htblTestData = new Hashtable();
                htblTestData = oGeneric.GetTestData(lStrValue);
                bool _Flag = false;

                clsAPIOrganization clOrgData = new clsAPIOrganization();

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();
                if (htblTestData["OrgID"].ToString() != "")
                {
                    clsAPI.orgID = htblTestData["OrgID"].ToString();
                }

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID), clOrgData, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.apiOrg.Replace("$", clsAPI.orgID), clOrgData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (result.Contains("ID"))
                    {
                        var oGetOrgID = JsonConvert.DeserializeObject <clsAPIOrganization>(result);
                        if (oGetOrgID.ID.Equals(clsAPI.orgID))
                        {
                            _Flag = true;
                        }
                    }
                }
                else
                {
                    if (!result.Contains("ID"))
                    {
                        _Flag = true;
                    }
                }

                return(_Flag);
            }
            catch (Exception er)
            {
                clsException.ExceptionHandler(er, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// function to get user transcript related to curricula
        /// </summary>
        /// <param name="orgID">organization id</param>
        /// <param name="userID">user id</param>
        /// <param name="testCaseType">positive/negative</param>
        /// <param name="certificationCourseName">course name</param>
        /// <returns>true/false</returns>
        public bool CurriclaTranscript(string orgID, string userID, string testcaseType, string certificationCourseName)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode = string.Empty;
            string     result     = string.Empty;
            clsGeneric oGeneric   = new clsGeneric();
            string     URI        = string.Empty;
            string     courseID   = string.Empty;
            bool       _flag      = false;
            string     lCourseId  = string.Empty;
            clsPage    oPage      = new clsPage(iWebdriver);

            clsAPITranscript oclsAPITranscript = new clsAPITranscript();

            lCourseId = oPage.GetCurriculumId(certificationCourseName);


            try
            {//////////////////////getting transcript
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSpecificCurriculumTranscript.Replace("{orgID}", orgID).Replace("{userID}", userID).Replace("{courseID}", lCourseId), oclsAPITranscript, "H1", _ecomLoginKey, _ecomTransactionKey);

                var status = JsonConvert.DeserializeObject <List <clsAPITranscript> >(result);

                if (testcaseType.ToUpper() == "NEGATIVE")
                {
                    if (statusCode == "OK/200")
                    {
                        _flag = true;
                    }
                    else
                    {
                        _flag = false;
                    }
                }
                else if (testcaseType.ToUpper() == "POSITIVE")
                {
                    if (statusCode == "OK/200")
                    {
                        _flag = true;
                    }
                    else
                    {
                        _flag = false;
                    }
                }
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
            return(_flag);
        }
Esempio n. 3
0
        public bool APIAddReduceSeats(object[] lStrvalue)
        {
            string     uri = string.Empty;
            string     uriApiCredential = string.Empty;
            string     statusCode       = string.Empty;
            string     result           = string.Empty;
            clsGeneric oGeneric         = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;

            try
            {
                if (htblTestData["orgID"].ToString().Trim() != "")
                {
                    clsAPI.orgID = htblTestData["orgID"].ToString().Trim();
                }
                if (htblTestData["userid"].ToString().Trim() != "")
                {
                    clsAPI.userid = htblTestData["userid"].ToString().Trim();
                }

                APICallReduceSeats oAPICallReduceSeats = new APICallReduceSeats();


                List <APIAddReduceSeats> lstRecords = new List <APIAddReduceSeats>();
                string[] strCourses     = htblTestData["OrgCourseID"].ToString().Split(',');   /////change name as per xml tag name
                string[] strCourseSeats = htblTestData["NumberofSeats"].ToString().Split(','); /////change name as per xml tag name
                int      iCounter       = 0;


                foreach (string strCourseID in strCourses)
                {
                    APIAddReduceSeats oAPIAddReduceSeats = new APIAddReduceSeats();
                    oAPIAddReduceSeats.NumberOfSeats = string.Empty;
                    oAPIAddReduceSeats.NumberOfSeats = strCourseSeats[iCounter].ToString();/////change name as per xml tag name
                    oAPIAddReduceSeats.OrgCourseID   = string.Empty;
                    oAPIAddReduceSeats.OrgCourseID   = strCourseID;
                    lstRecords.Add(oAPIAddReduceSeats);

                    iCounter++;
                }

                oAPICallReduceSeats.OrgCourseRecords = lstRecords;
                oAPICallReduceSeats.OrderID          = htblTestData["OrderID"].ToString();
                oAPICallReduceSeats.PurchaseDate     = htblTestData["PurchaseDate"].ToString();
                //Application.DoEvents();
                GetAPICredentials oGetAPICredentials = new GetAPICredentials();

                uri = ApplicationSettings.APIURI() + clsAPI.EcomCourseSeats.Replace("$", clsAPI.orgID) + clsAPI.EcommMgrID.Replace("#", clsAPI.userid);
                uriApiCredential = ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID);

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET",
                                                uriApiCredential, oAPICallReduceSeats, "H2", _ecomLoginKey, _ecomTransactionKey);

                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "Get", uri, oAPICallReduceSeats, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                // APIGetCourseSeats courseSeats = new APIGetCourseSeats();

                var courseSeats = JsonConvert.DeserializeObject <List <APICourseSeats> >(result);


                Dictionary <string, string> dicOldCourseData = new Dictionary <string, string>();

                foreach (string strCourseID in strCourses)
                {
                    for (int i = 0; i < courseSeats.Count; i++)
                    {
                        if (strCourseID.Contains(courseSeats[i].OrgCourseID.ToString()))
                        {
                            dicOldCourseData.Add(strCourseID, courseSeats[i].TotalSeats.ToString());
                        }
                    }
                }


                oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), uri, oAPICallReduceSeats, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);


                //Thread.Sleep(clsGlobalVariable.iWaitSCORMUpload);
                do
                {
                    Thread.Sleep(clsGlobalVariable.iWaitHigh);
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "Get", uri, oAPICallReduceSeats, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);
                    Thread.Sleep(5000);
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "Get", uri, oAPICallReduceSeats, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);
                } while (result.Contains("OrgCourseRecords"));
                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                if (result.ToUpper().Contains("!DOCTYPE"))
                {
                    if (htblTestData["TestCaseType"].ToString() == "Negative")
                    {
                        return(true);
                    }
                    else
                    {
                        clsGlobalVariable.strExceptionReport = "Invalid URI";
                        return(false);
                    }
                }

                var newCourseSeats = JsonConvert.DeserializeObject <List <APICourseSeats> >(result);


                Dictionary <string, string> dicNewCourseData = new Dictionary <string, string>();

                foreach (string strCourseID in strCourses)
                {
                    for (int i = 0; i < newCourseSeats.Count; i++)
                    {
                        if (strCourseID.Contains(newCourseSeats[i].OrgCourseID.ToString()))
                        {
                            dicNewCourseData.Add(strCourseID, newCourseSeats[i].TotalSeats);
                        }
                    }
                }

                int seatCounter = 0;
                foreach (string strCourseName in strCourses)
                {
                    int oldSeats = 0;
                    int newSeats = 0;
                    try
                    {
                        oldSeats = Convert.ToInt32(dicOldCourseData[strCourseName]);
                        newSeats = Convert.ToInt32(dicNewCourseData[strCourseName]);
                    }
                    catch (Exception ex) { }
                    try
                    {
                        if (Convert.ToInt32(strCourseSeats[seatCounter]) == Convert.ToInt32((newSeats - oldSeats)))
                        {
                            _Flag = true;
                        }
                    }
                    catch (FormatException eFormat)
                    {
                        if (htblTestData["TestCaseType"].ToString() == "Negative")
                        {
                            return(true);
                        }
                        else
                        {
                            clsGlobalVariable.strExceptionReport = "Invalid Seats";
                            return(false);
                        }
                    }


                    seatCounter++;
                }


                if (_Flag == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

                return(true);
            }
            catch (WebException ex) { return(false); }
        }
Esempio n. 4
0
        public bool AddRegion(Hashtable hTable)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode  = string.Empty;
            string     result      = string.Empty;
            string     GroupResult = string.Empty;
            clsGeneric oGeneric    = new clsGeneric();
            string     URI         = string.Empty;
            string     strGroupID  = string.Empty;

            List <string> lCourseId = new List <string>();
            bool          _Flag     = false;
            string        _UserID   = string.Empty;

            try
            {
                clsPage      oPage   = new clsPage(iWebdriver);
                clsRegionApi oRegion = new clsRegionApi();
                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;
                oRegion.name = hTable["Name"].ToString();

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oGetAPICredentials, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);


                oGeneric.GetApiResponseCodeData(out statusCode, out result, "POST", ApplicationSettings.APIURI() + clsAPI.Region.Replace("{orgid}", _orgID), oRegion, "H1", _ecomLoginKey, _ecomTransactionKey);


                Thread.Sleep(clsGlobalVariable.iWaitMedium);

                if (hTable["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.Region.Replace("{orgid}", _orgID), oRegion, "H1", _ecomLoginKey, _ecomTransactionKey);

                    var RegionData = JsonConvert.DeserializeObject <List <GetRegion> >(result);

                    _Flag = RegionData.Any(cus => cus.Name == hTable["Name"].ToString());

                    return(_Flag);
                }
                else
                {
                    if (result.Contains("ErrorCode") || result.Contains("Invalid URI."))
                    {
                        if (result.Contains("Invalid URI."))
                        {
                            return(true);
                        }


                        SuperAdminCoursePushDownErrorCode oError = new SuperAdminCoursePushDownErrorCode();
                        var error = JsonConvert.DeserializeObject <List <SuperAdminCoursePushDownError> >(result);

                        foreach (string errorcode in oError.coursePushDownErrorCode)
                        {
                            for (int i = 0; i < error.Count; i++)
                            {
                                if (error[i].ErrorCode == errorcode)
                                {
                                    _Flag = true;
                                }
                                else
                                {
                                    _Flag = false;
                                }
                            }
                            if (_Flag == true)
                            {
                                break;
                            }
                        }
                        return(_Flag);
                    }
                }
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }

            return(_Flag);
        }
Esempio n. 5
0
        /// <summary>
        /// update transcript function for put api request
        /// </summary>
        /// <param name="hTable">input from transcript function</param>
        /// <returns>true/false</returns>
        private bool UpdateTranscript(Hashtable hTable)
        {
            string _UserID = string.Empty;

            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode       = string.Empty;
            string     statusCodeUpdate = string.Empty;
            string     result           = string.Empty;
            string     resultput        = string.Empty;
            clsGeneric oGeneric         = new clsGeneric();
            string     URI      = string.Empty;
            string     courseID = string.Empty;
            bool       _flag    = false;

            try
            {
                Transcript       oTranscript       = new ILMS.Transcript();
                clsAPITranscript oclsAPITranscript = new clsAPITranscript();


                clsPage oPage = new clsPage(iWebdriver);

                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;


                Users oUser = new Users();

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();
                ////////////////////get api credentials for organization

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oUser, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);


                #region get user id by there type

                if (hTable["UserStatus"].ToString().ToUpper().Contains("INACTIVE"))
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID) + "?F015=" + hTable["UserEmail"].ToString() + "*&userstatus=inactive", oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                else if (hTable["UserStatus"].ToString().ToUpper().Contains("DELETED"))
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID) + "?F015=" + hTable["UserEmail"].ToString() + "*&userstatus=Deleted", oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                else
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                var oUserData = JsonConvert.DeserializeObject <List <Users> >(result);



                for (int iUser = 0; iUser < oUserData.Count; iUser++)
                {
                    if (oUserData[iUser].Profile.F015.ToString() == hTable["UserMailID"].ToString().Trim())
                    {
                        _UserID = oUserData[iUser].ID;
                        break;
                    }
                }

                #endregion

                #region course
                if (hTable["TranscriptFor"].ToString().ToUpper() == "COURSE")
                {
                    try
                    {
                        courseID = GetID(hTable["CourseName"].ToString(), hTable["TranscriptFor"].ToString());
                        ///old transcript
                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSpecificCourseTranscript.Replace("{orgID}", clsAPI.orgID).Replace("{userID}", _UserID).Replace("{courseID}", courseID), oclsAPITranscript, "H1", _ecomLoginKey, _ecomTransactionKey);


                        oTranscript.CompletionDate              = hTable["CompletionDate"].ToString();
                        oTranscript.EnrollmentDate              = hTable["EnrollmentDate"].ToString();
                        oTranscript.Score                       = hTable["Score"].ToString();
                        oTranscript.StartDate                   = hTable["StartDate"].ToString();
                        oTranscript.Status                      = hTable["Status"].ToString();
                        oTranscript.LicenseExpirationDate       = hTable["LicenseExpirationDate"].ToString();
                        oTranscript.RequirementType             = hTable["RequirementType"].ToString();
                        oTranscript.DueDate                     = hTable["DueDate"].ToString();
                        oTranscript.CertificationExpirationDate = hTable["CertificationExpirationDate"].ToString();

                        /////update transcript
                        string resultupdate = string.Empty;
                        string resultnew    = string.Empty;
                        oGeneric.GetApiResponseCodeData(out statusCodeUpdate, out resultupdate, "PUT", ApplicationSettings.APIURI() + clsAPI.GetSpecificCourseTranscript.Replace("{orgID}", clsAPI.orgID).Replace("{userID}", _UserID).Replace("{courseID}", courseID), oclsAPITranscript, "H1", _ecomLoginKey, _ecomTransactionKey);

                        Thread.Sleep(clsGlobalVariable.iWaitHigh);
                        oGeneric.GetApiResponseCodeData(out statusCode, out resultnew, "GET", ApplicationSettings.APIURI() + clsAPI.GetSpecificCourseTranscript.Replace("{orgID}", clsAPI.orgID).Replace("{userID}", _UserID).Replace("{courseID}", courseID), oclsAPITranscript, "H1", _ecomLoginKey, _ecomTransactionKey);
                        var status    = JsonConvert.DeserializeObject <List <clsAPITranscript> >(resultnew);
                        var statusold = JsonConvert.DeserializeObject <List <clsAPITranscript> >(result);

                        _flag = VerifyTranscriptUpdate(result, resultnew, statusCodeUpdate, hTable);
                    }
                    catch (Exception e)
                    {
                        clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                        return(false);
                    }
                }
                #endregion
                #region session
                else if (hTable["TranscriptFor"].ToString().ToUpper() == "SESSION")
                {
                    List <string> lCourseId = new List <string>();
                    string        resultnew = string.Empty;
                    lCourseId = oPage.GetCourseId(hTable["CourseName"].ToString());
                    clsGenericAPI oclsGenericAPI = new clsGenericAPI();
                    oclsGenericAPI.GetORGCredentials(out _ecomTransactionKey, out _ecomLoginKey, _orgID);


                    if (lCourseId.Count > 0)
                    {
                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSessionID.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString()), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);


                        var oSessionData = JsonConvert.DeserializeObject <List <clsAPISession> >(result);

                        if (result == "")
                        {
                            return(false);
                        }

                        _SessionID = oSessionData[0].SessionID;

                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSpecificSessionTranscript.Replace("{orgID}", _orgID).Replace("{CourseID}", lCourseId[0].ToString()).Replace("{sessionID}", _SessionID).Replace("{userID}", _UserID), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);


                        _flag = VerifyTranscriptUpdate(result, resultnew, statusCodeUpdate, hTable);
                    }
                    else
                    {
                        return(false);
                    }
                }
                #endregion
                #region Curricula
                else
                {
                    string resultnew = string.Empty;
                    courseID = oPage.GetCurriculumId(hTable["CourseName"].ToString());


                    try
                    {//////////////////////getting transcript
                        oTranscript.CompletionDate              = hTable["CompletionDate"].ToString();
                        oTranscript.EnrollmentDate              = hTable["EnrollmentDate"].ToString();
                        oTranscript.Score                       = hTable["Score"].ToString();
                        oTranscript.StartDate                   = hTable["StartDate"].ToString();
                        oTranscript.Status                      = hTable["Status"].ToString();
                        oTranscript.LicenseExpirationDate       = hTable["LicenseExpirationDate"].ToString();
                        oTranscript.RequirementType             = hTable["RequirementType"].ToString();
                        oTranscript.DueDate                     = hTable["DueDate"].ToString();
                        oTranscript.CertificationExpirationDate = hTable["CertificationExpirationDate"].ToString();

                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSpecificCurriculumTranscript.Replace("{orgID}", _orgID).Replace("{userID}", _UserID).Replace("{courseID}", courseID), oclsAPITranscript, "H1", _ecomLoginKey, _ecomTransactionKey);

                        var status = JsonConvert.DeserializeObject <List <clsAPITranscript> >(result);


                        oGeneric.GetApiResponseCodeData(out statusCodeUpdate, out resultput, "PUT", ApplicationSettings.APIURI() + clsAPI.GetSpecificCurriculumTranscript.Replace("{orgID}", _orgID).Replace("{userID}", _UserID).Replace("{courseID}", courseID), oclsAPITranscript, "H1", _ecomLoginKey, _ecomTransactionKey);
                        Thread.Sleep(clsGlobalVariable.iWaitHigh);

                        oGeneric.GetApiResponseCodeData(out statusCode, out resultnew, "GET", ApplicationSettings.APIURI() + clsAPI.GetSpecificCurriculumTranscript.Replace("{orgID}", _orgID).Replace("{userID}", _UserID).Replace("{courseID}", courseID), oclsAPITranscript, "H1", _ecomLoginKey, _ecomTransactionKey);
                        var statusold = JsonConvert.DeserializeObject <List <clsAPITranscript> >(result);


                        _flag = VerifyTranscriptUpdate(result, resultnew, statusCodeUpdate, hTable);
                    }
                    catch { clsGlobalVariable.strExceptionReport = "Get transcript scenario failed"; return(false); }
                    return(_flag);
                }
                #endregion
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }



            return(_flag);
        }
Esempio n. 6
0
        public bool GetSession(object[] oObject)
        {
            string _UserID = string.Empty;

            clsGlobalVariable.strExceptionReport = string.Empty;
            string        statusCode       = string.Empty;
            string        statusCodeUpdate = string.Empty;
            string        result           = string.Empty;
            string        resultput        = string.Empty;
            clsGeneric    oGeneric         = new clsGeneric();
            string        URI       = string.Empty;
            string        courseID  = string.Empty;
            bool          _flag     = false;
            List <string> lCourseId = new List <string>();
            string        resultnew = string.Empty;
            string        sessionId = string.Empty;

            Hashtable hTable = new Hashtable();

            hTable = oGeneric.GetTestData(oObject);

            clsPage oPage = new clsPage(iWebdriver);

            lCourseId = oPage.GetCourseId(hTable["CourseName"].ToString());
            clsGenericAPI oclsGenericAPI = new clsGenericAPI();


            _orgID       = oPage.GetOrganizationID();
            clsAPI.orgID = _orgID;
            oclsGenericAPI.GetORGCredentials(out _ecomTransactionKey, out _ecomLoginKey, _orgID);
            User oUser = new User();

            try
            {
                if (hTable["FunctionFor"].ToString().ToUpper() == "ALL")
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSessionID.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);


                    var oSessionData = JsonConvert.DeserializeObject <List <clsAPISession> >(result);

                    if (result == "")
                    {
                        return(false);
                    }
                    if (oSessionData.Count > 0)
                    {
                        _flag = true;
                    }
                }
                else if (hTable["FunctionFor"].ToString().ToUpper() == "ROOMNAME")
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSessionID.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);


                    var oSessionData = JsonConvert.DeserializeObject <List <clsAPISession> >(result);

                    for (int iSessionCounter = 0; iSessionCounter < oSessionData.Count; iSessionCounter++)
                    {
                        if (oSessionData[iSessionCounter].RoomName == hTable["RoomName"].ToString())
                        {
                            sessionId = oSessionData[iSessionCounter].SessionID; break;
                        }
                    }

                    if (sessionId == "")
                    {
                        return(false);
                    }

                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSessionID.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()) + "/" + sessionId, oUser, "H1", _ecomLoginKey, _ecomTransactionKey);

                    var oSessionDatanew = JsonConvert.DeserializeObject <List <clsAPISession> >(result);
                    if (oSessionDatanew.Count == 1)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSessionID.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()) + "?sessionstartdate=" + hTable["StartDate"] + "&sessionenddate=" + hTable["EndDate"], oUser, "H1", _ecomLoginKey, _ecomTransactionKey);

                    if (hTable["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                    {
                        if (statusCode.Contains("204") || statusCode.Contains("200"))
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                    var oSessionData = JsonConvert.DeserializeObject <List <clsAPISession> >(result);

                    if (result == "")
                    {
                        return(false);
                    }
                    if (oSessionData.Count > 0)
                    {
                        _flag = true;
                    }
                }
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }


            return(_flag);
        }
Esempio n. 7
0
        public bool APIEcomEnrollment(object[] lStrvalue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode       = string.Empty;
            string     uriApiCredential = string.Empty;
            string     result           = string.Empty;
            clsGeneric oGeneric         = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;


            try
            {
                EcomEnrolUser oEcomEnrolUser = new EcomEnrolUser();

                oEcomEnrolUser.OrderID = htblTestData["OrderID"].ToString();
                oEcomEnrolUser.UserID  = htblTestData["UserID"].ToString();
                clsAPI.orgID           = htblTestData["OrgID"].ToString();


                GetAPICredentials oGetAPICredentials = new GetAPICredentials();

                URI = ApplicationSettings.APIURI() + clsAPI.EcomCourseSeats.Replace("$", clsAPI.orgID) + clsAPI.EcommMgrID.Replace("#", clsAPI.userid);
                uriApiCredential = ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID);

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET",
                                                uriApiCredential, oEcomEnrolUser, "H2", _ecomLoginKey, _ecomTransactionKey);

                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);


                URI = string.Empty;
                URI = ApplicationSettings.APIURI() + clsAPI.EcommEnrolUser.Replace("{orgid}", htblTestData["OrgID"].ToString()).Replace("{userid}", htblTestData["EcomUserId"].ToString()).Replace("{courseid}", htblTestData["CourseID"].ToString());
                oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), URI, oEcomEnrolUser, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (statusCode.Contains("204"))
                    {
                        _Flag = true;
                    }
                }
                else
                {
                    if (!statusCode.Contains("204"))
                    {
                        _Flag = true;
                    }
                }

                return(_Flag);
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
        }
Esempio n. 8
0
        public bool ModifyDepartment(Hashtable hTable)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            string     RegionResult = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            string     strGroupID   = string.Empty;

            List <string> lCourseId = new List <string>();
            bool          _Flag     = false;
            string        _UserID   = string.Empty;

            try
            {
                clsPage      oPage   = new clsPage(iWebdriver);
                clsRegionApi oRegion = new clsRegionApi();
                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;
                //  oRegion.name = hTable["Name"].ToString();

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oGetAPICredentials, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);

                //Get All Regions Data of above organization
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.Region.Replace("{orgid}", _orgID), oRegion, "H1", _ecomLoginKey, _ecomTransactionKey);

                //Convert the JSON data in List and put in a Local variable
                var RegionData = JsonConvert.DeserializeObject <List <GetRegion> >(result);

                //Find for my region and get its id and put in a variable

                string RegID = "";
                for (int iRegions = 0; iRegions < RegionData.Count; iRegions++)
                {
                    if (RegionData[iRegions].Name.Contains(hTable["RegionName"].ToString()))
                    {
                        RegID = RegionData[iRegions].ID.ToString();
                        break;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }

                //Get All Divisions of a Region
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", clsAPI.apiURI + clsAPI.updateRegion.Replace("{orgid}", _orgID).Replace("{regionID}", RegID) + "/divisions", oRegion, "H1", _ecomLoginKey, _ecomTransactionKey);


                var DivisionData = JsonConvert.DeserializeObject <List <GetRegion> >(result);

                //Find for my division and get its id and put in a variable

                string DivID = "";
                for (int iDivs = 0; iDivs < DivisionData.Count; iDivs++)
                {
                    if (DivisionData[iDivs].Name.Contains(hTable["DivisionName"].ToString()))
                    {
                        DivID = DivisionData[iDivs].ID.ToString();
                        break;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }

                //Get All Depts of a Reg and Division
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", clsAPI.apiURI + clsAPI.GetAllDepartments.Replace("{orgid}", _orgID).Replace("{regionID}", RegID).Replace("{divisionID}", DivID), oRegion, "H1", _ecomLoginKey, _ecomTransactionKey);

                var DeptData = JsonConvert.DeserializeObject <List <GetRegion> >(result);

                //Find for my dept and get its id and put in a variable

                string DeptID = "";
                for (int iDepts = 0; iDepts < DeptData.Count; iDepts++)
                {
                    if (DeptData[iDepts].Name.Contains(hTable["OldDeptName"].ToString()))
                    {
                        DeptID = DeptData[iDepts].ID.ToString();
                        break;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }

                Thread.Sleep(clsGlobalVariable.iWaitMedium);

                if (hTable["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    clsDepartmentApi DepartmentData = new clsDepartmentApi();

                    DepartmentData.Name = hTable["NewDeptName"].ToString();

                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "PUT", clsAPI.apiURI + clsAPI.GetSingleDepartment.Replace("{orgid}", _orgID).Replace("{regionID}", RegID).Replace("{divisionID}", DivID).Replace("{deptID}", DeptID), DepartmentData, "H1", _ecomLoginKey, _ecomTransactionKey);
                    if (statusCode == "NoContent/204")
                    {
                        _Flag = true;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }

            return(true);
        }
Esempio n. 9
0
        public bool UpdateCourseDuedateSetting(Hashtable hTable)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string        statusCode = string.Empty;
            string        result     = string.Empty;
            clsGeneric    oGeneric   = new clsGeneric();
            string        URI        = string.Empty;
            List <string> lCourseId  = new List <string>();
            bool          _Flag      = false;

            try
            {
                clsPage oPage = new clsPage(iWebdriver);

                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;

                //Getting org API credentials
                GetAPICredentials oGetAPICredentials = new GetAPICredentials();
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oGetAPICredentials, "H2", "", "");
                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);

                //Getting the couse ID
                lCourseId = oPage.GetCourseId(hTable["CourseName"].ToString());

                if (hTable["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    DefaultDueDateSetting oDefaultDueDateSetting = new DefaultDueDateSetting();
                    oDefaultDueDateSetting.DefaultDueDate      = hTable["NewDuedateDefault"].ToString();
                    oDefaultDueDateSetting.DaysAfterEnrollment = hTable["NewDuedateAfterEnrollment"].ToString();

                    //Modifying old duedate
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "PUT", ApplicationSettings.APIURI() + clsAPI.CourseDuedateSetting.Replace("{orgid}", _orgID).Replace("{courseID}", lCourseId[0].ToString().Trim()), oDefaultDueDateSetting, "H1", _ecomLoginKey, _ecomTransactionKey);

                    //Getting new duedate after updating
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.CourseDuedateSetting.Replace("{orgid}", _orgID).Replace("{courseID}", lCourseId[0].ToString().Trim()), oDefaultDueDateSetting, "H1", _ecomLoginKey, _ecomTransactionKey);
                    var oCoursesettingdata = JsonConvert.DeserializeObject <DefaultDueDateSetting>(result);


                    string newDuedateAfterEnrollment = oCoursesettingdata.DaysAfterEnrollment;
                    string newDefaultDuedate         = oCoursesettingdata.DefaultDueDate;


                    if (!string.IsNullOrEmpty(newDuedateAfterEnrollment))
                    {
                        if (newDuedateAfterEnrollment.Contains(hTable["NewDuedateAfterEnrollment"].ToString()))
                        {
                            if (string.IsNullOrEmpty(newDefaultDuedate) && hTable["NewDuedateDefault"].ToString() == "null")
                            {
                                _Flag = true;
                            }
                            else
                            {
                                _Flag = false;
                            }
                        }

                        else
                        {
                            _Flag = false;
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(newDefaultDuedate))
                        {
                            if (string.IsNullOrEmpty(newDuedateAfterEnrollment) && hTable["NewDuedateAfterEnrollment"].ToString() == "null")
                            {
                                if (newDefaultDuedate.Contains(hTable["NewDuedateDefault"].ToString()))
                                {
                                    _Flag = true;
                                }

                                else
                                {
                                    _Flag = false;
                                }
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(newDuedateAfterEnrollment) && hTable["NewDuedateAfterEnrollment"].ToString() == "null")
                                {
                                    if (string.IsNullOrEmpty(newDefaultDuedate) && hTable["NewDuedateDefault"].ToString() == "null")
                                    {
                                        _Flag = true;
                                    }

                                    else
                                    {
                                        _Flag = false;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
            return(_Flag);
        }
Esempio n. 10
0
        /// <summary>
        /// Function to create organization ,Copy super admin course to created org and create ecom manager
        /// </summary>
        /// <param name="lStrvalue">XML Parameter</param>
        /// <returns></returns>
        public bool APICreateOrganizationCopyCourse(object[] lStrvalue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;
            clsCoursePushDown clData = new clsCoursePushDown();

            Organization organization = new Organization();

            organization.Name = htblTestData["OrganizationName"].ToString();

            User user = new User();

            user.F001 = htblTestData["UserFirstName"].ToString();
            user.F003 = htblTestData["UserLastName"].ToString();
            user.F015 = htblTestData["UserEmail"].ToString();
            user.F023 = htblTestData["TimeZone"].ToString();
            user.F006 = htblTestData["Language"].ToString();

            List <SuperAdminCourseRecords> lstRecords = new List <SuperAdminCourseRecords>();

            string[] strCourses = htblTestData["SuperAdminCourseId"].ToString().Split(',');

            foreach (string strCourseID in strCourses)
            {
                SuperAdminCourseRecords course = new SuperAdminCourseRecords();
                course.NumberOfSeats      = htblTestData["Seats"].ToString();
                course.SuperAdminCourseID = string.Empty;
                course.SuperAdminCourseID = strCourseID;
                lstRecords.Add(course);
            }

            clData.Organization            = organization;
            clData.User                    = user;
            clData.SuperAdminCourseRecords = lstRecords;
            clData.OrderID                 = htblTestData["OrderID"].ToString();
            clData.PurchaseDate            = htblTestData["PurchaseDate"].ToString();

            try
            {
                oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), ApplicationSettings.APIURI() + htblTestData["URI"].ToString(), clData, htblTestData["HeaderType"].ToString(), "", "");

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (result.ToUpper().Contains("!DOCTYPE"))
                    {
                        clsGlobalVariable.strExceptionReport = "Resource not found";
                        return(true);
                    }

                    if (statusCode.Contains("201"))
                    {
                        RequestID oRequest = JsonConvert.DeserializeObject <RequestID>(result);
                        URI    = ApplicationSettings.APIURI() + htblTestData["URI"].ToString() + "/" + oRequest.requestID.ToString();
                        result = string.Empty;
                        //   oGeneric.GetApiResponseCodeData(out statusCode, out result, "Get", URI, clData, htblTestData["HeaderType"].ToString(), "", "");
                        Thread.Sleep(20000);

                        AccountRequests oRequestData;
                        do
                        {
                            Thread.Sleep(10000);
                            oGeneric.GetApiResponseCodeData(out statusCode, out result, "Get", URI, clData, htblTestData["HeaderType"].ToString(), "", "");
                            Application.DoEvents();
                            oRequestData = JsonConvert.DeserializeObject <AccountRequests>(result);
                        } while (oRequestData.NewlyCreatedOrganizaitonInformation.OrganizationID == "0");

                        int courseCounter = 0;

                        clsAPI.orgID  = oRequestData.NewlyCreatedOrganizaitonInformation.OrganizationID;
                        clsAPI.userid = oRequestData.NewlyCreatedeComMgrInformation.UserID;
                        foreach (string strCourseID in strCourses)
                        {
                            if (strCourseID == oRequestData.CourseResults[courseCounter].SuperAdminCourseID.ToString())
                            {
                                courseCounter++;
                                _Flag = true;
                            }
                            else
                            {
                                courseCounter++;
                                _Flag = false;
                            }
                        }

                        if (_Flag == true)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        var oError = JsonConvert.DeserializeObject <List <SuperAdminCoursePushDownError> >(result);
                        clsGlobalVariable.strExceptionReport = "Invalid URI: Error Code: " + oError[0].ErrorCode + "\n Error Description: " + oError[0].ErrorMessage;
                        return(false);
                    }
                }
                else if (htblTestData["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                {
                    if (result.ToUpper().Contains("!DOCTYPE"))
                    {
                        clsGlobalVariable.strExceptionReport = "Resource not found";
                        return(true);
                    }

                    if (statusCode.Contains("4") || statusCode.Contains("5"))
                    {
                        if (statusCode.Contains("404") || statusCode.Contains("500") || statusCode.Contains("405"))
                        {
                            clsGlobalVariable.strExceptionReport = "Resource not found";
                            return(true);
                        }
                        var oError = JsonConvert.DeserializeObject <List <SuperAdminCoursePushDownError> >(result);
                        SuperAdminCoursePushDownErrorCode oErrorCode = new SuperAdminCoursePushDownErrorCode();
                        foreach (string strErrorCode in oErrorCode.coursePushDownErrorCode)
                        {
                            if (strErrorCode == oError[0].ErrorCode)
                            {
                                _Flag = true;
                            }
                        }
                        if (_Flag == true)
                        {
                            return(true);
                        }
                        else
                        {
                            clsGlobalVariable.strExceptionReport = "Negative Case Failed!";
                            return(false);
                        }
                    }
                    else
                    {
                        clsGlobalVariable.strExceptionReport = "Resource or URI Wrong!";
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
        }
Esempio n. 11
0
        public bool APICopyCourseForExistingOrganization(object[] lStrvalue)
        {
            string header = string.Empty;

            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;

            CopyCourseWithExistingOrganization oCopyCourseWithExistingOrganization = new CopyCourseWithExistingOrganization();
            SuperAdminCourseRecords            oSuperAdminCourseRecords            = new SuperAdminCourseRecords();

            List <SuperAdminCourseRecords> lstRecords = new List <SuperAdminCourseRecords>();

            string[] strCourses = htblTestData["CourseName"].ToString().Split(',');
            try
            {
                foreach (string strCourseID in strCourses)
                {
                    SuperAdminCourseRecords course = new SuperAdminCourseRecords();
                    course.NumberOfSeats      = htblTestData["Seats"].ToString();
                    course.SuperAdminCourseID = string.Empty;
                    course.SuperAdminCourseID = strCourseID;
                    lstRecords.Add(course);
                }

                oCopyCourseWithExistingOrganization.UserID = htblTestData["USERID"].ToString();
                oCopyCourseWithExistingOrganization.SuperAdminCourseRecords = lstRecords;
                oCopyCourseWithExistingOrganization.OrderID      = htblTestData["USERID"].ToString();
                oCopyCourseWithExistingOrganization.PurchaseDate = htblTestData["PurchaseDate"].ToString();
                #region
                if ((htblTestData["orgID"].ToString().Trim() == ""))
                {
                    lstRecords.Clear();

                    lstRecords = new List <SuperAdminCourseRecords>();

                    foreach (string strCourseID in strCourses)
                    {
                        SuperAdminCourseRecords course = new SuperAdminCourseRecords();
                        course.NumberOfSeats      = htblTestData["Seats"].ToString();
                        course.SuperAdminCourseID = string.Empty;
                        course.SuperAdminCourseID = strCourseID;
                        lstRecords.Add(course);
                    }

                    oCopyCourseWithExistingOrganization.SuperAdminCourseRecords = lstRecords;
                    oCopyCourseWithExistingOrganization.UserID = clsAPI.userid;

                    GetAPICredentials oGetAPICredentials = new GetAPICredentials();

                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID), oCopyCourseWithExistingOrganization, "H2", "", "");

                    var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                    Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                    _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                    _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), ApplicationSettings.APIURI() + htblTestData["URI"].ToString(), oCopyCourseWithExistingOrganization, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);
                }
                else
                {
                    #endregion
                    _ecomTransactionKey = ApplicationSettings.TransactionKey();
                    _ecomLoginKey       = ApplicationSettings.APILoginID();
                    clsAPI.orgID        = htblTestData["orgID"].ToString();
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), ApplicationSettings.APIURI() + htblTestData["URI"].ToString(), oCopyCourseWithExistingOrganization, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);
                }

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (result.ToUpper().Contains("!DOCTYPE"))
                    {
                        clsGlobalVariable.strExceptionReport = "Resource not found";
                        return(true);
                    }

                    if (statusCode.Contains("201"))
                    {
                        header = htblTestData["HeaderType"].ToString();

                        RequestID oRequest = JsonConvert.DeserializeObject <RequestID>(result);
                        URI    = ApplicationSettings.APIURI() + clsAPI.apiStatus + oRequest.requestID.ToString();
                        result = string.Empty;
                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "Get", URI, oCopyCourseWithExistingOrganization, "H2", "", "");
                        AccountRequests oRequestData  = JsonConvert.DeserializeObject <AccountRequests>(result);
                        int             courseCounter = 0;

                        foreach (string strCourseID in strCourses)
                        {
                            if (strCourseID == oRequestData.CourseResults[courseCounter].SuperAdminCourseID.ToString())
                            {
                                courseCounter++;
                                _Flag = true;
                            }
                            else
                            {
                                courseCounter++;
                                _Flag = false;
                            }
                        }

                        if (_Flag == true)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        var oError = JsonConvert.DeserializeObject <List <SuperAdminCoursePushDownError> >(result);
                        clsGlobalVariable.strExceptionReport = "Invalid URI: Error Code: " + oError[0].ErrorCode + "\n Error Description: " + oError[0].ErrorMessage;
                        return(false);
                    }
                }
                else if (htblTestData["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                {
                    if (result.ToUpper().Contains("!DOCTYPE"))
                    {
                        clsGlobalVariable.strExceptionReport = "Resource not found";
                        return(true);
                    }

                    if (statusCode.Contains("4") || statusCode.Contains("5"))
                    {
                        if (statusCode.Contains("404") || statusCode.Contains("500") || statusCode.Contains("405"))
                        {
                            clsGlobalVariable.strExceptionReport = "Resource not found";
                            return(true);
                        }
                        var oError = JsonConvert.DeserializeObject <List <SuperAdminCoursePushDownError> >(result);
                        SuperAdminCoursePushDownErrorCode oErrorCode = new SuperAdminCoursePushDownErrorCode();
                        foreach (string strErrorCode in oErrorCode.coursePushDownErrorCode)
                        {
                            if (strErrorCode == oError[0].ErrorCode)
                            {
                                _Flag = true;
                            }
                        }
                        if (_Flag == true)
                        {
                            return(true);
                        }
                        else
                        {
                            clsGlobalVariable.strExceptionReport = "Negative Case Failed!";
                            return(false);
                        }
                    }
                    else
                    {
                        clsGlobalVariable.strExceptionReport = "Resource or URI Wrong!";
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Function to pass Account Request ID and get data related to Request
        /// </summary>
        /// <param name="lStrvalue">XML Parameter</param>
        /// <returns></returns>
        public bool APIGetAccountRequestStatus(object[] lStrvalue)
        {
            string strError = string.Empty;

            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            string[] strCourseName = htblTestData["CourseName"].ToString().Split(',');

            bool _Flag = false;
            clsCoursePushDown clData = new clsCoursePushDown();

            try
            {
                oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), ApplicationSettings.APIURI() + htblTestData["URI"].ToString(), clData, htblTestData["HeaderType"].ToString(), "", "");

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (statusCode.Contains("201"))
                    {
                        var oAccountRequest = JsonConvert.DeserializeObject <AccountRequests>(result);
                        for (int courseNameCounter = 0; courseNameCounter < strCourseName.Length; courseNameCounter++)
                        {
                            for (int courseResultCounter = 0; courseResultCounter < oAccountRequest.CourseResults.Count; courseResultCounter++)
                            {
                                if (oAccountRequest.CourseResults[courseResultCounter].SuperAdminCourseID.ToString() == strCourseName[courseNameCounter])
                                {
                                    if (oAccountRequest.CourseResults[courseResultCounter].IsErrorOccurred != "true")
                                    {
                                        _Flag = true;
                                        break;
                                    }
                                    else
                                    {
                                        strError = oAccountRequest.CourseResults[courseResultCounter].ErrorDescription;
                                    }
                                }
                            }
                        }

                        if (_Flag == true)
                        {
                            return(true);
                        }
                        else
                        {
                            clsGlobalVariable.strExceptionReport = strError;
                            return(false);
                        }
                    }
                }
                else if (htblTestData["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                {
                    if (statusCode.Contains("40") || statusCode.Contains("50"))
                    {
                        return(true);
                    }
                    else
                    {
                        clsGlobalVariable.strExceptionReport = "Negative Case Failed!";
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
        }
Esempio n. 13
0
        public bool APIGetUser(object[] lStrvalue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode            = string.Empty;
            string     result                = string.Empty;
            string     allCourseResultresult = string.Empty;
            string     singleCourseresult    = string.Empty;
            clsGeneric oGeneric              = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;

            UserEnrollment userID = new UserEnrollment();

            GetAPICredentials oGetAPICredentials = new GetAPICredentials();

            //Get Org ID at runtime
            clsPage oPage = new clsPage(iWebdriver);

            _orgID       = oPage.GetOrganizationID();
            clsAPI.orgID = _orgID;
            try
            {
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID), oGetAPICredentials, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);

                if (htblTestData["RequestType"].ToString() == "All")
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", clsAPI.orgID), userID, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);
                    var userData = JsonConvert.DeserializeObject <List <Users> >(result);
                    if (userData.Count > 1)
                    {
                        _Flag = true;
                    }
                    else
                    {
                        _Flag = false;
                    }

                    return(_Flag);
                }

                if (htblTestData["RequestType"].ToString() == "Single")
                {
                    //Get All Users
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", clsAPI.orgID), userID, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                    var userData = JsonConvert.DeserializeObject <List <Users> >(result);

                    if (userData.Count > 0)
                    {
                        //Find the User that we created and get its ID
                        for (int iEnrolUser = 0; iEnrolUser < userData.Count; iEnrolUser++)
                        {
                            if (userData[iEnrolUser].Profile.F015.ToString().Contains(htblTestData["UserEmail"].ToString()))
                            {
                                string userid = userData[iEnrolUser].ID.ToString();

                                //Use the ID to create a specific URL to get particular user
                                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSingleUser.Replace("{orgID}", clsAPI.orgID).Replace("{UserID}", userid), userID, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                                var singleUserData = JsonConvert.DeserializeObject <Users>(result);

                                if (singleUserData.Profile.F015.Contains(htblTestData["UserEmail"].ToString()))
                                {
                                    _Flag = true;
                                    break;
                                }
                                else
                                {
                                    _Flag = false;
                                }
                            }
                            else
                            {
                                _Flag = false;
                            }
                        }
                    }
                }
                return(_Flag);
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// function to perform get request for transcript along with verification
        /// </summary>
        /// <param name="hTable">this is data used for this function to perform operation</param>
        /// <returns>true/false</returns>
        private bool GetTranscript(Hashtable hTable)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode = string.Empty;
            string     result     = string.Empty;
            clsGeneric oGeneric   = new clsGeneric();
            string     URI        = string.Empty;
            string     courseID   = string.Empty;

            bool   _Flag   = false;
            string _UserID = string.Empty;

            try
            {
                clsPage oPage = new clsPage(iWebdriver);

                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;
                courseID     = GetID(hTable["CourseName"].ToString(), hTable["TranscriptFor"].ToString());

                Users oUser = new Users();

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();
                ////////////////////get api credentials for organization

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oUser, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);


                #region get user id by there type

                if (hTable["UserStatus"].ToString().ToUpper().Contains("INACTIVE"))
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID) + "?F015=" + hTable["UserEmail"].ToString() + "*&userstatus=inactive", oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                else if (hTable["UserStatus"].ToString().ToUpper().Contains("DELETED"))
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID) + "?F015=" + hTable["UserEmail"].ToString() + "*&userstatus=Deleted", oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                else
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                var oUserData = JsonConvert.DeserializeObject <List <Users> >(result);



                for (int iUser = 0; iUser < oUserData.Count; iUser++)
                {
                    if (oUserData[iUser].Profile.F015.ToString() == hTable["UserMailID"].ToString().Trim())
                    {
                        _UserID = oUserData[iUser].ID;
                        break;
                    }
                }

                #endregion

                #region Activate deactivate course
                clsAPI_Courses oclsAPI_Courses = new clsAPI_Courses(iWebdriver);

                oclsAPI_Courses.ActivateDeactiveCourse(hTable["CourseName"].ToString(), hTable["CourseStatus"].ToString().ToUpper());

                #endregion

                //////////function to perform transcript function
                if (hTable["TranscriptFor"].ToString().ToUpper() == "CURRICULA")
                {
                    _Flag = CurriclaTranscript(_orgID, _UserID, hTable["TestCaseType"].ToString(), hTable["CourseName"].ToString());
                }
                else if (hTable["TranscriptFor"].ToString().ToUpper() == "SESSION")
                {
                }
                else
                {
                    _Flag = GetUserTranscript(_orgID, _UserID, hTable["TestCaseType"].ToString(), hTable["CourseName"].ToString());
                }
                if (_Flag == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception er)
            {
                clsGlobalVariable.strExceptionReport = "Something went wrong while fetching data from api";
                return(false);
            }
        }
Esempio n. 15
0
        /// <summary>
        /// function to get user transcript
        /// </summary>
        /// <param name="orgID">organization id</param>
        /// <param name="userID">user id</param>
        /// <param name="testCaseType">positive/negative</param>
        /// <param name="certificationCourseName">course name</param>
        /// <returns>true/false</returns>
        public bool GetUserTranscript(string orgID, string userID, string testCaseType, string certificationCourseName)
        {
            bool             _flag             = false;
            string           statusCode        = string.Empty;
            string           result            = string.Empty;
            clsGeneric       oGeneric          = new clsGeneric();
            clsAPITranscript oclsAPITranscript = new clsAPITranscript();

            try
            {
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetUserTranscript.Replace("{orgID}", orgID).Replace("{userid}", userID), oclsAPITranscript, "H1", _ecomLoginKey, _ecomTransactionKey);

                if (testCaseType.ToUpper() == "NEGATIVE")
                {
                    if (statusCode == "OK/200")
                    {
                        _flag = true;
                    }
                    else
                    {
                        _flag = false;
                    }
                }
                else if (testCaseType.ToUpper() == "POSITIVE")
                {
                    if (statusCode == "OK/200")
                    {
                        _flag = true;
                    }
                    else
                    {
                        _flag = false;
                    }
                }
                else if (testCaseType == "CERTIFICATION")
                {
                    try
                    {
                        var certCourseID = JsonConvert.DeserializeObject <List <clsAPITranscript> >(result);

                        var courseid = certCourseID.Where(cus => cus.CourseName == certificationCourseName);

                        List <ILMS.clsAPITranscript> t = new List <clsAPITranscript>();
                        t = courseid.ToList();
                        UserEnrollment ouser = new UserEnrollment();
                        ouser.userid = userID;

                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "POST", ApplicationSettings.APIURI() + clsAPI.EnrollRecertification.Replace("{orgid}", orgID).Replace("{CourseID}", t[0].CourseID.ToString()), ouser, "H1", _ecomLoginKey, _ecomTransactionKey);


                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetUserTranscript.Replace("{orgID}", orgID).Replace("{courseID}", t[0].CourseID.ToString()).Replace("{userid}", userID), ouser, "H1", _ecomLoginKey, _ecomTransactionKey);


                        var status = JsonConvert.DeserializeObject <List <clsAPITranscript> >(result);

                        if (status.Count > 0)
                        {
                            courseid = status.Where(cus => cus.CourseName == certificationCourseName);
                            t        = courseid.ToList();

                            if (t[0].Status.ToUpper() == "NOT STARTED")
                            {
                                _flag = true;
                            }
                            else
                            {
                                _flag = false;
                            }
                        }
                        else
                        {
                            _flag = false;
                        }
                    }
                    catch (Exception er) { clsGlobalVariable.strExceptionReport = "Recertification scenario failed"; return(false); }
                }
            }
            catch { clsGlobalVariable.strExceptionReport = "Get transcript scenario failed"; return(false); }
            return(_flag);
        }
        public bool APIExtendLicense(object[] lStrvalue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;

            string[] strUserId   = htblTestData["UserID"].ToString().Split(',');
            string[] strCourseId = htblTestData["OrgCourseID"].ToString().Split(',');

            RootAPIExtendLicense oRootAPIExtendLicense = new RootAPIExtendLicense();

            try
            {
                List <APIExtendLicense> ol = new List <ILMS.APIExtendLicense>();
                foreach (string Course in strCourseId)
                {
                    APIExtendLicense oListAPIExtendLicense = new ILMS.APIExtendLicense();
                    List <string>    olist = new List <string>();
                    foreach (string userid in strUserId)
                    {
                        olist.Add(userid);
                    }
                    oListAPIExtendLicense.LearnerIDs  = olist;
                    oListAPIExtendLicense.OrgCourseID = Course;
                    ol.Add(oListAPIExtendLicense);
                }
                oRootAPIExtendLicense.CourseUserRecords = ol;

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();


                Thread.Sleep(5000);
                do
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", htblTestData["OrgID"].ToString()), oRootAPIExtendLicense, "H2", "", "");

                    if (result.Contains("Login"))
                    {
                        break;
                    }
                } while (result.Contains("Login"));
                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);
                clsAPI.orgID        = htblTestData["OrgID"].ToString();
                oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), ApplicationSettings.APIURI() + clsAPI.apiExtendLicense.Replace("$", htblTestData["OrgID"].ToString()).Replace("#", htblTestData["EcomID"].ToString()), oRootAPIExtendLicense, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (result.Contains("") && !result.Contains("Error"))
                    {
                        _Flag = true;
                    }
                }
                else
                {
                    if (!result.Contains("Error"))
                    {
                        _Flag = true;
                    }
                }

                return(_Flag);
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
        }
Esempio n. 17
0
        public bool GetResetPasswordUrl(object[] lStrvalue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;

            clsCoursePushDown clData = new clsCoursePushDown();

            GetAPICredentials oGetAPICredentials = new GetAPICredentials();

            try
            {
                if (htblTestData["OrgID"].ToString() != "")
                {
                    clsAPI.orgID  = htblTestData["OrgID"].ToString();
                    clsAPI.userid = htblTestData["UserID"].ToString();
                }


                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID), clData, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);
                // clsAPI.orgID = htblTestData["OrgID"].ToString();
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.apiResetPasswordURL.Replace("$", clsAPI.orgID).Replace("#", clsAPI.userid), clData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (result.Contains("Url"))
                    {
                        ResetPasswordURL oResetPasswordURL = new ResetPasswordURL();
                        var oResetPassword = JsonConvert.DeserializeObject <ResetPasswordURL>(result);
                        iWebdriver.Navigate().GoToUrl(oResetPassword.URL);
                        _Flag = true;
                    }
                }
                else
                {
                    if (!result.Contains("Url"))
                    {
                        _Flag = true;
                    }
                }

                return(_Flag);
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
        }
Esempio n. 18
0
        public bool GetCurricula(object[] oObject)
        {
            string _UserID = string.Empty;

            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode       = string.Empty;
            string     statusCodeUpdate = string.Empty;
            string     result           = string.Empty;
            string     resultput        = string.Empty;
            clsGeneric oGeneric         = new clsGeneric();
            string     URI       = string.Empty;
            string     courseID  = string.Empty;
            bool       _flag     = false;
            string     lCourseId = string.Empty;
            string     resultnew = string.Empty;
            string     sessionId = string.Empty;

            Hashtable hTable = new Hashtable();

            hTable = oGeneric.GetTestData(oObject);

            clsPage oPage = new clsPage(iWebdriver);

            lCourseId = oPage.GetCurriculumId(hTable["CourseName"].ToString());
            clsGenericAPI oclsGenericAPI = new clsGenericAPI();


            _orgID       = oPage.GetOrganizationID();
            clsAPI.orgID = _orgID;
            oclsGenericAPI.GetORGCredentials(out _ecomTransactionKey, out _ecomLoginKey, _orgID);
            User oUser = new User();

            try
            {
                if (hTable["FunctionFor"].ToString().ToUpper() == "ALL")
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetCuriculla.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);


                    var oCurriculaData = JsonConvert.DeserializeObject <List <curiculla> >(result);

                    if (result == "")
                    {
                        return(false);
                    }
                    if (oCurriculaData.Count > 0)
                    {
                        _flag = true;
                    }
                }
                else if (hTable["FunctionFor"].ToString().ToUpper() == "SPECIFIC")
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetCuriculla.Replace("{orgid}", _orgID) + "/" + lCourseId, oUser, "H1", _ecomLoginKey, _ecomTransactionKey);


                    var oSessionData = JsonConvert.DeserializeObject <List <curiculla> >(result);


                    if (oSessionData.Count == 1)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    DefaultDueDateSettings oDefaultDueDateSettings = new DefaultDueDateSettings();

                    oDefaultDueDateSettings.DefaultDueDate      = hTable["DefaultDueDate"].ToString();
                    oDefaultDueDateSettings.DaysAfterEnrollment = hTable["DaysAfterEnrollment"].ToString();
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "PUT", ApplicationSettings.APIURI() + clsAPI.GetCuriculla.Replace("{orgid}", _orgID) + "/" + lCourseId + "/DueDate", oDefaultDueDateSettings, "H1", _ecomLoginKey, _ecomTransactionKey);

                    if (hTable["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                    {
                        if (statusCode.Contains("204") || statusCode.Contains("200"))
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }

                    if (statusCode.Contains("204") || statusCode.Contains("200"))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception er) { }


            return(_flag);
        }
Esempio n. 19
0
        public bool FetchCourseDuedateSetting(Hashtable hTable)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string        statusCode = string.Empty;
            string        result     = string.Empty;
            clsGeneric    oGeneric   = new clsGeneric();
            string        URI        = string.Empty;
            List <string> lCourseId  = new List <string>();
            bool          _Flag      = false;
            string        _UserID    = string.Empty;

            try
            {
                clsPage oPage = new clsPage(iWebdriver);

                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;

                //Getting org API credentials
                GetAPICredentials oGetAPICredentials = new GetAPICredentials();
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oGetAPICredentials, "H2", "", "");
                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);

                DefaultDueDateSetting oDefaultDueDateSetting = new DefaultDueDateSetting();

                //Getting couse id of my course
                lCourseId = oPage.GetCourseId(hTable["CourseName"].ToString());


                //Hitting API URI
                if (hTable["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    //organizations/{orgID}/courses/{courseID}/duedate
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.CourseDuedateSetting.Replace("{orgid}", _orgID).Replace("{courseID}", lCourseId[0].ToString().Trim()), oDefaultDueDateSetting, "H1", _ecomLoginKey, _ecomTransactionKey);

                    //var oCoursesettingdata = JsonConvert.DeserializeObject<DefaultDueDateSetting>(result);


                    if (statusCode == "OK/200")
                    {
                        _Flag = true;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }

                else if
                (hTable["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.CourseDuedateSetting.Replace("{orgid}", _orgID).Replace("{courseID}", lCourseId[0].ToString().Trim()), oDefaultDueDateSetting, "H1", _ecomLoginKey, _ecomTransactionKey);
                    if (result.Contains("ErrorCode"))
                    {
                        _Flag = true;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }

            return(_Flag);
        }
Esempio n. 20
0
        public bool Enrolluser(object[] lStrValue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrValue);
            string lCourseId = string.Empty;
            bool   _Flag     = false;
            string _UserID   = string.Empty;

            try
            {
                clsPage oPage = new clsPage(iWebdriver);

                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;
                lCourseId    = oPage.GetCurriculumId(htblTestData["CurriculumName"].ToString());

                Users oUser = new Users();

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();


                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oUser, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);



                if (htblTestData["Status"].ToString().ToUpper().Contains("INACTIVE"))
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID) + "?F015=" + htblTestData["UserEmail"].ToString() + "*&userstatus=inactive", oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                else if (htblTestData["Status"].ToString().ToUpper().Contains("DELETED"))
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID) + "?F015=" + htblTestData["UserEmail"].ToString() + "*&userstatus=Deleted", oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                else
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }



                var oUserData = JsonConvert.DeserializeObject <List <Users> >(result);

                for (int iUser = 0; iUser < oUserData.Count; iUser++)
                {
                    if (oUserData[iUser].Profile.F015.ToString() == htblTestData["UserEmail"].ToString().Trim())
                    {
                        _UserID = oUserData[iUser].ID;
                        break;
                    }
                }



                UserEnrollment oUserEnrollment = new ILMS.UserEnrollment();
                oUserEnrollment.userid = _UserID;
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "POST", ApplicationSettings.APIURI() + clsAPI.CurriculumEnrollment.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId.ToString()), oUserEnrollment, "H1", _ecomLoginKey, _ecomTransactionKey);

                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                {
                    if (result.ToUpper().Contains("!DOCTYPE"))
                    {
                        clsGlobalVariable.strExceptionReport = "Resource not found";
                        return(true);
                    }


                    var oError = JsonConvert.DeserializeObject <List <SuperAdminCoursePushDownError> >(result);
                    SuperAdminCoursePushDownErrorCode oErrorCode = new SuperAdminCoursePushDownErrorCode();
                    foreach (string strErrorCode in oErrorCode.coursePushDownErrorCode)
                    {
                        if (strErrorCode == oError[0].ErrorCode)
                        {
                            _Flag = true;
                        }
                    }
                    if (_Flag == true)
                    {
                        return(true);
                    }
                    else
                    {
                        clsGlobalVariable.strExceptionReport = "Negative Case Failed!";
                        return(false);
                    }
                }

                try
                {
                    if (htblTestData["Status"].ToString().ToUpper() == "Deleted".ToUpper())
                    {
                        if (_Flag == true)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                catch { }
                do
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.CurriculumEnrollment.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId.ToString().Trim()), oUserEnrollment, "H1", _ecomLoginKey, _ecomTransactionKey);
                } while (result == "");

                if (htblTestData["Status"].ToString().ToUpper() == "INACTIVE")
                {
                    do
                    {
                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetTranscript.Replace("{orgid}", _orgID).Replace("{UserID}", _UserID.ToString().Trim()), oUserEnrollment, "H1", _ecomLoginKey, _ecomTransactionKey);
                    } while (result == "");

                    var oTranscriptData = JsonConvert.DeserializeObject <List <clsAPITranscript> >(result);

                    for (int icount = 0; icount < oTranscriptData.Count; icount++)
                    {
                        if (oTranscriptData[icount].CourseName.ToString().ToUpper().Equals(htblTestData["CurriculumName"].ToString().ToUpper()))
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }



                var oCourseData = JsonConvert.DeserializeObject <List <CourseData> >(result);

                for (int iUser = 0; iUser < oCourseData.Count; iUser++)
                {
                    if (oCourseData[iUser].User.Profile_Basic.F015.ToString() == htblTestData["UserEmail"].ToString().Trim())
                    {
                        _UserID = oUserData[iUser].ID;
                        _Flag   = true;
                        break;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }



                if (_Flag == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                clsGlobalVariable.strExceptionReport = "User not enrolled in curriculum.";
                return(false);
            }
        }
        public bool Enrolluser(object[] lStrValue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrValue);
            List <string> lCourseId = new List <string>();
            bool          _Flag     = false;
            string        _UserID   = string.Empty;

            try
            {
                clsPage oPage = new clsPage(iWebdriver);

                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;
                lCourseId    = oPage.GetCourseId(htblTestData["CourseName"].ToString());

                Users oUser = new Users();

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();


                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oUser, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);



                if (htblTestData["Status"].ToString().ToUpper().Contains("INACTIVE"))
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID) + "?F015=" + htblTestData["UserEmail"].ToString() + "*&userstatus=inactive", oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                else if (htblTestData["Status"].ToString().ToUpper().Contains("DELETED"))
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID) + "?F015=" + htblTestData["UserEmail"].ToString() + "*&userstatus=Deleted", oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                else
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);
                }
                var oUserData = JsonConvert.DeserializeObject <List <Users> >(result);

                for (int iUser = 0; iUser < oUserData.Count; iUser++)
                {
                    if (oUserData[iUser].Profile.F015.ToString() == htblTestData["UserEmail"].ToString().Trim())
                    {
                        _UserID = oUserData[iUser].ID;
                        break;
                    }
                }



                UserEnrollment oUserEnrollment = new ILMS.UserEnrollment();
                oUserEnrollment.userid = _UserID;
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "POST", ApplicationSettings.APIURI() + clsAPI.CourseEnrollment.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()), oUserEnrollment, "H1", _ecomLoginKey, _ecomTransactionKey);

                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                {
                    if (result.ToUpper().Contains("!DOCTYPE"))
                    {
                        clsGlobalVariable.strExceptionReport = "Resource not found";
                        return(true);
                    }


                    var oError = JsonConvert.DeserializeObject <List <SuperAdminCoursePushDownError> >(result);
                    SuperAdminCoursePushDownErrorCode oErrorCode = new SuperAdminCoursePushDownErrorCode();
                    foreach (string strErrorCode in oErrorCode.coursePushDownErrorCode)
                    {
                        if (strErrorCode == oError[0].ErrorCode)
                        {
                            _Flag = true;
                        }
                    }
                    if (_Flag == true)
                    {
                        return(true);
                    }
                    else
                    {
                        clsGlobalVariable.strExceptionReport = "Negative Case Failed!";
                        return(false);
                    }
                }


                do
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.CourseEnrollment.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()), oUserEnrollment, "H1", _ecomLoginKey, _ecomTransactionKey);
                } while (result == "");

                if (htblTestData["Status"].ToString().ToUpper() == "INACTIVE")
                {
                    do
                    {
                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetTranscript.Replace("{orgid}", _orgID).Replace("{UserID}", _UserID.ToString().Trim()), oUserEnrollment, "H1", _ecomLoginKey, _ecomTransactionKey);
                    } while (result == "");

                    var oTranscriptData = JsonConvert.DeserializeObject <List <clsAPITranscript> >(result);

                    for (int icount = 0; icount < oTranscriptData.Count; icount++)
                    {
                        if (oTranscriptData[icount].CourseName.ToString().ToUpper().Equals(htblTestData["CourseName"].ToString().ToUpper()))
                        {
                            return(true);
                        }
                    }
                    return(false);
                }


                var oCourseData = JsonConvert.DeserializeObject <List <CourseData> >(result);

                for (int iUser = 0; iUser < oCourseData.Count; iUser++)
                {
                    if (oCourseData[iUser].User.Profile_Basic.F015.ToString() == htblTestData["UserEmail"].ToString().Trim())
                    {
                        _UserID = oUserData[iUser].ID;
                        _Flag   = true;
                        break;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }
                try
                {
                    if (htblTestData["Status"].ToString().ToUpper() == "Deleted".ToUpper())
                    {
                        if (_Flag == true)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                catch { }

                if (_Flag == true)
                {
                    iWebdriver.Navigate().GoToUrl(oPage.SetUrl(htblTestData["url"].ToString()));

                    clsGlobalVariable.strExceptionReport = string.Empty;
                    string   tag      = ApplicationSettings.ElementByPath();
                    object[] objparam = new object[] { ApplicationSettings.EleUserName(),
                             ApplicationSettings.ElePassword(),
                             ApplicationSettings.EleLogin() };


                    System.Threading.Thread.Sleep(clsGlobalVariable.iWaitMedium);
                    if (iWebdriver.GetType().Name.Contains("InternetExplorer") && clsGlobalVariable.IEFlag == true)
                    {
                        iWebdriver.Navigate().GoToUrl("javascript:document.getElementById('overridelink').click()");
                        clsGlobalVariable.IEFlag = false;
                    }
                    try
                    {
                        System.Threading.Thread.Sleep(clsGlobalVariable.iWaitHigh);
                        iWebdriver.FindElement((By)oGeneric.InvokeMethodwith_Param(tag, new object[] { objparam[0].ToString() })).SendKeys(htblTestData["UserEmail"].ToString());
                        iWebdriver.FindElement((By)oGeneric.InvokeMethodwith_Param(tag, new object[] { objparam[1].ToString() })).SendKeys(htblTestData["Password"].ToString());
                        iWebdriver.FindElement((By)oGeneric.InvokeMethodwith_Param(tag, new object[] { objparam[2].ToString() })).Click();

                        iWebdriver.SwitchTo().DefaultContent();
                        iWebdriver.SwitchTo().Frame(clsPageObject.frmLCLeftFrame);
                        iWebdriver.SwitchTo().Frame(clsPageObject.frmLCRightFrameFinal);


                        if (iWebdriver.FindElement(By.XPath(clsPageObject.scormCourseName.Replace("$", htblTestData["CourseName"].ToString()))).Displayed)
                        {
                            return(true);
                        }
                        else
                        {
                            clsGlobalVariable.strExceptionReport = "User is not enrolled in " + htblTestData["CourseName"].ToString();
                            return(false);
                        }
                    }
                    catch (Exception ex)
                    {
                        clsGlobalVariable.strExceptionReport = "User is not enrolled in " + htblTestData["CourseName"].ToString();
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex) { }



            return(_Flag);
        }
Esempio n. 22
0
        public bool GetGroups(object[] lStrValue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode            = string.Empty;
            string     result                = string.Empty;
            string     allCourseResultresult = string.Empty;
            string     singleCourseresult    = string.Empty;
            clsGeneric oGeneric              = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrValue);
            bool _Flag = false;

            clsGroupAPI clGrpData = new clsGroupAPI();

            GetAPICredentials oGetAPICredentials = new GetAPICredentials();

            try
            {
                //Get Org ID at runtime
                clsPage oPage = new clsPage(iWebdriver);
                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID), oGetAPICredentials, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);

                if (htblTestData["RequestType"].ToString() == "All")
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetAllGroups.Replace("{orgid}", clsAPI.orgID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);
                    var groupData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);
                    if (groupData.Count > 1)
                    {
                        _Flag = true;
                    }
                    else
                    {
                        _Flag = false;
                    }

                    return(_Flag);
                }

                if (htblTestData["RequestType"].ToString() == "Single")
                {
                    //Get All Groups
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetAllGroups.Replace("{orgid}", clsAPI.orgID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                    var groupData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);

                    if (groupData.Count > 0)
                    {
                        //Find the Group that we created and get its ID
                        for (int iEnrolUser = 0; iEnrolUser < groupData.Count; iEnrolUser++)
                        {
                            if (groupData[iEnrolUser].Name.ToString().Contains(htblTestData["GroupName"].ToString()))
                            {
                                var groupID = groupData[iEnrolUser].ID.ToString();

                                //Use the ID to create a specific URL to get particular group
                                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetGroupByID.Replace("{orgid}", clsAPI.orgID).Replace("{GroupID}", groupID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                                var singleGroupData = JsonConvert.DeserializeObject <clsGroupAPI>(result);

                                if (singleGroupData.Name.Contains(htblTestData["GroupName"].ToString()))
                                {
                                    _Flag = true;
                                    break;
                                }
                                else
                                {
                                    _Flag = false;
                                }
                            }
                            else
                            {
                                _Flag = false;
                            }
                        }
                    }
                }

                if (htblTestData["RequestType"].ToString() == "Members")
                {
                    //Get Members of a Group
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetAllGroups.Replace("{orgid}", clsAPI.orgID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                    var groupData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);


                    if (groupData.Count > 0)
                    {
                        //Find the Group that we created and get its ID
                        for (int iEnrolUser = 0; iEnrolUser < groupData.Count; iEnrolUser++)
                        {
                            if (groupData[iEnrolUser].Name.ToString().Contains(htblTestData["GroupName"].ToString()))
                            {
                                var groupID = groupData[iEnrolUser].ID.ToString();

                                //Use the ID to create a specific URL to get particular group
                                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetGroupMembers.Replace("{orgid}", clsAPI.orgID).Replace("{GroupID}", groupID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                                var GroupMemberData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);
                                for (int MemberCnt = 0; MemberCnt < GroupMemberData.Count; MemberCnt++)
                                {
                                    var MemberID = GroupMemberData[MemberCnt].ID.ToString();

                                    if (MemberID != "")
                                    {
                                        _Flag = true;
                                        break;
                                    }
                                    else
                                    {
                                        _Flag = false;
                                    }
                                }
                            }
                            else
                            {
                                _Flag = false;
                            }

                            if (_Flag == true)
                            {
                                break;
                            }
                        }
                    }
                }


                if (htblTestData["RequestType"].ToString() == "ExpInclListUsers")
                {
                    //Get Members of a Group
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetAllGroups.Replace("{orgid}", clsAPI.orgID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                    var groupData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);


                    if (groupData.Count > 0)
                    {
                        //Find the Group that we created and get its ID
                        for (int iEnrolUser = 0; iEnrolUser < groupData.Count; iEnrolUser++)
                        {
                            if (groupData[iEnrolUser].Name.ToString().Contains(htblTestData["GroupName"].ToString()))
                            {
                                var groupID = groupData[iEnrolUser].ID.ToString();

                                //Use the ID to create a specific URL to get particular group
                                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetGroupExplicitInclUsers.Replace("{orgid}", clsAPI.orgID).Replace("{GroupID}", groupID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                                var GroupMemberData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);
                                for (int MemberCnt = 0; MemberCnt < GroupMemberData.Count; MemberCnt++)
                                {
                                    var MemberID = GroupMemberData[MemberCnt].ID.ToString();

                                    if (MemberID != "")
                                    {
                                        _Flag = true;
                                        break;
                                    }
                                    else
                                    {
                                        _Flag = false;
                                    }
                                }
                            }
                            else
                            {
                                _Flag = false;
                            }

                            if (_Flag == true)
                            {
                                break;
                            }
                        }
                    }
                }


                if (htblTestData["RequestType"].ToString() == "ExpExclListUsers")
                {
                    //Get Members of a Group
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetAllGroups.Replace("{orgid}", clsAPI.orgID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                    var groupData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);

                    if (groupData.Count > 0)
                    {
                        //Find the Group that we created and get its ID
                        for (int iEnrolUser = 0; iEnrolUser < groupData.Count; iEnrolUser++)
                        {
                            if (groupData[iEnrolUser].Name.ToString().Contains(htblTestData["GroupName"].ToString()))
                            {
                                var groupID = groupData[iEnrolUser].ID.ToString();

                                //Use the ID to create a specific URL to get particular group
                                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetGroupExplicitExclUsers.Replace("{orgid}", clsAPI.orgID).Replace("{GroupID}", groupID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                                var GroupMemberData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);
                                for (int MemberCnt = 0; MemberCnt < GroupMemberData.Count; MemberCnt++)
                                {
                                    var MemberID = GroupMemberData[MemberCnt].ID.ToString();

                                    if (MemberID != "")
                                    {
                                        _Flag = true;
                                        break;
                                    }
                                    else
                                    {
                                        _Flag = false;
                                    }
                                }
                            }
                            else
                            {
                                _Flag = false;
                            }

                            if (_Flag == true)
                            {
                                break;
                            }
                        }
                    }
                }

                if (htblTestData["RequestType"].ToString() == "GetCourses")
                {
                    //Get Courses of a Group

                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetAllGroups.Replace("{orgid}", clsAPI.orgID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                    var groupData = JsonConvert.DeserializeObject <List <clsGroupAPI> >(result);

                    if (groupData.Count > 0)
                    {
                        //Find the Group that we created and get its ID
                        for (int iEnrolUser = 0; iEnrolUser < groupData.Count; iEnrolUser++)
                        {
                            if (groupData[iEnrolUser].Name.ToString().Contains(htblTestData["GroupName"].ToString()))
                            {
                                var groupID = groupData[iEnrolUser].ID.ToString();

                                //Use the ID to create a specific URL to get particular group
                                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetGroupCourses.Replace("{orgID}", clsAPI.orgID).Replace("{groupID}", groupID), clGrpData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                                var GroupCourse = JsonConvert.DeserializeObject <List <GroupCourseAPI> >(result);
                                for (int CourseCnt = 0; CourseCnt < GroupCourse.Count; CourseCnt++)
                                {
                                    var CourseID = GroupCourse[CourseCnt].Name.ToString();

                                    if (CourseID == htblTestData["CourseName"].ToString())
                                    {
                                        _Flag = true;
                                        break;
                                    }
                                    else
                                    {
                                        _Flag = false;
                                    }
                                }
                            }
                            else
                            {
                                _Flag = false;
                            }

                            if (_Flag == true)
                            {
                                break;
                            }
                        }
                    }
                }

                return(_Flag);
            }
            catch (Exception er)
            {
                clsException.ExceptionHandler(er, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }
Esempio n. 23
0
        public bool APIEcomEnrollmentDynamic(object[] lStrvalue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode       = string.Empty;
            string     uriApiCredential = string.Empty;
            string     result           = string.Empty;
            clsGeneric oGeneric         = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool    _Flag  = false;
            string  _orgID = string.Empty;
            clsPage oPage  = new clsPage(iWebdriver);


            try
            {
                EcomEnrolUser oEcomEnrolUser = new EcomEnrolUser();

                oEcomEnrolUser.OrderID = htblTestData["OrderID"].ToString();
                oEcomEnrolUser.UserID  = clsAPI.userid;
                // clsAPI.orgID = htblTestData["OrgID"].ToString();


                GetAPICredentials oGetAPICredentials = new GetAPICredentials();

                URI = ApplicationSettings.APIURI() + clsAPI.EcomCourseSeats.Replace("$", clsAPI.orgID) + clsAPI.EcommMgrID.Replace("#", clsAPI.userid);
                uriApiCredential = ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID);

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET",
                                                uriApiCredential, oEcomEnrolUser, "H2", _ecomLoginKey, _ecomTransactionKey);

                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);


                URI = ApplicationSettings.APIURI() + clsAPI.EcomCourseSeats.Replace("$", clsAPI.orgID) + clsAPI.EcommMgrID.Replace("#", clsAPI.userid);

                do
                {
                    Thread.Sleep(60000);
                    for (int i = 0; i < 5; i++)
                    {
                        Thread.Sleep(clsGlobalVariable.iWaitHigh);
                        oGeneric.GetApiResponseCodeData(out statusCode, out result, "Get", URI, oEcomEnrolUser, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);
                    }
                    if (result.Contains("Error") || result.Contains("Invalid") || result.Contains("DOCTYPE"))
                    {
                        break;
                    }
                } while (!result.ToString().Contains("OrgCourseID"));
                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                // APIGetCourseSeats courseSeats = new APIGetCourseSeats();

                var    courseSeats = JsonConvert.DeserializeObject <List <APICourseSeats> >(result);
                string CourseID    = string.Empty;
                for (int i = 0; i < courseSeats.Count; i++)
                {
                    if (courseSeats[i].CourseName == (htblTestData["CourseName"].ToString()))
                    {
                        CourseID = courseSeats[i].OrgCourseID;
                    }
                }



                URI = string.Empty;
                URI = ApplicationSettings.APIURI() + clsAPI.EcommEnrolUser.Replace("{orgid}", clsAPI.orgID).Replace("{userid}", clsAPI.userid).Replace("{courseid}", CourseID);
                oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), URI, oEcomEnrolUser, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (statusCode.Contains("204"))
                    {
                        _Flag = true;
                    }
                }
                else
                {
                    if (!statusCode.Contains("204"))
                    {
                        _Flag = false;
                    }
                }
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
            return(_Flag);
        }
Esempio n. 24
0
        public bool GetIlmsConnectSharedKey(object[] lStrvalue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;

            clsCoursePushDown clData = new clsCoursePushDown();

            GetAPICredentials oGetAPICredentials = new GetAPICredentials();

            try
            {
                if (htblTestData["OrgID"].ToString() != "")
                {
                    clsAPI.orgID = htblTestData["OrgID"].ToString();
                }

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", clsAPI.orgID), clData, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);
                //  clsAPI.orgID = htblTestData["OrgID"].ToString();
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.apiILMSConnect.Replace("$", clsAPI.orgID), clData, htblTestData["MethodType"].ToString(), _ecomLoginKey, _ecomTransactionKey);
                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    if (result.Contains("SharedKey") && result.Contains("BaseURL"))
                    {
                        var    oSharedKey = JsonConvert.DeserializeObject <IlmsConnectSharedKey>(result);
                        string URL        = oSharedKey.BaseURL;
                        _decriptedKey            = _des.Decrypt3DES(oSharedKey.SharedKey);
                        clsAPI.ilmsconnectFormat = clsAPI.ilmsconnectFormat.Replace("{OrgID}", clsAPI.orgID).Replace("{Key}", _decriptedKey).Replace("{UserID}", clsAPI.userid);

                        _Encriptedstring = _des.Encrypt3DES(clsAPI.ilmsconnectFormat);
                        iWebdriver.Navigate().GoToUrl(URL + "?enc=" + _Encriptedstring);
                        try
                        {
                            iWebdriver.SwitchTo().Frame(clsPageObject.strHeaderFrameID);
                            string strActualResult = iWebdriver.FindElement(clsPageObject.lvLearnerLogout).Text;
                            StringAssert.AreEqualIgnoringCase("Logout", strActualResult);
                            _Flag = true;
                        }
                        catch (Exception exc)
                        {
                            clsGlobalVariable.strExceptionReport = exc.Message.ToString();
                            _Flag = false;
                        }


                        _Flag = true;
                    }
                }
                else
                {
                    if (!result.Contains("SharedKey") && !result.Contains("BaseURL"))
                    {
                        _Flag = true;
                    }
                }

                return(_Flag);
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
        }
Esempio n. 25
0
        public bool Enrolluser(Hashtable htblTestData)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode = string.Empty;
            string     result     = string.Empty;
            clsGeneric oGeneric   = new clsGeneric();
            string     URI        = string.Empty;

            List <string> lCourseId = new List <string>();
            bool          _Flag     = false;
            string        _UserID   = string.Empty;

            try
            {
                clsPage oPage = new clsPage(iWebdriver);

                _orgID       = oPage.GetOrganizationID();
                clsAPI.orgID = _orgID;
                lCourseId    = oPage.GetCourseId(htblTestData["CourseName"].ToString());

                Users oUser = new Users();

                GetAPICredentials oGetAPICredentials = new GetAPICredentials();


                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", _orgID), oUser, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);

                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.user.Replace("{orgid}", _orgID), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);


                var oUserData = JsonConvert.DeserializeObject <List <Users> >(result);

                for (int iUser = 0; iUser < oUserData.Count; iUser++)
                {
                    if (oUserData[iUser].Profile.F015.ToString() == htblTestData["UserEmail"].ToString().Trim())
                    {
                        _UserID = oUserData[iUser].ID;
                        break;
                    }
                }


                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.GetSessionID.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()), oUser, "H1", _ecomLoginKey, _ecomTransactionKey);


                var oSessionData = JsonConvert.DeserializeObject <List <clsAPISession> >(result);

                if (result == "")
                {
                    return(false);
                }

                _SessionID = oSessionData[0].SessionID;

                UserEnrollment oUserEnrollment = new ILMS.UserEnrollment();
                oUserEnrollment.userid = _UserID;
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "POST", ApplicationSettings.APIURI() + clsAPI.SessionEnrollment.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()).Replace("{SessionID}", _SessionID), oUserEnrollment, "H1", _ecomLoginKey, _ecomTransactionKey);

                Thread.Sleep(clsGlobalVariable.iWaitHigh);

                if (htblTestData["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                {
                    if (result.ToUpper().Contains("!DOCTYPE"))
                    {
                        clsGlobalVariable.strExceptionReport = "Resource not found";
                        return(true);
                    }

                    if (result.Contains("Invalid URI"))
                    {
                        return(true);
                    }

                    var oError = JsonConvert.DeserializeObject <List <SuperAdminCoursePushDownError> >(result);
                    SuperAdminCoursePushDownErrorCode oErrorCode = new SuperAdminCoursePushDownErrorCode();
                    foreach (string strErrorCode in oErrorCode.coursePushDownErrorCode)
                    {
                        if (strErrorCode == oError[0].ErrorCode)
                        {
                            _Flag = true;
                        }
                    }
                    if (_Flag == true)
                    {
                        return(true);
                    }
                    else
                    {
                        clsGlobalVariable.strExceptionReport = "Negative Case Failed!";
                        return(false);
                    }
                }


                do
                {
                    oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.SessionEnrollment.Replace("{orgid}", _orgID).Replace("{CourseID}", lCourseId[0].ToString().Trim()).Replace("{SessionID}", _SessionID), oUserEnrollment, "H1", _ecomLoginKey, _ecomTransactionKey);
                } while (result == "");



                var oCourseData = JsonConvert.DeserializeObject <List <SessionEnrollment> >(result);

                for (int iUser = 0; iUser < oCourseData.Count; iUser++)
                {
                    if (oCourseData[iUser].User.Profile_Basic.F015.ToString() == htblTestData["UserEmail"].ToString().Trim())
                    {
                        _UserID = oCourseData[iUser].User.ID;
                        _Flag   = true;
                        break;
                    }
                    else
                    {
                        _Flag = false;
                    }
                }
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }



            return(_Flag);
        }
        public bool APIEnrollments(object[] lStrvalue)
        {
            clsGlobalVariable.strExceptionReport = string.Empty;
            string     statusCode   = string.Empty;
            string     result       = string.Empty;
            clsGeneric oGeneric     = new clsGeneric();
            string     URI          = string.Empty;
            Hashtable  htblTestData = new Hashtable();

            htblTestData = oGeneric.GetTestData(lStrvalue);
            bool _Flag = false;
            clsCoursePushDown clData = new clsCoursePushDown();

            GetAPICredentials oGetAPICredentials = new GetAPICredentials();

            try {
                oGeneric.GetApiResponseCodeData(out statusCode, out result, "GET", ApplicationSettings.APIURI() + clsAPI.orgCredential.Replace("$", htblTestData["OrgID"].ToString()), clData, "H2", "", "");

                var        orgCredential = JsonConvert.DeserializeObject <GetAPICredentials>(result);
                Crypto3DES _des          = new Crypto3DES(ApplicationSettings.EComModuleEncKey());

                _ecomTransactionKey = _des.Decrypt3DES(orgCredential.TransactionKey);
                _ecomLoginKey       = _des.Decrypt3DES(orgCredential.LoginID);



                clsAPI.orgID = htblTestData["OrgID"].ToString();
                oGeneric.GetApiResponseCodeData(out statusCode, out result, htblTestData["MethodType"].ToString(), ApplicationSettings.APIURI() + clsAPI.apiEnrollment.Replace("&", htblTestData["OrgID"].ToString()).Replace("$", htblTestData["EcomID"].ToString()).Replace("#", htblTestData["CourseID"].ToString()), clData, htblTestData["HeaderType"].ToString(), _ecomLoginKey, _ecomTransactionKey);



                if (htblTestData["TestCaseType"].ToString().ToUpper() == "POSITIVE")
                {
                    var oEnrolledUserCourseUserData = JsonConvert.DeserializeObject <List <EnrolledUserCourseUserData> >(result);
                    if (oEnrolledUserCourseUserData.Count > 0)
                    {
                        for (int iEnrolUser = 0; iEnrolUser < oEnrolledUserCourseUserData.Count; iEnrolUser++)
                        {
                            if (oEnrolledUserCourseUserData[iEnrolUser].CourseID.ToString().Contains(htblTestData["CourseID"].ToString()))
                            {
                                _Flag = true;
                            }
                        }
                    }
                }
                else if (htblTestData["TestCaseType"].ToString().ToUpper() == "NEGATIVE")
                {
                    if (_ecomTransactionKey == "" && _ecomLoginKey == "")
                    {
                        return(true);
                    }
                    if (result.ToUpper().Contains("!DOCTYPE"))
                    {
                        return(true);
                    }

                    if (statusCode.Contains("40") || statusCode.Contains("50"))
                    {
                        if (statusCode.Contains("404") || statusCode.Contains("500") || statusCode.Contains("405"))
                        {
                            return(true);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                clsException.ExceptionHandler(e, iWebdriver, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name);

                return(false);
            }
            return(_Flag);
        }