示例#1
0
        private TrialResult RequestTrial(
            string companyName
            , string sizeOfGroup
            , string description
            , string domain
            , string firstName
            , string lastName
            , string email
            , string phone
            , string country
            , string login
            , string password
            , string resellerGuid
            , string xml
            , string locale
            , string referrer
            , out int requestId
            , out string requestGuid
            )
        {
            TrialResult retVal = TrialResult.Failed;

            requestId   = -1;
            requestGuid = string.Empty;

            AspSettings settings = AspSettings.Load();

            domain += "." + settings.DnsParentDomain;
            try
            {
                //if (CManage.IsUserRegistered(settings, email))
                //    retVal = TrialResult.UserRegistered;
                //else
                if (CManage.CompanyExists(domain))
                {
                    retVal = TrialResult.DomainExists;
                }
                else
                {
                    requestId = DBTrialRequest.Create(
                        companyName,
                        sizeOfGroup,
                        description,
                        domain,
                        firstName,
                        lastName,
                        email,
                        phone,
                        country,
                        login,
                        password,
                        new Guid(resellerGuid),
                        xml,
                        locale
                        , referrer
                        );

                    TemplateVariables vars = DBTrialRequest.GetVariables(requestId);
                    requestGuid = vars["RequestGUID"];
                    retVal      = TrialResult.WaitingForActivation;

//					if (!string.IsNullOrEmpty(settings.OperatorEmail))
//						CManage.SendEmail(settings.OperatorEmail, EmailType.TrialNewRequest, vars);
                }
            }
            finally
            {
                if (retVal != TrialResult.Success && retVal != TrialResult.WaitingForActivation && retVal != TrialResult.RequestPending)
                {
                    object obj = null;
                    try
                    {
                        obj = new Guid(resellerGuid);
                    }
                    catch (ArgumentNullException)
                    {
                    }
                    catch (FormatException)
                    {
                    }

                    DBTrialRequestFailed.Create(
                        companyName,
                        sizeOfGroup,
                        description,
                        domain,
                        firstName,
                        lastName,
                        email,
                        phone,
                        login,
                        login,
                        password,
                        obj
                        , locale
                        , referrer
                        , (int)retVal
                        );
                }
            }
            return(retVal);
        }
示例#2
0
 public bool DomainExists(string domain)
 {
     return(CManage.CompanyExists(domain));
 }