/// <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); }