예제 #1
0
        public ActionResult RepTimelyMsg(int?selTaskName, string txtTaskName, int?selName, int?selWaringType, string txtName, string keyWord, string selkeyWord, string txtStartTime, string txtEndTime)
        {
            try
            {
                UserInfo user = (UserInfo)Session["userInfo"];
                //ViewBag.liShow = "Warning";
                ViewBag.left = "PWList";
                Dictionary <string, string> dic = new Dictionary <string, string>()
                {
                    { "selTaskName", (selTaskName ?? 1).ToString() },
                    { "txtTaskName", txtTaskName },
                    { "selName", (selName ?? 1).ToString() },
                    { "txtName", txtName },
                    { "keyWord", keyWord },
                    { "selkeyWord", selkeyWord },
                    { "selMobile", "" },
                    { "txtMobile", "" },
                    { "selMac", "" },
                    { "txtMac", "" },
                    { "selIMEI", "" },
                    { "txtIMEI", "" },
                    { "txtStartTime", txtStartTime },
                    { "txtEndTime", txtEndTime },
                    { "CaseType", "1" },
                    { "UserID", user.ID.ToString() },
                    { "ExcelType", "2" },
                    { "UserType", user.Type.ToString() },
                    { "selWaringType", (selWaringType ?? 0).ToString() }
                };
                object obj = new WarningDAL().GetPersonWaringListDal(dic);
                System.Data.DataTable dt = new System.Data.DataTable();
                System.Data.DataSet   ds = new System.Data.DataSet();
                ds = (System.Data.DataSet)obj;
                dt = ds.Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["DST_IP"] == DBNull.Value)
                    {
                        dt.Rows[i]["DST_IP"] = "00000";
                    }
                }
                Dictionary <string, string> Table_dic = new Dictionary <string, string>()
                {
                    { "审计任务名称", "TaskName" },
                    { "场所名称", "PLACE_NAME" },
                    { "布控类型", "CaseItem" },
                    { "布控内容", "CaseValue" },
                    { "预警邮箱", "WMail" },
                    { "报警时间", "Createtime" },
                    { "场所内网端口号", "PORT" },
                    { "目的公网IPv4地址", "DST_IP" }
                };
                Dictionary <string, string> Head_dic = new Dictionary <string, string>();
                if (!string.IsNullOrEmpty(txtTaskName))
                {
                    dic.Add("审计任务名称", txtTaskName);
                }
                if (!string.IsNullOrEmpty(txtName))
                {
                    dic.Add("场所名称", txtName);
                }
                //if (!string.IsNullOrEmpty(txtMobile))
                //    dic.Add("手机号码", txtMobile);
                //if (!string.IsNullOrEmpty(txtMac))
                //    dic.Add("上网终端MAC地址:", txtMac);
                if (!string.IsNullOrEmpty(txtStartTime))
                {
                    dic.Add("报警开始时间", txtStartTime);
                }
                if (!string.IsNullOrEmpty(txtEndTime))
                {
                    dic.Add("报警结束时间", txtEndTime);
                }

                NPOISheetModel sheel = new NPOISheetModel();
                sheel.dt          = dt;
                sheel.ExcelTitle  = "网警通预警---人员报警";
                sheel.TableTitle  = Table_dic;
                sheel.TableSearch = Head_dic;
                string filepath = new ComNPOIExcel().Export(sheel, Server.MapPath("~/") + "UserData/EXP/PWList/");
                //Dispose();
                //return Content("{\"result\":"+filepath+"\"}");
                return(Content("{\"result\":\"" + filepath + "\"}"));
            }
            catch (SqlException ex)
            {
                Logger.ErrorLog(ex, new Dictionary <string, string>()
                {
                    { "Function", "Warning.ExcelPwList(int selTaskName, string txtTaskName, int selName, string txtName, int selMobile, string txtMobile, int selMac, string txtMac, string txtStartTime, string txtEndTime)" }
                });
                return(Content("{\"err\":\"导出文件出错,请稍后重试\"}"));
            }
            catch (Exception ex)
            {
                Logger.ErrorLog(ex, new Dictionary <string, string>()
                {
                    { "Function", "Warning.ExcelPwList(int selTaskName, string txtTaskName, int selName, string txtName, int selMobile, string txtMobile, int selMac, string txtMac, string txtStartTime, string txtEndTime)" }
                });
                return(Content("{\"err\":\"导出文件出错,请稍后重试\"}"));
            }
        }
예제 #2
0
        public ActionResult RepIndex(string CaseType, string TaskName, string selTaskName, string keyWord, string selkeyWord, string HeadName, string selHeadName, string StartCreateTime, string EndCreateTime, string StartEndTime, string EndEndTime)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>()
            {
                { "CaseType", CaseType },
                { "TaskName", TaskName },
                { "selTaskName", selTaskName },
                { "keyWord", keyWord },
                { "selkeyWord", selkeyWord },
                { "Mac", "" },
                { "selMac", "" },
                { "Mobile", "" },
                { "selMobile", "" },
                { "IMEI", "" },
                { "selIMEI", "" },
                { "IM", "" },
                { "selIM", "" },
                { "HeadName", HeadName },
                { "selHeadName", selHeadName },
                { "StartCreateTime", StartCreateTime },
                { "EndCreateTime", EndCreateTime },
                { "StartEndTime", StartEndTime },
                { "EndEndTime", EndEndTime },
                { "Uid", ((UserInfo)Session["userinfo"]).Type == 1?"0":((UserInfo)Session["userinfo"]).ID.ToString() },
            };
            DataTable dt = new AuditDAL().ExportAuditDT(dic);

            Dictionary <string, string> Head_Dic = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(TaskName))
            {
                Head_Dic.Add("审计任务名称", TaskName);
            }
            if (!string.IsNullOrEmpty(keyWord))
            {
                Head_Dic.Add("布控内容", keyWord);
            }
            if (!string.IsNullOrEmpty(HeadName))
            {
                Head_Dic.Add("负责人", HeadName);
            }
            if (!string.IsNullOrEmpty(StartCreateTime))
            {
                Head_Dic.Add("审计任务添加开始时间", StartCreateTime);
            }
            if (!string.IsNullOrEmpty(EndCreateTime))
            {
                Head_Dic.Add("审计任务添加结束时间", EndCreateTime);
            }
            if (!string.IsNullOrEmpty(StartEndTime))
            {
                Head_Dic.Add("审计条件-审计有效开始时间", StartEndTime);
            }
            if (!string.IsNullOrEmpty(EndEndTime))
            {
                Head_Dic.Add("审计条件-审计有效结束时间", EndEndTime);
            }

            Dictionary <string, string> Title_Dic = new Dictionary <string, string>();

            if (CaseType == "1")
            {
                Title_Dic = new Dictionary <string, string>()
                {
                    { "序号", "ID" },
                    { "布控任务名称", "TaskName" },
                    { "布控类型", "CaseItem" },
                    { "布控内容", "CaseValue" },
                    { "负责人", "HeadName" },
                    { "布控任务添加时间", "CreateTime" },
                    { "布控条件-审计有效时间", "EndTime" },
                    { "状态", "IsEnabled" },
                };
            }
            else
            {
                Title_Dic = new Dictionary <string, string>()
                {
                    { "序号", "ID" },
                    { "审计任务名称", "TaskName" },
                    { "即时通讯标识", "CaseValue" },
                    { "即时通讯工具", "ST_NETWORK_APP" },
                    { "负责人", "HeadName" },
                    { "审计任务添加时间", "CreateTime" },
                    { "审计条件-审计有效时间", "EndTime" },
                    { "状态", "IsEnabled" },
                };
            }

            NPOISheetModel sheet = new NPOISheetModel();

            sheet.dt          = dt;
            sheet.ExcelTitle  = CaseType == "1" ? "布控报警" : "即时通讯审计";
            sheet.TableTitle  = Title_Dic;
            sheet.TableSearch = Head_Dic;
            string path = new ComNPOIExcel().Export(sheet, Server.MapPath("~/") + "UserData/EXP/Audit/");

            return(Content("{\"result\":\"" + path + "\"}"));
        }
예제 #3
0
        public ActionResult VideoExprt(string txtMac, string txtAPName, string txtLName, string txtBeginTime, string txtEndTime, string txtNETBAR_WACODE)
        {
            try
            {
                UserInfo user = (UserInfo)Session["userInfo"];

                if (Convert.ToDateTime(txtBeginTime) > Convert.ToDateTime(txtEndTime))
                {
                    return(Content("<script>alert('开始时间不能大于结束时间');</script>"));
                }

                int[] userType = ChangeValue.GetUserType();
                Dictionary <string, string> dic = new Dictionary <string, string>()
                {
                    { "txtMac", txtMac }, { "txtNETBAR_WACODE", txtNETBAR_WACODE }, { "txtLName", txtLName }, { "txtAPName", txtAPName }, { "txtBeginTime", txtBeginTime }, { "txtEndTime", txtEndTime }, { "UserType", userType[0].ToString() }, { "AreaId", userType[1].ToString() }
                };

                if (!string.IsNullOrEmpty(txtLName))
                {
                    log.What = "场所名称:" + txtLName;
                }
                if (!string.IsNullOrEmpty(txtAPName))
                {
                    log.What += "AP名称:" + txtAPName;
                }
                if (!string.IsNullOrEmpty(txtMac))
                {
                    log.What += "AP设备MAC地址:" + txtMac;
                }
                if (!string.IsNullOrEmpty(txtNETBAR_WACODE))
                {
                    log.What += "上网服务场所编码:" + txtNETBAR_WACODE;
                }
                if (!string.IsNullOrEmpty(txtBeginTime))
                {
                    log.What += "开始时间:" + txtBeginTime;
                }
                if (!string.IsNullOrEmpty(txtEndTime))
                {
                    log.What += "结束时间:" + txtEndTime;
                }
                if (!string.IsNullOrEmpty(log.What))
                {
                    log.What = "视频数据列表导出Excel" + log.What; new OPLogDAL().InsertLog(log);
                }
                DataTable dt = new Video3CDAL().GetVideoToTable(dic);

                int rowCount = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ExprotCout"]);
                if (dt == null || dt.Rows.Count == 0)
                {
                    return(Content("{\"err\":\"对不起,没有要导出的数据\"}"));
                }
                else if (dt.Rows.Count > rowCount)
                {
                    return(Content("{\"err\":\"为了保证导出数据的速度,数据源不能大于“" + rowCount + "”行\"}"));
                }
                else
                {
                    Dictionary <string, string> Head_Dic = new Dictionary <string, string>();
                    if (!string.IsNullOrEmpty(txtLName))
                    {
                        Head_Dic.Add("场所名称", txtLName);
                    }
                    if (!string.IsNullOrEmpty(txtAPName))
                    {
                        Head_Dic.Add("AP名称", txtAPName);
                    }
                    if (!string.IsNullOrEmpty(txtMac))
                    {
                        Head_Dic.Add("AP设备MAC地址", txtMac);
                    }
                    if (!string.IsNullOrEmpty(txtNETBAR_WACODE))
                    {
                        Head_Dic.Add("上网服务场所编码", txtNETBAR_WACODE);
                    }
                    if (!string.IsNullOrEmpty(txtBeginTime))
                    {
                        Head_Dic.Add("开始时间", txtBeginTime);
                    }
                    if (!string.IsNullOrEmpty(txtEndTime))
                    {
                        Head_Dic.Add("结束时间", txtEndTime);
                    }

                    Dictionary <string, string> Title_Dic = new Dictionary <string, string>()
                    {
                        { "序号", "PageNum" },
                        { "场所名称", "LName" },
                        { "AP名称", "APName" },
                        { "文件名", "FileName" },
                        { "文件大小", "FileSize" },
                        { "开始时间", "BeginTime" },
                        { "结束时间", "EndTime" },
                        { "创建时间", "CreateTime" }
                    };

                    NPOISheetModel sheet = new NPOISheetModel();
                    sheet.dt          = dt;
                    sheet.ExcelTitle  = "视频数据查询";
                    sheet.TableTitle  = Title_Dic;
                    sheet.TableSearch = Head_Dic;

                    string path = new ComNPOIExcel().Export(sheet, Server.MapPath("~/") + "UserData/EXP/Video/");
                    return(Content("{\"result\":\"" + path + "\"}"));
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                return(Content("{\"err\":\"检索数据遇到错误,请联系管理员\"}"));
            }
            catch (Exception ex)
            {
                Logger.ErrorLog(ex, new Dictionary <string, string>()
                {
                    { "Function", this.GetType().Name + ".VideoExprt()[HttpGet]" }
                });
                return(Content("{\"err\":\"导出文件时出错,请联系管理员\"}"));
            }
        }