/// <summary> /// 添加处警信息 /// </summary> /// <returns></returns> public bool AddHandleInfo(Model.ServHandleReportModel handle_info, List <Model.ServFileInfoModel> file_info) { bool bl = false; try { int result = handleinfo.AddEntity(handle_info); //添加处警 int handleid = result; Model.ServReportInfoModel reportinfo = GetReportByID(handle_info.report_id); //查询接警信息 if (handle_info.handle_type == 1 && reportinfo.incident_status != 3) { reportinfo.incident_status = (int)CSM.Common.EnumClass.IncidentStatus.处警;//案件状态 } if (handle_info.handle_type == 2) { reportinfo.incident_status = (int)CSM.Common.EnumClass.IncidentStatus.结案; //案件状态 } result = UpdataReportInfo(reportinfo); //更新接警信息 if (result > -1) { if (file_info.Count() > 0) {//添加接警文件信息 foreach (Model.ServFileInfoModel filemodel in file_info) { int file_id = fileinfo.AddEntity(filemodel); //往文件表中写信息 if (file_id > 0) //判断是否成功 { Model.ServReportFileModel reportfile = new Model.ServReportFileModel(); reportfile.report_id = handle_info.report_id; reportfile.relate_id = file_id; reportfile.type = filemodel.file_type; reportfile.handle_id = handleid; //接警时处警id为-1 int reportfile_id = reportfileinfo.AddEntity(reportfile); //往接处警文件关联表中写数据 if (reportfile_id < 0) { //判断是否成功 bl = false; } } else { bl = false; } } } bl = true; } return(bl); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据id删除接触警 /// </summary> /// <returns></returns> public bool DelReportInfo(int id, string apppath) { bool bl = false; try { Model.ServReportInfoModel reportinfomodel = reportinfo.GetEntity(id); string report_num = reportinfomodel.report_num; int result = reportinfo.DeleteReportInfoById(id); if (result < 0) { return(bl); } List <Model.ServReportFileModel> reportfilelist = reportfileinfo.GetEntityByreport_id(id); if (reportfilelist.Count() > 0) { foreach (Model.ServReportFileModel reportfile in reportfilelist) { int reportfilereult = reportfileinfo.DeleteReportFileById(reportfile.id); int fileresult = fileinfo.DeleteFileInfoById(reportfile.relate_id); if (reportfilereult < 0 || fileresult < 0) { return(bl); } } } List <Model.ServReportSuspectModel> reportsuspectlist = suspectinfo.GetEntityByreport_id(id); if (reportsuspectlist.Count() > 0) { foreach (Model.ServReportSuspectModel reportsuspect in reportsuspectlist) { int suspectreult = suspectinfo.DeleteReportSuspectById(reportsuspect.id); if (suspectreult < 0) { return(bl); } } } List <Model.ServHandleReportModel> handlelist = handleinfo.GetEntitiesByreport_id(id); if (reportsuspectlist.Count() > 0) { foreach (Model.ServHandleReportModel handlemodel in handlelist) { int handlereult = suspectinfo.DeleteReportSuspectById(handlemodel.id); if (handlereult < 0) { return(bl); } } } string localPath = Path.Combine(apppath, "Upload/Report/" + report_num); if (System.IO.Directory.Exists(localPath)) { DirectoryInfo di = new DirectoryInfo(localPath); di.Delete(true); } bl = true; return(bl); } catch (Exception ex) { throw ex; } }
/// <summary> /// 添加接警信息 /// </summary> /// <param name="report_info"></param> /// <param name="file_info"></param> /// <param name="suspect_info"></param> /// <returns></returns> public bool AddAACInfo(Model.ServReportInfoModel report_info, List <Model.ServFileInfoModel> file_info, List <Model.ServReportSuspectModel> suspect_info) { bool bl = false; try { bl = true; int report_id = reportinfo.AddEntity(report_info); //添加接警基本信息 if (report_id > 0) { //判断添加是否成功 //List<int> fileid_list = new List<int>(); if (file_info.Count() > 0) {//添加接警文件信息 foreach (Model.ServFileInfoModel filemodel in file_info) { int file_id = fileinfo.AddEntity(filemodel); //往文件表中写信息 if (file_id > 0) //判断是否成功 { Model.ServReportFileModel reportfile = new Model.ServReportFileModel(); reportfile.report_id = report_id; reportfile.relate_id = file_id; reportfile.type = filemodel.file_type; reportfile.handle_id = -1; //接警时处警id为-1 int reportfile_id = reportfileinfo.AddEntity(reportfile); //往接处警文件关联表中写数据 if (reportfile_id < 0) { //判断是否成功 bl = false; } } else { bl = false; } } } if (suspect_info.Count() > 0)//开始添加嫌疑人信息 { foreach (Model.ServReportSuspectModel suspectmodel in suspect_info) { suspectmodel.report_id = report_id;//添加接警id信息 int suspect_id = suspectinfo.AddEntity(suspectmodel); if (suspect_id < 0) {//判断是否成功 bl = false; } } } } else { bl = false; } } catch (Exception ex) { bl = false; throw ex; } return(bl); }