/// <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> 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="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="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="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>返回新增实体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_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()); }