/// <summary> /// 批量添加 /// </summary> public bool Add(XCLCMS.Data.CommonHelper.EnumType.ObjectTypeEnum objectType, long objectID, List <long> attachmentIDList, XCLCMS.Data.Model.Custom.ContextModel context = null) { if (null == attachmentIDList || attachmentIDList.Count == 0) { return(true); } attachmentIDList = attachmentIDList.Distinct().ToList(); DateTime dtNow = DateTime.Now; var lst = new List <XCLCMS.Data.Model.ObjectAttachment>(); attachmentIDList.ForEach(id => { var model = new XCLCMS.Data.Model.ObjectAttachment(); if (null != context) { model.CreaterID = context.UserInfoID; model.CreaterName = context.UserName; model.UpdaterID = context.UserInfoID; model.UpdaterName = context.UserName; } model.CreateTime = dtNow; model.UpdateTime = dtNow; model.FK_AttachmentID = id; model.FK_ObjectID = objectID; model.ObjectType = objectType.ToString(); model.RecordState = XCLCMS.Data.CommonHelper.EnumType.RecordStateEnum.N.ToString(); lst.Add(model); }); return(this.Add(lst)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(XCLCMS.Data.Model.ObjectAttachment model) { Database db = base.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("sp_ObjectAttachment_ADD"); db.AddInParameter(dbCommand, "ObjectType", DbType.AnsiString, model.ObjectType); db.AddInParameter(dbCommand, "FK_ObjectID", DbType.Int64, model.FK_ObjectID); db.AddInParameter(dbCommand, "FK_AttachmentID", DbType.Int64, model.FK_AttachmentID); db.AddInParameter(dbCommand, "RecordState", DbType.AnsiString, model.RecordState); db.AddInParameter(dbCommand, "CreateTime", DbType.DateTime, model.CreateTime); db.AddInParameter(dbCommand, "CreaterID", DbType.Int64, model.CreaterID); db.AddInParameter(dbCommand, "CreaterName", DbType.String, model.CreaterName); db.AddInParameter(dbCommand, "UpdateTime", DbType.DateTime, model.UpdateTime); db.AddInParameter(dbCommand, "UpdaterID", DbType.Int64, model.UpdaterID); db.AddInParameter(dbCommand, "UpdaterName", DbType.String, model.UpdaterName); db.AddOutParameter(dbCommand, "ResultCode", DbType.Int32, 4); db.AddOutParameter(dbCommand, "ResultMessage", DbType.String, 1000); db.ExecuteNonQuery(dbCommand); var result = XCLCMS.Data.DAL.Common.Common.GetProcedureResult(dbCommand.Parameters); if (result.IsSuccess) { return(true); } else { throw new Exception(result.ResultMessage); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(XCLCMS.Data.Model.ObjectAttachment model) { return dal.Add(model); }