Exemplo n.º 1
0
        /// <summary>
        /// Delete a user
        /// </summary>
        /// <param name="user">User Model</param>
        /// <returns></returns>
        public CommandResult deleteUser(Entity.GasStation.User user)
        {
            CommandResult result;

            if (null != user)
            {
                result = BaseDAL.DBaseHelper.executeCommand(BaseDAL.Base.EnumExecuteType.procedureReader, connection, C_spUserDelete, true,
                                                            new KeyValuePair("@userId", user.id)
                                                            );
            }
            else
            {
                result = CommandResult.makeNullDataResult();
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create service user
        /// </summary>
        /// <param name="user">User Model</param>
        /// <returns></returns>
        public CommandResult createServiceUser()
        {
            CommandResult result;

            Common.BLL.Entity.GasStation.User user = new Entity.GasStation.User()
            {
                name     = "Service",
                lastname = "",
                username = C_SERVICE_USER,
                password = @"$3r\/Ic3U53R",
                inserted = DateTime.Now,
                enable   = 1
            };
            result       = create(user);
            result.model = user;

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// get service user
        /// </summary>
        /// <param name="user">User Model</param>
        /// <returns></returns>
        public CommandResult getServiceUser()
        {
            CommandResult result;

            Common.BLL.Entity.GasStation.User user = new Entity.GasStation.User()
            {
                username = C_SERVICE_USER
            };
            result = read(user, "username");

            if (user.id == 0)
            {
                result = createServiceUser();
            }
            else
            {
                result.model = user;
            }

            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Insert or Read tag
        /// </summary>
        /// <param name="tag"></param>
        /// <returns></returns>
        public CommandResult insertOrReadTag(Entity.GasStation.Tag tag, Entity.GasStation.User user)
        {
            CommandResult result = null;

            if (null != tag)
            {
                result = read(tag, "tag");

                if (tag.id == 0)
                {
                    tag.insertedById = user.id;
                    tag.insertDate   = DateTime.Now;
                    result           = create(tag);
                }
            }
            else
            {
                result = CommandResult.makeNullDataResult();
            }

            return(result);
        }