Ejemplo n.º 1
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
                        {
                        orderid       = viviapi.BLL.Order.Card.Factory.Instance.GenerateOrderId(""),
                        addtime       = DateTime.Now,
                        attach        = "cardsell",
                        notifycontext = string.Empty,
                        notifycount   = 0,
                        notifystat    = 0,
                        notifyurl     = string.Empty,
                        clientip      = ServerVariables.TrueIP,
                        completetime  = DateTime.Now,
                        ordertype     = 8,
                        typeId        = typeId,
                        paymodeId     = typeId.ToString("0000") + faceValue.ToString(),
                        payRate       = 0M,
                        supplierId    = supplierId,
                        supplierOrder = string.Empty,
                        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.makeup = makeup;
                    order.method    = 0;
                    order.faceValue = 0M;
                    //订单所属业务
                    order.manageId = currentUser.manageId;

                    //_bll.Insert(order);


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

                    msg = "true";

                    //Model.SupplierCode supp = (viviapi.Model.SupplierCode)supplierId;

                    //string returncode = ETAPI.SellFactory.SellCard(supp
                    //    , order.orderid
                    //    , typeId
                    //    , order.cardNo
                    //    , order.cardPwd
                    //    , string.Empty
                    //    , faceValue
                    //    , out supporderid
                    //    , out errorCode
                    //    , out errorinfo);

                    //if (returncode != "0")
                    //{
                    //    msg = errorinfo;

                    //    BLL.OrderCard bll = new viviapi.BLL.OrderCard();

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

                return(msg);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Ejemplo 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);
            }
        }