public string GetDataSourceString(RoadFlow.Data.Model.HomeItems item) { if (item == null) { return(""); } switch (item.DataSourceType) { case 0: Guid?dbConnId = item.DBConnID; if (!dbConnId.HasValue) { return(""); } string dataSource = item.DataSource; int type = item.Type; dbConnId = item.DBConnID; Guid dbconnID = dbConnId.Value; return(this.getSqlString(dataSource, type, dbconnID)); case 1: return(this.GetCsharpMethodString(item.DataSource, (object)null)); case 2: return(this.GetUrlString(item.DataSource)); default: return(""); } }
private List <RoadFlow.Data.Model.HomeItems> DataReaderToList(OracleDataReader dataReader) { List <RoadFlow.Data.Model.HomeItems> homeItemsList = new List <RoadFlow.Data.Model.HomeItems>(); while (dataReader.Read()) { RoadFlow.Data.Model.HomeItems homeItems = new RoadFlow.Data.Model.HomeItems(); homeItems.ID = dataReader.GetString(0).ToGuid(); homeItems.Type = dataReader.GetInt32(1); homeItems.Name = dataReader.GetString(2); homeItems.Title = dataReader.GetString(3); homeItems.DataSourceType = dataReader.GetInt32(4); if (!dataReader.IsDBNull(5)) { homeItems.DataSource = dataReader.GetString(5); } if (!dataReader.IsDBNull(6)) { homeItems.Ico = dataReader.GetString(6); } if (!dataReader.IsDBNull(7)) { homeItems.BgColor = dataReader.GetString(7); } if (!dataReader.IsDBNull(8)) { homeItems.Color = dataReader.GetString(8); } if (!dataReader.IsDBNull(9)) { homeItems.DBConnID = new Guid?(dataReader.GetString(9).ToGuid()); } if (!dataReader.IsDBNull(10)) { homeItems.LinkURL = dataReader.GetString(10); } if (!dataReader.IsDBNull(11)) { homeItems.UseOrganizes = dataReader.GetString(11); } if (!dataReader.IsDBNull(12)) { homeItems.UseUsers = dataReader.GetString(12); } if (!dataReader.IsDBNull(13)) { homeItems.Sort = new int?(dataReader.GetInt32(13)); } if (!dataReader.IsDBNull(14)) { homeItems.Note = dataReader.GetString(14); } homeItemsList.Add(homeItems); } return(homeItemsList); }
public int Update(RoadFlow.Data.Model.HomeItems model) { string sql = "UPDATE HomeItems SET \r\n\t\t\t\tType=:Type,Name=:Name,Title=:Title,DataSourceType=:DataSourceType,DataSource=:DataSource,Ico=:Ico,BgColor=:BgColor,Color=:Color,DBConnID=:DBConnID,LinkURL=:LinkURL,UseOrganizes=:UseOrganizes,UseUsers=:UseUsers,Sort=:Sort,Note=:Note\r\n\t\t\t\tWHERE ID=:ID"; OracleParameter[] oracleParameterArray = new OracleParameter[15]; int index1 = 0; OracleParameter oracleParameter1 = new OracleParameter(":Type", OracleDbType.Int32); oracleParameter1.Value = (object)model.Type; oracleParameterArray[index1] = oracleParameter1; int index2 = 1; OracleParameter oracleParameter2 = new OracleParameter(":Name", OracleDbType.Varchar2); oracleParameter2.Value = (object)model.Name; oracleParameterArray[index2] = oracleParameter2; int index3 = 2; OracleParameter oracleParameter3 = new OracleParameter(":Title", OracleDbType.Varchar2); oracleParameter3.Value = (object)model.Title; oracleParameterArray[index3] = oracleParameter3; int index4 = 3; OracleParameter oracleParameter4 = new OracleParameter(":DataSourceType", OracleDbType.Int32); oracleParameter4.Value = (object)model.DataSourceType; oracleParameterArray[index4] = oracleParameter4; int index5 = 4; OracleParameter oracleParameter5; if (model.DataSource != null) { OracleParameter oracleParameter6 = new OracleParameter(":DataSource", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.DataSource; oracleParameter5 = oracleParameter6; } else { oracleParameter5 = new OracleParameter(":DataSource", OracleDbType.Varchar2); oracleParameter5.Value = (object)DBNull.Value; } oracleParameterArray[index5] = oracleParameter5; int index6 = 5; OracleParameter oracleParameter7; if (model.Ico != null) { OracleParameter oracleParameter6 = new OracleParameter(":Ico", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.Ico; oracleParameter7 = oracleParameter6; } else { oracleParameter7 = new OracleParameter(":Ico", OracleDbType.Varchar2); oracleParameter7.Value = (object)DBNull.Value; } oracleParameterArray[index6] = oracleParameter7; int index7 = 6; OracleParameter oracleParameter8; if (model.BgColor != null) { OracleParameter oracleParameter6 = new OracleParameter(":BgColor", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.BgColor; oracleParameter8 = oracleParameter6; } else { oracleParameter8 = new OracleParameter(":BgColor", OracleDbType.Varchar2); oracleParameter8.Value = (object)DBNull.Value; } oracleParameterArray[index7] = oracleParameter8; int index8 = 7; OracleParameter oracleParameter9; if (model.Color != null) { OracleParameter oracleParameter6 = new OracleParameter(":Color", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.Color; oracleParameter9 = oracleParameter6; } else { oracleParameter9 = new OracleParameter(":Color", OracleDbType.Varchar2); oracleParameter9.Value = (object)DBNull.Value; } oracleParameterArray[index8] = oracleParameter9; int index9 = 8; OracleParameter oracleParameter10; if (model.DBConnID.HasValue) { OracleParameter oracleParameter6 = new OracleParameter(":DBConnID", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.DBConnID; oracleParameter10 = oracleParameter6; } else { oracleParameter10 = new OracleParameter(":DBConnID", OracleDbType.Varchar2); oracleParameter10.Value = (object)DBNull.Value; } oracleParameterArray[index9] = oracleParameter10; int index10 = 9; OracleParameter oracleParameter11; if (model.LinkURL != null) { OracleParameter oracleParameter6 = new OracleParameter(":LinkURL", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.LinkURL; oracleParameter11 = oracleParameter6; } else { oracleParameter11 = new OracleParameter(":LinkURL", OracleDbType.Varchar2); oracleParameter11.Value = (object)DBNull.Value; } oracleParameterArray[index10] = oracleParameter11; int index11 = 10; OracleParameter oracleParameter12; if (model.UseOrganizes != null) { OracleParameter oracleParameter6 = new OracleParameter(":UseOrganizes", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.UseOrganizes; oracleParameter12 = oracleParameter6; } else { oracleParameter12 = new OracleParameter(":UseOrganizes", OracleDbType.Varchar2); oracleParameter12.Value = (object)DBNull.Value; } oracleParameterArray[index11] = oracleParameter12; int index12 = 11; OracleParameter oracleParameter13; if (model.UseUsers != null) { OracleParameter oracleParameter6 = new OracleParameter(":UseUsers", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.UseUsers; oracleParameter13 = oracleParameter6; } else { oracleParameter13 = new OracleParameter(":UseUsers", OracleDbType.Varchar2); oracleParameter13.Value = (object)DBNull.Value; } oracleParameterArray[index12] = oracleParameter13; int index13 = 12; OracleParameter oracleParameter14; if (model.Sort.HasValue) { OracleParameter oracleParameter6 = new OracleParameter(":Sort", OracleDbType.Int32); oracleParameter6.Value = (object)model.Sort; oracleParameter14 = oracleParameter6; } else { oracleParameter14 = new OracleParameter(":Sort", OracleDbType.Int32); oracleParameter14.Value = (object)DBNull.Value; } oracleParameterArray[index13] = oracleParameter14; int index14 = 13; OracleParameter oracleParameter15; if (model.Note != null) { OracleParameter oracleParameter6 = new OracleParameter(":Note", OracleDbType.Varchar2); oracleParameter6.Value = (object)model.Note; oracleParameter15 = oracleParameter6; } else { oracleParameter15 = new OracleParameter(":Note", OracleDbType.Varchar2); oracleParameter15.Value = (object)DBNull.Value; } oracleParameterArray[index14] = oracleParameter15; int index15 = 14; OracleParameter oracleParameter16 = new OracleParameter(":ID", OracleDbType.Varchar2); oracleParameter16.Value = (object)model.ID; oracleParameterArray[index15] = oracleParameter16; OracleParameter[] parameter = oracleParameterArray; return(this.dbHelper.Execute(sql, parameter)); }
public int Update(RoadFlow.Data.Model.HomeItems model) { string sql = "UPDATE HomeItems SET \r\n\t\t\t\tType=@Type,Name=@Name,Title=@Title,DataSourceType=@DataSourceType,DataSource=@DataSource,Ico=@Ico,BgColor=@BgColor,Color=@Color,DBConnID=@DBConnID,LinkURL=@LinkURL,UseOrganizes=@UseOrganizes,UseUsers=@UseUsers,Sort=@Sort,Note=@Note\r\n\t\t\t\tWHERE ID=@ID"; SqlParameter[] sqlParameterArray = new SqlParameter[15]; int index1 = 0; SqlParameter sqlParameter1 = new SqlParameter("@Type", SqlDbType.Int, -1); sqlParameter1.Value = (object)model.Type; sqlParameterArray[index1] = sqlParameter1; int index2 = 1; SqlParameter sqlParameter2 = new SqlParameter("@Name", SqlDbType.NVarChar, 1000); sqlParameter2.Value = (object)model.Name; sqlParameterArray[index2] = sqlParameter2; int index3 = 2; SqlParameter sqlParameter3 = new SqlParameter("@Title", SqlDbType.NVarChar, 1000); sqlParameter3.Value = (object)model.Title; sqlParameterArray[index3] = sqlParameter3; int index4 = 3; SqlParameter sqlParameter4 = new SqlParameter("@DataSourceType", SqlDbType.Int, -1); sqlParameter4.Value = (object)model.DataSourceType; sqlParameterArray[index4] = sqlParameter4; int index5 = 4; SqlParameter sqlParameter5; if (model.DataSource != null) { SqlParameter sqlParameter6 = new SqlParameter("@DataSource", SqlDbType.VarChar, -1); sqlParameter6.Value = (object)model.DataSource; sqlParameter5 = sqlParameter6; } else { sqlParameter5 = new SqlParameter("@DataSource", SqlDbType.VarChar, -1); sqlParameter5.Value = (object)DBNull.Value; } sqlParameterArray[index5] = sqlParameter5; int index6 = 5; SqlParameter sqlParameter7; if (model.Ico != null) { SqlParameter sqlParameter6 = new SqlParameter("@Ico", SqlDbType.VarChar, 2000); sqlParameter6.Value = (object)model.Ico; sqlParameter7 = sqlParameter6; } else { sqlParameter7 = new SqlParameter("@Ico", SqlDbType.VarChar, 2000); sqlParameter7.Value = (object)DBNull.Value; } sqlParameterArray[index6] = sqlParameter7; int index7 = 6; SqlParameter sqlParameter8; if (model.BgColor != null) { SqlParameter sqlParameter6 = new SqlParameter("@BgColor", SqlDbType.VarChar, 50); sqlParameter6.Value = (object)model.BgColor; sqlParameter8 = sqlParameter6; } else { sqlParameter8 = new SqlParameter("@BgColor", SqlDbType.VarChar, 50); sqlParameter8.Value = (object)DBNull.Value; } sqlParameterArray[index7] = sqlParameter8; int index8 = 7; SqlParameter sqlParameter9; if (model.Color != null) { SqlParameter sqlParameter6 = new SqlParameter("@Color", SqlDbType.VarChar, 50); sqlParameter6.Value = (object)model.Color; sqlParameter9 = sqlParameter6; } else { sqlParameter9 = new SqlParameter("@Color", SqlDbType.VarChar, 50); sqlParameter9.Value = (object)DBNull.Value; } sqlParameterArray[index8] = sqlParameter9; int index9 = 8; SqlParameter sqlParameter10; if (model.DBConnID.HasValue) { SqlParameter sqlParameter6 = new SqlParameter("@DBConnID", SqlDbType.UniqueIdentifier, -1); sqlParameter6.Value = (object)model.DBConnID; sqlParameter10 = sqlParameter6; } else { sqlParameter10 = new SqlParameter("@DBConnID", SqlDbType.UniqueIdentifier, -1); sqlParameter10.Value = (object)DBNull.Value; } sqlParameterArray[index9] = sqlParameter10; int index10 = 9; SqlParameter sqlParameter11; if (model.LinkURL != null) { SqlParameter sqlParameter6 = new SqlParameter("@LinkURL", SqlDbType.VarChar, 2000); sqlParameter6.Value = (object)model.LinkURL; sqlParameter11 = sqlParameter6; } else { sqlParameter11 = new SqlParameter("@LinkURL", SqlDbType.VarChar, 2000); sqlParameter11.Value = (object)DBNull.Value; } sqlParameterArray[index10] = sqlParameter11; int index11 = 10; SqlParameter sqlParameter12; if (model.UseOrganizes != null) { SqlParameter sqlParameter6 = new SqlParameter("@UseOrganizes", SqlDbType.VarChar, -1); sqlParameter6.Value = (object)model.UseOrganizes; sqlParameter12 = sqlParameter6; } else { sqlParameter12 = new SqlParameter("@UseOrganizes", SqlDbType.VarChar, -1); sqlParameter12.Value = (object)DBNull.Value; } sqlParameterArray[index11] = sqlParameter12; int index12 = 11; SqlParameter sqlParameter13; if (model.UseUsers != null) { SqlParameter sqlParameter6 = new SqlParameter("@UseUsers", SqlDbType.VarChar, -1); sqlParameter6.Value = (object)model.UseUsers; sqlParameter13 = sqlParameter6; } else { sqlParameter13 = new SqlParameter("@UseUsers", SqlDbType.VarChar, -1); sqlParameter13.Value = (object)DBNull.Value; } sqlParameterArray[index12] = sqlParameter13; int index13 = 12; SqlParameter sqlParameter14; if (model.Sort.HasValue) { SqlParameter sqlParameter6 = new SqlParameter("@Sort", SqlDbType.Int, -1); sqlParameter6.Value = (object)model.Sort; sqlParameter14 = sqlParameter6; } else { sqlParameter14 = new SqlParameter("@Sort", SqlDbType.Int, -1); sqlParameter14.Value = (object)DBNull.Value; } sqlParameterArray[index13] = sqlParameter14; int index14 = 13; SqlParameter sqlParameter15; if (model.Note != null) { SqlParameter sqlParameter6 = new SqlParameter("@Note", SqlDbType.NVarChar, 4000); sqlParameter6.Value = (object)model.Note; sqlParameter15 = sqlParameter6; } else { sqlParameter15 = new SqlParameter("@Note", SqlDbType.NVarChar, 4000); sqlParameter15.Value = (object)DBNull.Value; } sqlParameterArray[index14] = sqlParameter15; int index15 = 14; SqlParameter sqlParameter16 = new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1); sqlParameter16.Value = (object)model.ID; sqlParameterArray[index15] = sqlParameter16; SqlParameter[] parameter = sqlParameterArray; return(this.dbHelper.Execute(sql, parameter, false)); }
public int Update(RoadFlow.Data.Model.HomeItems model) { return(this.dataHomeItems.Update(model)); }
public int Add(RoadFlow.Data.Model.HomeItems model) { return(this.dataHomeItems.Add(model)); }
public int Update(RoadFlow.Data.Model.HomeItems model) { string sql = "UPDATE homeitems SET \r\n\t\t\t\tType=@Type,Name=@Name,Title=@Title,DataSourceType=@DataSourceType,DataSource=@DataSource,Ico=@Ico,BgColor=@BgColor,Color=@Color,DBConnID=@DBConnID,LinkURL=@LinkURL,UseOrganizes=@UseOrganizes,UseUsers=@UseUsers,Sort=@Sort,Note=@Note\r\n\t\t\t\tWHERE ID=@ID"; MySqlParameter[] mySqlParameterArray = new MySqlParameter[15]; int index1 = 0; MySqlParameter mySqlParameter1 = new MySqlParameter("@Type", MySqlDbType.Int32, 11); mySqlParameter1.Value = (object)model.Type; mySqlParameterArray[index1] = mySqlParameter1; int index2 = 1; MySqlParameter mySqlParameter2 = new MySqlParameter("@Name", MySqlDbType.Text, -1); mySqlParameter2.Value = (object)model.Name; mySqlParameterArray[index2] = mySqlParameter2; int index3 = 2; MySqlParameter mySqlParameter3 = new MySqlParameter("@Title", MySqlDbType.Text, -1); mySqlParameter3.Value = (object)model.Title; mySqlParameterArray[index3] = mySqlParameter3; int index4 = 3; MySqlParameter mySqlParameter4 = new MySqlParameter("@DataSourceType", MySqlDbType.Int32, 11); mySqlParameter4.Value = (object)model.DataSourceType; mySqlParameterArray[index4] = mySqlParameter4; int index5 = 4; MySqlParameter mySqlParameter5; if (model.DataSource != null) { MySqlParameter mySqlParameter6 = new MySqlParameter("@DataSource", MySqlDbType.LongText, -1); mySqlParameter6.Value = (object)model.DataSource; mySqlParameter5 = mySqlParameter6; } else { mySqlParameter5 = new MySqlParameter("@DataSource", MySqlDbType.LongText, -1); mySqlParameter5.Value = (object)DBNull.Value; } mySqlParameterArray[index5] = mySqlParameter5; int index6 = 5; MySqlParameter mySqlParameter7; if (model.Ico != null) { MySqlParameter mySqlParameter6 = new MySqlParameter("@Ico", MySqlDbType.Text, -1); mySqlParameter6.Value = (object)model.Ico; mySqlParameter7 = mySqlParameter6; } else { mySqlParameter7 = new MySqlParameter("@Ico", MySqlDbType.Text, -1); mySqlParameter7.Value = (object)DBNull.Value; } mySqlParameterArray[index6] = mySqlParameter7; int index7 = 6; MySqlParameter mySqlParameter8; if (model.BgColor != null) { MySqlParameter mySqlParameter6 = new MySqlParameter("@BgColor", MySqlDbType.VarChar, 50); mySqlParameter6.Value = (object)model.BgColor; mySqlParameter8 = mySqlParameter6; } else { mySqlParameter8 = new MySqlParameter("@BgColor", MySqlDbType.VarChar, 50); mySqlParameter8.Value = (object)DBNull.Value; } mySqlParameterArray[index7] = mySqlParameter8; int index8 = 7; MySqlParameter mySqlParameter9; if (model.Color != null) { MySqlParameter mySqlParameter6 = new MySqlParameter("@Color", MySqlDbType.VarChar, 50); mySqlParameter6.Value = (object)model.Color; mySqlParameter9 = mySqlParameter6; } else { mySqlParameter9 = new MySqlParameter("@Color", MySqlDbType.VarChar, 50); mySqlParameter9.Value = (object)DBNull.Value; } mySqlParameterArray[index8] = mySqlParameter9; int index9 = 8; MySqlParameter mySqlParameter10; if (model.DBConnID.HasValue) { MySqlParameter mySqlParameter6 = new MySqlParameter("@DBConnID", MySqlDbType.VarChar, 36); mySqlParameter6.Value = (object)model.DBConnID; mySqlParameter10 = mySqlParameter6; } else { mySqlParameter10 = new MySqlParameter("@DBConnID", MySqlDbType.VarChar, 36); mySqlParameter10.Value = (object)DBNull.Value; } mySqlParameterArray[index9] = mySqlParameter10; int index10 = 9; MySqlParameter mySqlParameter11; if (model.LinkURL != null) { MySqlParameter mySqlParameter6 = new MySqlParameter("@LinkURL", MySqlDbType.Text, -1); mySqlParameter6.Value = (object)model.LinkURL; mySqlParameter11 = mySqlParameter6; } else { mySqlParameter11 = new MySqlParameter("@LinkURL", MySqlDbType.Text, -1); mySqlParameter11.Value = (object)DBNull.Value; } mySqlParameterArray[index10] = mySqlParameter11; int index11 = 10; MySqlParameter mySqlParameter12; if (model.UseOrganizes != null) { MySqlParameter mySqlParameter6 = new MySqlParameter("@UseOrganizes", MySqlDbType.LongText, -1); mySqlParameter6.Value = (object)model.UseOrganizes; mySqlParameter12 = mySqlParameter6; } else { mySqlParameter12 = new MySqlParameter("@UseOrganizes", MySqlDbType.LongText, -1); mySqlParameter12.Value = (object)DBNull.Value; } mySqlParameterArray[index11] = mySqlParameter12; int index12 = 11; MySqlParameter mySqlParameter13; if (model.UseUsers != null) { MySqlParameter mySqlParameter6 = new MySqlParameter("@UseUsers", MySqlDbType.LongText, -1); mySqlParameter6.Value = (object)model.UseUsers; mySqlParameter13 = mySqlParameter6; } else { mySqlParameter13 = new MySqlParameter("@UseUsers", MySqlDbType.LongText, -1); mySqlParameter13.Value = (object)DBNull.Value; } mySqlParameterArray[index12] = mySqlParameter13; int index13 = 12; MySqlParameter mySqlParameter14; if (model.Sort.HasValue) { MySqlParameter mySqlParameter6 = new MySqlParameter("@Sort", MySqlDbType.Int32, 11); mySqlParameter6.Value = (object)model.Sort; mySqlParameter14 = mySqlParameter6; } else { mySqlParameter14 = new MySqlParameter("@Sort", MySqlDbType.Int32, 11); mySqlParameter14.Value = (object)DBNull.Value; } mySqlParameterArray[index13] = mySqlParameter14; int index14 = 13; MySqlParameter mySqlParameter15; if (model.Note != null) { MySqlParameter mySqlParameter6 = new MySqlParameter("@Note", MySqlDbType.Text, -1); mySqlParameter6.Value = (object)model.Note; mySqlParameter15 = mySqlParameter6; } else { mySqlParameter15 = new MySqlParameter("@Note", MySqlDbType.Text, -1); mySqlParameter15.Value = (object)DBNull.Value; } mySqlParameterArray[index14] = mySqlParameter15; int index15 = 14; MySqlParameter mySqlParameter16 = new MySqlParameter("@ID", MySqlDbType.VarChar, 36); mySqlParameter16.Value = (object)model.ID; mySqlParameterArray[index15] = mySqlParameter16; MySqlParameter[] parameter = mySqlParameterArray; return(this.dbHelper.Execute(sql, parameter, false)); }