Esempio n. 1
0
        public ActionResult AddDataOperations(OperationsModels entity)
        {
            entity.OpenId          = TempData["operationsopenId"].ToString();
            entity.SafetySecretKey = PluginCore.GetInstance.SafetySecretValue;
            entity.IsUsable        = true;
            var result = IocPlugin.IocAddDataOperationsPlugin.AddDataOperations(entity);

            return(Json(result));
        }
Esempio n. 2
0
        public BaseResult AddDataOperations(OperationsModels entity)
        {
            this.SafetySecretKey = entity.SafetySecretKey;
            this.Usable          = entity.IsUsable ? BasePluginType.Type.启用 : BasePluginType.Type.卸载;
            var result = new BaseResult()
            {
                Code    = (int)EnumCore.CodeType.失败,
                Message = "系统错误",
            };

            if (string.IsNullOrWhiteSpace(this.SafetySecretKey) || this.Usable == BasePluginType.Type.卸载 || PluginCore.GetInstance.VerifySafetySecretKey(this.SafetySecretKey))
            {
                return(result);
            }
            if (MenuManager.GetInstance.AddAndUpOperations(entity, out string message))
            {
                result.Code = (int)EnumCore.CodeType.成功;
            }
            result.Message = message;
            return(result);
        }
        /// <summary>
        /// 添加/修改
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public bool AddAndUpOperations(OperationsModels entity, out string message)
        {
            message      = "系统错误";
            entity.UTime = DateTime.Now;
            if (string.IsNullOrWhiteSpace(entity.OperationTitle))
            {
                message = "名称错误";
                return(false);
            }
            if (string.IsNullOrWhiteSpace(entity.OpenId))
            {
                entity.CTime     = DateTime.Now;
                entity.IsDeleted = false;
                entity.OpenId    = Guid.NewGuid().ToString();
                entity.Remark    = "图标数据";
                if (IocRepository.IocOperationsRepository.InsertBool(entity))
                {
                    message = "添加成功";
                    return(true);
                }
                return(false);
            }
            var upEntity = GetOperationsModel(entity.OpenId) ?? new OperationsModels();

            if (string.IsNullOrWhiteSpace(upEntity.OpenId))
            {
                return(false);
            }
            upEntity.OperationTitle = entity.OperationTitle;
            upEntity.UTime          = entity.UTime;
            if (IocRepository.IocOperationsRepository.Update(upEntity) > 0)
            {
                message = "修改成功";
                return(true);
            }
            return(false);
        }
 public int Delete(OperationsModels entity)
 {
     return(DBCore.Deleteable(entity).With(SqlWith.RowLock).ExecuteCommand());
 }
 public int Update(OperationsModels entity)
 {
     return(DBCore.Updateable(entity).With(SqlWith.UpdLock).Where(true).ExecuteCommand());
 }
 public bool InsertBool(OperationsModels entity)
 {
     return(DBCore.Insertable(entity).With(SqlWith.UpdLock).ExecuteCommandIdentityIntoEntity());
 }
 public OperationsModels InsertEntity(OperationsModels entity)
 {
     return(DBCore.Insertable(entity).With(SqlWith.UpdLock).ExecuteReturnEntity());
 }
 public long InsertLong(OperationsModels entity)
 {
     return(DBCore.Insertable(entity).With(SqlWith.UpdLock).ExecuteReturnBigIdentity());
 }
 public int InsertInt(OperationsModels entity)
 {
     return(DBCore.Insertable(entity).With(SqlWith.UpdLock).ExecuteCommand());
 }