Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="orderid"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        OrderCardInfo InitOrder(HttpContext _context, string orderid, CardInfo info)
        {
            try
            {
                var order = new OrderCardInfo
                {
                    ordertype  = 1,
                    orderid    = orderid,
                    userid     = info.UserId,
                    userorder  = info.orderid,
                    typeId     = info.TypeId,
                    cardType   = info.CardType,
                    cardNo     = info.CardNo,
                    cardPwd    = info.CardPwd,
                    paymodeId  = info.ChanelNo,
                    refervalue = info.OrderAmt,
                    faceValue  = 0M,
                    attach     = info.attach,
                    referUrl   =
                        _context.Request.UrlReferrer != null
                            ? _context.Request.UrlReferrer.ToString()
                            : string.Empty,
                    clientip      = ServerVariables.TrueIP,
                    addtime       = DateTime.Now,
                    completetime  = DateTime.Now,
                    notifycontext = string.Empty,
                    notifycount   = 0,
                    notifystat    = 0,
                    notifyurl     = info.callbackurl,
                    payRate       = 0M,
                    supplierId    = info.SupplierId,
                    supplierOrder = string.Empty,
                    server        = RuntimeSetting.ServerId,
                    manageId      = info.ManageId,
                    cardnum       = 1,
                    resultcode    = "",
                    ismulticard   = 0,
                    status        = 1,
                    ovalue        = string.Empty,
                    opstate       = "",
                    msg           = info.Msg,
                    userViewMsg   = info.Msg,
                    errtype       = "",
                    Desc          = info.Msg,
                    version       = info.Version,
                    withhold_type = 0,
                    makeup        = (byte)(info.ProcessMode == 2 ? 1 : 0)
                };

                if (order.manageId <= 0)
                {
                    order.agentId = viviapi.BLL.User.Factory.GetPromID(info.UserId);
                }

                if (info.ProcessMode == 1)
                {
                    viviapi.Cache.WebCache.GetCacheService().AddObject(order.orderid, order, ExpiresTime);
                }

                OrderBll.Insert(order);

                return(order);
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex);
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        string SendToSupp()
        {
            try
            {
                int    userid = currentUser.ID;
                string msg    = string.Empty;

                int supplierId = 0;

                bool isxunhuan = typeInfo.runmode == 1;


                ChannelInfo chanelInfo
                    = viviapi.BLL.Channel.Channel.GetModel(typeId, faceValue, userid, isxunhuan);

                if (chanelInfo == null ||
                    chanelInfo.supplier.HasValue == false ||
                    chanelInfo.supplier == 0)
                {
                    msg = "找不到通道,请联系商务或系统管理员处理。";
                }
                else
                {
                    supplierId = chanelInfo.supplier.Value;
                }

                if (supplierId > 0 && string.IsNullOrEmpty(msg))
                {
                    var order
                        = new viviapi.Model.Order.OrderCardInfo();

                    order.orderid       = viviapi.BLL.Order.Card.Factory.Instance.GenerateOrderId("");
                    order.addtime       = DateTime.Now;
                    order.attach        = "cardsell";
                    order.notifycontext = string.Empty;
                    order.notifycount   = 0;
                    order.notifystat    = 0;
                    order.notifyurl     = string.Empty;
                    order.clientip      = ServerVariables.TrueIP;
                    order.completetime  = DateTime.Now;
                    order.ordertype     = 8;
                    order.typeId        = typeId;
                    order.paymodeId     = typeId.ToString("0000") + faceValue.ToString();// chanelInfo.code;
                    order.payRate       = 0M;
                    order.supplierId    = supplierId;
                    order.supplierOrder = string.Empty;
                    order.userid        = userid;
                    order.userorder     = order.orderid + userid.ToString();
                    order.refervalue    = faceValue;
                    order.referUrl      = string.Empty;
                    order.cardNo        = cardNo;
                    order.cardPwd       = cardPwd;
                    order.server        = viviapi.SysConfig.RuntimeSetting.ServerId;
                    order.cardnum       = 1;
                    order.version       = "";
                    order.agentId       = Factory.GetPromID(userid);

                    //订单所属业务
                    order.manageId = currentUser.manageId;

                    bll.Insert(order);


                    string supporderid = string.Empty;
                    string errorinfo   = string.Empty;
                    string errorCode   = string.Empty;

                    msg = "true";

                    var supp = (viviapi.Model.supplier.SupplierCode)supplierId;

                    var callBack = OrderCardUtils.SynchSubmit(supp
                                                              , order.orderid
                                                              , typeId
                                                              , order.cardNo
                                                              , order.cardPwd
                                                              , faceValue
                                                              , ""
                                                              , 1);

                    if (callBack.SummitStatus == 0)
                    {
                        msg = errorinfo;

                        //bll.ReceiveSuppResult(supplierId
                        //    , order.orderid
                        //    , order.cardNo
                        //    , 4
                        //    , callBack.SuppErrorCode
                        //    , errorinfo
                        //    , 0M
                        //    , 0M
                        //    , string.Empty);
                    }
                }

                return(msg);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }