Example #1
0
    protected void IovationSubmit(ref int intProcessSerialId, string strProcessId, string strPageName, string strUsername, string strIPAddress, string strPermission)
    {
        string strResultCode    = string.Empty;
        string strResultDetail  = string.Empty;
        string strErrorCode     = string.Empty;
        string strErrorDetail   = string.Empty;
        string strProcessRemark = string.Empty;
        bool   isSystemError    = false;

        customConfig.IovationSettings ioSettings = new customConfig.IovationSettings("W88");
        string strCheckTransactionUrl            = ioSettings.Values.Get("CheckTransactionUrl");
        string strGetEvidenceUrl     = ioSettings.Values.Get("GetEvidenceUrl");
        string strAccountPrefix      = ioSettings.Values.Get("AccountPrefix");
        string strSubscriberID       = ioSettings.Values.Get("SubscriberId");
        string strSubscriberAccount  = ioSettings.Values.Get("SubscriberAccount");
        string strSubscriberPassCode = ioSettings.Values.Get("SubscriberPassCode");
        string strServiceEnabled     = ioSettings.Values.Get("ServiceEnabled");
        string strUserAccountCode    = string.Format("{0}{1}", strAccountPrefix, strUsername);
        string strExceptions         = ioSettings.Values.Get("Exceptions");

        List <string> lstPermission = strExceptions.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList();

        if (lstPermission.FindIndex(x => x.Trim().Equals(strPermission, StringComparison.OrdinalIgnoreCase)) >= 0)
        {
            return;
        }
        else if (string.Compare(strServiceEnabled, "true", true) != 0)
        {
            return;
        }

        strProcessRemark = string.Format("CheckTransactionURL: {0} | GetEvidenceURL: {1} | AccountPrefix: {2} | SubscriberID: {3} | SubscriberAccount: {4} | SubscriberPassCode: {5} | UserAccountCode : {6}",
                                         strCheckTransactionUrl, strGetEvidenceUrl, strAccountPrefix, strSubscriberID, strSubscriberAccount, strSubscriberPassCode, strUserAccountCode);

        try
        {
            using (CheckTransactionDetailsService ioInstance = new CheckTransactionDetailsService(strCheckTransactionUrl))
            {
                CheckTransactionDetails ioRequest = new CheckTransactionDetails();

                ioRequest.accountcode = strUserAccountCode;
                ioRequest.enduserip   = strIPAddress;

                ioRequest.beginblackbox      = HttpContext.Current.Request.Form.Get("ioBlackBox");
                ioRequest.subscriberid       = strSubscriberID;
                ioRequest.subscriberpasscode = strSubscriberPassCode;
                ioRequest.subscriberaccount  = strSubscriberAccount;
                ioRequest.type = "login";

                CheckTransactionDetailsResponse ioResponse = new CheckTransactionDetailsResponse();

                ioResponse = ioInstance.CheckTransactionDetails(ioRequest);

                #region setIovationCookie
                HttpCookie cookie = new HttpCookie(strUsername);
                cookie.Value = ioResponse.result;
                if (!string.IsNullOrEmpty(commonIp.DomainName))
                {
                    cookie.Domain = commonIp.DomainName;
                }
                cookie.Expires = System.DateTime.Now.AddDays(Convert.ToInt32(ioSettings.Values.Get("ServiceDays")));
                HttpContext.Current.Response.Cookies.Add(cookie);
                #endregion
            }
        }
        catch (Exception ex)
        {
            strResultCode   = "31";
            strResultDetail = "Error:Iovation";
            strErrorCode    = Convert.ToString(ex.HResult);
            strErrorDetail  = ex.Message;

            isSystemError = true;
        }


        intProcessSerialId += 1;
        commonAuditTrail.appendLog("system", strPageName, "Iovation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError);
    }
Example #2
0
        public void IovationSubmit(ref int intProcessSerialId, string strProcessId, string strIPAddress, LoginInfo info)
        {
            var iovationObj = new IovationModel(info.Username);

            if (string.Compare(iovationObj.ServiceEnabled, "true", true) != 0)
            {
                return;
            }

            iovationObj.ProcessRemark =
                string.Format(
                    "CheckTransactionURL: {0} | GetEvidenceURL: {1} | AccountPrefix: {2} | SubscriberID: {3} | SubscriberAccount: {4} | SubscriberPassCode: {5} | UserAccountCode : {6}",
                    iovationObj.CheckTransactionUrl, iovationObj.GetEvidenceUrl, iovationObj.AccountPrefix,
                    iovationObj.SubscriberID, iovationObj.SubscriberAccount, iovationObj.SubscriberPassCode,
                    iovationObj.UserAccountCode);

            try
            {
                using (var ioInstance = new CheckTransactionDetailsService(iovationObj.CheckTransactionUrl))
                {
                    var ioRequest = new CheckTransactionDetails
                    {
                        accountcode        = iovationObj.UserAccountCode,
                        enduserip          = strIPAddress,
                        beginblackbox      = info.ioBlackBox,
                        subscriberid       = iovationObj.SubscriberID,
                        subscriberpasscode = iovationObj.SubscriberPassCode,
                        subscriberaccount  = iovationObj.SubscriberAccount,
                        type = info.PageName
                    };

                    var ioResponse = new CheckTransactionDetailsResponse();

                    ioResponse = ioInstance.CheckTransactionDetails(ioRequest);

                    #region setIovationCookie
                    var cookie = new HttpCookie(info.Username);
                    cookie.Value = ioResponse.result;
                    if (!string.IsNullOrEmpty(commonIp.DomainName))
                    {
                        cookie.Domain = commonIp.DomainName;
                    }
                    cookie.Expires = System.DateTime.Now.AddDays(Convert.ToInt32(iovationObj.ServiceDays));
                    HttpContext.Current.Response.Cookies.Add(cookie);
                    #endregion
                }
            }
            catch (Exception ex)
            {
                iovationObj.ResultCode   = "31";
                iovationObj.ResultDetail = "Error:Iovation";
                iovationObj.ErrorCode    = Convert.ToString(ex.HResult);
                iovationObj.ErrorDetail  = ex.Message;

                iovationObj.isSystemError = true;
            }


            intProcessSerialId += 1;
            commonAuditTrail.appendLog("system", info.PageName, "Iovation", "DataBaseManager.DLL", iovationObj.ResultCode, iovationObj.ResultDetail, iovationObj.ErrorCode, iovationObj.ErrorDetail, iovationObj.ProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, iovationObj.isSystemError);
        }