Exemplo n.º 1
0
        /// <summary>
        /// Retrive SFDC only user with contactCRMId
        /// </summary>
        /// <returns></returns>
        public string getSFDCUser()
        {
            //TODO:get ghost user from initateregistration then completeRegistrtion
            DataSet Data = new DataSet();
            string  findNamedSeatUser = string.Empty;

            string[] GetNamedSeatUser = null;
            string   userCRMContactId = string.Empty;
            //string findInstitutionalUser = string.Empty;
            //string[] GetInstitutionalUser = null;

            //Call the initiateregistration method for named seat user
            RegistrationServiceTests objRWS = new RegistrationServiceTests(LogSummaryFile, LogDetailedFile, _writer, root, _Assert);

            GetNamedSeatUser  = objRWS.GetNamedSeatUser().Split(',');
            findNamedSeatUser = GetNamedSeatUser[0];
            //GetInstitutionalUser = objRWS.GetInstitutionalUser().Split(',');
            //findInstitutionalUser = GetInstitutionalUser[0];

            //TODO:call cds db registration to pic created named seat user
            if (string.IsNullOrEmpty(findNamedSeatUser))
            {
                string Query1 = "select top 20 Title, FirstName, Lastname, EmailAddress, AccountCRMId, Queue_Status, Token," +
                                "CreationDate, DestinationUrl,Country, TokenExpiration from mfweb.tbl_Registration where " +
                                " EmailAddress like '%@" + validAccountDomains[0] + "%' and EmailAddress like '%ghost%' and Queue_Status='RCM' order by CreationDate desc";
                Data = _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query1, "Select");
                findNamedSeatUser = Convert.ToString(Data.Tables[0].Rows[0]["EmailAddress"]);
            }

            //TODO:Verify user from CDS DB
            DataSet ds     = new DataSet();
            string  Query2 = "select * from mfweb.tbl_User where UserName ='******'";

            ds = _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query2, "Select");

            userCRMContactId = Convert.ToString(ds.Tables[0].Rows[0]["CRMContactId"]);
            //Delete Data from CDS DB so User Will exists in SFDC DB Only.
            string Query3 = "Delete From  workspace.tbl_ResourceHistory where FK_MemberResourceId" +
                            " in (select PK_ResourceUserAssocId From  workspace.tbl_ResourceUserAssoc" +
                            " where FK_UserId=(SELECT PK_User_Id from mfweb.tbl_User where UserName ='******')) ;" +
                            "Delete From  workspace.tbl_ResourceUserAssoc  where FK_UserId=(SELECT PK_User_Id from mfweb.tbl_User where UserName ='******') ;" +
                            "Delete from mfweb.tbl_User where UserName = '******'";

            _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query3, "Delete");

            Query2 = "select * from mfweb.tbl_User where UserName ='******'";
            ds     = _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query2, "Select");

            if (ds.Tables[0].Rows.Count == 0)
            {
                return(findNamedSeatUser + "," + userCRMContactId + "," + GetNamedSeatUser[2]);
            }

            return(null);
        }
Exemplo n.º 2
0
        public string getSFDCUser_RoleStatus_InActive()
        {
            //TODO:get ghost user from initateregistration then completeRegistrtion
            DataSet Data = new DataSet();
            string  findNamedSeatUser = string.Empty;

            string[] GetNamedSeatUser = null;
            //string findInstitutionalUser = string.Empty;
            //string[] GetInstitutionalUser = null;
            string userContactCRMId = string.Empty;
            //Call the initiateregistration method for named seat user
            RegistrationServiceTests objRWS = new RegistrationServiceTests(LogSummaryFile, LogDetailedFile, _writer, root, _Assert);

            if (!string.IsNullOrEmpty(objRWS.GetNamedSeatUser_RoleStatus_InActive()))
            {
                GetNamedSeatUser  = objRWS.GetNamedSeatUser_RoleStatus_InActive().Split(',');
                findNamedSeatUser = GetNamedSeatUser[0];
            }
            //GetInstitutionalUser = objRWS.GetInstitutionalUser().Split(',');
            //findInstitutionalUser = GetInstitutionalUser[0];

            //TODO:call cds db registration to pic created named seat user
            if (string.IsNullOrEmpty(findNamedSeatUser))
            {
                string Query1 = "select top 20 Title, FirstName, Lastname, EmailAddress, AccountCRMId, Queue_Status, Token," +
                                "CreationDate, DestinationUrl,Country, TokenExpiration from mfweb.tbl_Registration where " +
                                " EmailAddress like '%@" + validAccountDomains[0] + "%' and EmailAddress like '%ghost%' and Queue_Status='RCM' order by CreationDate desc";
                Data = _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query1, "Select");
                findNamedSeatUser = Convert.ToString(Data.Tables[0].Rows[0]["EmailAddress"]);
            }

            //TODO:Verify user from CDS DB
            DataSet ds     = new DataSet();
            string  Query2 = "select * from mfweb.tbl_User where UserName ='******'";

            ds = _Common.ExecuteDatabase(_Common.CDS_ConnectionString, Query2, "Select");
            userContactCRMId = Convert.ToString(ds.Tables[0].Rows[0]["CRMContactId"]);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(findNamedSeatUser + "," + userContactCRMId);
            }

            return(null);
        }