示例#1
0
        public ActionResult GetPageDetailListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();
            TrainingOrderEntity para = new TrainingOrderEntity();

            if (!string.IsNullOrWhiteSpace(queryJson))
            {
                var queryParam = queryJson.ToJObject();
                if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
                {
                    DateTime startTime = queryParam["StartTime"].ToDate();
                    DateTime endTime   = queryParam["EndTime"].ToDate();
                    para.StartTime = startTime.ToString();
                    para.EndTime   = endTime.ToString();
                }
                if (!queryParam["TrainingCarId"].IsEmpty())
                {
                    para.TrainingCarId = queryParam["TrainingCarId"].ToString();
                }
            }
            var pageList = new List <TrainingOrderEntity>();

            try
            {
                pageList = TrainingOrderBLL.Instance.GetPageList(new TrainingOrderEntity()
                {
                    TrainingCarId = para.TrainingCarId,
                    StartTime     = para.StartTime,
                    EndTime       = para.EndTime
                }, ref pagination).Where(p => p.Status != (int)RCHL.Model.Enums.TrainingStatus.已取消).ToList();

                pageList.ForEach((o) =>
                {
                    string datetime = "";
                    var detail      = TrainingOrderDetailBLL.Instance.GetList(new TrainingOrderDetailEntity()
                    {
                        TrainingOrderId = o.TrainingOrderId
                    });

                    detail.ForEach((d) =>
                    {
                        datetime += d.ServiceTime + ",";
                    });
                    o.ServiceTime = string.Format("{0}", datetime.TrimEnd(','));
                });
            }
            catch (Exception ex)
            {
            }
            var JsonData = new
            {
                rows     = pageList,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
示例#2
0
        public JsonResult GetMyTraingOrder(int status)
        {
            var result = new ReturnMessage(false)
            {
                Message = "获取失败!"
            };

            try
            {
                TrainingOrderEntity para = new TrainingOrderEntity();
                //switch (status)
                //{
                //    case (int)RCHL.Model.Enums.SubscribeStatus.预约成功:
                //        para.Status = (int)RCHL.Model.Enums.SubscribeStatus.预约成功;
                //        break;
                //    case (int)RCHL.Model.Enums.SubscribeStatus.已取消:
                //        para.Status = (int)RCHL.Model.Enums.SubscribeStatus.已取消;
                //        break;
                //}
                if (status != -1)
                {
                    para.Status = status;
                }

                para.MemberId = LoginUser.UserId;
                para.sidx     = "CreateTime";
                para.sord     = "desc";
                var list = TrainingOrderBLL.Instance.GetList(para);
                list.Foreach((o) =>
                {
                    if (o.Status != null)
                    {
                        o.StatusName = ((RCHL.Model.Enums.TrainingStatus)o.Status).ToString();
                    }
                });
                result.IsSuccess          = true;
                result.Message            = "获取成功";
                result.ResultData["List"] = list;
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "TrainingCarController>>GetMyTraingOrder";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public JsonResult GetTeacherTrainingList(int status)
        {
            var result = new ReturnMessage(false)
            {
                Message = "获取失败!"
            };

            try
            {
                TrainingOrderEntity para = new TrainingOrderEntity();
                if (status != -1)
                {
                    para.Status = status;
                }

                para.MemberId = LoginTeacher.UserId;
                para.sidx     = "CreateTime";
                para.sord     = "desc";
                var list = TrainingOrderBLL.Instance.GetList(para);
                list.Foreach((o) =>
                {
                    if (o.Status != null)
                    {
                        o.StatusName = ((RCHL.Model.Enums.TrainingStatus)o.Status).ToString();
                    }
                });
                result.IsSuccess          = true;
                result.Message            = "获取成功";
                result.ResultData["List"] = list;
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "MaCenterController>>GetTeacherWithDrivingList";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        /// <summary>
        /// 导出EXCEL
        /// </summary>
        /// <param name="queryJson"></param>
        public void ExportExcel(string queryJson)
        {
            string cacheKey = Request["cacheid"] as string;

            HttpRuntime.Cache[cacheKey + "-state"] = "processing";
            HttpRuntime.Cache[cacheKey + "-row"]   = "0";
            try
            {
                TrainingOrderEntity para = new TrainingOrderEntity();
                if (!string.IsNullOrWhiteSpace(queryJson))
                {
                    //这里要url解码
                    var queryParam = Server.UrlDecode(queryJson).ToJObject();
                    //类型
                    if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty())
                    {
                        var condition = queryParam["condition"].ToString().ToLower();
                        switch (condition)
                        {
                        case "trainingorderno":
                            para.TrainingOrderNo = queryParam["keyword"].ToString();
                            break;

                        case "membername":
                            para.MemberName = queryParam["keyword"].ToString();
                            break;

                        case "membermobile":
                            para.MemberMobile = queryParam["keyword"].ToString();
                            break;

                        case "schoolname":
                            para.SchoolName = queryParam["keyword"].ToString();
                            break;

                        case "trainingcarnumber":
                            para.TrainingCarNumber = queryParam["keyword"].ToString();
                            break;
                        }
                    }
                    if (!queryParam["status"].IsEmpty())
                    {
                        para.Status = int.Parse(queryParam["status"].ToString());
                    }
                }
                para.sidx = "CreateTime";
                para.sord = "desc";
                var list = TrainingOrderBLL.Instance.GetList(para);
                if (list != null)
                {
                    int subcount = 0;
                    list.ForEach((o) =>
                    {
                        if (o.ServiceDate != null)
                        {
                            o.ServiceTime = Converter.ParseDateTime(o.ServiceDate).ToString("yyyy-MM-dd") + " " + o.ServiceTime;
                        }
                        if (o.Status != null)
                        {
                            o.StatusName = ((RCHL.Model.Enums.TrainingStatus)o.Status).ToString();
                        }
                        if (o.CashType != null)
                        {
                            o.CashTypeName = ((RCHL.Model.Enums.CashType)o.CashType).ToString();
                        }
                        var detail = TrainingOrderDetailBLL.Instance.GetList(new TrainingOrderDetailEntity()
                        {
                            TrainingOrderId = o.TrainingOrderId
                        });

                        int subCount = 0;
                        detail.ForEach((d) =>
                        {
                            subCount = subCount + 1;
                        });
                        o.SubrictCount = subCount;
                    });

                    //设置导出格式
                    ExcelConfig excelconfig = new ExcelConfig();
                    excelconfig.Title           = "实训预约订单";
                    excelconfig.TitleFont       = "微软雅黑";
                    excelconfig.TitlePoint      = 10;
                    excelconfig.FileName        = "实训预约订单.xls";
                    excelconfig.IsAllSizeColumn = true;
                    //每一列的设置,没有设置的列信息,系统将按datatable中的列名导出
                    List <ColumnEntity> listColumnEntity = new List <ColumnEntity>();
                    excelconfig.ColumnEntity = listColumnEntity;
                    ColumnEntity columnentity = new ColumnEntity();
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "TrainingOrderNo", ExcelColumn = "订单号", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "MemberName", ExcelColumn = "学员用户名", Width = 15
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "MemberMobile", ExcelColumn = "联系方式", Width = 15
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "ServiceTime", ExcelColumn = "预约时间", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "SubrictCount", ExcelColumn = "合计预约数", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "SchoolName", ExcelColumn = "预约驾校", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "Price", ExcelColumn = "费用", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "CashTypeName", ExcelColumn = "支付方式", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "TrainingTypeName", ExcelColumn = "实训类型", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "TrainingCarName", ExcelColumn = "实训车名称", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "TrainingCarNumber", ExcelColumn = "实训车车牌", Width = 20
                    });
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        Column = "StatusName", ExcelColumn = "状态", Width = 20
                    });
                    //需合并索引
                    //excelconfig.MergeRangeIndexArr = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };

                    //调用导出方法
                    ExcelHelper <TrainingOrderEntity> .ExcelDownload(list, excelconfig);

                    HttpRuntime.Cache[cacheKey + "-state"] = "done";
                }
            }
            catch (Exception)
            {
                HttpRuntime.Cache[cacheKey + "-state"] = "error";
            }
        }
示例#5
0
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();
            TrainingOrderEntity para = new TrainingOrderEntity();

            if (!string.IsNullOrWhiteSpace(queryJson))
            {
                var queryParam = queryJson.ToJObject();

                //类型
                if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty())
                {
                    var condition = queryParam["condition"].ToString().ToLower();
                    switch (condition)
                    {
                    case "trainingorderno":
                        para.TrainingOrderNo = queryParam["keyword"].ToString();
                        break;

                    case "membername":
                        para.MemberName = queryParam["keyword"].ToString();
                        break;

                    case "membermobile":
                        para.MemberMobile = queryParam["keyword"].ToString();
                        break;

                    case "schoolname":
                        para.SchoolName = queryParam["keyword"].ToString();
                        break;

                    case "TrainingCarNumber":
                        para.TrainingCarNumber = queryParam["keyword"].ToString();
                        break;
                    }
                }
                if (!queryParam["status"].IsEmpty())
                {
                    para.Status = int.Parse(queryParam["status"].ToString());
                }
            }

            var pageList = TrainingOrderBLL.Instance.GetPageList(para, ref pagination);

            if (pageList != null)
            {
                pageList.ForEach((o) =>
                {
                    if (o.Status != null)
                    {
                        o.StatusName = ((RCHL.Model.Enums.TrainingStatus)o.Status).ToString();
                    }
                    if (o.CashType != null)
                    {
                        o.CashTypeName = ((RCHL.Model.Enums.CashType)o.CashType).ToString();
                    }
                    if (o.UserType != null)
                    {
                        o.UserTypeName = ((RCHL.Model.Enums.TrainingUserType)o.UserType).ToString();
                    }
                    var detail = TrainingOrderDetailBLL.Instance.GetList(new TrainingOrderDetailEntity()
                    {
                        TrainingOrderId = o.TrainingOrderId
                    });
                    string datetime = "";
                    int subCount    = 0;
                    detail.ForEach((d) =>
                    {
                        datetime += d.ServiceTime + ",";
                        subCount  = subCount + 1;
                    });
                    o.SubrictCount = subCount;
                    o.ServiceTime  = string.Format("{0} {1}", Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd"), datetime.TrimEnd(','));
                });
            }
            var JsonData = new
            {
                rows     = pageList,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }