/// <summary> /// 增加一条数据 /// </summary> public void Add(UserPermission.Model.USER_SHARE_COMPANYFUNMODEL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into USER_SHARE_COMPANYFUN("); strSql.Append("CFID,FMID,PROJECTID,COMPANYID,CFNAME,CFANOTHERNAME,CFPAGEURL,CFPARENTID,CFSORTNUM,CFSTEP,CFISLAST,CFDESC,CFSTATUS)"); strSql.Append(" values ("); strSql.Append("@CFID,@FMID,@PROJECTID,@COMPANYID,@CFNAME,@CFANOTHERNAME,@CFPAGEURL,@CFPARENTID,@CFSORTNUM,@CFSTEP,@CFISLAST,@CFDESC,@CFSTATUS)"); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()); db.AddInParameter(dbCommand, "CFID", DbType.String, model.CFID); db.AddInParameter(dbCommand, "FMID", DbType.String, model.FMID); db.AddInParameter(dbCommand, "PROJECTID", DbType.String, model.PROJECTID); db.AddInParameter(dbCommand, "COMPANYID", DbType.String, model.COMPANYID); db.AddInParameter(dbCommand, "CFNAME", DbType.String, model.CFNAME); db.AddInParameter(dbCommand, "CFANOTHERNAME", DbType.String, model.CFANOTHERNAME); db.AddInParameter(dbCommand, "CFPAGEURL", DbType.String, model.CFPAGEURL); db.AddInParameter(dbCommand, "CFPARENTID", DbType.String, model.CFPARENTID); db.AddInParameter(dbCommand, "CFSORTNUM", DbType.String, model.CFSORTNUM); db.AddInParameter(dbCommand, "CFSTEP", DbType.String, model.CFSTEP); db.AddInParameter(dbCommand, "CFISLAST", DbType.String, model.CFISLAST); db.AddInParameter(dbCommand, "CFDESC", DbType.String, model.CFDESC); db.AddInParameter(dbCommand, "CFSTATUS", DbType.String, model.CFSTATUS); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 得到一个对象实体 /// </summary> public UserPermission.Model.USER_SHARE_COMPANYFUNMODEL GetModel(decimal CFID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select CFID,FMID,PROJECTID,COMPANYID,CFNAME,CFANOTHERNAME,CFPAGEURL,CFPARENTID,CFSORTNUM,CFSTEP,CFISLAST,CFDESC,CFSTATUS from USER_SHARE_COMPANYFUN "); strSql.Append(" where CFID=@CFID "); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()); db.AddInParameter(dbCommand, "CFID", DbType.String, CFID); UserPermission.Model.USER_SHARE_COMPANYFUNMODEL model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(UserPermission.Model.USER_SHARE_COMPANYFUNMODEL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update USER_SHARE_COMPANYFUN set "); strSql.Append("FMID=@FMID,"); strSql.Append("PROJECTID=@PROJECTID,"); strSql.Append("COMPANYID=@COMPANYID,"); strSql.Append("CFNAME=@CFNAME,"); strSql.Append("CFANOTHERNAME=@CFANOTHERNAME,"); strSql.Append("CFPAGEURL=@CFPAGEURL,"); strSql.Append("CFPARENTID=@CFPARENTID,"); strSql.Append("CFSORTNUM=@CFSORTNUM,"); strSql.Append("CFSTEP=@CFSTEP,"); strSql.Append("CFISLAST=@CFISLAST,"); strSql.Append("CFDESC=@CFDESC,"); strSql.Append("CFSTATUS=@CFSTATUS"); strSql.Append(" where CFID=@CFID "); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()); db.AddInParameter(dbCommand, "CFID", DbType.String, model.CFID); db.AddInParameter(dbCommand, "FMID", DbType.String, model.FMID); db.AddInParameter(dbCommand, "PROJECTID", DbType.String, model.PROJECTID); db.AddInParameter(dbCommand, "COMPANYID", DbType.String, model.COMPANYID); db.AddInParameter(dbCommand, "CFNAME", DbType.String, model.CFNAME); db.AddInParameter(dbCommand, "CFANOTHERNAME", DbType.String, model.CFANOTHERNAME); db.AddInParameter(dbCommand, "CFPAGEURL", DbType.String, model.CFPAGEURL); db.AddInParameter(dbCommand, "CFPARENTID", DbType.String, model.CFPARENTID); db.AddInParameter(dbCommand, "CFSORTNUM", DbType.String, model.CFSORTNUM); db.AddInParameter(dbCommand, "CFSTEP", DbType.String, model.CFSTEP); db.AddInParameter(dbCommand, "CFISLAST", DbType.String, model.CFISLAST); db.AddInParameter(dbCommand, "CFDESC", DbType.String, model.CFDESC); db.AddInParameter(dbCommand, "CFSTATUS", DbType.String, model.CFSTATUS); return(db.ExecuteNonQuery(dbCommand) > 0); }