Exemple #1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            var startTime = DateTime.Parse(hidStartTime.Value);
            var endTime   = DateTime.Parse(hidEndTime.Value);

            if (!base.CheckInput(startTime, endTime, ltCheckInfo))
            {
                ScriptManager.RegisterStartupScript(upRpt, this.Page.GetType(), "", "canClick()", true);
                return;
            }

            // 车辆ID
            long vehiclesID = 0;

            if (!string.IsNullOrWhiteSpace(this.hidVehicleID.Value))
            {
                vehiclesID = Convert.ToInt32(hidVehicleID.Value);
            }
            //这里的id是指异常类型表里的ID列而不是IndexID
            //因为对于设备以及电源异常都属于硬件异常,肯定是车机上报
            int exceptionTypeID = -1;

            if (ddlExTypes.Visible)
            {
                exceptionTypeID = Convert.ToInt32(this.ddlExTypes.SelectedValue);
            }

            try
            {
                int collectID = -1;
                ExceptionSearchModel            model = new ExceptionSearchModel();
                List <ExceptionsEquipmentModel> list  = null;
                model.UserID     = base.CurrentUserID;
                model.SartTime   = startTime;
                model.EndTime    = endTime;
                model.VehiclesID = vehiclesID;

                // 异常明细汇总
                if (this.CurrentRptName == ExceptionCollectEnum.ExDetailsSummaryRpt.ToString())
                {
                    if (base.VehicleViewMode)
                    {
                        list = ReportBLL.GetDefaultAllExceptions(model, base.CurrentStrucID);
                    }
                    else
                    {
                        list = ReportBLL.GetAllExceptions(model);
                    }
                }
                else
                {
                    collectID             = (int)Enum.Parse(typeof(ExceptionCollectEnum), base.CurrentRptName);
                    model.ExceptionTypeID = exceptionTypeID;
                    model.CollectID       = collectID;
                    if (base.VehicleViewMode)
                    {
                        list = ReportBLL.GetDefaultExceptionsForEquipment(model, base.CurrentStrucID);
                    }
                    else
                    {
                        list = ReportBLL.GetExceptionsForEquipment(model);
                    }
                }

                if (!base.CheckResult <ExceptionsEquipmentModel>(list, ltCheckInfo))
                {
                    ScriptManager.RegisterStartupScript(upRpt, this.Page.GetType(), "", "canClick()", true);
                    return;
                }
                this.ShowReport(list);
                ScriptManager.RegisterStartupScript(upRpt, this.Page.GetType(), "", "canClick()", true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(upRpt, this.Page.GetType(), "", "canClick()", true);
                base.DoReportLog(ex.Message, ltCheckInfo);
            }
        }