当前位置: 首页>>代码示例>>C#>>正文


C# BLL.orders.BathcUseOrder方法代码示例

本文整理汇总了C#中BLL.orders.BathcUseOrder方法的典型用法代码示例。如果您正苦于以下问题:C# BLL.orders.BathcUseOrder方法的具体用法?C# BLL.orders.BathcUseOrder怎么用?C# BLL.orders.BathcUseOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BLL.orders的用法示例。


在下文中一共展示了BLL.orders.BathcUseOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BathcUseOrder

        public void BathcUseOrder(string jsondata, string version, string equType, string equName)
        {
            if (string.IsNullOrEmpty(jsondata))
            {
                Context.Response.Write("{\"status\":\"false\",\"data\":\"参数不能为空!\"}");
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            try
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                Dictionary<string, object> json = (Dictionary<string, object>)serializer.DeserializeObject(jsondata);

                string order_no = json["order_no"].ToString();
                if (string.IsNullOrEmpty(order_no))
                {
                    Context.Response.Write("{\"status\":\"false\",\"data\":\"对不起,订单号不能为空!\"}");
                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                    return;
                }
                BLL.orders bll_order = new BLL.orders();
                //验证票的状态是否可以进行消费
                if (bll_order.ValidateOrder(order_no) == 0)
                {
                    Context.Response.Write("{\"status\":\"false\",\"data\":\"定单未支付!\"}");
                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                    return;
                }

                int menpiao_type = 0;
                int count = 0;
                object[] arrlist = ((object[])json["order_lst"]);
                Dictionary<string, object> d = null;

                string json_result = string.Empty;
                foreach (var _item in arrlist)
                {
                    d = (Dictionary<string, object>)_item;
                    int.TryParse(d["menpiao_type"].ToString(), out menpiao_type);
                    int.TryParse(d["count"].ToString(), out count);

                    //查未消费的count
                    int unCount = bll_order.GetCountByOrderNO(order_no, menpiao_type);

                    if (unCount < count)
                    {
                        //Context.Response.Write("{\"status\":\"true\",\"data\":\"" + GetMenPiaoTypeName(menpiao_type) + "的余票数量不足!" + (string.IsNullOrEmpty(json_result) ? "" : "消费明细:" + json_result.Remove(json_result.LastIndexOf(','))) + "\"}");
                        // HttpContext.Current.ApplicationInstance.CompleteRequest();
                        //return;
                        json_result += GetMenPiaoTypeName(menpiao_type) + "的余票数量不足!,";
                        continue;
                    }
                    int result = bll_order.BathcUseOrder(order_no, menpiao_type, count);
                    json_result += GetMenPiaoTypeName(menpiao_type) + "消费成功:" + count + "张,";
                }

                WriteWebServiceLog(version, equType, equName, "BathcUseOrder", "");
                Context.Response.Write("{\"status\":\"true\",\"data\":\"消费明细:" + json_result.Remove(json_result.LastIndexOf(',')) + "\"}");
                HttpContext.Current.ApplicationInstance.CompleteRequest();

            }
            catch (Exception ex)
            {
                WriteWebServiceLog(version, equType, equName, "BathcUseOrder", "");
                Context.Response.Write("{\"status\":\"false\",\"data\":\"消费失败,请联系管理员!\"}");
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
        }
开发者ID:codefighting,项目名称:shouxinzhihui,代码行数:69,代码来源:JsonService.asmx.cs


注:本文中的BLL.orders.BathcUseOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。