public override async Task SetChannel()
        {
            var teamBusiness = new TeamBusiness();

            SetTeamChannel();

            teamBusiness.Edit(Team);
            await PostMessage(GetSlackExecutionSuccessMessage());
        }
        /// <summary>
        /// scope= set:settings
        /// cmd= 'set currency @p0'.
        /// @p0 parameter for desired currency
        /// </summary>
        /// <returns></returns>
        public override async Task SetCurrency()
        {
            int parameterCount = 1;
            var parameterSet   = new List <CommandParameter>
            {
                new CommandParameter
                {
                    Depth          = 2,
                    ParameterValue = Parameters[0].ToLower(),
                    ParameterSet   = new List <string>
                    {
                        "tl",
                        "usd",
                        "$"
                    }
                }
            };

            var validateResp = ValidateParameters(parameterSet, parameterCount);

            if (validateResp.ResponseCode != ResponseCode.Success)
            {
                await PostMessage(GetSlackExecutionErrorMessage(validateResp.ResponseData));

                return;
            }

            var teamBusiness = new TeamBusiness();

            var currency = Statics.GetMainCurrency(Parameters[0]);

            if (currency == MainCurrency.Unknown)
            {
                await PostMessage(GetSlackExecutionErrorMessage(3));

                return;
            }

            Team.MainCurrency = currency;

            teamBusiness.Edit(Team);
            await PostMessage(GetSlackExecutionSuccessMessage());
        }
        /// <summary>
        /// scope= set:settings
        /// cmd= 'set lang @p0'
        /// </summary>
        /// <returns></returns>
        public override async Task SetLanguage()
        {
            int parameterCount = 1;
            var parameterSet   = new List <CommandParameter>
            {
                new CommandParameter
                {
                    Depth          = 2,
                    ParameterValue = Parameters[0].ToLower(),
                    ParameterSet   = new List <string>
                    {
                        "en",
                        "tr"
                    }
                }
            };

            var validateResp = ValidateParameters(parameterSet, parameterCount);

            if (validateResp.ResponseCode != ResponseCode.Success)
            {
                await PostMessage(GetSlackExecutionErrorMessage(validateResp.ResponseData));

                return;
            }

            var teamBusiness = new TeamBusiness();

            var lang = Statics.GetLanguage(Parameters[0]);

            if (lang == Language.Unknown)
            {
                await PostMessage(GetSlackExecutionErrorMessage(3));

                return;
            }


            SetTeamLanguage(lang);

            teamBusiness.Edit(Team);
            await PostMessage(GetSlackExecutionSuccessMessage());
        }
Esempio n. 4
0
 private void EditSlackTeam(Dto.Team team)
 {
     _teamBusiness.Edit(team);
 }