示例#1
0
        //Modified: Ranjeet | 26-Dec | Fixed recharger status bug
        public DL_RefundOrTransStatusReturn RefundorTransStatus(DL_RefundOrTransStatus dL_RefundOrTransStatus)
        {
            this.SpName = DL_StoreProcedure.SP_DHS_API_RefundorTransStatus; //Sp Name
            DL_RefundOrTransStatusReturn dL_RefundOrTransStatusReturn = null;

            _IsSuccess = true;
            try
            {
                //For Refund
                if (dL_RefundOrTransStatus.TypeId == 1)
                {
                    SqlParameter[] param = new SqlParameter[5];
                    param[0] = new SqlParameter("@UserId", dL_RefundOrTransStatus.UserId);
                    param[1] = new SqlParameter("@TransId", dL_RefundOrTransStatus.TransId);
                    param[2] = new SqlParameter("@Date", indianTime);
                    param[3] = new SqlParameter("@Comments", dL_RefundOrTransStatus.Comments);
                    param[4] = new SqlParameter("@TypeId", dL_RefundOrTransStatus.TypeId);

                    ds = db.GetDataSet(this.SpName, param);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        var row = ds.Tables[0].Rows[0];
                        dL_RefundOrTransStatusReturn = new DL_RefundOrTransStatusReturn
                        {
                            Status       = Convert.ToInt32(row["Status"]),
                            CyberTransId = row["CyberTransId"].ToString(),
                            OperatorId   = Convert.ToInt32(row["OperatorId"])
                        };
                    }
                }
                //check cyber status
                else if (dL_RefundOrTransStatus.TypeId == 2)
                {
                    BL_Operator      bl = new BL_Operator();
                    CyberPlateStatus cyberPlateStatus = bl.GetSessionId(dL_RefundOrTransStatus.TransId); //Added | Ranjeet |26-Dec |Get cyber Session and Opid

                    DL_SessionCyberPlateStatusReturn dL_SessionCyberPlateStatusReturn = bl.GetCyberPlateStatus(
                        new DL_SessionCyberPlateStatus()
                    {
                        TransactionId = dL_RefundOrTransStatus.TransId
                    });
                    dL_RefundOrTransStatusReturn = new DL_RefundOrTransStatusReturn(); //Added | Ranjeet | to fix Null Exception
                    dL_RefundOrTransStatusReturn.CyberTransId = dL_SessionCyberPlateStatusReturn.TransId;
                    dL_RefundOrTransStatusReturn.Message      = dL_SessionCyberPlateStatusReturn.CyberCode + " : " + dL_SessionCyberPlateStatusReturn.Message;
                    dL_RefundOrTransStatusReturn.Status       = Convert.ToInt32(dL_SessionCyberPlateStatusReturn.Status);
                }
                dL_RefundOrTransStatusReturn.TypeId = dL_RefundOrTransStatus.TypeId;
            }
            catch (Exception ex)
            {
                Logger.WriteLog(LogLevelL4N.ERROR, "Error @ RefundorTransStatus : " + ex.Message);
                _IsSuccess = false;
            }

            return(dL_RefundOrTransStatusReturn);
        }
示例#2
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);
        }
示例#3
0
        //Modified: Ranjeet || 26-Dec || return type CyberPlateStatus
        public CyberPlateStatus GetSessionId(string transId)
        {
            CyberPlateStatus cyberPlateStatus = null;

            //string sessionNum = string.Empty;
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@TransId", transId);
            string spName = DL_StoreProcedure.SP_DHS_GetSessionId; //Sp Name"GetSessionId";

            ds = db.GetDataSet(spName, param);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                //Modified: Ranjeet || Get cyber session id
                //sessionNum = "" + dr["CSessionId"];
                cyberPlateStatus = new CyberPlateStatus()
                {
                    SessionId = "" + dr["CSessionId"], OperatorId = Convert.ToInt32(dr["OpId"])
                };
            }
            return(cyberPlateStatus);
        }