/// <summary> /// 得到一个对象实体 /// </summary> public Model.ASSIGN_UPREPORT DataRowToModel(DataRow row) { Model.ASSIGN_UPREPORT model = new Model.ASSIGN_UPREPORT(); if (row != null) { if (row["ID"] != null) { model.ID = row["ID"].ToString(); } if (row["ASSIGN_ID"] != null) { model.ASSIGN_ID = row["ASSIGN_ID"].ToString(); } //model.DEALCONTENT=row["DEALCONTENT"].ToString(); if (row["FYLX"] != null) { model.FYLX = row["FYLX"].ToString(); } if (row["CREATETIME"] != null && row["CREATETIME"].ToString() != "") { model.CREATETIME = DateTime.Parse(row["CREATETIME"].ToString()); } if (row["CREATOR"] != null) { model.CREATOR = row["CREATOR"].ToString(); } if (row["MYLY"] != null && row["MYLY"].ToString() != "") { model.MYLY = decimal.Parse(row["MYLY"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.ASSIGN_UPREPORT model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ASSIGN_UPREPORT set "); strSql.Append("ID=:ID,"); strSql.Append("ASSIGN_ID=:ASSIGN_ID,"); strSql.Append("DEALCONTENT=:DEALCONTENT,"); strSql.Append("FYLX=:FYLX,"); strSql.Append("CREATETIME=:CREATETIME,"); strSql.Append("CREATOR=:CREATOR,"); strSql.Append("MYLY=:MYLY"); strSql.Append(" where "); OracleParameter[] parameters = { new OracleParameter(":ID", OracleDbType.Varchar2, 36), new OracleParameter(":ASSIGN_ID", OracleDbType.Varchar2, 36), new OracleParameter(":DEALCONTENT", OracleDbType.Clob), new OracleParameter(":FYLX", OracleDbType.Varchar2, 8), new OracleParameter(":CREATETIME", OracleDbType.Date), new OracleParameter(":CREATOR", OracleDbType.Varchar2, 36), new OracleParameter(":MYLY", OracleDbType.Int32, 4) }; parameters[0].Value = model.ID; parameters[1].Value = model.ASSIGN_ID; parameters[2].Value = model.DEALCONTENT; parameters[3].Value = model.FYLX; parameters[4].Value = model.CREATETIME; parameters[5].Value = model.CREATOR; parameters[6].Value = model.MYLY; int rows = DbHelperOra_new.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.ASSIGN_UPREPORT GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,ASSIGN_ID,DEALCONTENT,FYLX,CREATETIME,CREATOR,MYLY from ASSIGN_UPREPORT "); strSql.Append(" where "); OracleParameter[] parameters = { }; Model.ASSIGN_UPREPORT model = new Model.ASSIGN_UPREPORT(); DataSet ds = DbHelperOra_new.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 上报数据 /// </summary> /// <param name="assign_guid"></param> /// <param name="upReportMyly"></param> /// <param name="dr"></param> /// <returns></returns> private Model.ASSIGN_UPREPORT UpReportModel(string assign_guid, string upreport_guid, int upReportMyly, DataRow dr) { string fylx_MY1 = dr["TYPES"].ToString(); //民意一期反映类型 string fyle_MY2 = string.Empty; //民意二期反映类型 if (dicFYLXID_CODE.ContainsKey(fylx_MY1)) { fyle_MY2 = dicFYLXID_CODE[fylx_MY1]; //得到字典中对应的ID } Model.ASSIGN_UPREPORT model_upreport = new Model.ASSIGN_UPREPORT(); model_upreport.ID = upreport_guid; //得到32位大写的 GUID model_upreport.ASSIGN_ID = assign_guid; //交办id model_upreport.DEALCONTENT = dr["REPLY_CONTENT"].ToString(); //调查内容 model_upreport.FYLX = fyle_MY2; //反映类型 if (!string.IsNullOrWhiteSpace(dr["CREATE_DATE"].ToString())) { model_upreport.CREATETIME = Convert.ToDateTime(dr["CREATE_DATE"].ToString());//创建时间 } //model_upreport.CREATETIME = Convert.ToDateTime(dr["CREATE_DATE"].ToString());//创建时间 model_upreport.CREATOR = "民意一期"; model_upreport.MYLY = upReportMyly;//民意来源 1寒山闻钟论坛;2:12345热线;3纪委条线;4:信访条线;5省厅、总队信件办理;6督察条线来信;7支队信件转办;8其他自选项;9:96122 return(model_upreport); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.ASSIGN_UPREPORT model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ASSIGN_UPREPORT("); strSql.Append("ID,ASSIGN_ID,DEALCONTENT,FYLX,CREATETIME,CREATOR,MYLY)"); strSql.Append(" values ("); strSql.Append(":ID,:ASSIGN_ID,:DEALCONTENT,:FYLX,:CREATETIME,:CREATOR,:MYLY)"); OracleParameter[] parameters = { new OracleParameter(":ID", OracleDbType.Varchar2, 36), new OracleParameter(":ASSIGN_ID", OracleDbType.Varchar2, 36), new OracleParameter(":DEALCONTENT", OracleDbType.Clob), new OracleParameter(":FYLX", OracleDbType.Varchar2, 8), new OracleParameter(":CREATETIME", OracleDbType.Date), new OracleParameter(":CREATOR", OracleDbType.Varchar2, 36), new OracleParameter(":MYLY", OracleDbType.Int32, 4) }; parameters[0].Value = model.ID; parameters[1].Value = model.ASSIGN_ID; parameters[2].Value = model.DEALCONTENT; parameters[3].Value = model.FYLX; parameters[4].Value = model.CREATETIME; parameters[5].Value = model.CREATOR; parameters[6].Value = model.MYLY; int rows = DbHelperOra_new.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.ASSIGN_UPREPORT model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.ASSIGN_UPREPORT model) { return(dal.Add(model)); }
/// <summary> /// 获取民意一期数据并插入新民意系统对应的数据库中 /// </summary> private void GetPlatformData() { try { string strSql = $"select top 1000 * from Data_processingissues t where id >{strMaxid} order by id"; //每次读取1000条数据 DataSet dt_MY1 = DbHelperSQL.Query(strSql); //获取某ID之上的所有数据 event_showLogs("获取民意一期数据未同步数据信息"); if (dt_MY1 == null || dt_MY1.Tables[0].Rows.Count <= 0) { event_showLogs("获取民意一期数据未同步数据信息为null"); return; } //1.遍历数据并转存到系统数据库 foreach (DataRow dr in dt_MY1.Tables[0].Rows) { string SourceID = dr["SOURCEID"].ToString(); //数据来源ID string mylyguid = string.Empty; //二期民意来源guid int upReportMyly = 0; //上报民意来源对应number switch (SourceID) { //6062178399694A078E1AACF5FDD9F481 寒山闻钟论坛----------支队寒山闻钟 //0E8E2D480578471EAB622AC8DDC2A874 12345热线-------------支队政风行风 //510521AAF5FC4F06BD58C2696BDA22E5 96122-----------------96122工单 //7B8F5B74C09243FA9E2B5540B708761D 纪委条线--------------市局纪委 //58EAE7497C054DBCB3241A15C9336795 信访条线--------------市局信访处 //EA6859A55E7A44289A6B589D887C61AC 省厅、总队信件办理----其他 //09B7732CDBEA4009A1FA9DC5166B7690 督察条线来信----------市局督察 //BED2CF750A634A9D876262BB670A3A39 支队信件转办----------支队 //0C51C38CFF464CB4B839FA663C181CDE 其他自选项------------分局寒山闻钟、分局政风行风 // 1寒山闻钟论坛;2:12345热线;3纪委条线;4:信访条线;5省厅、总队信件办理;6督察条线来信;7支队信件转办;8其他自选项;9:96122 case "1": //支队寒山闻钟 mylyguid = "6062178399694A078E1AACF5FDD9F481"; upReportMyly = 1; break; case "2": //支队政风行风 mylyguid = "0E8E2D480578471EAB622AC8DDC2A874"; upReportMyly = 2; break; case "3": //96122工单 mylyguid = "510521AAF5FC4F06BD58C2696BDA22E5"; upReportMyly = 9; break; case "5": //分局寒山闻钟 mylyguid = "0C51C38CFF464CB4B839FA663C181CDE"; upReportMyly = 8; break; case "6": //分局政风行风 mylyguid = "0C51C38CFF464CB4B839FA663C181CDE"; upReportMyly = 8; break; case "7": //市局信访处 mylyguid = "58EAE7497C054DBCB3241A15C9336795"; upReportMyly = 4; break; case "8": //市局纪委 mylyguid = "7B8F5B74C09243FA9E2B5540B708761D"; upReportMyly = 3; break; case "9": //1号窗口 mylyguid = ""; break; case "10": //市局平安民声 mylyguid = ""; break; case "11": //支队 mylyguid = "BED2CF750A634A9D876262BB670A3A39"; upReportMyly = 7; break; case "12": //市局督查 mylyguid = "09B7732CDBEA4009A1FA9DC5166B7690"; upReportMyly = 6; break; case "13": //其他 mylyguid = "EA6859A55E7A44289A6B589D887C61AC"; upReportMyly = 5; break; default: break; } if (string.IsNullOrWhiteSpace(mylyguid)) { continue; } string jbdw_MY1 = dr["SPONSORID"].ToString(); //承办单位 //如遇有多个承办单位,则取第一个为交办单位 if (jbdw_MY1.IndexOf(",") >= 0) { jbdw_MY1 = jbdw_MY1.Substring(0, jbdw_MY1.LastIndexOf(",")); } string jbdw_MY2 = string.Empty;//民意二期交办单位 if (dicDEPID_GUID.ContainsKey(jbdw_MY1)) { jbdw_MY2 = dicDEPID_GUID[jbdw_MY1]; //得到字典中对应的ID } //添加民意档案数据 string con_guid = Guid.NewGuid().ToString("N").ToUpper(); //得到32位大写的 GUID bool conres = MYDangan(con_guid, dr); // 添加交办数据 string assign_guid = Guid.NewGuid().ToString("N").ToUpper();//得到32位大写的 GUID Model.ASSIGN model_assign = AssignModel(assign_guid, mylyguid, con_guid, jbdw_MY2, dr); //添加处办数据 string inwork_guid = Guid.NewGuid().ToString("N").ToUpper();//得到32位大写的 GUID Model.INWORK model_inwork = InworkModel(assign_guid, inwork_guid, jbdw_MY2, dr); //添加部门答复数据 Model.REPLY_RECORD model_reply = ReplyModel(inwork_guid, dr); //添加上报数据 string upreport_guid = Guid.NewGuid().ToString("N").ToUpper();//得到32位大写的 GUID Model.ASSIGN_UPREPORT model_upreport = UpReportModel(assign_guid, upreport_guid, upReportMyly, dr); // 添加上报附件数据 try { string fjdz = dr["REPLY_CONTENTFILE"].ToString();//答复附件地址 if (!string.IsNullOrWhiteSpace(fjdz)) { Model.ASSIGN_UPFJ model_upfj = UpFJModel(upreport_guid, dr); bool upfjres = new BLL.ASSIGN_UPFJ().Add(model_upfj); } // 添加时间轴数据 } catch (Exception ex) { SysLog.WriteLog(ex, AppDomain.CurrentDomain.BaseDirectory); } try { bool assignres = new BLL.ASSIGN().Add(model_assign); bool inworkres = new BLL.INWORK().Add(model_inwork); bool replyres = new BLL.REPLY_RECORD().Add(model_reply); bool upreportres = new BLL.ASSIGN_UPREPORT().Add(model_upreport); event_showLogs("成功更新民意数据库,对应ID:" + dr["ID"]); } catch (Exception ex) { SysLog.WriteLog(ex, AppDomain.CurrentDomain.BaseDirectory); } #region 更新最大ID try { //更新最大ID using (FileStream fs = new FileStream("configs/maxid.txt", FileMode.Open, FileAccess.ReadWrite)) { using (StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding("UTF-8"))) { sw.WriteLine(dr["ID"] + ""); sw.Close(); fs.Close(); // Class1 cl = new Class1(); strMaxid = dr["ID"].ToString(); event_showLogs("成功更新configs/maxid.txt最大ID:" + dr["ID"]); SysLog.WriteOptDisk("成功更新configs/maxid.txt最大ID:" + dr["ID"], AppDomain.CurrentDomain.BaseDirectory, 100); } } } catch (Exception ex) { SysLog.WriteLog(ex, AppDomain.CurrentDomain.BaseDirectory); } #endregion } } catch (Exception ex) { SysLog.WriteLog(ex, AppDomain.CurrentDomain.BaseDirectory); } }