private List <RoadFlow.Data.Model.ProgramBuilderFields> DataReaderToList(SqlDataReader dataReader) { List <RoadFlow.Data.Model.ProgramBuilderFields> list = new List <RoadFlow.Data.Model.ProgramBuilderFields>(); RoadFlow.Data.Model.ProgramBuilderFields programBuilderFields = null; while (dataReader.Read()) { programBuilderFields = new RoadFlow.Data.Model.ProgramBuilderFields(); programBuilderFields.ID = dataReader.GetGuid(0); programBuilderFields.ProgramID = dataReader.GetGuid(1); if (!dataReader.IsDBNull(2)) { programBuilderFields.Field = dataReader.GetString(2); } programBuilderFields.ShowTitle = dataReader.GetString(3); programBuilderFields.Align = dataReader.GetString(4); if (!dataReader.IsDBNull(5)) { programBuilderFields.Width = dataReader.GetString(5); } programBuilderFields.ShowType = dataReader.GetInt32(6); if (!dataReader.IsDBNull(7)) { programBuilderFields.ShowFormat = dataReader.GetString(7); } if (!dataReader.IsDBNull(8)) { programBuilderFields.CustomString = dataReader.GetString(8); } programBuilderFields.Sort = dataReader.GetInt32(9); list.Add(programBuilderFields); } return(list); }
public int Update(RoadFlow.Data.Model.ProgramBuilderFields model) { string sql = "UPDATE ProgramBuilderFields SET \r\n\t\t\t\tProgramID=@ProgramID,Field=@Field,ShowTitle=@ShowTitle,Align=@Align,Width=@Width,ShowType=@ShowType,ShowFormat=@ShowFormat,CustomString=@CustomString,Sort=@Sort\r\n\t\t\t\tWHERE ID=@ID"; SqlParameter[] parameter = new SqlParameter[10] { new SqlParameter("@ProgramID", SqlDbType.UniqueIdentifier, -1) { Value = model.ProgramID }, new SqlParameter("@Field", SqlDbType.VarChar, 500) { Value = model.Field }, new SqlParameter("@ShowTitle", SqlDbType.VarChar, -1) { Value = model.ShowTitle }, new SqlParameter("@Align", SqlDbType.VarChar, 50) { Value = model.Align }, (model.Width == null) ? new SqlParameter("@Width", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@Width", SqlDbType.VarChar, 50) { Value = model.Width }, new SqlParameter("@ShowType", SqlDbType.Int, -1) { Value = model.ShowType }, (model.ShowFormat == null) ? new SqlParameter("@ShowFormat", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@ShowFormat", SqlDbType.VarChar, 50) { Value = model.ShowFormat }, (model.CustomString == null) ? new SqlParameter("@CustomString", SqlDbType.VarChar, -1) { Value = DBNull.Value } : new SqlParameter("@CustomString", SqlDbType.VarChar, -1) { Value = model.CustomString }, new SqlParameter("@Sort", SqlDbType.Int, -1) { Value = model.Sort }, new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1) { Value = model.ID } }; return(dbHelper.Execute(sql, parameter)); }
public int Add(RoadFlow.Data.Model.ProgramBuilderFields model) { string sql = "INSERT INTO ProgramBuilderFields\r\n\t\t\t\t(ID,ProgramID,Field,ShowTitle,Align,Width,ShowType,ShowFormat,CustomString,Sort) \r\n\t\t\t\tVALUES(@ID,@ProgramID,@Field,@ShowTitle,@Align,@Width,@ShowType,@ShowFormat,@CustomString,@Sort)"; SqlParameter[] parameter = new SqlParameter[10] { new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1) { Value = model.ID }, new SqlParameter("@ProgramID", SqlDbType.UniqueIdentifier, -1) { Value = model.ProgramID }, new SqlParameter("@Field", SqlDbType.VarChar, 500) { Value = model.Field }, new SqlParameter("@ShowTitle", SqlDbType.VarChar, -1) { Value = model.ShowTitle }, new SqlParameter("@Align", SqlDbType.VarChar, 50) { Value = model.Align }, (model.Width == null) ? new SqlParameter("@Width", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@Width", SqlDbType.VarChar, 50) { Value = model.Width }, new SqlParameter("@ShowType", SqlDbType.Int, -1) { Value = model.ShowType }, (model.ShowFormat == null) ? new SqlParameter("@ShowFormat", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@ShowFormat", SqlDbType.VarChar, 50) { Value = model.ShowFormat }, (model.CustomString == null) ? new SqlParameter("@CustomString", SqlDbType.VarChar, -1) { Value = DBNull.Value } : new SqlParameter("@CustomString", SqlDbType.VarChar, -1) { Value = model.CustomString }, new SqlParameter("@Sort", SqlDbType.Int, -1) { Value = model.Sort } }; return(dbHelper.Execute(sql, parameter)); }
public int Update(RoadFlow.Data.Model.ProgramBuilderFields model) { return(dataProgramBuilderFields.Update(model)); }
public int Add(RoadFlow.Data.Model.ProgramBuilderFields model) { return(dataProgramBuilderFields.Add(model)); }
public int InDataFormExcel(Guid programID, string table, string file, out string msg, string numberFiled = "") { int num = 0; msg = ""; if (table.IsNullOrEmpty()) { msg = "没有选择表"; return(num); } DBConnection dbConnection = new DBConnection(); RoadFlow.Data.Model.ProgramBuilder programBuilder = this.Get(programID); if (programBuilder == null) { msg = "未找到应用程序设计"; return(num); } RoadFlow.Data.Model.DBConnection conn = dbConnection.Get(programBuilder.DBConnID, true); if (conn == null) { msg = "未找到相应的数据库连接"; return(num); } List <RoadFlow.Data.Model.ProgramBuilderFields> all = new ProgramBuilderFields().GetAll(programID); if (all.Count == 0) { msg = "应用程序未设置列表字段"; return(num); } try { DataTable dataTable = NPOIHelper.ReadToDataTable(file, 1); if (dataTable.Rows.Count == 0) { msg = "未发现要导入的数据"; return(num); } List <string> fieldsBySql = dbConnection.GetFieldsBySQL(programBuilder.DBConnID, "select * from " + table + " where 1=0"); DataTable dt = new DataTable(table); string str = DateTimeNew.Now.ToString("yyyyMMddHHmmssfffff"); foreach (RoadFlow.Data.Model.ProgramBuilderFields programBuilderFields in all) { RoadFlow.Data.Model.ProgramBuilderFields filed = programBuilderFields; if (!filed.Field.IsNullOrEmpty() && fieldsBySql.Find((Predicate <string>)(p => p.Equals(filed.Field, StringComparison.CurrentCultureIgnoreCase))) != null) { dt.Columns.Add(filed.Field); } } if (!numberFiled.IsNullOrEmpty()) { dt.Columns.Add(numberFiled); } foreach (DataRow row1 in (InternalDataCollectionBase)dataTable.Rows) { DataRow row2 = dt.NewRow(); foreach (DataColumn column in (InternalDataCollectionBase)dt.Columns) { DataColumn col = column; RoadFlow.Data.Model.ProgramBuilderFields programBuilderFields = all.Find((Predicate <RoadFlow.Data.Model.ProgramBuilderFields>)(p => p.Field.Equals(col.ColumnName))); if (programBuilderFields != null) { row2[col.ColumnName] = row1[programBuilderFields.ShowTitle]; } } if (!numberFiled.IsNullOrEmpty()) { row2[numberFiled] = (object)str; } dt.Rows.Add(row2); } num = dbConnection.DataTableToDB(conn, dt); Log.Add("通过应用程序导入了数据-表(" + table + ")标识(" + str + ")", file, Log.Types.其它分类, "", "", (RoadFlow.Data.Model.Users)null); return(num); } catch (Exception ex) { msg = ex.Message; return(num); } }
public int Update(RoadFlow.Data.Model.ProgramBuilderFields model) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0032: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0076: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0095: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00b5: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_00fb: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_011c: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_0162: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01a6: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_01c7: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_01ed: Expected O, but got Unknown string sql = "UPDATE programbuilderfields SET \r\n\t\t\t\tProgramID=@ProgramID,Field=@Field,ShowTitle=@ShowTitle,Align=@Align,Width=@Width,ShowType=@ShowType,ShowFormat=@ShowFormat,CustomString=@CustomString,Sort=@Sort\r\n\t\t\t\tWHERE ID=@ID"; MySqlParameter[] obj = new MySqlParameter[10]; MySqlParameter val = new MySqlParameter("@ProgramID", 253, 36); ((DbParameter)val).Value = model.ProgramID; obj[0] = val; _003F val2; if (model.Field != null) { val2 = new MySqlParameter("@Field", 752, -1); ((DbParameter)val2).Value = model.Field; } else { val2 = new MySqlParameter("@Field", 752, -1); ((DbParameter)val2).Value = DBNull.Value; } obj[1] = val2; MySqlParameter val3 = new MySqlParameter("@ShowTitle", 751, -1); ((DbParameter)val3).Value = model.ShowTitle; obj[2] = val3; MySqlParameter val4 = new MySqlParameter("@Align", 253, 50); ((DbParameter)val4).Value = model.Align; obj[3] = val4; _003F val5; if (model.Width != null) { val5 = new MySqlParameter("@Width", 253, 50); ((DbParameter)val5).Value = model.Width; } else { val5 = new MySqlParameter("@Width", 253, 50); ((DbParameter)val5).Value = DBNull.Value; } obj[4] = val5; MySqlParameter val6 = new MySqlParameter("@ShowType", 3, 11); ((DbParameter)val6).Value = model.ShowType; obj[5] = val6; _003F val7; if (model.ShowFormat != null) { val7 = new MySqlParameter("@ShowFormat", 253, 50); ((DbParameter)val7).Value = model.ShowFormat; } else { val7 = new MySqlParameter("@ShowFormat", 253, 50); ((DbParameter)val7).Value = DBNull.Value; } obj[6] = val7; _003F val8; if (model.CustomString != null) { val8 = new MySqlParameter("@CustomString", 751, -1); ((DbParameter)val8).Value = model.CustomString; } else { val8 = new MySqlParameter("@CustomString", 751, -1); ((DbParameter)val8).Value = DBNull.Value; } obj[7] = val8; MySqlParameter val9 = new MySqlParameter("@Sort", 3, 11); ((DbParameter)val9).Value = model.Sort; obj[8] = val9; MySqlParameter val10 = new MySqlParameter("@ID", 253, 36); ((DbParameter)val10).Value = model.ID; obj[9] = val10; MySqlParameter[] parameter = (MySqlParameter[])obj; return(dbHelper.Execute(sql, parameter)); }
public int Add(RoadFlow.Data.Model.ProgramBuilderFields model) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0032: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0057: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_009b: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00ba: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00da: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_0120: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0141: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_0187: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01cb: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_01ed: Expected O, but got Unknown string sql = "INSERT INTO programbuilderfields\r\n\t\t\t\t(ID,ProgramID,Field,ShowTitle,Align,Width,ShowType,ShowFormat,CustomString,Sort) \r\n\t\t\t\tVALUES(@ID,@ProgramID,@Field,@ShowTitle,@Align,@Width,@ShowType,@ShowFormat,@CustomString,@Sort)"; MySqlParameter[] obj = new MySqlParameter[10]; MySqlParameter val = new MySqlParameter("@ID", 253, 36); ((DbParameter)val).Value = model.ID; obj[0] = val; MySqlParameter val2 = new MySqlParameter("@ProgramID", 253, 36); ((DbParameter)val2).Value = model.ProgramID; obj[1] = val2; _003F val3; if (model.Field != null) { val3 = new MySqlParameter("@Field", 752, -1); ((DbParameter)val3).Value = model.Field; } else { val3 = new MySqlParameter("@Field", 752, -1); ((DbParameter)val3).Value = DBNull.Value; } obj[2] = val3; MySqlParameter val4 = new MySqlParameter("@ShowTitle", 751, -1); ((DbParameter)val4).Value = model.ShowTitle; obj[3] = val4; MySqlParameter val5 = new MySqlParameter("@Align", 253, 50); ((DbParameter)val5).Value = model.Align; obj[4] = val5; _003F val6; if (model.Width != null) { val6 = new MySqlParameter("@Width", 253, 50); ((DbParameter)val6).Value = model.Width; } else { val6 = new MySqlParameter("@Width", 253, 50); ((DbParameter)val6).Value = DBNull.Value; } obj[5] = val6; MySqlParameter val7 = new MySqlParameter("@ShowType", 3, 11); ((DbParameter)val7).Value = model.ShowType; obj[6] = val7; _003F val8; if (model.ShowFormat != null) { val8 = new MySqlParameter("@ShowFormat", 253, 50); ((DbParameter)val8).Value = model.ShowFormat; } else { val8 = new MySqlParameter("@ShowFormat", 253, 50); ((DbParameter)val8).Value = DBNull.Value; } obj[7] = val8; _003F val9; if (model.CustomString != null) { val9 = new MySqlParameter("@CustomString", 751, -1); ((DbParameter)val9).Value = model.CustomString; } else { val9 = new MySqlParameter("@CustomString", 751, -1); ((DbParameter)val9).Value = DBNull.Value; } obj[8] = val9; MySqlParameter val10 = new MySqlParameter("@Sort", 3, 11); ((DbParameter)val10).Value = model.Sort; obj[9] = val10; MySqlParameter[] parameter = (MySqlParameter[])obj; return(dbHelper.Execute(sql, parameter)); }
public int InDataFormExcel(Guid programID, string table, string file, out string msg, string numberFiled = "") { int result = 0; msg = ""; if (table.IsNullOrEmpty()) { msg = "没有选择表"; return(result); } DBConnection dBConnection = new DBConnection(); RoadFlow.Data.Model.ProgramBuilder programBuilder = Get(programID); if (programBuilder == null) { msg = "未找到应用程序设计"; return(result); } RoadFlow.Data.Model.DBConnection dBConnection2 = dBConnection.Get(programBuilder.DBConnID); if (dBConnection2 == null) { msg = "未找到相应的数据库连接"; return(result); } List <RoadFlow.Data.Model.ProgramBuilderFields> all = new ProgramBuilderFields().GetAll(programID); if (all.Count != 0) { try { DataTable dataTable = NPOIHelper.ReadToDataTable(file); if (dataTable.Rows.Count == 0) { msg = "未发现要导入的数据"; return(result); } List <string> fieldsBySQL = dBConnection.GetFieldsBySQL(programBuilder.DBConnID, "select * from " + table + " where 1=0"); DataTable dataTable2 = new DataTable(table); string text = DateTimeNew.Now.ToString("yyyyMMddHHmmssfffff"); foreach (RoadFlow.Data.Model.ProgramBuilderFields item in all) { if (!item.Field.IsNullOrEmpty() && fieldsBySQL.Find((string p) => p.Equals(item.Field, StringComparison.CurrentCultureIgnoreCase)) != null) { dataTable2.Columns.Add(item.Field); } } if (!numberFiled.IsNullOrEmpty()) { dataTable2.Columns.Add(numberFiled); } foreach (DataRow row in dataTable.Rows) { DataRow dataRow2 = dataTable2.NewRow(); foreach (DataColumn column in dataTable2.Columns) { RoadFlow.Data.Model.ProgramBuilderFields programBuilderFields = all.Find((RoadFlow.Data.Model.ProgramBuilderFields p) => p.Field.Equals(column.ColumnName)); if (programBuilderFields != null) { dataRow2[column.ColumnName] = row[programBuilderFields.ShowTitle]; } } if (!numberFiled.IsNullOrEmpty()) { dataRow2[numberFiled] = text; } dataTable2.Rows.Add(dataRow2); } result = dBConnection.DataTableToDB(dBConnection2, dataTable2); Log.Add("通过应用程序导入了数据-表(" + table + ")标识(" + text + ")", file); return(result); } catch (Exception ex) { msg = ex.Message; return(result); } } msg = "应用程序未设置列表字段"; return(result); }