public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     int serviceId = Convert.ToInt32(context.Request.QueryString["serviceId"]);
     ServiceDAO serviceDAO = new ServiceDAO();
     bool success = serviceDAO.finishService(serviceId);
     context.Response.Write(success + "\n");
     context.Response.Write("help");
 }
Example #2
0
        public void getServiceCall()
        {
            StringBuilder sb = new StringBuilder();
            ServiceDAO serviceDAO = new ServiceDAO();
            List<ServiceEntity> list = serviceDAO.getAllServiceByRestaurantId(restaurantId);
            for (int i = 0; i < list.Count; i++)
            {
                DateTime todaydate = Convert.ToDateTime(list[i].ctime);
                String date = todaydate.ToString("hh:mm:ss");
                switch (list[i].status)
                {
                    //对订单状态进行分类,应该需要换,优化
                    case 0:
                        sb.Append("<tr>");
                        sb.Append("<td><input type='checkbox' name='checkbox'/></td>");
                        sb.Append("<td>"+list[i].user_id+"</td>");
                        sb.Append("<td>"+list[i].service_name+"</td>");
                        sb.Append("<td>"+date+"</td>");
                        sb.Append("<td width='55' class='bl_blue'><span class='label label-info'>新呼叫</span></td>");
                        sb.Append("<td>");
                        sb.Append("<input id='" + list[i].user_id + "'  type='button' value='绘制路线' onclick='strokeRect(this);'/> ");

                        sb.Append("<a href='#' class='button green'>");
                        sb.Append("<div class='icon'><span class='ico-pencil'></span></div>");
                        sb.Append("</a>");
                        sb.Append("<div><input id='" + list[i].id + "' type='button' value='完成'  OnClick='deleteService(this)'></div>");
                        sb.Append("</a>");
                        sb.Append("</td>");
                        sb.Append("</tr>");
                        break;
                    case 1:
                        sb.Append("<tr>");
                        sb.Append("<td><input type='checkbox' name='checkbox'/></td>");
                        sb.Append("<td>"+list[i].user_id+"</td>");
                        sb.Append("<td>"+list[i].service_name+"</td>");
                        sb.Append("<td>"+date+"</td>");
                        sb.Append("<td class='bl_green'><span class='label label-success'>完成</span></td>");
                        sb.Append("<td>");
                        sb.Append("<input id='" + list[i].user_id + "' type='button' value='绘制路线' onclick='strokeRect(this);'/> ");

                        sb.Append("<a href='#' class='button green'>");
                        sb.Append("<div class='icon'><span class='ico-pencil'></span></div>");
                        sb.Append("</a>");
                        //sb.Append("<div><input id='" + list[i].id + "' type='button' value='完成'  OnClick='deleteService(this)'></div>");
                        sb.Append("</a>");
                        sb.Append("</td>");
                        sb.Append("</tr>");
                        break;
                    case 2:
                        sb.Append("<tr>");
                        sb.Append("<td><input type='checkbox' name='checkbox'/></td>");
                        sb.Append("<td>" + list[i].user_id + "</td>");
                        sb.Append("<td>" + list[i].service_name + "</td>");
                        sb.Append("<td>" + date + "</td>");
                        sb.Append("<td class='bl_red'><span class='label label-important'>取消</span></td>");
                        sb.Append("<td>");
                        sb.Append("<input id='" + list[i].user_id + "' type='button' value='绘制路线' onclick='strokeRect(this);'/> ");

                        sb.Append("<a href='#' class='button green'>");
                        sb.Append("<div class='icon'><span class='ico-pencil'></span></div>");
                        sb.Append("</a>");
                        //sb.Append("<div><input id='" + list[i].id + "' type='button' value='完成'  OnClick='deleteService(this)'></div>");
                        sb.Append("</a>");
                        sb.Append("</td>");
                        sb.Append("</tr>");
                        break;
                }
            }
            servicePart = sb.ToString();
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MapDAO mm = new MapDAO();
            MapEntity entity = mm.getMap();
            Dijkstra dijkstra = new Dijkstra();

            StringBuilder sb = new StringBuilder();

            StringBuilder sb2 = new StringBuilder();
            Floyd floyd = new Floyd();
            ServiceDAO serviceDAO = new ServiceDAO();
            List<ServiceEntity> list = serviceDAO.getAllServiceByRestaurantId(1);
            ArrayList pointList = new ArrayList();
            for(int i=0;i<list.Count;i++){
                if (list[i].status == 0 && (pointList.IndexOf(list[i].user_id) == -1) && (list[i].service_type == 0))
                {
                    pointList.Add(list[i].user_id);
                }
            }
            ArrayList result = floyd.getPath(pointList,entity.dist,41,38);
            for (int i = 0; i < result.Count;i++ )
            {
                sb2.Append(result[i]+"->");
            }
            for (int i = 0; i < result.Count - 1; i++)
            {
                int[] pre = dijkstra.run((int)result[i], entity.dist, 41);
                int endpoint = (int)result[i+1];
                int ss = pre[endpoint];
                sb.Append("context.moveTo(" + entity.vertexList[endpoint - 1].x + ", " + entity.vertexList[endpoint - 1].y + ");"); // 设置路径起点,坐标为(20,20)
                sb.Append("context.lineTo(" + entity.vertexList[ss - 1].x + ", " + entity.vertexList[ss - 1].y + ");"); // 绘制一条到(200,20)的直线
                number = "1<-" + ss + "<-";
                while (ss != (int)result[i])
                {
                    ss = pre[ss];
                    sb.Append("context.lineTo(" + entity.vertexList[ss - 1].x + ", " + entity.vertexList[ss - 1].y + ");"); // 绘制一条到(200,20)的直线
                    number += ss + "<-";
                }

            }
            js = sb.ToString();
            number = js;
            shortString = sb2.ToString();

            StringBuilder sb3 = new StringBuilder();
            ArrayList pointList2 = new ArrayList();
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].status == 0 && (pointList2.IndexOf(list[i].user_id) == -1)&&(list[i].service_type==1))
                {
                    pointList2.Add(list[i].user_id);
                }
            }
            ArrayList result2 = floyd.getPath(pointList2, entity.dist, 41, 38);
            for (int i = 0; i < result2.Count - 1; i++)
            {
                int[] pre = dijkstra.run((int)result2[i], entity.dist, 41);
                int endpoint = (int)result2[i + 1];
                int ss = pre[endpoint];
                sb3.Append("context.moveTo(" + entity.vertexList[endpoint - 1].x + ", " + entity.vertexList[endpoint - 1].y + ");"); // 设置路径起点,坐标为(20,20)
                sb3.Append("context.lineTo(" + entity.vertexList[ss - 1].x + ", " + entity.vertexList[ss - 1].y + ");"); // 绘制一条到(200,20)的直线
                number = "1<-" + ss + "<-";
                while (ss != (int)result2[i])
                {
                    ss = pre[ss];
                    sb3.Append("context.lineTo(" + entity.vertexList[ss - 1].x + ", " + entity.vertexList[ss - 1].y + ");"); // 绘制一条到(200,20)的直线
                    number += ss + "<-";
                }

            }
            js2 = sb3.ToString();

            StringBuilder sb4 = new StringBuilder();
            ArrayList pointList3 = new ArrayList();
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].status == 0 && (pointList3.IndexOf(list[i].user_id) == -1) && (list[i].service_type == 2))
                {
                    pointList3.Add(list[i].user_id);
                }
            }
            ArrayList result3 = floyd.getPath(pointList3, entity.dist, 41, 38);
            for (int i = 0; i < result3.Count - 1; i++)
            {
                int[] pre = dijkstra.run((int)result3[i], entity.dist, 41);
                int endpoint = (int)result3[i + 1];
                int ss = pre[endpoint];
                sb4.Append("context.moveTo(" + entity.vertexList[endpoint - 1].x + ", " + entity.vertexList[endpoint - 1].y + ");"); // 设置路径起点,坐标为(20,20)
                sb4.Append("context.lineTo(" + entity.vertexList[ss - 1].x + ", " + entity.vertexList[ss - 1].y + ");"); // 绘制一条到(200,20)的直线
                number = "1<-" + ss + "<-";
                while (ss != (int)result3[i])
                {
                    ss = pre[ss];
                    sb4.Append("context.lineTo(" + entity.vertexList[ss - 1].x + ", " + entity.vertexList[ss - 1].y + ");"); // 绘制一条到(200,20)的直线
                    number += ss + "<-";
                }

            }
            js3 = sb4.ToString();
        }