示例#1
0
        public void handler(IResponder responder)
        {
            int bookingshopid = SJSRequest.GetInt("Bookingshopid", 0);

            IList <Bookingtrade> list = BookingtradeManager.GetBookingtrade(bookingshopid, 0, 0);

            string json = PageUtils.TranformJSON(list);

            responder.WriteSuccessed(json);
        }
示例#2
0
        public void handler(IResponder responder)
        {
            int id = SJSRequest.GetInt("Id", 0);

            if (id <= 0)
            {
                responder.WriteErroredMsg("请求参数错误!");
                return;
            }

            Booking booking = BookingManager.GetBooking(id);

            if (booking == null)
            {
                responder.WriteErroredMsg("不存在此预订, 无法结束预订!");
                return;
            }

            if (booking.Isbooking == false)
            {
                responder.WriteErroredMsg("此预订已经结束,无法重复结束!");
                return;
            }

            if (booking.Uid != PageUtils.AccountID)
            {
                responder.WriteErroredMsg("没有权限结束其他人的预订!");
                return;
            }

            booking.Isbooking = false;

            int rlt = BookingManager.UpdateBooking(booking);

            if (rlt <= 0)
            {
                responder.WriteErroredMsg("结束预订失败,数据库更新不成功!");
                return;
            }

            IList <Bookingshop> list = BookingshopManager.GetBookingshop(booking.Id, true);

            foreach (Bookingshop item in list)
            {
                item.Isover = true;
                BookingshopManager.UpdateBookingshop(item);
            }

            BookingtradeManager.UpdateBookingtrade(booking.Id, !booking.Isbooking);

            responder.WriteSuccessedMsg("结束预订成功!");
        }
        public void handler(IResponder responder)
        {
            DateTime dt = DateTime.Now;

            int uid = PageUtils.AccountID;

            if (uid <= 0)
            {
                uid = -1;
            }

            IList <Bookingtrade> list = BookingtradeManager.GetBookingtrade(uid, dt);

            string json = PageUtils.TranformJSON(list);

            responder.WriteSuccessed(json);
        }
        public void handler(IResponder responder)
        {
            int start = SJSRequest.GetInt("start", 0);
            int limit = SJSRequest.GetInt("limit", PageUtils.DefaultPageSize);

            if (start <= 0)
            {
                start = 0;
            }
            if (limit <= 0)
            {
                limit = PageUtils.DefaultPageSize;
            }

            int curPage = PageUtils.TranformCurrentPage(start, limit);

            int len = BookingtradeManager.GetBookingtradeCountByUid(PageUtils.AccountID);
            IList <Bookingtrade> list = BookingtradeManager.GetBookingtrade(PageUtils.AccountID, limit, curPage, (uint)0);

            string json = PageUtils.TranformJSON(list);

            responder.WritePagingList(len, json);
        }
示例#5
0
        public void handler(IResponder responder)
        {
            int bookingtradeid = SJSRequest.GetInt("Id", 0);
            int tradecount     = SJSRequest.GetInt("Tradecount", 0);

            if (bookingtradeid <= 0)
            {
                responder.WriteErroredMsg("请求参数错误!");
                return;
            }

            if (tradecount <= 0)
            {
                responder.WriteErroredMsg("取消数量应为正数!");
                return;
            }

            Bookingtrade bookingtrade = BookingtradeManager.GetBookingtrade(bookingtradeid);

            if (bookingtrade == null)
            {
                responder.WriteErroredMsg("不存在此预订项,无法取消!");
                return;
            }

            Booking booking = BookingManager.GetBooking(bookingtrade.Bookingid);

            if (booking == null)
            {
                responder.WriteErroredMsg("此预订不存在或已被删除,无法取消!");
                return;
            }

            if (booking.Isbooking == false && User.IsAdministrator(PageUtils.Utype) == false)
            {
                responder.WriteErroredMsg("此预订已结束,无法取消!");
                return;
            }
            int rlt = 0;

            using (DbTransaction trans = DbHelper.BeginTransaction())
            {
                bool writeError = false;
                try
                {
                    int hasCount = bookingtrade.Tradecount;

                    bookingtrade.Tradecount = Math.Max(0, bookingtrade.Tradecount - tradecount);
                    tradecount = hasCount - bookingtrade.Tradecount;

                    if (bookingtrade.Uid != PageUtils.AccountID)
                    {
                        bookingtrade.Remarks += string.Format(" 由{0}退订{1}份", PageUtils.RealName, tradecount);
                    }

                    User user = UserManager.GetUser(bookingtrade.Uid, trans);

                    rlt = UserManager.UpdateUserBalance(bookingtrade.Uid, -bookingtrade.Tradevalue * tradecount, trans);
                    if (rlt <= 0)
                    {
                        writeError = true;
                        trans.Rollback();
                        responder.WriteErroredMsg("返还余额失败,数据库更新不成功!");
                        return;
                    }

                    Deduction deduction = new Deduction();
                    deduction.Deductionbalance = user.Balance + bookingtrade.Tradevalue * tradecount;
                    deduction.Deductioncount   = -tradecount;
                    deduction.Deductionname    = string.Format("取消{0}", bookingtrade.Tradename);
                    deduction.Deductiontime    = DateTime.Now;
                    deduction.Deductionvalue   = bookingtrade.Tradevalue * tradecount;
                    deduction.Uid      = bookingtrade.Uid;
                    deduction.Realname = bookingtrade.Realname;
                    deduction.Shopid   = bookingtrade.Shopid;
                    deduction.Shopname = bookingtrade.Shopname;
                    deduction.Remarks  = bookingtrade.Remarks;
                    rlt = DeductionManager.AddDeduction(deduction, trans);
                    if (rlt <= 0)
                    {
                        writeError = true;
                        trans.Rollback();
                        responder.WriteErroredMsg("返还余额失败,数据库更新不成功!");
                        return;
                    }

                    if (bookingtrade.Tradecount > 0)
                    {
                        rlt = BookingtradeManager.UpdateBookingtrade(bookingtrade, trans);
                    }
                    else
                    {
                        rlt = BookingtradeManager.DelBookingtrade(bookingtrade.Id, trans);
                    }

                    if (rlt <= 0)
                    {
                        writeError = true;
                        trans.Rollback();
                        responder.WriteErroredMsg("取消预订失败,数据库更新不成功!");
                        return;
                    }

                    trans.Commit();
                }
                catch (Exception ex)
                {
                    trans.Rollback();

                    if (writeError == false)
                    {
                        responder.WriteErroredMsg("取消失败,程序异常!");
                    }
                    return;
                }
            }

            responder.WriteSuccessedMsg(string.Format("成功取消{0}个预订", tradecount));
        }
示例#6
0
        public void handler(IResponder responder)
        {
            int          withUid      = SJSRequest.GetInt("WithUid", 0);
            Bookingtrade bookingtrade = new Bookingtrade();

            bookingtrade.Tradeid       = SJSRequest.GetInt("Tradeid", 0);
            bookingtrade.Bookingshopid = SJSRequest.GetInt("Id", 0);
            bookingtrade.Tradecount    = SJSRequest.GetInt("Tradecount", 0);
            //bookingtrade.Remarks = SJSRequest.GetString("Remarks");

            if (bookingtrade.Tradecount <= 0)
            {
                responder.WriteErroredMsg("预订数量只能是正数!");
                return;
            }

            if (bookingtrade.Tradeid <= 0)
            {
                responder.WriteErroredMsg("菜单项请求参数错误!");
                return;
            }

            if (bookingtrade.Bookingshopid <= 0)
            {
                responder.WriteErroredMsg("预订店铺记录请求参数错误!");
                return;
            }

            Bookingshop bookingshop = BookingshopManager.GetBookingshop(bookingtrade.Bookingshopid);

            if (bookingshop == null)
            {
                responder.WriteErroredMsg("此店铺接受预订记录不存在,无法预订!");
                return;
            }

            Booking booking = BookingManager.GetBooking(bookingshop.Bookingid);

            if (booking == null)
            {
                responder.WriteErroredMsg("此预订不存在,无法预订!");
                return;
            }

            if (booking.Isbooking == false && User.IsAdministrator(PageUtils.Utype) == false)
            {
                responder.WriteErroredMsg("此预订已结束,无法预订!");
                return;
            }

            Trade trade = TradeManager.GetTrade(bookingtrade.Tradeid);

            if (trade == null)
            {
                responder.WriteErroredMsg("不存在此菜单项,无法预订!");
                return;
            }

            IList <Bookingtrade> confirmList = BookingtradeManager.GetBookingtrade(bookingshop.Id, trade.Id, true);

            Bookingtrade confirm = null;

            int    uid   = PageUtils.AccountID;
            string rname = PageUtils.RealName;

            for (int i = 0; i < confirmList.Count; i++)
            {
                if (withUid > 0 && withUid == confirmList[i].Uid)
                {
                    confirm = confirmList[i];
                    break;
                }

                if (withUid <= 0 && uid == confirmList[i].Uid)
                {
                    confirm = confirmList[i];
                    break;
                }
            }

            int  rlt   = 0;
            bool isAdd = false;

            using (DbTransaction trans = DbHelper.BeginTransaction())
            {
                bool writeError = false;
                try
                {
                    User      user       = null;
                    Deduction deduction  = new Deduction();
                    int       addedCount = 0;
                    if (confirm != null && (withUid <= 0 || withUid == confirm.Uid))
                    {
                        addedCount = bookingtrade.Tradecount;

                        user = UserManager.GetUser(confirm.Uid, trans);

                        if (user == null)
                        {
                            writeError = true;
                            trans.Rollback();
                            responder.WriteErroredMsg("不存在此用户,无法预订!");
                            return;
                        }


                        if (user.Enabled == false)
                        {
                            writeError = true;
                            trans.Rollback();
                            responder.WriteErroredMsg(user.Realname + " 处于禁用状态,无法预订!");
                            return;
                        }


                        uid   = user.Uid;
                        rname = user.Realname;

                        deduction.Deductionbalance = user.Balance - confirm.Tradevalue * addedCount;
                        deduction.Deductioncount   = addedCount;
                        deduction.Deductionname    = string.Format("预订{0}", confirm.Tradename);
                        deduction.Deductiontime    = DateTime.Now;
                        deduction.Deductionvalue   = -confirm.Tradevalue * addedCount;
                        deduction.Uid      = confirm.Uid;
                        deduction.Realname = confirm.Realname;
                        deduction.Shopid   = confirm.Shopid;
                        deduction.Shopname = confirm.Shopname;
                        deduction.Remarks  = confirm.Remarks;

                        confirm.Tradecount += addedCount;
                        bookingtrade        = confirm;

                        isAdd = false;
                    }
                    else
                    {
                        if (withUid > 0 && uid != withUid)
                        {
                            user = UserManager.GetUser(withUid, trans);
                        }
                        else
                        {
                            user = UserManager.GetUser(uid, trans);
                        }

                        if (user == null)
                        {
                            writeError = true;
                            trans.Rollback();
                            responder.WriteErroredMsg("不存在此用户,无法预订!");
                            return;
                        }


                        if (user.Enabled == false)
                        {
                            writeError = true;
                            trans.Rollback();
                            responder.WriteErroredMsg(user.Realname + " 处于禁用状态,无法预订!");
                            return;
                        }


                        if (withUid > 0)
                        {
                            bookingtrade.Proxyid   = uid;
                            bookingtrade.Proxyname = rname;
                            bookingtrade.Remarks  += string.Format("由 {0} 代订", rname.Trim());
                        }

                        uid   = user.Uid;
                        rname = user.Realname;

                        bookingtrade.Bookingid   = booking.Id;
                        bookingtrade.Bookingname = booking.Bookingname;
                        bookingtrade.Handlerid   = bookingshop.Uid;
                        bookingtrade.Handlername = bookingshop.Realname;
                        bookingtrade.Uid         = uid;
                        bookingtrade.Realname    = rname;
                        bookingtrade.Shopid      = bookingshop.Shopid;
                        bookingtrade.Shopname    = bookingshop.Shopname;
                        bookingtrade.Tradename   = trade.Tradename;
                        bookingtrade.Tradevalue  = trade.Tradevalue;
                        bookingtrade.Issettle    = booking.Isbooking == false;
                        bookingtrade.Bookinttime = DateTime.Now;

                        if (booking.Bookingtime.Date.Equals(DateTime.Now.Date) == false)
                        {
                            bookingtrade.Bookinttime = new DateTime(booking.Bookingtime.Date.Ticks);
                            bookingtrade.Bookinttime = bookingtrade.Bookinttime.AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute).AddSeconds(DateTime.Now.Second);
                        }

                        addedCount = bookingtrade.Tradecount;
                        deduction.Deductionbalance = user.Balance - trade.Tradevalue * addedCount;
                        deduction.Deductioncount   = addedCount;
                        deduction.Deductionname    = string.Format("预订{0}", bookingtrade.Tradename);
                        deduction.Deductiontime    = DateTime.Now;
                        deduction.Deductionvalue   = -bookingtrade.Tradevalue * addedCount;
                        deduction.Uid      = bookingtrade.Uid;
                        deduction.Realname = bookingtrade.Realname;
                        deduction.Shopid   = bookingtrade.Shopid;
                        deduction.Shopname = bookingtrade.Shopname;
                        deduction.Remarks  = bookingtrade.Remarks;

                        isAdd = true;
                    }

                    rlt = UserManager.UpdateUserBalance(uid, trade.Tradevalue * addedCount, trans);
                    if (rlt <= 0)
                    {
                        writeError = true;
                        trans.Rollback();
                        responder.WriteErroredMsg("扣除余额失败,数据库更新不成功!");
                        return;
                    }

                    rlt = DeductionManager.AddDeduction(deduction, trans);
                    if (rlt <= 0)
                    {
                        writeError = true;
                        trans.Rollback();
                        responder.WriteErroredMsg("扣款记录失败,数据库写入不成功!");
                        return;
                    }

                    if (isAdd)
                    {
                        rlt = BookingtradeManager.AddBookingtrade(bookingtrade, trans);
                    }
                    else
                    {
                        rlt = BookingtradeManager.UpdateBookingtrade(bookingtrade, trans);
                    }

                    trans.Commit();
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    if (writeError == false)
                    {
                        responder.WriteErroredMsg("预订失败,程序异常!");
                    }
                    return;
                }
            }

            if (rlt <= 0)
            {
                if (isAdd)
                {
                    responder.WriteErroredMsg("预订失败,数据库写入不成功!");
                }
                else
                {
                    responder.WriteErroredMsg("预订失败,数据库更新不成功!");
                }

                return;
            }

            if (isAdd)
            {
                responder.WriteSuccessedMsg("提交成功,预订项已添加!");
            }
            else
            {
                responder.WriteSuccessedMsg("提交成功,预订项已更新!");
            }
        }
示例#7
0
        public void handler(IResponder responder)
        {
            int id = SJSRequest.GetInt("Id", 0);

            if (id <= 0)
            {
                responder.WriteErroredMsg("请求参数错误!");
                return;
            }

            Booking booking = BookingManager.GetBooking(id);

            if (booking == null)
            {
                responder.WriteErroredMsg("不存在此预订,无法删除!");
                return;
            }

            if (booking.Issettle)
            {
                responder.WriteErroredMsg("此预订已结算,无法删除!");
                return;
            }

            using (DbTransaction trans = DbHelper.BeginTransaction())
            {
                bool writeError = false;
                try
                {
                    int rlt = BookingManager.DelBooking(id, trans);
                    if (rlt <= 0)
                    {
                        writeError = true;
                        trans.Rollback();
                        responder.WriteErroredMsg("删除预订失败,数据库更新不成功!");
                        return;
                    }

                    BookingshopManager.DelBookingshop(id, true, trans);

                    IList <Bookingtrade> list = BookingtradeManager.GetBookingtrade(id, trans, true);

                    foreach (Bookingtrade item in list)
                    {
                        User user = UserManager.GetUser(item.Uid, trans);
                        user.Balance = user.Balance + item.Tradevalue * item.Tradecount;

                        rlt = UserManager.UpdateUserBalance(item.Uid, -item.Tradevalue * item.Tradecount, trans);
                        if (rlt <= 0)
                        {
                            writeError = true;
                            trans.Rollback();
                            responder.WriteErroredMsg("返还余额失败,数据库更新不成功!");
                            return;
                        }

                        Deduction deduction = new Deduction();
                        deduction.Deductionbalance = user.Balance;
                        deduction.Deductioncount   = -item.Tradecount;
                        deduction.Deductionname    = string.Format("退订{0}(删除预订)", item.Tradename);
                        deduction.Deductiontime    = DateTime.Now;
                        deduction.Deductionvalue   = item.Tradevalue * item.Tradecount;
                        deduction.Uid      = item.Uid;
                        deduction.Realname = item.Realname;
                        deduction.Shopid   = item.Shopid;
                        deduction.Shopname = item.Shopname;
                        deduction.Remarks  = item.Remarks;

                        rlt = DeductionManager.AddDeduction(deduction, trans);

                        if (rlt <= 0)
                        {
                            writeError = true;
                            trans.Rollback();
                            responder.WriteErroredMsg("扣款记录失败,数据库写入不成功!");
                            return;
                        }

                        rlt = BookingtradeManager.DelBookingtrade(item.Id, trans);
                        if (rlt <= 0)
                        {
                            writeError = true;
                            trans.Rollback();
                            responder.WriteErroredMsg("删除已预订列表失败,数据库更新不成功!");
                            return;
                        }
                    }

                    trans.Commit();
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    if (writeError == false)
                    {
                        responder.WriteErroredMsg("删除失败,程序异常!");
                    }
                    return;
                }
            }

            responder.WriteSuccessedMsg("预订、此预订接受预订的店铺列表和此预订的预订记录删除成功!");
        }
示例#8
0
        public void handler(IResponder responder)
        {
            string dir = System.Web.HttpContext.Current.Server.MapPath(".\\Excels");

            int bookingId = SJSRequest.GetInt("Bookingid", 0);

            if (bookingId <= 0)
            {
                responder.WriteSuccessedMsg("");
                return;
            }

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            MSExcel.Application excel = new MSExcel.Application();

            MSExcel.Workbook wbook = excel.Workbooks.Add(true);

            MSExcel.Worksheet ws = (MSExcel.Worksheet)wbook.Sheets[1];
            ws.Name = "预订报表";
            ws.Select();

            int offsetRow = 1;
            int offsetCol = 1;


            MSExcel.Range r = ws.get_Range(getCell(2 + offsetRow, 1 + offsetCol), Type.Missing);
            r.Select();
            excel.ActiveWindow.FreezePanes = true;


            r = ws.get_Range(getCell(1, 1), getCell(1, 7));
            r.Merge(r.MergeCells);
            r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
            r.VerticalAlignment   = MSExcel.XlVAlign.xlVAlignCenter;
            r.RowHeight           = 25;
            r.Font.Bold           = true;
            r.Font.Size           = 14;
            r.Value2 = "预订报表";


            r = ws.get_Range(getCell(1 + offsetRow, 1 + offsetCol), Type.Missing);
            r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
            r.VerticalAlignment   = MSExcel.XlVAlign.xlVAlignCenter;
            r.ColumnWidth         = 12;
            r.RowHeight           = 25;
            r.Font.Bold           = true;
            r.Value2 = "餐饮店";

            r = ws.get_Range(getCell(1 + offsetRow, 2 + offsetCol), Type.Missing);
            r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
            r.VerticalAlignment   = MSExcel.XlVAlign.xlVAlignCenter;
            r.ColumnWidth         = 26;
            r.Font.Bold           = true;
            r.Value2 = "菜单项";

            r = ws.get_Range(getCell(1 + offsetRow, 3 + offsetCol), Type.Missing);
            r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
            r.VerticalAlignment   = MSExcel.XlVAlign.xlVAlignCenter;
            r.ColumnWidth         = 10;
            r.Font.Bold           = true;
            r.Value2 = "数 量";

            r = ws.get_Range(getCell(1 + offsetRow, 4 + offsetCol), Type.Missing);
            r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
            r.VerticalAlignment   = MSExcel.XlVAlign.xlVAlignCenter;
            r.ColumnWidth         = 10;
            r.Font.Bold           = true;
            r.Value2 = "预订者";

            r = ws.get_Range(getCell(1 + offsetRow, 5 + offsetCol), Type.Missing);
            r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
            r.VerticalAlignment   = MSExcel.XlVAlign.xlVAlignCenter;
            r.ColumnWidth         = 10;
            r.Font.Bold           = true;
            r.Value2 = "签名";

            Dictionary <string, IList <Bookingtrade> > dic = new Dictionary <string, IList <Bookingtrade> >();



            IList <Bookingshop> list = BookingshopManager.GetBookingshop(bookingId, true);

            foreach (Bookingshop bs in list)
            {
                IList <Bookingtrade> tList = BookingtradeManager.GetBookingtrade(bs.Id, 0, 0);
                dic[bs.Shopname.Trim()] = tList;
            }

            string[] keys = new string[dic.Keys.Count];

            dic.Keys.CopyTo(keys, 0);

            int curRow = 2 + offsetRow;

            int startRow = 0;

            double allMoney = 0;

            Booking booking = BookingManager.GetBooking(bookingId);

            if (booking == null)
            {
                responder.WriteSuccessedMsg("");
                return;
            }
            DateTime dt = booking.Bookingtime;

            for (int i = 0; i < keys.Length; i++)
            {
                IList <Bookingtrade> tList = dic[keys[i]];
                startRow = curRow;
                allMoney = 0;
                for (int j = 0; j < tList.Count; j++, curRow++)
                {
                    //r = ws.get_Range(getCell(curRow, 1 + offsetCol), Type.Missing);
                    //r.Value2 = tList[j].Shopname.Trim();

                    r           = ws.get_Range(getCell(curRow, 2 + offsetCol), Type.Missing);
                    r.RowHeight = 18;
                    r.Value2    = tList[j].Tradename.Trim();

                    r = ws.get_Range(getCell(curRow, 3 + offsetCol), Type.Missing);
                    r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
                    r.Value2 = tList[j].Tradecount;

                    r        = ws.get_Range(getCell(curRow, 4 + offsetCol), Type.Missing);
                    r.Value2 = tList[j].Realname.Trim();

                    allMoney = allMoney + tList[j].Tradevalue * tList[j].Tradecount;
                }

                r = ws.get_Range(getCell(startRow, 1 + offsetCol), getCell(curRow - 1, 1 + offsetCol));
                r.Merge(r.MergeCells);
                r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
                r.VerticalAlignment   = MSExcel.XlVAlign.xlVAlignCenter;
                r.Value2 = keys[i];

                r = ws.get_Range(getCell(curRow, 1 + offsetCol), Type.Missing);
                r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignRight;
                r.Font.Bold           = true;
                r.RowHeight           = 18;
                r.Value2 = "总数量:";

                r = ws.get_Range(getCell(curRow, 2 + offsetCol), Type.Missing);
                r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
                r.Font.Bold           = true;
                r.Formula             = "=SUM(" + getCell(startRow, 3 + offsetCol) + ":" + getCell(curRow - 1, 3 + offsetCol) + ")";

                r = ws.get_Range(getCell(curRow, 3 + offsetCol), Type.Missing);
                r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignRight;
                r.Font.Bold           = true;
                r.Value2 = "总 价:";

                r = ws.get_Range(getCell(curRow, 4 + offsetCol), Type.Missing);
                r.HorizontalAlignment = MSExcel.XlHAlign.xlHAlignCenter;
                r.Font.Bold           = true;
                r.Value2 = allMoney;


                curRow++;

                //r = ws.get_Range(getCell(curRow, 1 + offsetCol), getCell(curRow, 4 + offsetCol));
                //r.Merge(r.MergeCells);
                //r.Value2 =
            }

            r = ws.get_Range(getCell(1 + offsetRow, 1 + offsetCol), getCell(curRow - 1, 5 + offsetCol));
            r.Borders.LineStyle = 1;
            //r.Borders.get_Item(MSExcel.XlBordersIndex.xlEdgeTop).LineStyle = MSExcel.XlLineStyle.xlContinuous;

            string str = getCell(1, 1);

            string filename = dt.ToString("yyyyMMdd") + "报表.xlsx";
            string file     = Path.Combine(dir, filename);

            File.Delete(file);

            try
            {
                wbook.SaveAs(file, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, MSExcel.XlSaveAsAccessMode.xlExclusive);
            }
            catch (Exception ex)
            {
                //if (ex.Message.EndsWith("HRESULT:0x800A03EC")) Console.WriteLine("用户拒绝覆盖!");
                //else Console.WriteLine(ex.Message);
            }


            wbook.Close(false);
            excel.Quit();
            //Thread.Sleep(1000);
            responder.WriteSuccessedMsg("/Excels/" + filename);
            //System.Web.HttpContext.Current.Response.Redirect("/Excels/" + filename);

            //FileInfo fi = new FileInfo(file);
            //responder.RWExcelFile(fi);
        }