Exemplo n.º 1
0
        private void UpLoadFile(HttpContext context)
        {
            string         _delfile     = AXRequest.GetString("DelFilePath");
            HttpPostedFile _upfile      = context.Request.Files["Filedata"];
            bool           _iswater     = false; //默认不打水印
            bool           _isthumbnail = false; //默认不生成缩略图

            if (AXRequest.GetQueryString("IsWater") == "1")
            {
                _iswater = true;
            }
            if (AXRequest.GetQueryString("IsThumbnail") == "1")
            {
                _isthumbnail = true;
            }
            if (_upfile == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}");
                return;
            }
            UpLoad upFiles = new UpLoad();
            string msg     = upFiles.fileSaveAs(_upfile, _isthumbnail, _iswater);

            //删除已存在的旧文件
            if (!string.IsNullOrEmpty(_delfile))
            {
                Utils.DeleteUpFile(_delfile);
            }
            //返回成功信息
            context.Response.Write(msg);
            context.Response.End();
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.siteconfig siteConfig             = new BLL.siteconfig().loadConfig();
            SortedDictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, AXRequest.GetString("notify_id"), AXRequest.GetString("sign"));

                if (verifyResult)//验证成功
                {
                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
                    string trade_no     = AXRequest.GetString("trade_no");          //支付宝交易号
                    string order_no     = AXRequest.GetString("out_trade_no");      //获取订单号
                    string trade_status = AXRequest.GetString("trade_status");      //交易状态

                    if (trade_status == "WAIT_SELLER_SEND_GOODS" || trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS")
                    {
                        //成功状态
                        Response.Redirect(new Web.UI.BasePage().linkurl("payment", "succeed", order_no));
                        return;
                    }
                }
            }
            //失败状态
            Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error"));
            return;
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     mobiles = AXRequest.GetString("mobiles");
     if (!Page.IsPostBack)
     {
         ChkAdminLevel("user_sms", AXEnums.ActionEnum.View.ToString()); //检查权限
         ShowInfo(mobiles);
         TreeBind("is_lock=0");                                         //绑定类别
     }
 }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, AXRequest.GetString("notify_id"), AXRequest.GetString("sign"));

                //写日志
                //System.IO.File.AppendAllText(Utils.GetMapPath("alipaylog.txt"), "验证结果:" + verifyResult.ToString() + "\n", System.Text.Encoding.UTF8);

                if (verifyResult)                                                        //验证成功
                {
                    string trade_no     = AXRequest.GetString("trade_no");               //支付宝交易号
                    string order_no     = AXRequest.GetString("out_trade_no").ToUpper(); //获取订单号
                    string total_fee    = AXRequest.GetString("total_fee");              //获取总金额
                    string trade_status = AXRequest.GetString("trade_status");           //交易状态

                    if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS")
                    {
                        if (order_no.StartsWith("R")) //充值订单
                        {
                            BLL.user_amount_log   bll   = new BLL.user_amount_log();
                            Model.user_amount_log model = bll.GetModel(order_no);
                            if (model == null)
                            {
                                Response.Write("该订单号不存在");
                                return;
                            }
                            if (model.status == 1) //已成功
                            {
                                Response.Write("success");
                                return;
                            }
                            if (model.value != decimal.Parse(total_fee))
                            {
                                Response.Write("订单金额和支付金额不相符");
                                return;
                            }
                            model.trade_no      = trade_no;
                            model.status        = 1;
                            model.complete_time = DateTime.Now;
                            bool result = bll.Update(model);
                            if (!result)
                            {
                                Response.Write("修改订单状态失败");
                                return;
                            }
                        }
                        else if (order_no.StartsWith("B")) //商品订单
                        {
                            //写日志
                            //System.IO.File.AppendAllText(Utils.GetMapPath("alipaylog.txt"), "商品订单\n", System.Text.Encoding.UTF8);

                            BLL.orders   bll   = new BLL.orders();
                            Model.orders model = bll.GetModel(order_no);
                            if (model == null)
                            {
                                //写日志
                                //System.IO.File.AppendAllText(Utils.GetMapPath("alipaylog.txt"), "订单号:" + order_no + "不存在\n", System.Text.Encoding.UTF8);
                                Response.Write("该订单号不存在");
                                return;
                            }
                            if (model.payment_status == 2) //已付款
                            {
                                //写日志
                                //System.IO.File.AppendAllText(Utils.GetMapPath("alipaylog.txt"), "订单号:" + order_no + "已付款\n", System.Text.Encoding.UTF8);
                                Response.Write("success");
                                return;
                            }
                            if (model.order_amount != decimal.Parse(total_fee))
                            {
                                //写日志
                                //System.IO.File.AppendAllText(Utils.GetMapPath("alipaylog.txt"), "订单号:" + order_no + "订单金额" + model.order_amount + "和支付金额" + total_fee + "不相符\n", System.Text.Encoding.UTF8);
                                Response.Write("订单金额和支付金额不相符");
                                return;
                            }
                            bool result = bll.UpdateField(order_no, "trade_no='" + trade_no + "',status=2,payment_status=2,payment_time='" + DateTime.Now + "'");
                            if (!result)
                            {
                                Response.Write("修改订单状态失败");
                                return;
                            }
                            //写日志
                            //System.IO.File.AppendAllText(Utils.GetMapPath("alipaylog.txt"), "修改订单状态:" + result.ToString() + "\n", System.Text.Encoding.UTF8);

                            //扣除积分
                            if (model.point < 0)
                            {
                                new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no, false);
                            }
                        }
                    }

                    Response.Write("success");  //请不要修改或删除
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 将在Init事件执行
        /// </summary>
        protected void payment_Init(object sender, EventArgs e)
        {
            //取得处事类型
            action = AXRequest.GetString("action");
            order_no = AXRequest.GetString("order_no");
            if (order_no.ToUpper().StartsWith("R")) //充值订单
            {
                order_type = AXEnums.AmountTypeEnum.Recharge.ToString().ToLower();
            }
            else if (order_no.ToUpper().StartsWith("B")) //商品订单
            {
                order_type = AXEnums.AmountTypeEnum.BuyGoods.ToString().ToLower();
            }
            
            switch (action)
            {
                case "confirm":
                    if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(order_no))
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,URL传输参数有误!")));
                        return;
                    }
                    //是否需要支持匿名购物
                    userModel = new Web.UI.BasePage().GetUserInfo(); //取得用户登录信息
                    if (orderConfig.anonymous == 0 || order_no.ToUpper().StartsWith("R"))
                    {
                        if (userModel == null)
                        {
                            //用户未登录
                            HttpContext.Current.Response.Redirect(linkurl("payment", "login"));
                            return;
                        }
                    }
                    else if (userModel == null)
                    {
                        userModel = new Model.users();
                    }
                    //检查订单的类型(充值或购物)
                    if (order_no.ToUpper().StartsWith("R")) //充值订单
                    {
                        amountModel = new BLL.user_amount_log().GetModel(order_no);
                        if (amountModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                        //检查订单号是否已支付
                        if (amountModel.status == 1)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "succeed", amountModel.order_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(amountModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                            return;
                        }
                        //检查是否线上支付
                        if (payModel.type == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,账户充值不允许线下支付!")));
                            return;
                        }
                        order_amount = amountModel.value; //" + Resources.lang.amount+ "
                    }
                    else if (order_no.ToUpper().StartsWith("B")) //商品订单
                    {
                        //检查订单是否存在
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                        //检查是否已支付过
                        if (orderModel.payment_status == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "succeed", orderModel.order_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(orderModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                            return;
                        }
                        //检查是否线下付款
                        if (orderModel.payment_status == 0)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "succeed", orderModel.order_no));
                            return;
                        }
                        //检查是否积分换购,直接跳转成功页面
                        if (orderModel.order_amount == 0)
                        {
                            //修改" + Resources.lang.orderStatus+ "
                            bool result = new BLL.orders().UpdateField(orderModel.order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'");
                            if (!result)
                            {
                                HttpContext.Current.Response.Redirect(linkurl("payment", "error"));
                                return;
                            }
                            HttpContext.Current.Response.Redirect(linkurl("payment", "succeed", orderModel.order_no));
                            return;
                        }
                        order_amount = orderModel.order_amount; //" + Resources.lang.amount+ "
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                        return;
                    }
                    break;
                case "succeed":
                    //检查订单的类型(充值或购物)
                    if (order_no.ToUpper().StartsWith("R")) //充值订单
                    {
                        amountModel = new BLL.user_amount_log().GetModel(order_no);
                        if (amountModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }

                    }
                    else if (order_no.ToUpper().StartsWith("B")) //商品订单
                    {
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                        return;
                    }
                    break;
            }
        }
Exemplo n.º 6
0
        private void ExcelFile(HttpContext context)
        {
            string         _delfile     = AXRequest.GetString("DelFilePath");
            HttpPostedFile _upfile      = context.Request.Files["Filedata"];
            bool           _iswater     = false; //默认不打水印
            bool           _isthumbnail = false; //默认不生成缩略图
            int            id           = 0;

            if (_upfile == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}");
                return;
            }
            //    Common.Log.LogMsg("1", "admin");
            StringBuilder sb   = new StringBuilder(220000);
            StringBuilder info = new StringBuilder(220000);
            //  Common.Log.LogMsg("start", "super");
            UpLoad upFiles = new UpLoad();
            string newpath = "";
            string msg     = upFiles.fileSaveAs(_upfile, _isthumbnail, _iswater, ref newpath);
            //  Common.Log.LogMsg("newpath:" + newpath, "super");
            DataTable dt = Common.ExcelHelper.ConvertExcelFileToTable(newpath);

            BLL.article          bll = new BLL.article();
            BLL.article_category bbc = new BLL.article_category();
            //     Common.Log.LogMsg("count:"+dt.Rows.Count.ToString(), "super");
            //     Common.Log.LogMsg("row:" + dt.Rows[0][0].ToString().Trim(), "super");

            for (int i = 1; i < dt.Rows.Count; i++)
            {
                int    type = 0;
                string no   = "";
                if (dt.Rows[i]["Name"].ToString().Trim() == "" && dt.Rows[i]["Barcode"].ToString().Trim() == "")
                {
                    continue;
                }

                if (dt.Rows[i]["Name"].ToString().Trim() == "")
                {
                    sb.Append("{");
                    sb.Append("\"id\":\"" + i + "\",");
                    sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                    sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                    sb.Append("\"result\":\"失败\",");
                    sb.Append("\"reason\":\"中文名不能为空\"");
                    sb.Append("},");
                    continue;
                }
                if (dt.Rows[i]["Barcode"].ToString().Trim() == "")
                {
                    sb.Append("{");
                    sb.Append("\"id\":\"" + i + "\",");
                    sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                    sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                    sb.Append("\"result\":\"失败\",");
                    sb.Append("\"reason\":\"条形码不能为空\"");
                    sb.Append("},");
                    continue;
                }
                else
                {
                    if (bll.ExistsBarcode(dt.Rows[i]["Barcode"].ToString().Trim()))
                    {
                        //       sb.Append("{");
                        // sb.Append("\"id\":\"" + i + "\",");
                        //sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                        //sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                        //sb.Append("\"result\":\"失败\",");
                        // sb.Append("\"reason\":\"此商品已存在\"");
                        // sb.Append("},");
                        // continue;
                        type = 1;
                    }
                }
                if (dt.Rows[i]["ProductTypeNo"].ToString().Trim() == "")
                {
                    sb.Append("{");
                    sb.Append("\"id\":\"" + i + "\",");
                    sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                    sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                    sb.Append("\"result\":\"失败\",");
                    sb.Append("\"reason\":\"商品类型不能为空\"");
                    sb.Append("},");
                    continue;
                }
                else
                {
                    try
                    {
                        no = dt.Rows[i]["ProductTypeNo"].ToString().Trim();
                        if (string.IsNullOrEmpty(no))
                        {
                            id = 0;
                        }
                        else
                        {
                            id = bbc.GetID(no);
                        }
                        if (id == 0)
                        {
                            sb.Append("{");
                            sb.Append("\"id\":\"" + i + "\",");
                            sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                            sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                            sb.Append("\"result\":\"失败\",");
                            sb.Append("\"reason\":\"商品类型不存在\"");
                            sb.Append("},");
                            continue;
                        }
                    }
                    catch (Exception ex)
                    {
                        sb.Append("{");
                        sb.Append("\"id\":\"" + i + "\",");
                        sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                        sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                        sb.Append("\"result\":\"失败\",");
                        sb.Append("\"reason\":\"商品类型:" + ex.Message + "\"");
                        sb.Append("},");
                        continue;
                    }
                }
                //  Common.Log.LogMsg("1", "super");
                Model.article model            = new Model.article();
                Dictionary <string, string> dn = new Dictionary <string, string>();
                if (type == 1)
                {
                    model = bll.GetModelNew(" where Barcode='" + dt.Rows[i]["Barcode"].ToString().Trim() + "'");
                    dn    = model.fields;
                    if (dt.Rows[i]["Quantity"].ToString().Trim() == "")
                    {
                        //  dn.Add("stock_quantity", "0");
                    }
                    else
                    {
                        Decimal d = Convert.ToDecimal(model.fields["stock_quantity"]) + Convert.ToDecimal(dt.Rows[i]["Quantity"].ToString().Trim());
                        dn["stock_quantity"] = d.ToString();
                    }
                    if (dt.Rows[i]["PriceMode"].ToString().Trim() == "")
                    {
                        dn["PriceMode"] = "0";
                    }
                    else
                    {
                        dn["PriceMode"] = dt.Rows[i]["PriceMode"].ToString().Trim();
                    }
                    if (dt.Rows[i]["PurchasePrice"].ToString().Trim() == "")
                    {
                        dn["PurchasePrice"] = "0";
                    }
                    else
                    {
                        dn["PurchasePrice"] = dt.Rows[i]["PurchasePrice"].ToString().Trim();
                    }
                    if (dt.Rows[i]["WholesalePrice"].ToString().Trim() == "")
                    {
                        dn["WholesalePrice"] = "0";
                    }
                    else
                    {
                        dn["WholesalePrice"] = dt.Rows[i]["WholesalePrice"].ToString().Trim();
                    }
                    if (dt.Rows[i]["SpecialPrice"].ToString().Trim() == "")
                    {
                        dn["SpecialPrice"] = "0";
                    }
                    else
                    {
                        dn["SpecialPrice"] = dt.Rows[i]["SpecialPrice"].ToString().Trim();
                    }

                    if (dt.Rows[i]["DiscountRate"].ToString().Trim() == "")
                    {
                        dn["DiscountRate"] = "0";
                    }
                    else
                    {
                        dn["DiscountRate"] = dt.Rows[i]["DiscountRate"].ToString().Trim();
                    }

                    dn["Barcode"]       = dt.Rows[i]["Barcode"].ToString().Trim();
                    dn["goods_no"]      = dt.Rows[i]["No"].ToString().Trim();
                    dn["english_name"]  = dt.Rows[i]["NameP"].ToString().Trim();
                    dn["ProductTypeNo"] = dt.Rows[i]["ProductTypeNo"].ToString().Trim();
                    dn["sub_title"]     = dt.Rows[i]["Name"].ToString().Trim();
                }
                else
                {
                    model.img_url  = "/upload/templates/default.jpg";
                    model.sort_id  = 99;
                    model.click    = 0;
                    model.status   = 0;
                    model.is_msg   = 0;
                    model.is_top   = 0;
                    model.is_red   = 0;
                    model.is_hot   = 0;
                    model.is_slide = 0;
                    if (dt.Rows[i]["Quantity"].ToString().Trim() == "")
                    {
                        dn.Add("stock_quantity", "0");
                    }
                    else
                    {
                        dn.Add("stock_quantity", dt.Rows[i]["Quantity"].ToString().Trim());
                    }
                    if (dt.Rows[i]["PriceMode"].ToString().Trim() == "")
                    {
                        dn.Add("PriceMode", "0");
                    }
                    else
                    {
                        dn.Add("PriceMode", dt.Rows[i]["PriceMode"].ToString().Trim());
                    }
                    if (dt.Rows[i]["PurchasePrice"].ToString().Trim() == "")
                    {
                        dn.Add("PurchasePrice", "0");
                    }
                    else
                    {
                        dn.Add("PurchasePrice", dt.Rows[i]["PurchasePrice"].ToString().Trim());
                    }
                    if (dt.Rows[i]["WholesalePrice"].ToString().Trim() == "")
                    {
                        dn.Add("WholesalePrice", "0");
                    }
                    else
                    {
                        dn.Add("WholesalePrice", dt.Rows[i]["WholesalePrice"].ToString().Trim());
                    }
                    if (dt.Rows[i]["SpecialPrice"].ToString().Trim() == "")
                    {
                        dn.Add("SpecialPrice", "0");
                    }
                    else
                    {
                        dn.Add("SpecialPrice", dt.Rows[i]["SpecialPrice"].ToString().Trim());
                    }
                    //if (dt.Rows[i]["RetailPrice"].ToString().Trim() == "")
                    //{
                    //    dn.Add("RetailPrice", "0");
                    //}
                    //else
                    //{
                    //    dn.Add("RetailPrice", dt.Rows[i]["RetailPrice"].ToString().Trim());
                    //}
                    //if (dt.Rows[i]["TaxRate"].ToString().Trim() == "")
                    //{
                    //    dn.Add("TaxRate", "0");
                    //}
                    //else
                    //{
                    //    dn.Add("TaxRate", dt.Rows[i]["TaxRate"].ToString().Trim());
                    //}
                    if (dt.Rows[i]["DiscountRate"].ToString().Trim() == "")
                    {
                        dn.Add("DiscountRate", "0");
                    }
                    else
                    {
                        dn.Add("DiscountRate", dt.Rows[i]["DiscountRate"].ToString().Trim());
                    }

                    dn.Add("Barcode", dt.Rows[i]["Barcode"].ToString().Trim());
                    dn.Add("goods_no", dt.Rows[i]["No"].ToString().Trim());
                    dn.Add("english_name", dt.Rows[i]["NameP"].ToString().Trim());
                    dn.Add("ProductTypeNo", dt.Rows[i]["ProductTypeNo"].ToString().Trim());
                    dn.Add("sub_title", dt.Rows[i]["Name"].ToString().Trim());

                    model.fields = dn;
                }
                model.channel_id  = 2;
                model.category_id = id;

                model.title = dt.Rows[i]["Name"].ToString();


                model.zhaiyao   = dt.Rows[i]["Remark"].ToString().Trim();
                model.add_time  = DateTime.Now;
                model.is_sys    = 1;       //管理员发布
                model.user_name = "super"; //获得当前登录" + Resources.lang.username+ "


                //    Common.Log.LogMsg("2", "super");

                model.fields["sell_price"] = GetPrice(model.fields);
                List <Model.user_group_price> priceList = new List <Model.user_group_price>();
                decimal _price = Convert.ToDecimal(model.fields["sell_price"]);
                priceList.Add(new Model.user_group_price {
                    group_id = 1, price = _price
                });
                priceList.Add(new Model.user_group_price {
                    group_id = 2, price = _price
                });
                model.group_price = priceList;
                if (type == 1)
                {
                    if (!bll.Update(model))
                    {
                        sb.Append("{");
                        sb.Append("\"id\":\"" + i + "\",");
                        sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                        sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                        sb.Append("\"result\":\"更新失败\",");
                        sb.Append("\"reason\":\"请检查数据格式\"");
                        sb.Append("},");
                        continue;
                    }
                    type = 0;
                }
                else
                {
                    if (bll.Add(model) == 0)
                    {
                        sb.Append("{");
                        sb.Append("\"id\":\"" + i + "\",");
                        sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                        sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                        sb.Append("\"result\":\"新增失败\",");
                        sb.Append("\"reason\":\"请检查数据格式\"");
                        sb.Append("},");
                        continue;
                    }
                }
            }
            string data = sb.ToString();

            if (data.Length > 0)
            {
                data = data.Substring(0, data.Length - 1);
                msg  = "{\"status\": 1, \"msg\": \"导入成功!\",\"data\":[" + data + "]}";
            }
            else
            {
                msg = "{\"status\": 1, \"msg\": \"部分数据导入失败!\",\"data\":[" + data + "]}";
            }

            //    Common.Log.LogMsg(msg, "admin");
            ////删除已存在的旧文件
            //if (!string.IsNullOrEmpty(_delfile))
            //{
            //    Utils.DeleteUpFile(_delfile);
            //}
            //返回成功信息
            context.Response.Write(msg);
            context.Response.End();
        }