/// <summary> /// 修改 (可能有其他业务逻辑检查) /// </summary> /// <param name="model"></param> /// <returns></returns> public ResultInfo Update(SoftLinkType model) { ResultInfo ri = new ResultInfo(); if (Edit(model)) { ri.Ok = true; ri.Msg = "修改成功"; } return(ri); }
/// <summary> /// 保存 (可能有其他业务逻辑检查) /// </summary> /// <param name="model">实体</param> /// <returns></returns> public ResultInfo Create(SoftLinkType model) { ResultInfo ri = new ResultInfo(); if (model == null) { return(ri); } int result = Add(model); if (result > 0) { ri.Ok = true; ri.Msg = "添加成功"; } return(ri); }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Update(SoftLinkType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SoftLinkType set "); strSql.Append("SoftLinkTypeName=@SoftLinkTypeName,SoftLinkColor=@SoftLinkColor,SoftLinkLogo=@SoftLinkLogo,CreateUser=@CreateUser,CreateTime=@CreateTime,IsDelete=@IsDelete"); strSql.Append(" where SoftLinkTypeID=@SoftLinkTypeID"); SqlParameter[] parameters = { new SqlParameter("@SoftLinkTypeName", model.SoftLinkTypeName), new SqlParameter("@SoftLinkColor", model.SoftLinkColor), new SqlParameter("@SoftLinkLogo", model.SoftLinkLogo), new SqlParameter("@CreateUser", model.CreateUser), new SqlParameter("@CreateTime", model.CreateTime), new SqlParameter("@IsDelete", model.IsDelete), new SqlParameter("@SoftLinkTypeID", model.SoftLinkTypeID) }; return(SqlHelper.ExecuteSql(strSql.ToString(), CommandType.Text, parameters) > 0); }
/// <summary> /// 添加一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Add(SoftLinkType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SoftLinkType("); strSql.Append(" SoftLinkTypeName,SoftLinkColor,SoftLinkLogo,CreateUser,CreateTime,IsDelete )"); strSql.Append(" values ("); strSql.Append("@SoftLinkTypeName,@SoftLinkColor,@SoftLinkLogo,@CreateUser,@CreateTime,@IsDelete)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@SoftLinkTypeName", model.SoftLinkTypeName), new SqlParameter("@SoftLinkColor", model.SoftLinkColor), new SqlParameter("@SoftLinkLogo", model.SoftLinkLogo), new SqlParameter("@CreateUser", model.CreateUser), new SqlParameter("@CreateTime", model.CreateTime), new SqlParameter("@IsDelete", model.IsDelete), }; object obj = SqlHelper.GetSingle(strSql.ToString(), CommandType.Text, parameters); return(obj == null ? 0 : Convert.ToInt32(obj)); }
/// <summary> /// 修改一条记录 /// </summary> /// <param name="model">实体对象</param> /// <returns></returns> public bool Edit(SoftLinkType model) { return(dal.Update(model)); }
/// <summary> /// 添加一条记录,没有任何逻辑 /// </summary> /// <param name="model">实体对象</param> /// <returns></returns> public int Add(SoftLinkType model) { return(dal.Add(model)); }