Beispiel #1
0
        public void BatchUpdateAudit(HttpContext context)
        {
            string orderId                = context.Request["orderId"];
            string Batch_cboAudit         = context.Request["Batch_cboAudit"];
            string Batch_FN_RebatesRemark = context.Request["Batch_FN_RebatesRemark"];
            string result = "";

            if (string.IsNullOrEmpty(orderId))
            {
                result = "没有可以审核的订单。";
                context.Response.Write("{\"msg\":\"" + result + "。\",\"success\":false}");
                return;
            }
            BLL.Order     bll       = new BLL.Order();
            string[]      orders    = orderId.Split(new char[] { ',' });
            List <string> newOrders = new List <string>();
            var           rightCar  = string.Format("'{0}'", context.Session["UserCar"].ToString().Replace(",", "','"));

            foreach (string s in orders)
            {
                if (bll.ExistsCarOrder(s, rightCar.Trim()))
                {
                    newOrders.Add(s);
                }
            }
            int orderlen = orderId.Length;

            if (newOrders.Count < 1)
            {
                result = "没有有权限审核的订单";
                context.Response.Write("{\"msg\":\"" + result + "。\",\"success\":false}");
                return;
            }
            orderId = string.Join(",", newOrders.ToArray <string>());
            if (orderId.Length != orderlen)
            {
                result = "部分订单没有权限审核";
                context.Response.Write("{\"msg\":\"" + result + "。\",\"success\":false}");
                return;
            }
            bll.BatchUpdateAudit(orderId, context.Session["Name"].ToString(), Batch_cboAudit, Batch_FN_RebatesRemark);
            if (Batch_cboAudit.Equals("同意"))
            {
                foreach (string s in orderId.Split(new char[] { ',' }))
                {
                    try
                    {
                        // 更新审核状态
                        bll.SplitOrders(orderId);
                        result = "批审核成功。";
                    }
                    catch
                    {
                    }
                }
            }
            context.Response.Write("{\"msg\":\"" + result + "。\",\"success\":true}");
        }