Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <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());
        }
Exemple #3
0
        /// <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()));
        }
Exemple #4
0
        /// <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());
        }
Exemple #5
0
        /// <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());
        }
Exemple #6
0
        /// <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);
        }
Exemple #7
0
        /// <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);
        }
Exemple #8
0
        /// <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);
        }
Exemple #9
0
        /// <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);
        }
Exemple #10
0
        /// <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);
        }
Exemple #11
0
        /// <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);
        }
Exemple #12
0
        /// <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());
        }
Exemple #13
0
        /// <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);
        }
Exemple #14
0
        /// <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);
        }
Exemple #15
0
        /// <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());
        }