Example #1
0
        /// <summary>
        /// SignIn TopupInteface
        /// ChungNN 03/2009
        /// </summary>
        /// <returns>token</returns>
        private string SignIn()
        {
            string blnRetvalue = "";

            try
            {
                SignInResult sginObj = srvObj.GetToken(AppConfiguration.TopupInterfaceUserName, AppConfiguration.TopupInterfacePassword);
                if (sginObj.ErrorCode != 0)
                {
                    sginObj = srvObj.SignIn(AppConfiguration.TopupInterfaceUserName, AppConfiguration.TopupInterfacePassword);
                    if (sginObj.ErrorCode == 0)
                    {
                        blnRetvalue = sginObj.Token;
                    }
                }
                else
                {
                    blnRetvalue = sginObj.Token;
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            if (blnRetvalue.Length > 0)
            {
                ServiceSessionManager.GetSessionInstance().AddSession(blnRetvalue, "TopupInterfaceToken");
            }

            return(blnRetvalue);
        }
Example #2
0
        /// <summary>
        /// POS download softpin in template
        /// ChungNN 03/2009
        /// </summary>
        /// <param name="Pos_ID"></param>
        /// <param name="Merchant_ID"></param>
        /// <param name="RequestID"></param>
        /// <param name="SoftpinStock"></param>
        /// <returns></returns>
        public BatchBuyObject PosDownloadSoftpinTemplate(int Pos_ID, int Merchant_ID, string RequestID, object[] SoftpinStock)
        {
            BatchBuyObject buyObj = new BatchBuyObject();
            string         strTopupInterfaceToken = ServiceSessionManager.GetSessionInstance().GetSession("TopupInterfaceToken");

            buyObj = srvObj.PosDownloadSoftpinTemplate(Pos_ID, Merchant_ID, RequestID, SoftpinStock, strTopupInterfaceToken);
            Thread.Sleep(AppConfiguration.TopupInterface_TimeOut);

            return(buyObj);
            //transObj.WriteLog("PosDownloadSingleSoftpin, Errorcode = " + buyObj.ErrorCode.ToString());
        }
Example #3
0
        /// <summary>
        /// POS download some softpins
        /// ChungNN 03/2009
        /// </summary>
        /// <param name="Pos_ID"></param>
        /// <param name="Merchant_ID"></param>
        /// <param name="RequestID"></param>
        /// <param name="CategoryName"></param>
        /// <param name="ServiceProviderName"></param>
        /// <param name="ProductValue"></param>
        /// <param name="StockQuantity"></param>
        /// <param name="DownloadQuantity"></param>
        /// <returns></returns>
        public BatchBuyObject PosDownloadSingleSoftpin(int Pos_ID, int Merchant_ID, string RequestID, string CategoryName, string ServiceProviderName, int ProductValue, int StockQuantity, int DownloadQuantity)
        {
            BatchBuyObject buyObj = new BatchBuyObject();
            string         strTopupInterfaceToken = ServiceSessionManager.GetSessionInstance().GetSession("TopupInterfaceToken");

            //string RequestID = Guid.NewGuid().ToString().Substring(0, 19);
            buyObj = srvObj.PosDownloadSingleSoftpin(Pos_ID, Merchant_ID, RequestID, CategoryName, ServiceProviderName, ProductValue, StockQuantity, DownloadQuantity, strTopupInterfaceToken);
            Thread.Sleep(AppConfiguration.TopupInterface_TimeOut);
            //buyObj = srvObj.PosDownloadSingleSoftpin(Pos_ID, Merchant_ID, RequestID, CategoryName, ServiceProviderName, ProductValue, StockQuantity, strTopupInterfaceToken);

            return(buyObj);
            //transObj.WriteLog("PosDownloadSingleSoftpin, Errorcode = " + buyObj.ErrorCode.ToString());
        }
Example #4
0
        /// <summary>
        /// POS Logout gateway
        /// ChungNN 03/2009
        /// </summary>
        /// <param name="Pos_ID"></param>
        /// <param name="Request"></param>
        /// <returns></returns>
        public bool PosLogout(int Pos_ID, string Request)
        {
            bool blnRetValue = false;

            try
            {
                if (!ServiceSessionManager.GetSessionInstance().IsExistedSession(Pos_ID.ToString(), Request))
                {
                    ServiceSessionManager.GetSessionInstance().DelSession(Pos_ID.ToString());
                    blnRetValue = true;
                }
                else
                {
                    blnRetValue = false;
                }
            }
            catch //(Exception ex)
            {
                blnRetValue = false;
            }

            return(blnRetValue);
        }
Example #5
0
        /// <summary>
        /// POS Logon gateway
        /// ChungNN 03/2009
        /// </summary>
        /// <param name="Pos_ID"></param>
        /// <param name="Request"></param>
        /// <param name="PosAdminPassword"></param>
        /// <returns></returns>
        public bool PosLogon(int Pos_ID, ref string Request, string PosAdminPassword)
        {
            bool   blnRetvalue            = false;
            string strTopupInterfaceToken = string.Empty;

            try
            {
                //get TopupInterface token
                if (ServiceSessionManager.GetSessionInstance().IsExistedSession("TopupInterfaceToken"))
                {
                    strTopupInterfaceToken = ServiceSessionManager.GetSessionInstance().GetSession("TopupInterfaceToken");
                }
                else
                {
                    //new Thread(new ThreadStart(SignIn)).Start();

                    strTopupInterfaceToken = SignIn();
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            //Logon as POS
            int nCounter = 2;

            while (nCounter > 0)
            {
                try
                {
                    ErrorResult ErrObj = srvObj.PosLogon(Pos_ID, PosAdminPassword, strTopupInterfaceToken);
                    if (ErrObj.ErrorCode == 0)
                    {
                        //Save POS_ID session to server
                        if (!ServiceSessionManager.GetSessionInstance().IsExistedSession(Pos_ID.ToString()))
                        {
                            ServiceSessionManager.GetSessionInstance().AddSession(Request, Pos_ID.ToString());
                        }
                        else
                        {
                            Request = ServiceSessionManager.GetSessionInstance().GetSession(Pos_ID.ToString());
                        }

                        nCounter    = 0;
                        blnRetvalue = true;
                        break;
                    }
                    //token is not existed on TopupInerface ->invok SignIn() again
                    else //if (ErrObj.ErrorCode == -1)
                    {
                        strTopupInterfaceToken = SignIn();
                        nCounter--;
                    }
                }
                catch (Exception ex)
                {
                    throw (ex);
                }
            }
            return(blnRetvalue);
        }