예제 #1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public bool Add(XCLCMS.Data.Model.KeyValueInfoType model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("sp_KeyValueInfoType_ADD");

            db.AddInParameter(dbCommand, "FK_KeyValueInfoID", DbType.Int64, model.FK_KeyValueInfoID);
            db.AddInParameter(dbCommand, "FK_TypeID", DbType.Int64, model.FK_TypeID);
            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);
            }
        }
예제 #2
0
        /// <summary>
        /// 批量添加
        /// </summary>
        public bool Add(long keyValueInfoID, List <long> keyValueInfoTypeIDList, XCLCMS.Data.Model.Custom.ContextModel context = null)
        {
            if (null == keyValueInfoTypeIDList || keyValueInfoTypeIDList.Count == 0)
            {
                return(true);
            }
            keyValueInfoTypeIDList = keyValueInfoTypeIDList.Distinct().ToList();

            DateTime dtNow = DateTime.Now;
            var      lst   = new List <XCLCMS.Data.Model.KeyValueInfoType>();

            keyValueInfoTypeIDList.ForEach(id =>
            {
                var model = new XCLCMS.Data.Model.KeyValueInfoType();
                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_TypeID         = id;
                model.FK_KeyValueInfoID = keyValueInfoID;
                model.RecordState       = XCLCMS.Data.CommonHelper.EnumType.RecordStateEnum.N.ToString();
                lst.Add(model);
            });

            return(this.Add(lst));
        }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(XCLCMS.Data.Model.KeyValueInfoType model)
 {
     return(dal.Add(model));
 }