Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="oclass"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static string GetNotifyUrl(int oclass, object obj)
        {
            string notifyUrl = string.Empty;

            if (oclass == 1)//网银
            {
                OrderBankInfo orderInfo = obj as OrderBankInfo;
                if (orderInfo == null)
                {
                    return(string.Empty);
                }

                OrderBank bll = new OrderBank();
                notifyUrl = "";   //bll.GetCallBackUrl(orderInfo);
            }
            else if (oclass == 2) //点卡
            {
                OrderCardInfo orderInfo = obj as OrderCardInfo;
                if (orderInfo == null)
                {
                    return(string.Empty);
                }

                OrderCard bll = new OrderCard();
                //notifyUrl = bll.GetCallBackUrl(orderInfo);
            }
            else if (oclass == 3)//短信及声讯
            {
                OrderSmsInfo orderInfo = obj as OrderSmsInfo;
                if (orderInfo == null)
                {
                    return(string.Empty);
                }
                OrderSms bll = new OrderSms();
                notifyUrl = bll.GetCallBackUrl(orderInfo);
            }
            return(notifyUrl);
        }
Esempio n. 2
0
        const int DefaultTimeout = 2 * 60 * 1000; // 2 minutes timeout

        #region UpdatetoDB
        /// <summary>
        /// 将结果返回到数据库
        /// </summary>
        /// <param name="oclass"></param>
        /// <param name="obj"></param>
        /// <param name="agurl"></param>
        /// <param name="times"></param>
        /// <param name="callbacktext"></param>
        private static void UpdatetoDB(int oclass, object obj, string agurl, int times, string callbacktext, bool success, string errcode)
        {
            if (oclass == 1)
            {
                OrderBankInfo orderInfo = obj as OrderBankInfo;
                if (orderInfo != null)
                {
                    OrderBank dal = new OrderBank();

                    //string SuccessFlag = SystemApiHelper.Successflag(orderInfo.version);

                    bool isnotifysucc = SystemApiHelper.CheckCallBackIsSuccess(orderInfo.version, callbacktext);

                    orderInfo.notifystat     = isnotifysucc ? 2 : 4;
                    orderInfo.againNotifyUrl = agurl;
                    orderInfo.notifycontext  = callbacktext;
                    orderInfo.notifycount    = times;
                    orderInfo.notifytime     = DateTime.Now;
                    dal.UpdateNotifyInfo(orderInfo);

                    if (orderInfo.notifystat != 2)
                    {
                        //没有成功将发送到异常队列 多次通知
                        banknotifyQueue.Send(orderInfo);
                    }
                }
            }
            else if (oclass == 2)
            {
                OrderCardInfo orderInfo = obj as OrderCardInfo;
                if (orderInfo != null)
                {
                    OrderCard dal = new OrderCard();

                    bool isnotifysucc = SystemApiHelper.CheckCallBackIsSuccess(orderInfo.version, callbacktext);
                    orderInfo.notifystat     = isnotifysucc ? 2 : 4;
                    orderInfo.againNotifyUrl = agurl;
                    orderInfo.notifycontext  = callbacktext;
                    orderInfo.notifycount    = times;
                    orderInfo.notifytime     = DateTime.Now;

                    dal.UpdateNotifyInfo(orderInfo);

                    if (orderInfo.notifystat != 2)
                    {
                        //没有成功将发送到异常队列 多次通知
                        cardnotifyQueue.Send(orderInfo);
                    }
                }
            }
            else if (oclass == 3)
            {
                OrderSmsInfo orderInfo = obj as OrderSmsInfo;

                if (orderInfo != null)
                {
                    OrderSms dal = new OrderSms();

                    orderInfo.notifystat     = success ? 2:4;
                    orderInfo.issucc         = success;
                    orderInfo.errcode        = errcode;
                    orderInfo.againNotifyUrl = agurl;
                    orderInfo.notifycontext  = callbacktext;
                    orderInfo.notifycount    = times;
                    dal.UpdateNotifyInfo(orderInfo);

                    if (orderInfo.notifystat != 2)
                    {
                        //没有成功将发送到异常队列 多次通知
                        smsnotifyQueue.Send(orderInfo);
                    }
                }
            }
        }