public object GetUserOrderPayStatus(string orderno)
        {
            string errmsg = null;

            if (userLoginManager.LoginUser == null || userLoginManager.LoginUser.UserID < 1)
            {
                return new { Rcode = -2, Rmsg = "未登录" }
            }
            ;
            if (string.IsNullOrEmpty(orderno))
            {
                return new { Rcode = 0, Rmsg = "参数错误" }
            }
            ;

            chosen_orderinfo orderinfo = OrderPayBLL.GetUserOrderInfo(orderno, out errmsg);

            if (!string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "获取订单数据错误" + errmsg }
            }
            ;
            if (orderinfo == null)
            {
                return new { Rcode = -1, Rmsg = "订单号不存在" }
            }
            ;
            return(new { Rcode = 1, Rdata = orderinfo.status });
        }
Example #2
0
        /// <summary>
        /// 订单管理 添加数据
        /// </summary>
        /// <param name="chosen_orderinfo">要添加的订单管理对象</param>
        /// <param name="errmsg">错误信息</param>
        /// <returns>返回对象</returns>
        public static bool Add(chosen_orderinfo info, out string errmsg)
        {
            List <DataParameter> pars = new List <DataParameter>();

            pars.Add(new DataParameter("orderno", info.orderno));
            pars.Add(new DataParameter("ordername", info.ordername));
            pars.Add(new DataParameter("userid", info.userid));
            pars.Add(new DataParameter("customerid", info.customerid));
            pars.Add(new DataParameter("serviceno", info.serviceno));
            pars.Add(new DataParameter("feetype", info.feetype));
            pars.Add(new DataParameter("m_price", info.m_price));
            pars.Add(new DataParameter("s_price", info.s_price));
            pars.Add(new DataParameter("addressid", info.addressid));
            pars.Add(new DataParameter("ctype", info.ctype));
            pars.Add(new DataParameter("paytype", info.paytype));
            pars.Add(new DataParameter("paybank", info.paybank));
            pars.Add(new DataParameter("payno", info.payno));
            pars.Add(new DataParameter("createdtime", info.createdtime));
            pars.Add(new DataParameter("paytime", info.paytime));
            pars.Add(new DataParameter("payresulttime", info.payresulttime));
            pars.Add(new DataParameter("deliverytime", info.deliverytime));
            pars.Add(new DataParameter("deliveryoktime", info.deliveryoktime));
            pars.Add(new DataParameter("logisticaltype", info.logisticaltype));
            pars.Add(new DataParameter("logisticalcode", info.logisticalcode));
            pars.Add(new DataParameter("status", info.status));
            pars.Add(new DataParameter("creator", info.creator));
            pars.Add(new DataParameter("terminaltype", info.terminaltype));
            string sqlstr = "insert into chosen_orderinfo (orderno,ordername,userid,customerid,serviceno,feetype,m_price,s_price,addressid,ctype,paytype,paybank,payno,createdtime,paytime,payresulttime,deliverytime,deliveryoktime,logisticaltype,logisticalcode,status,creator,terminaltype) values (@orderno,@ordername,@userid,@customerid,@serviceno,@feetype,@m_price,@s_price,@addressid,@ctype,@paytype,@paybank,@payno,@createdtime,@paytime,@payresulttime,@deliverytime,@deliveryoktime,@logisticaltype,@logisticalcode,@status,@creator,@terminaltype) ";

            return(MySqlHelper.ExecuteCommand(sqlstr, out errmsg, pars) > 0);
        }
Example #3
0
        /// <summary>
        /// 订单管理 更新数据
        /// </summary>
        /// <param name="chosen_orderinfo">要更新的订单管理对象</param>
        /// <param name="errmsg">错误信息</param>
        /// <returns>返回对象</returns>
        public static bool Update(chosen_orderinfo info, out string errmsg)
        {
            List <DataParameter> pars = new List <DataParameter>();

            //pars.Add(new DataParameter("orderno", info.orderno));
            pars.Add(new DataParameter("ordername", info.ordername));
            pars.Add(new DataParameter("userid", info.userid));
            pars.Add(new DataParameter("customerid", info.customerid));
            pars.Add(new DataParameter("serviceno", info.serviceno));
            pars.Add(new DataParameter("feetype", info.feetype));
            pars.Add(new DataParameter("m_price", info.m_price));
            pars.Add(new DataParameter("s_price", info.s_price));
            pars.Add(new DataParameter("addressid", info.addressid));
            pars.Add(new DataParameter("ctype", info.ctype));
            pars.Add(new DataParameter("paytype", info.paytype));
            pars.Add(new DataParameter("paybank", info.paybank));
            pars.Add(new DataParameter("payno", info.payno));
            pars.Add(new DataParameter("createdtime", info.createdtime));
            pars.Add(new DataParameter("paytime", info.paytime));
            pars.Add(new DataParameter("payresulttime", info.payresulttime));
            pars.Add(new DataParameter("deliverytime", info.deliverytime));
            pars.Add(new DataParameter("deliveryoktime", info.deliveryoktime));
            pars.Add(new DataParameter("logisticaltype", info.logisticaltype));
            pars.Add(new DataParameter("logisticalcode", info.logisticalcode));
            pars.Add(new DataParameter("status", info.status));
            pars.Add(new DataParameter("creator", info.creator));
            pars.Add(new DataParameter("terminaltype", info.terminaltype));
            string sqlstr = "update chosen_orderinfo set orderno=@orderno,ordername=@ordername,userid=@userid,customerid=@customerid,serviceno=@serviceno,feetype=@feetype,m_price=@m_price,s_price=@s_price,addressid=@addressid,ctype=@ctype,paytype=@paytype,paybank=@paybank,payno=@payno,createdtime=@createdtime,paytime=@paytime,payresulttime=@payresulttime,deliverytime=@deliverytime,deliveryoktime=@deliveryoktime,logisticaltype=@logisticaltype,logisticalcode=@logisticalcode,status=@status,creator=@creator,terminaltype=@terminaltype where orderno=@orderno ";

            pars.Add(new DataParameter("orderno", info.orderno));
            return(MySqlHelper.ExecuteCommand(sqlstr, out errmsg, pars) > 0);
        }
Example #4
0
        /// <summary>
        /// 订单管理 添加数据
        /// </summary>
        public object Post([FromBody] chosen_orderinfo info)
        {
            string datenum  = DateTime.Now.ToString("yyyyMMddhh24mmss");
            Random rd       = new Random();
            string sjnum    = rd.Next(1000000, 10000000).ToString();
            string ordernum = datenum + sjnum;

            info.orderno = ordernum;

            info.createdtime  = DateTime.Now;
            info.creator      = LoginUserData.UserID;
            info.userid       = LoginUserData.UserID;
            info.feetype      = "1";
            info.ctype        = 1;
            info.status       = 1;
            info.terminaltype = 1;
            info.addressid    = 0;
            bool success = orderinfoBLL.Add(info, out errmsg);

            WriteSysLog(0, string.Format("添加订单{0},返回{1} {2}", info.ordername, success, errmsg));
            if (!success || !string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "添加失败" }
            }
            ;
            return(new { Rcode = 1, Rmsg = "添加成功" });
        }
Example #5
0
        /// <summary>
        /// 订单管理 详情查询
        /// </summary>
        public object Get(string id)
        {
            chosen_orderinfo info = orderinfoBLL.GetInfo(id, out errmsg)
            ;                        if (!string.IsNullOrEmpty(errmsg))

            {
                return(new { Rcode = -1, Rmsg = "获取数据失败" });
            }
            return(new { Rcode = 1, Rdata = info });
        }
Example #6
0
        /// <summary>
        /// 订单管理 更新数据
        /// </summary>
        public object Put(string id, [FromBody] chosen_orderinfo info)
        {
            info.orderno     = id;
            info.createdtime = DateTime.Now;
            info.creator     = LoginUserData.UserID;
            bool success = orderinfoBLL.Update(info, out errmsg);

            WriteSysLog(1, string.Format("更新订单id为{0},返回{1} {2}", id, success, errmsg));
            if (!success || !string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "更新失败" }
            }
            ;
            return(new { Rcode = 1, Rmsg = "更新成功" });
        }
        public object InsertOrdersInfo(int m_price, string title)
        {
            string           errmsg   = null;
            chosen_orderinfo info     = new chosen_orderinfo();
            string           datenum  = DateTime.Now.ToString("yyyyMMddhh24mmss");
            Random           rd       = new Random();
            string           sjnum    = rd.Next(1000000, 10000000).ToString();
            string           ordernum = datenum + sjnum;

            info.orderno     = ordernum;     //订单编号
            info.ordername   = title;        //订单名称
            info.createdtime = DateTime.Now; //下单时间
            if (userLoginManager.LoginUser == null || userLoginManager.LoginUser.UserID < 1)
            {
                return new { Rcode = 0, Rmsg = "未登录" }
            }
            ;
            info.userid       = userLoginManager.LoginUser.UserID; //用户账户
            info.creator      = userLoginManager.LoginUser.UserID; //客户账户
            info.feetype      = "1";                               //货币类型
            info.ctype        = 1;                                 //下单方式
            info.status       = 1;                                 //支付状态
            info.terminaltype = 1;                                 //操作终端
            info.addressid    = 0;                                 //收货地址编号
            info.paybank      = 0;
            info.m_price      = m_price;
            info.s_price      = m_price;
            info.paytype      = 2;
            bool success = BLL.UserLoginManager.AdduserOrders(info, out errmsg);

            if (!success || !string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "添加失败" }
            }
            ;
            return(new { Rcode = 1, Rmsg = "添加成功" });
        }
Example #8
0
 internal static bool AdduserOrders(chosen_orderinfo info, out string errmsg)
 {
     return(DAL.UserAccountDAL.AdduserOrders(info, out errmsg));
 }
Example #9
0
 /// <summary>
 /// 订单管理 更新数据
 /// </summary>
 /// <param name="chosen_orderinfo">要更新的订单管理对象</param>
 /// <param name="errmsg">错误信息</param>
 /// <returns>返回对象</returns>
 public static bool Update(chosen_orderinfo info, out string errmsg)
 {
     return(orderinfoDAL.Update(info, out errmsg));
 }
Example #10
0
 /// <summary>
 /// 订单管理 添加数据
 /// </summary>
 /// <param name="chosen_orderinfo">要添加的订单管理对象</param>
 /// <param name="errmsg">错误信息</param>
 /// <returns>返回对象</returns>
 public static bool Add(chosen_orderinfo info, out string errmsg)
 {
     return(orderinfoDAL.Add(info, out errmsg));
 }
Example #11
0
        /// <summary>
        /// 订单管理 详情查询
        /// </summary>
        public static chosen_orderinfo GetInfo(string orderno, out string errmsg)
        {
            chosen_orderinfo info = orderinfoDAL.GetInfo(orderno, out errmsg);

            return(info);
        }
Example #12
0
        /// <summary>
        /// 判断全文资源计费情况
        /// </summary>
        /// <param name="restype">资源库id</param>
        /// <param name="seqid">资源id</param>
        /// <param name="userid">用户id</param>
        /// <param name="customerid">客户id</param>
        /// <param name="userIp">用户ip</param>
        /// <param name="tablename">资源库名</param>
        /// <param name="costtype">计费类型 【0免费资源;1 客户计时订单;2 客户计量订单;3 用户订单;】</param>
        /// <param name="m_price">单条价格</param>
        /// <param name="m_discount">单条折扣</param>
        /// <param name="serviceno">客户服务编号</param>
        /// <param name="orderno">客户服务订单号</param>
        /// <param name="errmsg"></param>
        /// <returns></returns>
        public static int GetFullPathResourceCheckCost(int restype, long seqid, int userid, int customerid, string userIp, out string tablename, out int costtype, out decimal m_price, out decimal m_discount, out string serviceno, out string orderno, out string errmsg)
        {
            errmsg     = null;
            tablename  = null;
            costtype   = 0;
            m_price    = 0;
            m_discount = 0;
            serviceno  = null;
            orderno    = null;
            string          sqlstr = string.Format("select mouldid,databasename,databasecname,isware from db_datalibrarys where databaseid={0}", restype);
            db_datalibrarys dbinfo = MySqlHelper.GetDataInfo <db_datalibrarys>(sqlstr, out errmsg);

            if (!string.IsNullOrEmpty(errmsg))
            {
                errmsg = "查询资源库出错" + errmsg;
                return(-1);
            }
            if (dbinfo == null)
            {
                errmsg = "资源库参数错误";
                return(-1);
            }
            tablename = dbinfo.databasename;
            DataTable dt;

            //首先判断是否商品库中的资源,如果是,判断单条资源是否收费 如果是,资源是否在用户已完成的订单中 (以前购买过,可以直接使用)
            string shopname = null;

            if (dbinfo.isware == 1 && userid > 0)
            {
                sqlstr = string.Format("select m_price,m_discount,title from {0} where seqid={1}", tablename, seqid);
                dt     = MySqlHelper.GetDataTable(sqlstr, out errmsg);
                if (!string.IsNullOrEmpty(errmsg) || dt == null)
                {
                    errmsg = "查询资源费用信息出错" + errmsg;
                    return(-1);
                }
                if (dt.Rows.Count == 0)
                {
                    errmsg = "资源不存在";
                    return(-1);
                }
                if (!decimal.TryParse(dt.Rows[0][0].ToString(), out m_price) || !decimal.TryParse(dt.Rows[0][1].ToString(), out m_discount))
                {
                    errmsg = "查询资源价格及折扣信息出错";
                    return(-1);
                }
                if (m_price * m_discount == 0) //免费资源,直接使用
                {
                    costtype = 0;
                    return(1);
                }
                shopname = dt.Rows[0][2].ToString();
                sqlstr   = string.Format("select count(1) from chosen_orderinfo a,chosen_ordershop b where a.orderno=b.orderno and a.status=9 and a.userid={0} and b.restype='{1}' and rescode={2}", userid, tablename, seqid);
                long count = MySqlHelper.GetRecCount(sqlstr, out errmsg);
                if (!string.IsNullOrEmpty(errmsg))
                {
                    errmsg = "查询用户订单信息出错" + errmsg;
                    return(-1);
                }
                if (count > 0) //用户购买过,直接使用
                {
                    costtype = 3;
                    return(1);
                }
            }
            // 用户是否在客户已购买并有效的授权服务当中
            if (customerid > 0)
            {
                sqlstr = string.Format("select a.orderno,a.serviceno,b.stype,b.starttime,b.endtime,b.maxnum,b.leftnum,d.rulename,d.rulevalue from chosen_orderinfo a,chosen_serviceinfo b,chosen_servicepermit c,chosen_servicecont d where a.serviceno=b.serviceno and a.serviceno=c.serviceno and a.serviceno=d.serviceno and a.status=9 and a.customerid={0} and d.restype='{1}' ", customerid, tablename);
                dt     = MySqlHelper.GetDataTable(sqlstr, out errmsg);
                if (!string.IsNullOrEmpty(errmsg))
                {
                    errmsg = "查询资源服务信息出错" + errmsg;
                    return(-1);
                }
                if (dt != null && dt.Rows.Count > 0)
                {
                    //资源是否在服务内容当中
                    orderno   = dt.Rows[0]["orderno"].ToString();
                    serviceno = dt.Rows[0]["serviceno"].ToString();
                    costtype  = int.Parse(dt.Rows[0]["stype"].ToString());
                    return(1);
                }
            }
            //都不符合,生成用户订单,返回需要计费信息
            if (m_price * m_discount > 0)
            {
                chosen_orderinfo order = new chosen_orderinfo();
                order.GetNo();
                order.ordername = string.Format("订购资源库 {0} 的资源 {1} 的全文", dbinfo.databasecname, seqid);


                MySqlTransactionHelper tran = new MySqlTransactionHelper();
                if (tran.TransactionBegin(out errmsg))
                {
                    //写入用户订单
                    List <DataParameter> pars = new List <DataParameter>();
                    pars.Add(new DataParameter("orderno", order.orderno));
                    pars.Add(new DataParameter("ordername", order.ordername));
                    pars.Add(new DataParameter("userid", userid));
                    pars.Add(new DataParameter("m_price", m_price));
                    pars.Add(new DataParameter("s_price", m_price * m_discount));
                    pars.Add(new DataParameter("ctype", 1));
                    pars.Add(new DataParameter("paytype", 1));
                    pars.Add(new DataParameter("status", 1));
                    pars.Add(new DataParameter("Creator", userid));
                    pars.Add(new DataParameter("createdtime", DateTime.Now));
                    string sqlor = "insert into chosen_orderinfo (orderno,ordername,userid,m_price,s_price,ctype,paytype,status,creator,createdtime) values (orderno,ordername,userid,m_price,s_price,ctype,paytype,status,creator,createdtime) ";
                    tran.TransactionExecuteCommand(sqlor, out errmsg, pars);
                    if (!string.IsNullOrEmpty(errmsg))
                    {
                        string err;
                        tran.TransactionRollback(out err);
                        return(-1);
                    }
                    pars.Clear();
                    pars.Add(new DataParameter("shopname", string.IsNullOrEmpty(shopname) ? order.ordername : shopname));
                    pars.Add(new DataParameter("orderno", order.orderno));
                    pars.Add(new DataParameter("restype", restype));
                    pars.Add(new DataParameter("rescode", seqid));
                    pars.Add(new DataParameter("prices", m_price));
                    pars.Add(new DataParameter("thumbnail", null));
                    pars.Add(new DataParameter("shopnum", 1));
                    sqlstr = "insert into chosen_ordershop (shopname,orderno,restype,rescode,prices,thumbnail,shopnum) values (@shopname,@orderno,@restype,@rescode,@prices,@thumbnail,@shopnum) ";
                    tran.TransactionExecuteCommand(sqlstr, out errmsg, pars);
                    if (!string.IsNullOrEmpty(errmsg))
                    {
                        string err;
                        tran.TransactionRollback(out err);
                        return(-1);
                    }
                    bool issuc = tran.TransactionCommit(out errmsg);
                    if (!string.IsNullOrEmpty(errmsg) || !issuc)
                    {
                        errmsg = "提交订单出错:" + errmsg;
                        return(-1);
                    }
                    costtype = 3;
                    orderno  = order.orderno;
                    return(0);
                }
                return(-1);
            }
            else //免费资源
            {
                costtype = 0;
                return(1);
            }
        }
        public object GetUserOrderPay(string orderno, int paytype)
        {
            string errmsg = null;

            if (userLoginManager.LoginUser == null || userLoginManager.LoginUser.UserID < 1)
            {
                return new { Rcode = -2, Rmsg = "未登录" }
            }
            ;

            if (string.IsNullOrEmpty(orderno))
            {
                return new { Rcode = 0, Rmsg = "参数错误" }
            }
            ;

            chosen_orderinfo orderinfo = OrderPayBLL.GetUserOrderInfo(orderno, out errmsg);

            if (!string.IsNullOrEmpty(errmsg))
            {
                return new { Rcode = -1, Rmsg = "获取订单数据错误" + errmsg }
            }
            ;
            if (orderinfo == null)
            {
                return new { Rcode = -1, Rmsg = "订单号不存在" }
            }
            ;
            if (orderinfo.status != 1 && orderinfo.status != 1)
            {
                return new { Rcode = -1, Rmsg = "订单不在待支付状态" }
            }
            ;
            string savename = string.Format("{0}_{1}", orderno, paytype);
            string url      = GetSavePayUrl(savename);

            if (string.IsNullOrEmpty(url))
            {
                switch (paytype)
                {
                case 1:
                    url = WXPayBLL.GetPayUrl(orderinfo, out errmsg);
                    break;

                case 2:
                    url = AliPayBLL.GetPayUrl(orderinfo, out errmsg);
                    break;

                default:
                    errmsg = "错误的支付方式选择";
                    break;
                }
            }
            if (string.IsNullOrEmpty(errmsg) && !string.IsNullOrEmpty(url))
            {
                SetSavePayUrl(savename, url);

                return(new { Rcode = 1, Rdata = url, Rmsg = "ok" });
            }
            return(new { Rcode = -1, Rmsg = errmsg });
        }