/// <summary>分页获取数据列表 /// /// </summary> /// <param name="strFields">字段</param> /// <param name="strOrder">排序</param> /// <param name="strOrderType">排序类型</param> /// <param name="intPageSize">每页大小</param> /// <param name="intPageIndex">当前第N页</param> /// <param name="strWhere">条件</param> /// <returns>返回符合条件的对象集合</returns> public List <Nikita.Assist.CodeMaker.Model.Bse_ControlType> GetListArray(string strFields, string strOrder, string strOrderType, int intPageSize, int intPageIndex, string strWhere) { SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); DataTable dt = h.FengYe("Bse_ControlType", strFields, strOrder, strOrderType, strWhere, intPageSize, intPageIndex); List <Nikita.Assist.CodeMaker.Model.Bse_ControlType> list = new List <Nikita.Assist.CodeMaker.Model.Bse_ControlType>(); foreach (DataRow row in dt.Rows) { list.Add(new Model.Bse_ControlType() { Ctl_Id = int.Parse(row["Ctl_Id"].ToString()), ControlType = row["ControlType"].ToString(), Ctl_Simple = row["Ctl_Simple"].ToString(), Ctl_Name = row["Ctl_Name"].ToString(), Ctl_NameSpace = row["Ctl_NameSpace"].ToString(), Ctl_Width = int.Parse(row["Ctl_Width"].ToString()), Ctl_Height = int.Parse(row["Ctl_Height"].ToString()), Ctl_Type = row["Ctl_Type"].ToString(), State = row["State"].ToString(), Sort = int.Parse(row["Sort"].ToString()), Type = row["Type"].ToString(), IsSelf = row["IsSelf"].ToString(), }); } return(list); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Model.Set model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Tb_Set("); strSql.Append("SetKey, SetText, SetValue, State, Remark )"); strSql.Append(" values ("); strSql.Append("@SetKey, @SetText, @SetValue, @State, @Remark )"); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); if (model.SetKey == null) { h.AddParameter("@SetKey", DBNull.Value); } else { h.AddParameter("@SetKey", model.SetKey); } if (model.SetText == null) { h.AddParameter("@SetText", DBNull.Value); } else { h.AddParameter("@SetText", model.SetText); } if (model.SetValue == null) { h.AddParameter("@SetValue", DBNull.Value); } else { h.AddParameter("@SetValue", model.SetValue); } h.AddParameter("@State", model.State); if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } h.ExecuteNonQuery(); const string strSql2 = "select max(id) from Tb_Set"; h.CreateCommand(strSql2); int result; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out result)) { return(0); } return(result); }
/// <summary>分页获取数据列表 /// /// </summary> /// <param name="strFields">字段</param> /// <param name="strOrder">排序</param> /// <param name="strOrderType">排序类型</param> /// <param name="intPageSize">每页大小</param> /// <param name="intPageIndex">当前第N页</param> /// <param name="strWhere">条件</param> /// <returns>返回符合条件的DataSet数据集</returns> public DataSet GetList(string strFields, string strOrder, string strOrderType, int intPageSize, int intPageIndex, string strWhere) { SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); DataTable dt = h.FengYe("Bse_UI", strFields, strOrder, strOrderType, strWhere, intPageSize, intPageIndex); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>分页获取数据列表 /// /// </summary> public DataSet GetList(string fileds, string order, string ordertype, int intPageSize, int intPageIndex, string strWhere) { SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); DataTable dt = h.FengYe("Tb_Set", fileds, order, ordertype, strWhere, intPageSize, intPageIndex); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>删除一条数据 /// /// </summary> /// <param name="intId">主键ID</param> /// <returns>返回受影响的行数</returns> public bool Delete(int intId) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Bse_UI "); strSql.Append(" where Ui_Id=@id "); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); h.AddParameter("@id", intId); return(h.ExecuteNonQuery()); }
/// <summary>计算记录数 /// /// </summary> /// <param name="strCond">条件</param> /// <returns>总数量</returns> public int CalcCount(string strCond) { string sql = "select count(1) from Bse_UI"; if (!string.IsNullOrEmpty(strCond)) { sql += " where " + strCond; } SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(sql); return(int.Parse(h.ExecuteScalar())); }
/// <summary>根据条件删除数据 /// /// </summary> /// <param name="strCond">条件</param> /// <returns>返回受影响的行数</returns> public bool DeleteByCond(string strCond) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Bse_UI "); if (!string.IsNullOrEmpty(strCond)) { strSql.Append(" where " + strCond); } SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); return(h.ExecuteNonQuery()); }
/// <summary>分页获取数据列表 /// /// </summary> /// <param name="strFields">字段</param> /// <param name="strOrder">排序</param> /// <param name="strOrderType">排序类型</param> /// <param name="intPageSize">每页大小</param> /// <param name="intPageIndex">当前第N页</param> /// <param name="strWhere">条件</param> /// <returns>返回符合条件的对象集合</returns> public List <Nikita.Assist.CodeMaker.Model.Bse_UI> GetListArray(string strFields, string strOrder, string strOrderType, int intPageSize, int intPageIndex, string strWhere) { SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); DataTable dt = h.FengYe("Bse_UI", strFields, strOrder, strOrderType, strWhere, intPageSize, intPageIndex); List <Nikita.Assist.CodeMaker.Model.Bse_UI> list = new List <Nikita.Assist.CodeMaker.Model.Bse_UI>(); foreach (DataRow row in dt.Rows) { list.Add(new Model.Bse_UI() { Ui_Id = int.Parse(row["Ui_Id"].ToString()), TableName = row["TableName"].ToString(), PanelName = row["PanelName"].ToString(), ColumnName = row["ColumnName"].ToString(), ColumnType = row["ColumnType"].ToString(), FrmNameSpace = row["FrmNameSpace"].ToString(), ControlNameSpace = row["ControlNameSpace"].ToString(), ControlType = row["ControlType"].ToString(), Ctl_Simple = row["Ctl_Simple"].ToString(), ControlName = row["ControlName"].ToString(), GridSpeicalCtlName = row["GridSpeicalCtlName"].ToString(), ControlSort = row["ControlSort"].ToString(), DefaultValue = row["DefaultValue"].ToString(), IsAddLable = row["IsAddLable"].ToString(), LabelName = row["LabelName"].ToString(), LabelText = row["LabelText"].ToString(), IsNeed = row["IsNeed"].ToString(), IsReadonly = row["IsReadonly"].ToString(), FiledText = row["FiledText"].ToString(), FiledValue = row["FiledValue"].ToString(), DataSourse = row["DataSourse"].ToString(), DefaultFiledText = row["DefaultFiledText"].ToString(), DefaultFiledValue = row["DefaultFiledValue"].ToString(), DefaultDataSourse = row["DefaultDataSourse"].ToString(), Remark = row["Remark"].ToString(), State = int.Parse(row["State"].ToString()), CreateDate = DateTime.Parse(row["CreateDate"].ToString()), CreateUserId = int.Parse(row["CreateUserId"].ToString()), }); } return(list); }
/// <summary>分页获取数据列表 /// /// </summary> public List <Model.SetOrd> GetListArray(string fileds, string order, string ordertype, int intPageSize, int intPageIndex, string strWhere) { SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); DataTable dt = h.FengYe("Tb_SetOrd", fileds, order, ordertype, strWhere, intPageSize, intPageIndex); return((from DataRow row in dt.Rows select new Model.SetOrd() { Id = int.Parse(row["id"].ToString()), SetOrdText = row["SetOrdText"].ToString(), SetOrdKey = row["SetOrdKey"].ToString(), State = int.Parse(row["State"].ToString()), Remark = row["Remark"].ToString(), }).ToList()); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Model.Set model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Tb_Set set "); strSql.Append("SetKey=@SetKey, SetText=@SetText, SetValue=@SetValue, State=@State, Remark=@Remark "); strSql.Append(" where id=@id "); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); if (model.SetKey == null) { h.AddParameter("@SetKey", DBNull.Value); } else { h.AddParameter("@SetKey", model.SetKey); } if (model.SetText == null) { h.AddParameter("@SetText", DBNull.Value); } else { h.AddParameter("@SetText", model.SetText); } if (model.SetValue == null) { h.AddParameter("@SetValue", DBNull.Value); } else { h.AddParameter("@SetValue", model.SetValue); } h.AddParameter("@State", model.State); if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } h.AddParameter("@id", model.Id); return(h.ExecuteNonQuery()); }
/// <summary>获得数据列表 /// /// </summary> /// <param name="strWhere">条件</param> /// <param name="strFields">字段</param> /// <returns>返回符合条件的DataSet数据集</returns> public DataSet GetList(string strWhere, string strFields) { StringBuilder strSql = new StringBuilder(); strSql.Append("select " + strFields + " "); strSql.Append(" FROM Bse_UI "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>得到一个对象实体 /// /// </summary> /// <param name="intId">主键</param> /// <returns>返回对象实体</returns> public Nikita.Assist.CodeMaker.Model.Bse_UI GetModel(int intId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Bse_UI "); strSql.Append(" where Ui_Id=@id "); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); h.AddParameter("@id", intId); Nikita.Assist.CodeMaker.Model.Bse_UI model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>得到一个对象实体 /// /// </summary> public Model.Set GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Tb_Set "); strSql.Append(" where id=@id "); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); h.AddParameter("@id", id); Model.Set model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } h.CloseConn(); return(model); }
/// <summary>根据条件得到一个对象实体 /// /// </summary> /// <param name="strCond">条件</param> /// <returns>返回对象实体</returns> public Nikita.Assist.CodeMaker.Model.Bse_UI GetModelByCond(string strCond) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Bse_UI "); if (!string.IsNullOrEmpty(strCond)) { strSql.Append(" where " + strCond); } strSql.Append(" limit 1"); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); Nikita.Assist.CodeMaker.Model.Bse_UI model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>根据条件得到一个对象实体 /// /// </summary> public Model.Set GetModelByCond(string cond) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Tb_Set "); if (!string.IsNullOrEmpty(cond)) { strSql.Append(" where " + cond); } strSql.Append(" limit 1"); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); Model.Set model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>获得数据列表(比DataSet效率高,推荐使用) /// /// </summary> /// <param name="strWhere">条件</param> /// <returns>返回符合条件的对象集合</returns> public List <Nikita.Assist.CodeMaker.Model.Bse_UI> GetListArray(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" FROM Bse_UI "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } List <Nikita.Assist.CodeMaker.Model.Bse_UI> list = new List <Nikita.Assist.CodeMaker.Model.Bse_UI>(); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); using (IDataReader dataReader = h.ExecuteReader()) { while (dataReader.Read()) { list.Add(ReaderBind(dataReader)); } h.CloseConn(); } return(list); }
/// <summary>增加一条数据 /// /// </summary> /// <param name="model">实体对象</param> /// <returns>返回新增实体ID</returns> public int Add(Nikita.Assist.CodeMaker.Model.Bse_UI model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_UI("); strSql.Append("TableName, PanelName, ColumnName, ColumnType, FrmNameSpace, ControlNameSpace, ControlType, Ctl_Simple, ControlName, GridSpeicalCtlName, ControlSort, DefaultValue, IsAddLable, LabelName, LabelText, IsNeed, IsReadonly, FiledText, FiledValue, DataSourse, DefaultFiledText, DefaultFiledValue, DefaultDataSourse, Remark, State, CreateDate, CreateUserId )"); strSql.Append(" values ("); strSql.Append("@TableName, @PanelName, @ColumnName, @ColumnType, @FrmNameSpace, @ControlNameSpace, @ControlType, @Ctl_Simple, @ControlName, @GridSpeicalCtlName, @ControlSort, @DefaultValue, @IsAddLable, @LabelName, @LabelText, @IsNeed, @IsReadonly, @FiledText, @FiledValue, @DataSourse, @DefaultFiledText, @DefaultFiledValue, @DefaultDataSourse, @Remark, @State, @CreateDate, @CreateUserId )"); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); if (model.TableName == null) { h.AddParameter("@TableName", DBNull.Value); } else { h.AddParameter("@TableName", model.TableName); } if (model.PanelName == null) { h.AddParameter("@PanelName", DBNull.Value); } else { h.AddParameter("@PanelName", model.PanelName); } if (model.ColumnName == null) { h.AddParameter("@ColumnName", DBNull.Value); } else { h.AddParameter("@ColumnName", model.ColumnName); } if (model.ColumnType == null) { h.AddParameter("@ColumnType", DBNull.Value); } else { h.AddParameter("@ColumnType", model.ColumnType); } if (model.FrmNameSpace == null) { h.AddParameter("@FrmNameSpace", DBNull.Value); } else { h.AddParameter("@FrmNameSpace", model.FrmNameSpace); } if (model.ControlNameSpace == null) { h.AddParameter("@ControlNameSpace", DBNull.Value); } else { h.AddParameter("@ControlNameSpace", model.ControlNameSpace); } if (model.ControlType == null) { h.AddParameter("@ControlType", DBNull.Value); } else { h.AddParameter("@ControlType", model.ControlType); } if (model.Ctl_Simple == null) { h.AddParameter("@Ctl_Simple", DBNull.Value); } else { h.AddParameter("@Ctl_Simple", model.Ctl_Simple); } if (model.ControlName == null) { h.AddParameter("@ControlName", DBNull.Value); } else { h.AddParameter("@ControlName", model.ControlName); } if (model.GridSpeicalCtlName == null) { h.AddParameter("@GridSpeicalCtlName", DBNull.Value); } else { h.AddParameter("@GridSpeicalCtlName", model.GridSpeicalCtlName); } if (model.ControlSort == null) { h.AddParameter("@ControlSort", DBNull.Value); } else { h.AddParameter("@ControlSort", model.ControlSort); } if (model.DefaultValue == null) { h.AddParameter("@DefaultValue", DBNull.Value); } else { h.AddParameter("@DefaultValue", model.DefaultValue); } if (model.IsAddLable == null) { h.AddParameter("@IsAddLable", DBNull.Value); } else { h.AddParameter("@IsAddLable", model.IsAddLable); } if (model.LabelName == null) { h.AddParameter("@LabelName", DBNull.Value); } else { h.AddParameter("@LabelName", model.LabelName); } if (model.LabelText == null) { h.AddParameter("@LabelText", DBNull.Value); } else { h.AddParameter("@LabelText", model.LabelText); } if (model.IsNeed == null) { h.AddParameter("@IsNeed", DBNull.Value); } else { h.AddParameter("@IsNeed", model.IsNeed); } if (model.IsReadonly == null) { h.AddParameter("@IsReadonly", DBNull.Value); } else { h.AddParameter("@IsReadonly", model.IsReadonly); } if (model.FiledText == null) { h.AddParameter("@FiledText", DBNull.Value); } else { h.AddParameter("@FiledText", model.FiledText); } if (model.FiledValue == null) { h.AddParameter("@FiledValue", DBNull.Value); } else { h.AddParameter("@FiledValue", model.FiledValue); } if (model.DataSourse == null) { h.AddParameter("@DataSourse", DBNull.Value); } else { h.AddParameter("@DataSourse", model.DataSourse); } if (model.DefaultFiledText == null) { h.AddParameter("@DefaultFiledText", DBNull.Value); } else { h.AddParameter("@DefaultFiledText", model.DefaultFiledText); } if (model.DefaultFiledValue == null) { h.AddParameter("@DefaultFiledValue", DBNull.Value); } else { h.AddParameter("@DefaultFiledValue", model.DefaultFiledValue); } if (model.DefaultDataSourse == null) { h.AddParameter("@DefaultDataSourse", DBNull.Value); } else { h.AddParameter("@DefaultDataSourse", model.DefaultDataSourse); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.State == null) { h.AddParameter("@State", DBNull.Value); } else { h.AddParameter("@State", model.State); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate.ToString("s")); } if (model.CreateUserId == null) { h.AddParameter("@CreateUserId", DBNull.Value); } else { h.AddParameter("@CreateUserId", model.CreateUserId); } h.ExecuteNonQuery(); string strSql2 = "select max(Ui_Id) from Bse_UI"; h.CreateCommand(strSql2); int intResult; string strObj = h.ExecuteScalar(); if (!int.TryParse(strObj, out intResult)) { return(0); } return(intResult); }
/// <summary>增加一条数据 /// /// </summary> /// <param name="model">实体对象</param> /// <returns>返回新增实体ID</returns> public int Add(Nikita.Assist.CodeMaker.Model.Bse_ControlType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_ControlType("); strSql.Append(" ControlType, Ctl_Simple, Ctl_Name, Ctl_NameSpace, Ctl_Width, Ctl_Height, Ctl_Type, State, Sort, Type, IsSelf )"); strSql.Append(" values ("); strSql.Append(" @ControlType, @Ctl_Simple, @Ctl_Name, @Ctl_NameSpace, @Ctl_Width, @Ctl_Height, @Ctl_Type, @State, @Sort, @Type, @IsSelf )"); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); if (model.ControlType == null) { h.AddParameter("@ControlType", DBNull.Value); } else { h.AddParameter("@ControlType", model.ControlType); } if (model.Ctl_Simple == null) { h.AddParameter("@Ctl_Simple", DBNull.Value); } else { h.AddParameter("@Ctl_Simple", model.Ctl_Simple); } if (model.Ctl_Name == null) { h.AddParameter("@Ctl_Name", DBNull.Value); } else { h.AddParameter("@Ctl_Name", model.Ctl_Name); } if (model.Ctl_NameSpace == null) { h.AddParameter("@Ctl_NameSpace", DBNull.Value); } else { h.AddParameter("@Ctl_NameSpace", model.Ctl_NameSpace); } if (model.Ctl_Width == null) { h.AddParameter("@Ctl_Width", DBNull.Value); } else { h.AddParameter("@Ctl_Width", model.Ctl_Width); } if (model.Ctl_Height == null) { h.AddParameter("@Ctl_Height", DBNull.Value); } else { h.AddParameter("@Ctl_Height", model.Ctl_Height); } if (model.Ctl_Type == null) { h.AddParameter("@Ctl_Type", DBNull.Value); } else { h.AddParameter("@Ctl_Type", model.Ctl_Type); } if (model.State == null) { h.AddParameter("@State", DBNull.Value); } else { h.AddParameter("@State", model.State); } if (model.Sort == null) { h.AddParameter("@Sort", DBNull.Value); } else { h.AddParameter("@Sort", model.Sort); } if (model.Type == null) { h.AddParameter("@Type", DBNull.Value); } else { h.AddParameter("@Type", model.Type); } if (model.IsSelf == null) { h.AddParameter("@IsSelf", DBNull.Value); } else { h.AddParameter("@IsSelf", model.IsSelf); } h.ExecuteNonQuery(); string strSql2 = "select max(id) from Bse_ControlType"; h.CreateCommand(strSql2); int intResult; string strObj = h.ExecuteScalar(); if (!int.TryParse(strObj, out intResult)) { return(0); } return(intResult); }
/// <summary>更新一条数据 /// /// </summary> /// <param name="model">实体对象</param> /// <returns>返回受影响的行数</returns> public bool Update(Nikita.Assist.CodeMaker.Model.Bse_UI model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_UI set "); strSql.Append(" TableName=@TableName, PanelName=@PanelName, ColumnName=@ColumnName, ColumnType=@ColumnType, FrmNameSpace=@FrmNameSpace, ControlNameSpace=@ControlNameSpace, ControlType=@ControlType, Ctl_Simple=@Ctl_Simple, ControlName=@ControlName, GridSpeicalCtlName=@GridSpeicalCtlName, ControlSort=@ControlSort, DefaultValue=@DefaultValue, IsAddLable=@IsAddLable, LabelName=@LabelName, LabelText=@LabelText, IsNeed=@IsNeed, IsReadonly=@IsReadonly, FiledText=@FiledText, FiledValue=@FiledValue, DataSourse=@DataSourse, DefaultFiledText=@DefaultFiledText, DefaultFiledValue=@DefaultFiledValue, DefaultDataSourse=@DefaultDataSourse, Remark=@Remark, State=@State, CreateDate=@CreateDate, CreateUserId=@CreateUserId "); strSql.Append(" where id=@id "); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); if (model.TableName == null) { h.AddParameter("@TableName", DBNull.Value); } else { h.AddParameter("@TableName", model.TableName); } if (model.PanelName == null) { h.AddParameter("@PanelName", DBNull.Value); } else { h.AddParameter("@PanelName", model.PanelName); } if (model.ColumnName == null) { h.AddParameter("@ColumnName", DBNull.Value); } else { h.AddParameter("@ColumnName", model.ColumnName); } if (model.ColumnType == null) { h.AddParameter("@ColumnType", DBNull.Value); } else { h.AddParameter("@ColumnType", model.ColumnType); } if (model.FrmNameSpace == null) { h.AddParameter("@FrmNameSpace", DBNull.Value); } else { h.AddParameter("@FrmNameSpace", model.FrmNameSpace); } if (model.ControlNameSpace == null) { h.AddParameter("@ControlNameSpace", DBNull.Value); } else { h.AddParameter("@ControlNameSpace", model.ControlNameSpace); } if (model.ControlType == null) { h.AddParameter("@ControlType", DBNull.Value); } else { h.AddParameter("@ControlType", model.ControlType); } if (model.Ctl_Simple == null) { h.AddParameter("@Ctl_Simple", DBNull.Value); } else { h.AddParameter("@Ctl_Simple", model.Ctl_Simple); } if (model.ControlName == null) { h.AddParameter("@ControlName", DBNull.Value); } else { h.AddParameter("@ControlName", model.ControlName); } if (model.GridSpeicalCtlName == null) { h.AddParameter("@GridSpeicalCtlName", DBNull.Value); } else { h.AddParameter("@GridSpeicalCtlName", model.GridSpeicalCtlName); } if (model.ControlSort == null) { h.AddParameter("@ControlSort", DBNull.Value); } else { h.AddParameter("@ControlSort", model.ControlSort); } if (model.DefaultValue == null) { h.AddParameter("@DefaultValue", DBNull.Value); } else { h.AddParameter("@DefaultValue", model.DefaultValue); } if (model.IsAddLable == null) { h.AddParameter("@IsAddLable", DBNull.Value); } else { h.AddParameter("@IsAddLable", model.IsAddLable); } if (model.LabelName == null) { h.AddParameter("@LabelName", DBNull.Value); } else { h.AddParameter("@LabelName", model.LabelName); } if (model.LabelText == null) { h.AddParameter("@LabelText", DBNull.Value); } else { h.AddParameter("@LabelText", model.LabelText); } if (model.IsNeed == null) { h.AddParameter("@IsNeed", DBNull.Value); } else { h.AddParameter("@IsNeed", model.IsNeed); } if (model.IsReadonly == null) { h.AddParameter("@IsReadonly", DBNull.Value); } else { h.AddParameter("@IsReadonly", model.IsReadonly); } if (model.FiledText == null) { h.AddParameter("@FiledText", DBNull.Value); } else { h.AddParameter("@FiledText", model.FiledText); } if (model.FiledValue == null) { h.AddParameter("@FiledValue", DBNull.Value); } else { h.AddParameter("@FiledValue", model.FiledValue); } if (model.DataSourse == null) { h.AddParameter("@DataSourse", DBNull.Value); } else { h.AddParameter("@DataSourse", model.DataSourse); } if (model.DefaultFiledText == null) { h.AddParameter("@DefaultFiledText", DBNull.Value); } else { h.AddParameter("@DefaultFiledText", model.DefaultFiledText); } if (model.DefaultFiledValue == null) { h.AddParameter("@DefaultFiledValue", DBNull.Value); } else { h.AddParameter("@DefaultFiledValue", model.DefaultFiledValue); } if (model.DefaultDataSourse == null) { h.AddParameter("@DefaultDataSourse", DBNull.Value); } else { h.AddParameter("@DefaultDataSourse", model.DefaultDataSourse); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.State == null) { h.AddParameter("@State", DBNull.Value); } else { h.AddParameter("@State", model.State); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate.ToString("s")); } if (model.CreateUserId == null) { h.AddParameter("@CreateUserId", DBNull.Value); } else { h.AddParameter("@CreateUserId", model.CreateUserId); } h.AddParameter("@id", model.Ui_Id); return(h.ExecuteNonQuery()); }
/// <summary>更新一条数据 /// /// </summary> /// <param name="model">实体对象</param> /// <returns>返回受影响的行数</returns> public bool Update(Nikita.Assist.CodeMaker.Model.Bse_ControlType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_ControlType set "); strSql.Append(" ControlType=@ControlType, Ctl_Simple=@Ctl_Simple, Ctl_Name=@Ctl_Name, Ctl_NameSpace=@Ctl_NameSpace, Ctl_Width=@Ctl_Width, Ctl_Height=@Ctl_Height, Ctl_Type=@Ctl_Type, State=@State, Sort=@Sort, Type=@Type, IsSelf=@IsSelf "); strSql.Append(" where id=@id "); SQLiteHelper h = GlobalHelp.GetSQLiteHelper(); h.CreateCommand(strSql.ToString()); if (model.ControlType == null) { h.AddParameter("@ControlType", DBNull.Value); } else { h.AddParameter("@ControlType", model.ControlType); } if (model.Ctl_Simple == null) { h.AddParameter("@Ctl_Simple", DBNull.Value); } else { h.AddParameter("@Ctl_Simple", model.Ctl_Simple); } if (model.Ctl_Name == null) { h.AddParameter("@Ctl_Name", DBNull.Value); } else { h.AddParameter("@Ctl_Name", model.Ctl_Name); } if (model.Ctl_NameSpace == null) { h.AddParameter("@Ctl_NameSpace", DBNull.Value); } else { h.AddParameter("@Ctl_NameSpace", model.Ctl_NameSpace); } if (model.Ctl_Width == null) { h.AddParameter("@Ctl_Width", DBNull.Value); } else { h.AddParameter("@Ctl_Width", model.Ctl_Width); } if (model.Ctl_Height == null) { h.AddParameter("@Ctl_Height", DBNull.Value); } else { h.AddParameter("@Ctl_Height", model.Ctl_Height); } if (model.Ctl_Type == null) { h.AddParameter("@Ctl_Type", DBNull.Value); } else { h.AddParameter("@Ctl_Type", model.Ctl_Type); } if (model.State == null) { h.AddParameter("@State", DBNull.Value); } else { h.AddParameter("@State", model.State); } if (model.Sort == null) { h.AddParameter("@Sort", DBNull.Value); } else { h.AddParameter("@Sort", model.Sort); } if (model.Type == null) { h.AddParameter("@Type", DBNull.Value); } else { h.AddParameter("@Type", model.Type); } if (model.IsSelf == null) { h.AddParameter("@IsSelf", DBNull.Value); } else { h.AddParameter("@IsSelf", model.IsSelf); } h.AddParameter("@id", model.Ctl_Id); return(h.ExecuteNonQuery()); }