示例#1
0
    public static string GetSessionCode()
    {
        var strProcessCode = "10";

        if (!IsLoggedIn())
        {
            return(strProcessCode);
        }
        System.Data.DataSet dsSignin = null;
        try
        {
            using (wsMemberMS1.memberWSSoapClient svcInstance = new wsMemberMS1.memberWSSoapClient())
            {
                dsSignin = svcInstance.MemberSessionCheck(commonVariables.CurrentMemberSessionId, commonIp.UserIP);

                if (dsSignin.Tables[0].Rows.Count > 0)
                {
                    strProcessCode = Convert.ToString(dsSignin.Tables[0].Rows[0]["RETURN_VALUE"]);
                }
            }
        }
        catch (Exception e)
        {
        }
        return(strProcessCode);
    }
示例#2
0
    private string CheckMemberSession(int signInreturnValue)
    {
        string returnMsg = string.Empty;

        using (var svcInstance = new wsMemberMS1.memberWSSoapClient())
        {
            DataSet dsMember = svcInstance.MemberSessionCheck(commonVariables.CurrentMemberSessionId, commonIp.UserIP);

            if (dsMember.Tables[0].Rows.Count > 0)
            {
                switch (signInreturnValue)
                {
                case 0:
                    returnMsg = commonCulture.ElementValues.getResourceString("Exception", _loginInfo.XeErrors);
                    break;

                case 1:
                    HttpContext.Current.Session.Add("MemberName",
                                                    Convert.ToString(dsMember.Tables[0].Rows[0]["lastName"]) +
                                                    Convert.ToString(dsMember.Tables[0].Rows[0]["firstName"]));
                    break;
                }
            }
        }

        return(returnMsg);
    }
示例#3
0
        public DataTable FetchMemberData(string memberSessionId = null, string password = null)
        {
            var response = new DataTable();

            try
            {
                using (var svcInstance = new wsMemberMS1.memberWSSoapClient())
                {
                    var id       = memberSessionId ?? commonVariables.CurrentMemberSessionId;
                    var dsMember = svcInstance.MemberSessionCheck(id, commonIp.UserIP);

                    if (dsMember != null)
                    {
                        if (dsMember.Tables[0].Rows.Count > 0)
                        {
                            response = dsMember.Tables[0];
                        }
                    }
                    return(response);
                }
            }
            catch (Exception)
            {
                return(response);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Xml.Linq.XElement xeErrors = commonVariables.ErrorsXML;

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

        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;

        string strProcessCode    = string.Empty;
        string strProcessMessage = string.Empty;
        string strLastLoginIP    = string.Empty;

        bool runIovation = false;

        System.Xml.XmlDocument xdResponse = new System.Xml.XmlDocument();

        #endregion

        #region populateVariables
        var lngOperatorId   = long.Parse(commonVariables.OperatorId);
        var strMemberCode   = Request.Form.Get("txtUsername");
        var strPassword     = Request.Form.Get("txtPassword");
        var strSiteURL      = commonVariables.SiteUrl;
        var strDeviceId     = HttpContext.Current.Request.UserAgent;
        var strVCode        = Request.Form.Get("txtCaptcha");
        var strSessionVCode = commonEncryption.decrypting(commonVariables.GetSessionVariable("vCode"));
        #endregion

        #region parametersValidation
        if (string.IsNullOrEmpty(strMemberCode))
        {
            strProcessCode    = "-1";
            strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/MissingUsername", xeErrors);
            isProcessAbort    = true;
        }
        else if (string.IsNullOrEmpty(strPassword))
        {
            strProcessCode    = "-1";
            strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/MissingPassword", xeErrors);
            isProcessAbort    = true;
        }
        else if (commonValidation.isInjection(strMemberCode))
        {
            strProcessCode    = "-1";
            strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InvalidUsername", xeErrors);
            isProcessAbort    = true;
        }
        else if (commonValidation.isInjection(strPassword))
        {
            strProcessCode    = "-1";
            strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InvalidPassword", xeErrors);
            isProcessAbort    = true;
        }
        else if (!string.IsNullOrEmpty(strVCode) && !string.IsNullOrEmpty(strSessionVCode))
        {
            if (string.IsNullOrEmpty(strVCode))
            {
                strProcessCode    = "-1";
                strProcessMessage = commonCulture.ElementValues.getResourceString("MissingVCode", xeErrors);
                isProcessAbort    = true;
            }
            else if (commonValidation.isInjection(strVCode))
            {
                strProcessCode    = "-1";
                strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Register/InvalidVCode", xeErrors);
                isProcessAbort    = true;
            }
            if (strVCode != strSessionVCode)
            {
                strProcessCode    = "-1";
                strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Register/IncorrectVCode", xeErrors);
                isProcessAbort    = true;
            }
        }
        else
        {
            strPassword = commonEncryption.Encrypt(strPassword);
        }

        strProcessRemark = string.Format("MemberCode: {0} | Password: {1} | VCode: {2} | SVCode: {3} | IP: {4} ", strMemberCode, strPassword, strVCode, strSessionVCode, commonIp.UserIP);

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

        #endregion

        #region initiateLogin
        if (!isProcessAbort)
        {
            try
            {
                using (wsMemberMS1.memberWSSoapClient svcInstance = new wsMemberMS1.memberWSSoapClient())
                {
                    System.Data.DataSet dsSignin = null;
                    dsSignin = svcInstance.MemberSignin(lngOperatorId, strMemberCode, strPassword, strSiteURL, commonIp.UserIP, strDeviceId);

                    if (dsSignin.Tables[0].Rows.Count > 0)
                    {
                        strProcessCode = Convert.ToString(dsSignin.Tables[0].Rows[0]["RETURN_VALUE"]);
                        switch (strProcessCode)
                        {
                        case "0":
                            strProcessMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                            break;

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

                            commonCookie.CookieS       = strMemberSessionId;
                            commonCookie.CookieG       = strMemberSessionId;
                            commonCookie.CookiePalazzo = strPassword;

                            bool isResetPassword = Convert.ToBoolean(string.IsNullOrWhiteSpace(Session["ResetPassword"] as string) ? 0 : Session["ResetPassword"]);

                            if (isResetPassword)
                            {
                                strProcessCode = "resetPassword";
                            }

                            strLastLoginIP = Convert.ToString(dsSignin.Tables[0].Rows[0]["lastLoginIP"]);
                            if (HttpContext.Current.Request.Cookies[strMemberCode] == null)
                            {
                                runIovation = true;
                            }
                            else if (HttpContext.Current.Request.Cookies[strMemberCode] != null && string.Compare(strLastLoginIP, commonIp.UserIP, true) != 0)
                            {
                                runIovation = true;
                            }
                            if (runIovation)
                            {
                                this.IovationSubmit(ref intProcessSerialId, strProcessId, strPageName, strMemberCode, commonIp.UserIP);
                            }

                            DataSet dsMember = svcInstance.MemberSessionCheck(commonVariables.CurrentMemberSessionId, commonIp.UserIP);

                            if (dsMember.Tables[0].Rows.Count > 0)
                            {
                                strProcessCode = Convert.ToString(dsSignin.Tables[0].Rows[0]["RETURN_VALUE"]);
                                switch (strProcessCode)
                                {
                                case "0":
                                    strProcessMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);;
                                    break;

                                case "1":
                                    HttpContext.Current.Session.Add("MemberName", Convert.ToString(dsMember.Tables[0].Rows[0]["lastName"]) + Convert.ToString(dsMember.Tables[0].Rows[0]["firstName"]));
                                    break;
                                }
                            }

                            break;

                        case "21":
                            strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InvalidUsername", xeErrors);
                            break;

                        case "22":
                            strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InactiveAccount", xeErrors);
                            break;

                        case "23":
                            strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InvalidPassword", xeErrors);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                strProcessCode    = "0";
                strProcessMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors);
                strProcessRemark  = string.Format("{0} | Message: {1}", strProcessRemark, ex.Message);
            }

            strProcessRemark = string.Format("{0} | strProcessCode: {1}", strProcessRemark, strProcessCode);

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

        #region Response
        System.Xml.XmlNode xnRootNode    = xdResponse.CreateElement("Login");
        System.Xml.XmlNode xnCodeNode    = xdResponse.CreateElement("ErrorCode");
        System.Xml.XmlNode xnMessageNode = xdResponse.CreateElement("Message");

        xnCodeNode.InnerText    = strProcessCode;
        xnMessageNode.InnerText = strProcessMessage;
        xnRootNode.AppendChild(xnCodeNode);
        xnRootNode.AppendChild(xnMessageNode);
        xdResponse.AppendChild(xnRootNode);

        Response.ContentType = "text/xml";
        Response.Write(xdResponse.DocumentElement.OuterXml);
        Response.End();
        #endregion
    }