Exemple #1
0
    static void checkCountry()
    {
        customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");
        string strBlockedCountries = opSettings.Values.Get("BlockedCountries");
        string strCountryCode      = string.Empty;
        string strType             = string.Empty;

        using (wsIP2Loc.ServiceSoapClient wsInstance = new wsIP2Loc.ServiceSoapClient())
        {
            wsInstance.location(commonIp.remoteIP, ref strCountryCode, ref strType);
        }

        if (strBlockedCountries.IndexOf(strCountryCode) > -1)
        {
            //System.Web.HttpContext.Current.Response.Redirect("/forbidden.html");
        }
    }
Exemple #2
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string strAffiliateId = string.Empty;

        #region initialiseVariables
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "Register";

        string strProcessCode = string.Empty;

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        long lngOperatorId = 1;
        bool isTestAccount = false;
        //string strMemberCode = string.Empty;
        //string strPassword = string.Empty;
        //string strPasswordEncrypted = string.Empty;
        //string strEmail = string.Empty;
        string strContact       = string.Empty;
        string strContactNumber = string.Empty;
        string strDOB           = string.Empty;
        string strFName         = string.Empty;
        //string strLName = string.Empty;
        //string strCurrencyCode = string.Empty;
        string strCountryCode = string.Empty;
        string strAccount     = string.Empty;
        //string strReferralId = string.Empty;
        string strLanguageCode   = string.Empty;
        string strCommissionType = string.Empty;
        string strAddress        = string.Empty;
        string strCity           = string.Empty;
        string strPostal         = string.Empty;
        string strUrl1           = string.Empty;
        string strUrl2           = string.Empty;
        string strUrl3           = string.Empty;
        //string strDesc = string.Empty;

        string strIPAddress    = string.Empty;
        string strSignUpUrl    = string.Empty;
        string strVCode        = string.Empty;
        string strSessionVCode = string.Empty;
        string strPermission   = string.Empty;

        string strSecurityQues = string.Empty;
        string strSecurityAns  = string.Empty;

        string strBankAccName = string.Empty;
        string strBankAccNo   = string.Empty;
        string strSwiftCode   = string.Empty;
        string strBankName    = string.Empty;
        string strBankAdd     = string.Empty;


        int             intOddsType     = 1;
        System.DateTime dtDOB           = DateTime.MinValue;
        string          strHiddenValues = hidValues.Value;

        List <string> lstValues = null;
        #endregion

        #region populateVariables

        strContact        = txtContact.Text;
        strContactNumber  = string.Format("{0}-{1}", drpContactCountry.SelectedValue, strContact);
        strDOB            = string.Format("{0}-{1}-{2}", drpYear.SelectedValue, drpMonth.SelectedValue, drpDay.SelectedValue);
        strCountryCode    = drpCountry.SelectedValue;
        strAccount        = txtAccount.Text.Trim();;
        strLanguageCode   = drpLanguage.SelectedValue;
        strCommissionType = drpCommissionType.SelectedValue;
        strAddress        = txtAddress.Text.Trim();
        strCity           = txtCity.Text.Trim();
        strPostal         = txtPostal.Text.Trim();
        strUrl1           = txtURL1.Text.Trim();
        strUrl2           = txtURL2.Text.Trim();
        strUrl3           = txtURL3.Text.Trim();

        strSecurityQues = drpSecQues.SelectedValue;
        strSecurityAns  = txtSecAns.Text.Trim();
        strBankAccName  = txtBankAccName.Text.Trim();
        strBankAccNo    = txtBankAccNo.Text.Trim();
        strSwiftCode    = txtSwiftCode.Text.Trim();
        strBankName     = txtBankName.Text.Trim();
        strBankAdd      = txtBankAdd.Text.Trim();

        strSessionVCode = commonVariables.GetSessionVariable("vCode");
        strAlertCode    = "-1";

        //strAffiliateId = txtAffiliateID.Text;

        System.Text.RegularExpressions.Regex rexContact = new System.Text.RegularExpressions.Regex("([0-9]{1,4})[-]([0-9]{6,12})$");
        #endregion

        #region parametersValidation

        strResultCode   = "11";
        strResultDetail = "Error:ParameterValidation";

        //txtCaptcha.Text = string.Empty;

        if (string.IsNullOrEmpty(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (!rexContact.IsMatch(strContactNumber))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strSecurityAns))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/MissingSecurityAnswer", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strBankAccName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAccName", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strBankAccNo))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAccNo", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strBankName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankName", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strBankAdd))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidBankAdd", xeErrors);
            isProcessAbort  = true;
        }

        else if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCountryCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strLanguageCode) || string.Compare(strLanguageCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingLanguageCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strCommissionType) || string.Compare(strCommissionType, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCommissionType", xeErrors);
            isProcessAbort  = true;
        }

        else if (commonValidation.isInjection(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCountryCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCountryCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strAccount))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidAccount", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strLanguageCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidLanguageCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCommissionType))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCommissionType", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strAddress))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidAddress", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCity))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCity", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPostal))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidPostal", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl1))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl1", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl2))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl2", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl3))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl3", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strSecurityQues))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidSecurityQuestion", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strSecurityAns))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidSecurityAnswer", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strBankAccName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAccName", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strBankAccNo))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAccNo", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strBankName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankName", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strBankAdd))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/InvalidBankAdd", xeErrors);
            isProcessAbort  = true;
        }


        else if (!DateTime.TryParse(strDOB, out dtDOB))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidDOB", xeErrors);
            isProcessAbort  = true;
        }
        else
        {
            strResultCode   = "00";
            strResultDetail = "OK:ParameterValidation";

            strContact = strContact.TrimStart('+');
        }

        strErrorDetail   = strAlertMessage;
        strProcessRemark = string.Format("strAlertMessage: {0} | HiddenValues: {1}", strAlertMessage, strHiddenValues);

        intProcessSerialId += 1;
        commonAuditTrail.appendLog("system", strPageName, "ParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

        #endregion

        if (!isProcessAbort)
        {
            lstValues = strHiddenValues.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList();

            if (lstValues.Count > 0)
            {
                //if (lstValues[0] != null) { strCountryCode = lstValues[0]; }
                //if (lstValues[1] != null) { strSignUpUrl = string.Format("m.{0}", lstValues[1]); }
                if (lstValues[2] != null)
                {
                    strIPAddress = lstValues[2];
                }
                if (lstValues[3] != null)
                {
                    strPermission = lstValues[3];
                }
            }

            strSignUpUrl    = string.Format("m.{0}", commonIp.DomainName);
            strLanguageCode = commonVariables.SelectedLanguage;

            if (string.IsNullOrEmpty(strIPAddress))
            {
                strIPAddress = commonIp.UserIP;
            }

            if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-", true) == 0)
            {
                using (wsIP2Loc.ServiceSoapClient wsInstance = new wsIP2Loc.ServiceSoapClient())
                {
                    wsInstance.location(strIPAddress, ref strCountryCode, ref strPermission);
                }
            }

            switch (strCountryCode.ToUpper())
            {
            case "MY":
            case "TH":
            case "VN":
            case "KH":
                intOddsType = 1;
                break;

            case "CN":
                intOddsType = 2;
                break;

            case "IN":
            case "KR":
            case "JP":
            case "AU":
                intOddsType = 3;
                break;

            case "ID":
                intOddsType = 4;
                break;

            default:
                intOddsType = 3;
                break;
            }

            customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");

            if (opSettings.Values.Get("DemoDomains").IndexOf(commonIp.DomainName) >= 0)
            {
                isTestAccount = true;
            }

            int    intAffiliateId = string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId")) ? (string.IsNullOrEmpty(strAffiliateId) ? 0 : Convert.ToInt32(strAffiliateId)) : Convert.ToInt32(commonVariables.GetSessionVariable("AffiliateId"));
            string strReferBy     = string.Empty;
            string strDeviceId    = "Mobile";


            //System.Data.DataSet dsRegister = null;
            int result = 0;

            //using (wsMemberMS1.memberWSSoapClient svcInstance = new wsMemberMS1.memberWSSoapClient())
            using (wsAffiliateMS1.affiliateWSSoapClient svcInstance = new wsAffiliateMS1.affiliateWSSoapClient())
            {
                //result = svcInstance.MemberRegistration(strMemberCode, strPasswordEncrypted, strFName, strEmail, strContactNumber, strCountryCode, strLanguageCode, strCurrencyCode, lngOperatorId,
                //            strAddress, strCity, strPostal, strIPAddress, strDesc, referralid, strUrl1, strUrl2, strUrl3, dtDOB, strAccount, strCommissionType, strSignUpUrl,
                //            (string)System.Configuration.ConfigurationManager.AppSettings.Get("internal_affiliate"));

                //strProcessRemark = "exec spAffiliateMemberInsertWS " + "'" + strMemberCode + "'" + ",'" + strPasswordEncrypted + "'" + ",'" + strFName + "'" + ",'" + strEmail + "'" + ",'" + strContactNumber + "'" + ",'" + strCountryCode + "'" + ",'" + strLanguageCode + "'" + ",'" + strCurrencyCode + "'" + ",'" + lngOperatorId + "'" + ",'" + strAddress + "'" + ",'" + strCity + "'" + ",'" + strPostal + "'" + ",'" + strIPAddress + "'" + ",'" + strDesc + "'" + ",'" + referralid + "'" + ",'" + strUrl1 + "'" + ",'" + strUrl2 + "'" + ",'" + strUrl3 + "'" + ",'" + dtDOB + "'" + ",'" + strAccount + "'" + ",'" + strCommissionType + "'" + ",'" + strSignUpUrl + "'" + ",'" + (string)System.Configuration.ConfigurationManager.AppSettings.Get("internal_affiliate") + "'";
                try
                {
                    //result = svcInstance.UpdateAffiliateMemberInfo(long.Parse(System.Web.HttpContext.Current.Session["AffiliateId"].ToString()), DateTime.Parse(strDOB),
                    //strCountryCode, strAccount, strContactNumber, strAddress, strCity, strPostal, strLanguageCode, strCommissionType, strSecurityQues,
                    //strSecurityAns, strBankAccName, strBankAccNo, strSwiftCode, strBankName, strBankAdd);

                    result = svcInstance.UpdateAffiliateMemberInfo(long.Parse(commonCookie.CookieAffiliateId), DateTime.Parse(strDOB),
                                                                   strCountryCode, strAccount, strContactNumber, strAddress, strCity, strPostal, strLanguageCode, strCommissionType, strSecurityQues,
                                                                   strSecurityAns, strBankAccName, strBankAccNo, strSwiftCode, strBankName, strBankAdd, "");

                    if (result == 1)
                    {
                        //delete removed url
                        if (String.IsNullOrEmpty(txtURL1.Text) && (string)System.Web.HttpContext.Current.Session["url1"] != "")
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID1"]));
                        }

                        if (String.IsNullOrEmpty(txtURL2.Text) && (string)System.Web.HttpContext.Current.Session["url2"] != "")
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID2"]));
                        }

                        if (String.IsNullOrEmpty(txtURL3.Text) && (string)System.Web.HttpContext.Current.Session["url3"] != "")
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID3"]));
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url1"] != txtURL1.Text && !String.IsNullOrEmpty((string)System.Web.HttpContext.Current.Session["url1"]))
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID1"]));
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url2"] != txtURL2.Text && !String.IsNullOrEmpty((string)System.Web.HttpContext.Current.Session["url2"]))
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID2"]));
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url3"] != txtURL3.Text && !String.IsNullOrEmpty((string)System.Web.HttpContext.Current.Session["url3"]))
                        {
                            result = svcInstance.DeleteWebsiteURL(long.Parse((string)System.Web.HttpContext.Current.Session["urlID3"]));
                        }

                        //add new url
                        if ((string)System.Web.HttpContext.Current.Session["url1"] != txtURL1.Text && txtURL1.Text != commonCulture.ElementValues.getResourceString("lblURL1", xeResources) && !String.IsNullOrEmpty(txtURL1.Text))
                        {
                            result = svcInstance.InsertWebsiteURL(long.Parse(commonCookie.CookieAffiliateId), txtURL1.Text);
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url2"] != txtURL2.Text && txtURL2.Text != commonCulture.ElementValues.getResourceString("lblURL2", xeResources) && !String.IsNullOrEmpty(txtURL2.Text))
                        {
                            result = svcInstance.InsertWebsiteURL(long.Parse(commonCookie.CookieAffiliateId), txtURL2.Text);
                        }

                        if ((string)System.Web.HttpContext.Current.Session["url3"] != txtURL3.Text && txtURL3.Text != commonCulture.ElementValues.getResourceString("lblURL3", xeResources) && !String.IsNullOrEmpty(txtURL3.Text))
                        {
                            result = svcInstance.InsertWebsiteURL(long.Parse(commonCookie.CookieAffiliateId), txtURL3.Text);
                        }
                    }
                }
                catch (Exception)
                {
                    throw;
                }
                strProcessRemark = "exec spAffiliateMemberUpdatePublic " + "'" + long.Parse(commonCookie.CookieAffiliateId) + "'" + ",'" + DateTime.Parse(strDOB) + "'" + ",'" + strCountryCode + "'" + ",'" + strAccount + "'" + ",'" + strContactNumber + "'" + ",'" + strAddress + "'" + ",'" + strCity + "'" + ",'" + strPostal + "'" + ",'" + strLanguageCode + "'" + ",'" + strCommissionType + "'" + ",'" + strSecurityQues + "'" + ",'" + strSecurityAns + "'" + ",'" + strBankAccName + "'" + ",'" + strBankAccNo + "'" + ",'" + strSwiftCode + "'" + ",'" + strBankName + ",'" + strBankAdd + "'" + "'";

                intProcessSerialId += 1;
                commonAuditTrail.appendLog("system", strPageName, "RegistrationParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

                strResultCode   = "21";
                strResultDetail = "Error:MemberRegistrationNew";

                //if (dsRegister.Tables[0].Rows.Count > 0)
                //{
                //    strProcessCode = Convert.ToString(dsRegister.Tables[0].Rows[0]["RETURN_VALUE"]);

                //switch (strProcessCode)
                switch (result.ToString())
                {
                case "0":
                    strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                    break;

                case "1":
                    strAlertCode    = "1";
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("UpdateProfile/Success", xeErrors);
                    break;

                case "10":
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateUsername", xeErrors);
                    break;

                case "11":
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateEmail", xeErrors);
                    break;

                default:
                    strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                    break;
                }

                strErrorCode   = strProcessCode;
                strErrorDetail = strAlertMessage;
            }

            intProcessSerialId += 1;
            commonAuditTrail.appendLog("system", strPageName, "MemberRegistrationNew", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string strAffiliateId = string.Empty;

        #region initialiseVariables
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "Register";

        string strProcessCode = string.Empty;

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        long   lngOperatorId        = 1;
        bool   isTestAccount        = false;
        string strMemberCode        = string.Empty;
        string strPassword          = string.Empty;
        string strPasswordEncrypted = string.Empty;
        string strEmail             = string.Empty;
        string strContact           = string.Empty;
        string strContactNumber     = string.Empty;
        string strDOB            = string.Empty;
        string strFName          = string.Empty;
        string strLName          = string.Empty;
        string strCurrencyCode   = string.Empty;
        string strCountryCode    = string.Empty;
        string strAccount        = string.Empty;
        string strReferralId     = string.Empty;
        string strLanguageCode   = string.Empty;
        string strCommissionType = string.Empty;
        string strAddress        = string.Empty;
        string strCity           = string.Empty;
        string strPostal         = string.Empty;
        string strUrl1           = string.Empty;
        string strUrl2           = string.Empty;
        string strUrl3           = string.Empty;
        string strDesc           = string.Empty;

        string strIPAddress    = string.Empty;
        string strSignUpUrl    = string.Empty;
        string strVCode        = string.Empty;
        string strSessionVCode = string.Empty;
        string strPermission   = string.Empty;


        int             intOddsType     = 1;
        System.DateTime dtDOB           = DateTime.MinValue;
        string          strHiddenValues = hidValues.Value;

        List <string> lstValues = null;
        #endregion

        #region populateVariables

        strMemberCode    = txtUsername.Text.Trim();
        strPassword      = txtPassword.Text;
        strEmail         = txtEmail.Text;
        strContact       = txtContact.Text;
        strContactNumber = string.Format("{0}-{1}", drpContactCountry.SelectedValue, strContact);
        strDOB           = string.Format("{0}-{1}-{2}", drpYear.SelectedValue, drpMonth.SelectedValue, drpDay.SelectedValue);
        //strFName = System.Text.RegularExpressions.Regex.Replace(txtFirstName.Text, @"\t|\n|\r|", "");
        //strLName = System.Text.RegularExpressions.Regex.Replace(txtLastName.Text, @"\t|\n|\r|", "");
        strFName          = System.Text.RegularExpressions.Regex.Replace(txtFullName.Text, @"\t|\n|\r|", "");
        strCurrencyCode   = drpCurrency.SelectedValue;
        strCountryCode    = drpCountry.SelectedValue;
        strAccount        = txtAccount.Text.Trim();;
        strReferralId     = txtReferralID.Text.Trim();
        strLanguageCode   = drpLanguage.SelectedValue;
        strCommissionType = drpCommissionType.SelectedValue;
        strAddress        = txtAddress.Text.Trim();
        strCity           = txtCity.Text.Trim();
        strPostal         = txtPostal.Text.Trim();
        strUrl1           = txtURL1.Text.Trim();
        strUrl2           = txtURL2.Text.Trim();
        strUrl3           = txtURL3.Text.Trim();
        strDesc           = txtDesc.Text.Trim();

        strVCode        = txtCaptcha.Text;
        strSessionVCode = commonVariables.GetSessionVariable("vCode");
        strAlertCode    = "-1";

        //strAffiliateId = txtAffiliateID.Text;

        System.Text.RegularExpressions.Regex rexContact = new System.Text.RegularExpressions.Regex("([0-9]{1,4})[-]([0-9]{6,12})$");
        #endregion

        #region parametersValidation

        strResultCode   = "11";
        strResultDetail = "Error:ParameterValidation";

        txtCaptcha.Text = string.Empty;

        if (string.IsNullOrEmpty(strMemberCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingUsername", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strPassword))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strEmail))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingEmail", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (!rexContact.IsMatch(strContactNumber))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strFName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingFName", xeErrors);
            isProcessAbort  = true;
        }
        //else if (string.IsNullOrEmpty(strLName))
        //{
        //    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingLName", xeErrors);
        //    isProcessAbort = true;
        //}
        else if (string.IsNullOrEmpty(strCurrencyCode) || string.Compare(strCurrencyCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCurrency", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCountryCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strLanguageCode) || string.Compare(strLanguageCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingLanguageCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strCommissionType) || string.Compare(strCommissionType, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCommissionType", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strVCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingVCode", xeErrors);
            isProcessAbort  = true;
        }

        else if (commonValidation.isInjection(strMemberCode) || strMemberCode.IndexOf(' ') >= 0 || !commonValidation.isAlphanumeric(strMemberCode) || strMemberCode.Length < 5 || strMemberCode.Length > 16)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUsername", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPassword) || strPassword.Length < 8 || strPassword.Length > 10)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strEmail))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidEmail", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCurrencyCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCurrency", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCountryCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCountryCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strFName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidFName", xeErrors);
            isProcessAbort  = true;
        }
        //else if (commonValidation.isInjection(strLName))
        //{
        //    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidLName", xeErrors);
        //    isProcessAbort = true;
        //}
        else if (commonValidation.isInjection(strAccount))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidAccount", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strReferralId))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidReferralId", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strLanguageCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidLanguageCode", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCommissionType))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCommissionType", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strAddress))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidAddress", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCity))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCity", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPostal))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidPostal", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl1))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl1", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl2))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl2", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strUrl3))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUrl3", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strDesc))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidDesc", xeErrors);
            isProcessAbort  = true;
        }

        else if (commonValidation.isInjection(strVCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidVCode", xeErrors);
            isProcessAbort  = true;
        }

        else if (!DateTime.TryParse(strDOB, out dtDOB))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidDOB", xeErrors);
            isProcessAbort  = true;
        }
        //else if (!chkDisclaimer.Checked)
        //{
        //    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/chkDisclaimer", xeErrors);
        //    isProcessAbort = true;
        //}

        else if (string.Compare(commonEncryption.encrypting(strVCode), strSessionVCode, true) != 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/IncorrectVCode", xeErrors);
            isProcessAbort  = true;
        }
        else
        {
            strResultCode   = "00";
            strResultDetail = "OK:ParameterValidation";

            strContact           = strContact.TrimStart('+');
            strPasswordEncrypted = commonEncryption.Encrypt(strPassword);
        }

        strErrorDetail   = strAlertMessage;
        strProcessRemark = string.Format("strAlertMessage: {0} | HiddenValues: {1}", strAlertMessage, strHiddenValues);

        intProcessSerialId += 1;
        commonAuditTrail.appendLog("system", strPageName, "ParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

        #endregion

        if (!isProcessAbort)
        {
            lstValues = strHiddenValues.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList();

            if (lstValues.Count > 0)
            {
                //if (lstValues[0] != null) { strCountryCode = lstValues[0]; }
                //if (lstValues[1] != null) { strSignUpUrl = string.Format("m.{0}", lstValues[1]); }
                if (lstValues[2] != null)
                {
                    strIPAddress = lstValues[2];
                }
                if (lstValues[3] != null)
                {
                    strPermission = lstValues[3];
                }
            }

            strSignUpUrl    = string.Format("m.{0}", commonIp.DomainName);
            strLanguageCode = commonVariables.SelectedLanguage;

            if (string.IsNullOrEmpty(strIPAddress))
            {
                strIPAddress = commonIp.UserIP;
            }

            if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-", true) == 0)
            {
                using (wsIP2Loc.ServiceSoapClient wsInstance = new wsIP2Loc.ServiceSoapClient())
                {
                    wsInstance.location(strIPAddress, ref strCountryCode, ref strPermission);
                }
            }

            switch (strCountryCode.ToUpper())
            {
            case "MY":
            case "TH":
            case "VN":
            case "KH":
                intOddsType = 1;
                break;

            case "CN":
                intOddsType = 2;
                break;

            case "IN":
            case "KR":
            case "JP":
            case "AU":
                intOddsType = 3;
                break;

            case "ID":
                intOddsType = 4;
                break;

            default:
                intOddsType = 3;
                break;
            }

            customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");

            if (opSettings.Values.Get("DemoDomains").IndexOf(commonIp.DomainName) >= 0)
            {
                isTestAccount = true;
            }

            int    intAffiliateId = string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId")) ? (string.IsNullOrEmpty(strAffiliateId) ? 0 : Convert.ToInt32(strAffiliateId)) : Convert.ToInt32(commonVariables.GetSessionVariable("AffiliateId"));
            string strReferBy     = string.Empty;
            string strDeviceId    = "Mobile";

            long referralid = 0;
            try
            {
                referralid = long.Parse(strReferralId);
            }
            catch (Exception)
            {
                referralid = 0;
            }

            //System.Data.DataSet dsRegister = null;
            int result = 0;

            //using (wsMemberMS1.memberWSSoapClient svcInstance = new wsMemberMS1.memberWSSoapClient())
            using (wsAffiliateMS1.affiliateWSSoapClient svcInstance = new wsAffiliateMS1.affiliateWSSoapClient())
            {
                //dsRegister = svcInstance.MemberRegistrationNew(lngOperatorId, strMemberCode, strPasswordEncrypted, strEmail, strContactNumber,
                //            strAddress, strCity, strPostal, strCountryCode, strCurrencyCode, strGender, intOddsType, strLanguageCode,
                //            intAffiliateId, strReferBy, strIPAddress, strSignUpUrl, strDeviceId, isTestAccount, strFName, strLName, dtDOB, string.Empty);

                result = svcInstance.MemberRegistration(strMemberCode, strPasswordEncrypted, strFName, strEmail, strContactNumber, strCountryCode, strLanguageCode, strCurrencyCode, lngOperatorId,
                                                        strAddress, strCity, strPostal, strIPAddress, strDesc, referralid, strUrl1, strUrl2, strUrl3, dtDOB, strAccount, strCommissionType, strSignUpUrl,
                                                        (string)System.Configuration.ConfigurationManager.AppSettings.Get("internal_affiliate"));

                //strProcessRemark = string.Format("OperatorId: {0} | MemberCode: {1} | Password: {2} | Email: {3} | Contact: {4} | Address: {5} | City: {6} | Postal: {6} | Country: {8} | Currency: {9} | Gender: {10} | OddsType: {11} | Language: {12} | Affiliate: {13} | ReferBy: {14} | IP: {15} | SignUpUrl: {16} | DeviceID: {17} | TestAccount: {18} | FName: {19} | LName: {20} | DOB: {21} | REMOTEIP: {22} | FORWARDEDIP: {23} | REQUESTERIP: {24} | AffiliateID: {25}",
                //    lngOperatorId, strMemberCode, strPasswordEncrypted, strEmail, strContact, strAddress, strCity, strPostal, strCountryCode, strCurrencyCode, strGender, intOddsType, strLanguageCode, intAffiliateId, strReferBy, strIPAddress, strSignUpUrl, strDeviceId, isTestAccount, strFName, strLName, dtDOB, commonIp.remoteIP, commonIp.forwardedIP, commonIp.requesterIP, intAffiliateId);

                strProcessRemark = "exec spAffiliateMemberInsertWS " + "'" + strMemberCode + "'" + ",'" + strPasswordEncrypted + "'" + ",'" + strFName + "'" + ",'" + strEmail + "'" + ",'" + strContactNumber + "'" + ",'" + strCountryCode + "'" + ",'" + strLanguageCode + "'" + ",'" + strCurrencyCode + "'" + ",'" + lngOperatorId + "'" + ",'" + strAddress + "'" + ",'" + strCity + "'" + ",'" + strPostal + "'" + ",'" + strIPAddress + "'" + ",'" + strDesc + "'" + ",'" + referralid + "'" + ",'" + strUrl1 + "'" + ",'" + strUrl2 + "'" + ",'" + strUrl3 + "'" + ",'" + dtDOB + "'" + ",'" + strAccount + "'" + ",'" + strCommissionType + "'" + ",'" + strSignUpUrl + "'" + ",'" + (string)System.Configuration.ConfigurationManager.AppSettings.Get("internal_affiliate") + "'";

                intProcessSerialId += 1;
                commonAuditTrail.appendLog("system", strPageName, "RegistrationParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

                strResultCode   = "21";
                strResultDetail = "Error:MemberRegistrationNew";

                //if (dsRegister.Tables[0].Rows.Count > 0)
                //{
                //    strProcessCode = Convert.ToString(dsRegister.Tables[0].Rows[0]["RETURN_VALUE"]);

                //switch (strProcessCode)
                switch (result.ToString())
                {
                case "0":
                    strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                    break;

                case "1":
                    strAlertCode    = "1";
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/Success", xeErrors);
                    //string strMemberSessionId = Convert.ToString(dsRegister.Tables[0].Rows[0]["memberSessionId"]);
                    //HttpContext.Current.Session.Add("MemberSessionId", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberSessionId"]));
                    //HttpContext.Current.Session.Add("MemberId", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberId"]));
                    //HttpContext.Current.Session.Add("MemberCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberCode"]));
                    //HttpContext.Current.Session.Add("CountryCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["countryCode"]));
                    //HttpContext.Current.Session.Add("CurrencyCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["currency"]));
                    //HttpContext.Current.Session.Add("LanguageCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["languageCode"]));
                    //HttpContext.Current.Session.Add("RiskId", Convert.ToString(dsRegister.Tables[0].Rows[0]["riskId"]));
                    ////HttpContext.Current.Session.Add("PaymentGroup", "A"); //Convert.ToString(dsSignin.Tables[0].Rows[0]["paymentGroup"]));
                    //HttpContext.Current.Session.Add("PartialSignup", Convert.ToString(dsRegister.Tables[0].Rows[0]["partialSignup"]));
                    //HttpContext.Current.Session.Add("ResetPassword", Convert.ToString(dsRegister.Tables[0].Rows[0]["resetPassword"]));

                    //commonCookie.CookieS = strMemberSessionId;
                    //commonCookie.CookieG = strMemberSessionId;
                    //HttpContext.Current.Session.Add("LoginStatus", "success");

                    //strResultCode = "00";
                    //strResultDetail = "OK:MemberRegistrationNew";

                    //#region IOVATION
                    //this.IovationSubmit(ref intProcessSerialId, strProcessId, strPageName, strMemberCode, strIPAddress, strPermission);
                    //#endregion
                    break;

                case "10":
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateUsername", xeErrors);
                    break;

                case "11":
                    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateEmail", xeErrors);
                    break;

                default:
                    strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                    break;
                }

                strErrorCode   = strProcessCode;
                strErrorDetail = strAlertMessage;
            }

            intProcessSerialId += 1;
            commonAuditTrail.appendLog("system", strPageName, "MemberRegistrationNew", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        #region initialiseVariables
        int    intProcessSerialId = 0;
        string strProcessId       = Guid.NewGuid().ToString().ToUpper();
        string strPageName        = "Register";

        string strProcessCode = string.Empty;

        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isProcessAbort   = false;
        bool   isSystemError    = false;

        long   lngOperatorId        = 1;
        bool   isTestAccount        = false;
        string strMemberCode        = string.Empty;
        string strPassword          = string.Empty;
        string strConfirmPassword   = string.Empty;
        string strPasswordEncrypted = string.Empty;
        string strEmail             = string.Empty;
        string strContact           = string.Empty;
        string strCurrencyCode      = string.Empty;
        string strFName             = string.Empty;
        string strLName             = string.Empty;
        string strDOB           = string.Empty;
        string strCountryCode   = string.Empty;
        string strLanguageCode  = string.Empty;
        string strIPAddress     = string.Empty;
        string strSignUpUrl     = string.Empty;
        string strPermission    = string.Empty;
        string strContactNumber = string.Empty;
        string strAffiliateId   = string.Empty;

        int             intOddsType     = 1;
        System.DateTime dtDOB           = DateTime.MinValue;
        string          strHiddenValues = hidValues.Value;
        List <string>   lstValues       = null;
        int             affiliateId;
        #endregion

        #region populateVariables

        strMemberCode      = txtUsername.Text.Trim();
        strPassword        = txtPassword.Text;
        strConfirmPassword = txtConfirmPassword.Text;
        strEmail           = txtEmail.Text;
        strContact         = txtContact.Text;
        strCurrencyCode    = drpCurrency.SelectedValue;
        // This changes is for the combined name on frontend only but on the BO everything will be saved in firstname
        strFName         = System.Text.RegularExpressions.Regex.Replace(txtName.Text, @"\t|\n|\r|", "").TrimStart().TrimEnd();
        strLName         = string.Empty; //System.Text.RegularExpressions.Regex.Replace(txtLastName.Text, @"\t|\n|\r|", "");
        strDOB           = string.Format("{0}-{1}-{2}", drpYear.SelectedValue, drpMonth.SelectedValue, drpDay.SelectedValue);
        strAlertCode     = "-1";
        strContactNumber = string.Format("{0}-{1}", drpContactCountry.SelectedValue, strContact);
        strAffiliateId   = txtAffiliateID.Text;
        var lineId = commonVariables.SelectedLanguageShort.ToLower() == "th" ? txtLineId.Text : string.Empty;

        System.Text.RegularExpressions.Regex rexContact = new System.Text.RegularExpressions.Regex("([0-9]{1,4})[-]([0-9]{6,12})$");
        // get hidden values
        lstValues = strHiddenValues.Split(new char[] { '|' }).Select(p => p.Trim()).ToList();

        if (lstValues.Count > 0)
        {
            if (lstValues[0] != null)
            {
                strCountryCode = lstValues[0];
            }
            if (lstValues.Count > 2)
            {
                strIPAddress = lstValues[2];
            }
            if (lstValues.Count > 3)
            {
                strPermission = lstValues[3];
            }
        }

        if (string.IsNullOrEmpty(strCountryCode) || string.Compare(strCountryCode, "-", true) == 0)
        {
            if (commonCountry.IsValidCountry(CDNCountryCode))
            {
                strCountryCode = CDNCountryCode;
            }
            else
            {
                using (wsIP2Loc.ServiceSoapClient wsInstance = new wsIP2Loc.ServiceSoapClient())
                {
                    wsInstance.location(strIPAddress, ref strCountryCode, ref strPermission);
                }
            }
        }
        #endregion

        #region parametersValidation

        strResultCode   = "11";
        strResultDetail = "Error:ParameterValidation";

        if (string.IsNullOrEmpty(strMemberCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingUsername", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strPassword))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (!strPassword.Equals(strConfirmPassword))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidConfirmPass", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strEmail))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingEmail", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (!rexContact.IsMatch(strContactNumber))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (string.IsNullOrEmpty(strCurrencyCode) || string.Compare(strCurrencyCode, "-1", true) == 0)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingCurrency", xeErrors);
            isProcessAbort  = true;
        }
        //else if (string.IsNullOrEmpty(strFName))
        //{
        //    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingFName", xeErrors);
        //    isProcessAbort = true;
        //}
        //else if (string.IsNullOrEmpty(strLName))
        //{
        //    strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingLName", xeErrors);
        //    isProcessAbort = true;
        //}
        else if (string.IsNullOrEmpty(strFName))
        {
            // This changes is for the combined name on frontend only but on the BO everything will be saved in firstname
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/MissingName", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strMemberCode) || strMemberCode.IndexOf(' ') >= 0 || !commonValidation.isAlphanumeric(strMemberCode) || strMemberCode.Length < 5 || strMemberCode.Length > 16)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidUsername", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strPassword) || strPassword.Length < 8 || strPassword.Length > 10)
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidPassword", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strEmail))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidEmail", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strContact))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidContact", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strCurrencyCode))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidCurrency", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strFName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidFName", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(strLName))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidLName", xeErrors);
            isProcessAbort  = true;
        }
        else if (!DateTime.TryParse(strDOB, out dtDOB))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidDOB", xeErrors);
            isProcessAbort  = true;
        }
        else if (!CheckOver18(Convert.ToDateTime(strDOB)))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/Required18", xeErrors);
            isProcessAbort  = true;
        }
        else if ((!string.IsNullOrEmpty(strCountryCode) && commonCountry.IsBlocked(strCountryCode) && string.IsNullOrEmpty(strPermission)) || strPermission == commonIp.Ip2locPermission.blocked.ToString())
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/CountryBlocked", xeErrors);
            isProcessAbort  = true;
        }
        else if (commonValidation.isInjection(txtLineId.Text))
        {
            strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidLineId", xeErrors);
            isProcessAbort  = true;
        }
        else
        {
            strResultCode   = "00";
            strResultDetail = "OK:ParameterValidation";

            strContact           = strContact.TrimStart('+');
            strPasswordEncrypted = commonEncryption.Encrypt(strPassword);
        }

        if (_blockList != null)
        {
            foreach (var item in _blockList.Where(item => item.Value.ToLower().Equals(strFName.ToLower())))
            {
                strResultCode   = "11";
                strResultDetail = "Error:ParameterValidation";

                strAlertMessage = commonCulture.ElementValues.getResourceXPathString("CustomerService", xeErrors);
                isProcessAbort  = true;
            }
        }

        strErrorDetail   = strAlertMessage;
        strProcessRemark = string.Format("strAlertMessage: {0} | HiddenValues: {1} ", strAlertMessage, strHiddenValues);

        intProcessSerialId += 1;
        commonAuditTrail.appendLog("system", strPageName, "ParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

        #endregion

        if (!isProcessAbort)
        {
            strSignUpUrl    = string.Format("m.{0}", commonIp.DomainName);
            strLanguageCode = commonVariables.SelectedLanguage;

            if (string.IsNullOrEmpty(strIPAddress))
            {
                strIPAddress = commonIp.UserIP;
            }

            // should assign country based from currency if still empty or "xx"
            if (!commonCountry.IsValidCountry(strCountryCode))
            {
                strCountryCode = commonCountry.CountryFromCurrency(strCurrencyCode);
            }

            switch (strCountryCode.ToUpper())
            {
            case "MY":
            case "TH":
            case "VN":
            case "KH":
                intOddsType = 1;
                break;

            case "CN":
                intOddsType = 2;
                break;

            case "IN":
            case "KR":
            case "JP":
            case "AU":
                intOddsType = 3;
                break;

            case "ID":
                intOddsType = 4;
                break;

            default:
                intOddsType = 3;
                break;
            }

            customConfig.OperatorSettings opSettings = new customConfig.OperatorSettings("W88");

            if (opSettings.Values.Get("DemoDomains").IndexOf(commonIp.DomainName) >= 0)
            {
                isTestAccount = true;
            }

            string strAddress = strCountryCode;
            string strCity    = strCountryCode;
            string strPostal  = "000000";
            string strGender  = "M";
            //int intAffiliateId = string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId")) ? (string.IsNullOrEmpty(strAffiliateId) ? 0 : Convert.ToInt32(strAffiliateId)) : Convert.ToInt32(commonVariables.GetSessionVariable("AffiliateId"));
            string AffiliateId;
            if (string.IsNullOrEmpty(commonVariables.GetSessionVariable("AffiliateId")))
            {
                AffiliateId = (string.IsNullOrEmpty(strAffiliateId) ? "0" : strAffiliateId);
            }
            else
            {
                AffiliateId = commonVariables.GetSessionVariable("AffiliateId");
            }

            int intAffiliateId;
            try
            {
                int.TryParse(AffiliateId, out intAffiliateId);
            }
            catch
            {
                intAffiliateId = 0;
            }

            var    strReferBy  = commonCookie.CookieReferralId;
            string strDeviceId = !String.IsNullOrEmpty(commonCookie.CookieDeviceId) ? commonCookie.CookieDeviceId : "Mobile";

            System.Data.DataSet dsRegister = null;

            using (wsMemberMS1.memberWSSoapClient svcInstance = new wsMemberMS1.memberWSSoapClient())
            {
                dsRegister = svcInstance.MemberRegistrationNewWithLineId(lngOperatorId, strMemberCode, strPasswordEncrypted, strEmail, strContactNumber,
                                                                         strAddress, strCity, strPostal, strCountryCode, strCurrencyCode, strGender, intOddsType, string.IsNullOrEmpty(strLanguageCode) ? "en-us" : strLanguageCode,
                                                                         intAffiliateId, strReferBy, strIPAddress, strSignUpUrl, strDeviceId, isTestAccount, strFName, strLName, dtDOB, string.Empty, lineId);

                strProcessRemark = string.Format("OperatorId: {0} | MemberCode: {1} | Password: {2} | Email: {3} | Contact: {4} | Address: {5} | City: {6} | Postal: {6} | Country: {8} | Currency: {9} | Gender: {10} | OddsType: {11} | Language: {12} | Affiliate: {13} | ReferBy: {14} | IP: {15} | SignUpUrl: {16} | DeviceID: {17} | TestAccount: {18} | FName: {19} | LName: {20} | DOB: {21} | REMOTEIP: {22} | FORWARDEDIP: {23} | REQUESTERIP: {24} | AffiliateID: {25}",
                                                 lngOperatorId, strMemberCode, strPasswordEncrypted, strEmail, strContact, strAddress, strCity, strPostal, strCountryCode, strCurrencyCode, strGender, intOddsType, strLanguageCode, intAffiliateId, strReferBy, strIPAddress, strSignUpUrl, strDeviceId, isTestAccount, strFName, strLName, dtDOB, commonIp.remoteIP, commonIp.forwardedIP, commonIp.requesterIP, intAffiliateId);

                intProcessSerialId += 1;
                commonAuditTrail.appendLog("system", strPageName, "RegistrationParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);

                strResultCode   = "21";
                strResultDetail = "Error:MemberRegistrationNew";

                if (dsRegister.Tables[0].Rows.Count > 0)
                {
                    strProcessCode = Convert.ToString(dsRegister.Tables[0].Rows[0]["RETURN_VALUE"]);

                    switch (strProcessCode)
                    {
                    case "0":
                        strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                        break;

                    case "1":
                        strAlertCode    = strProcessCode;
                        strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/Success", xeErrors);
                        string strMemberSessionId = Convert.ToString(dsRegister.Tables[0].Rows[0]["memberSessionId"]);
                        HttpContext.Current.Session.Add("MemberSessionId", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberSessionId"]));
                        HttpContext.Current.Session.Add("MemberId", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberId"]));
                        HttpContext.Current.Session.Add("MemberCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["memberCode"]));
                        HttpContext.Current.Session.Add("CountryCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["countryCode"]));
                        HttpContext.Current.Session.Add("CurrencyCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["currency"]));
                        HttpContext.Current.Session.Add("LanguageCode", Convert.ToString(dsRegister.Tables[0].Rows[0]["languageCode"]));
                        HttpContext.Current.Session.Add("RiskId", Convert.ToString(dsRegister.Tables[0].Rows[0]["riskId"]));
                        HttpContext.Current.Session.Add("PartialSignup", Convert.ToString(dsRegister.Tables[0].Rows[0]["partialSignup"]));
                        HttpContext.Current.Session.Add("ResetPassword", Convert.ToString(dsRegister.Tables[0].Rows[0]["resetPassword"]));

                        commonCookie.CookieS = strMemberSessionId;
                        commonCookie.CookieG = strMemberSessionId;
                        HttpContext.Current.Session.Add("LoginStatus", "success");

                        strResultCode   = "00";
                        strResultDetail = "OK:MemberRegistrationNew";

                        #region IOVATION
                        //this.IovationSubmit(ref intProcessSerialId, strProcessId, strPageName, strMemberCode, strIPAddress, strPermission);
                        #endregion
                        break;

                    case "10":
                        strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateUsername", xeErrors);
                        break;

                    case "11":
                        strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateEmail", xeErrors);
                        break;

                    case "50":
                        strAlertMessage = commonCulture.ElementValues.getResourceXPathString("Register/DuplicateContact", xeErrors);
                        break;

                    default:
                        strAlertMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                        break;
                    }

                    strErrorCode   = strProcessCode;
                    strErrorDetail = strAlertMessage;
                }

                intProcessSerialId += 1;
                commonAuditTrail.appendLog("system", strPageName, "MemberRegistrationNew", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
                if (strAlertCode == "1")
                {
                    string strRedirect = Request.QueryString.Get("redirect");

                    if (string.IsNullOrWhiteSpace(strRedirect))
                    {
                        Response.Redirect("/_Secure/RegisterSuccess.aspx?lang=" + commonVariables.SelectedLanguage.ToLower(), false);
                    }
                    else
                    {
                        Response.Redirect(strRedirect, false);
                    }
                }
            }
        }
    }