示例#1
0
        public DL_SessionCyberPlateStatusReturn GetCyberPlateStatus(DL_SessionCyberPlateStatus dL_SessionCyberPlateStatus)
        {
            _IsSuccess = true;
            dL_SessionCyberPlateStatusReturn = new DL_SessionCyberPlateStatusReturn();
            ProcessReqReturn prt          = new ProcessReqReturn();
            string           TransationId = string.Empty;

            try
            {
                RechargeProcess  rechargeProcess  = new RechargeProcess();
                CyberPlateStatus cyberPlateStatus = GetSessionId(dL_SessionCyberPlateStatus.TransactionId); //Added | Ranjeet |26-Dec |Get Session and Opid
                if (cyberPlateStatus != null)
                {
                    string strinputMsgStatus = rechargeProcess.GetInputMessageForStatus(cyberPlateStatus.SessionId,
                                                                                        cyberPlateStatus.OperatorId, string.Empty);

                    string statusResponse = RechargeProcess.Process(rechargeProcess.Status_OperatorRequestUrl(cyberPlateStatus.OperatorId), strinputMsgStatus);

                    int num = statusResponse.LastIndexOf("TRANSID=");
                    TransationId = statusResponse.Substring(num).Split(new char[1] {
                        '\r'
                    })[0].Split('=')[1];
                    if (statusResponse.IndexOf("ERROR=0") != -1 && statusResponse.IndexOf("RESULT=7") != -1)
                    {
                        dL_SessionCyberPlateStatusReturn.TransId = TransationId;
                        dL_SessionCyberPlateStatusReturn.Status  = "1";
                        dL_SessionCyberPlateStatusReturn.Message = "Successfully recharged.";
                        return(dL_SessionCyberPlateStatusReturn);
                    }
                    else
                    {
                        dL_SessionCyberPlateStatusReturn.TransId = TransationId;
                        dL_SessionCyberPlateStatusReturn.Status  = "2";
                        dL_SessionCyberPlateStatusReturn.Message = rechargeProcess.GetErrorDescription(statusResponse);
                        return(dL_SessionCyberPlateStatusReturn);
                    }
                }

                else
                {
                    return(null);
                }
            }


            catch (Exception ex)
            {
                Logger.WriteLog(LogLevelL4N.ERROR, "Exception : " + ex.Message);
                _IsSuccess = false;
            }

            return(dL_SessionCyberPlateStatusReturn);
        }
        public HttpResponseMessage CheckCyberPlateTransStatus(HttpRequestMessage req, DL_SessionCyberPlateStatus dL_SessionCyberPlateStatus)
        {
            BL_Operator cyberPlateStatus = new BL_Operator();
            DL_SessionCyberPlateStatusReturn cyberPlateStatusReturn = cyberPlateStatus.GetCyberPlateStatus(dL_SessionCyberPlateStatus); //Validate Login

            if (cyberPlateStatus._IsSuccess)
            {
                return(req.CreateResponse <DL_SessionCyberPlateStatusReturn>(HttpStatusCode.OK, cyberPlateStatusReturn));
            }
            else
            {
                return(req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError"));
            }
        }