public async Task CommandHandler_BuisnessRegistrationKorporativ(long chatid, string message, MessageEventArgs messageObject)
        {
            if (provider.userService == null)
            {
                await client.SendTextMessageAsync(chatid, "strange");
            }
            int currentStep = await provider.userService.GetCurrentActionStep(chatid);

            UserDTO user = await provider.userService.FindById(chatid);

            DronDTO dron = new DronDTO();

            if (currentStep == 1)
            {
                if (user == null)
                {
                    await provider.userService.AuthenticateUser(chatid);
                }
                user.FIO = message;
                await provider.userService.Update(user);

                await provider.userService.ChangeAction(chatid, "Корпоративная бизнесс-регистрация", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Введите номер телефона");

                return;
            }

            if (currentStep == 2)
            {
                if (RegularExpression.IsTelephoneCorrect(message))
                {
                    user.Phone           = message;
                    user.BuisnesPrivilag = 1;
                    await provider.userService.Update(user);

                    await provider.userService.ChangeAction(chatid, "NULL", 0);

                    await client.SendTextMessageAsync(chatid, "Вы успешно зарегистрировались", 0, false, false, 0, KeyBoardHandler.Murkup_BuisnessmanMenu());

                    await provider.managerPush.SendMessage(client, chatid);

                    return;
                }
                else
                {
                    await client.SendTextMessageAsync(chatid, "Вы ввели некорректный телефон,попробуйте еще раз");
                }
            }
        }
Beispiel #2
0
        public async Task CommandHandler_BuisnessRegistrationKorporativ(long chatid, string message, MessageEventArgs messageObject)
        {
            if (provider.userService == null)
            {
                await client.SendTextMessageAsync(chatid, "strange");
            }

            int currentStep = await provider.userService.GetCurrentActionStep(chatid);

            UserDTO user = await provider.userService.FindById(chatid);

            DronDTO dron = new DronDTO();

            if (currentStep == 1)
            {
                user.FIO = message;
                await provider.userService.Update(user);

                await provider.userService.ChangeAction(chatid, "Corporate registration", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Your telephone number");

                return;
            }

            if (currentStep == 2)
            {
                if (RegularExpression.IsTelephoneCorrect(message))
                {
                    user.Phone             = message;
                    user.BusinessPrivilage = 1;
                    await provider.userService.Update(user);

                    await provider.userService.ChangeAction(chatid, "NULL", 0);

                    await client.SendTextMessageAsync(chatid, "Registered", 0, false, false, 0, KeyboardHandler.Markup_BuisnessmanMenu());

                    await provider.managerPush.SendMessage(client, chatid);

                    return;
                }
                else
                {
                    await client.SendTextMessageAsync(chatid, "Wrong telephone number");
                }
            }
        }
 public async Task Create(DronDTO dron)
 {
     await dronRepository.Create(dron);
 }
Beispiel #4
0
        public async Task CommandHandler_PaidRegistrationWithoutInsurance(UserDTO user, string message, MessageEventArgs messageObject)
        {
            long chatid      = user.ChatId;
            int  currentStep = await provider.userService.GetCurrentActionStep(chatid);

            DronDTO     dron     = new DronDTO();
            ProposalDTO proposal = await provider.proposalService.FindById(chatid);

            if (currentStep == 1)
            {
                user.FIO = message;
                await provider.userService.Update(user);

                await provider.userService.ChangeAction(chatid, "Платная регистрация без страховки", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Введите мобильный телефон");

                return;
            }
            if (currentStep == 2)
            {
                if (RegularExpression.IsTelephoneCorrect(message))
                {
                    user.Phone = message;
                    await provider.userService.Update(user);

                    await provider.userService.ChangeAction(chatid, "Платная регистрация без страховки", ++currentStep);

                    await client.SendTextMessageAsync(chatid, "Введите марку дрона");

                    return;
                }
                else
                {
                    await client.SendTextMessageAsync(chatid, "Вы ввели некорректный телефон.Попробуйте еще раз");
                }
            }
            if (currentStep == 3)
            {
                dron.Mark = message;
                await provider.dronService.Create(dron);

                await provider.userService.ChangeAction(chatid, "Платная регистрация без страховки", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Введите адрес");

                return;
            }
            if (currentStep == 4)
            {
                await provider.proposalService.Create(user);

                proposal.Adress = message;
                await provider.proposalService.Update(proposal);

                await provider.userService.ChangeAction(chatid, "Платная регистрация без страховки", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Сбросьте вашу геолокацию");

                return;
            }
            if (currentStep == 5)
            {
                if (messageObject.Message.Location != null)
                {
                    proposal.longtitude = messageObject.Message.Location.Longitude;
                    proposal.latitude   = messageObject.Message.Location.Latitude;
                    string realAdres = await GeolocateHandler.GetAddressFromCordinat(proposal.longtitude, proposal.latitude);

                    proposal.Region     = GetGeolocateRegion.GetRegion(realAdres);
                    proposal.RealAdress = realAdres;
                    await provider.proposalService.Update(proposal);

                    await provider.proposeHandler.ChangeProposeCount();

                    user.PilotPrivilag = 1;
                    await provider.userService.Update(user);

                    await provider.adminPush.MessageAboutRegistrationPilot(client, provider, chatid);
                }
            }
        }
Beispiel #5
0
        public async Task CommandHandler_PaidRegistrationWithInsurance(UserDTO user, string message, MessageEventArgs messageObject = null)
        {
            long chatid      = user.ChatId;
            int  currentStep = await provider.userService.GetCurrentActionStep(chatid);

            DronDTO     dron     = new DronDTO();
            ProposalDTO proposal = await provider.proposalService.FindById(chatid);

            if (currentStep == 1)
            {
                user.FIO = message;
                await provider.userService.Update(user);

                await provider.userService.ChangeAction(chatid, "Платная регистрация со страховкой", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Введите телефон");

                return;
            }

            if (currentStep == 2)
            {
                if (RegularExpression.IsTelephoneCorrect(message))
                {
                    await provider.proposalService.Create(user);

                    user.Phone = message;
                    await provider.userService.Update(user);

                    await provider.userService.ChangeAction(chatid, "Платная регистрация со страховкой", ++currentStep);

                    await client.SendTextMessageAsync(chatid, "Введите марку дрона");

                    return;
                }
                else
                {
                    await client.SendTextMessageAsync(chatid, "Вы ввели некорректный телефон,попробуйте еще раз");

                    return;
                }
            }
            if (currentStep == 3)
            {
                dron.Mark = message;
                await provider.dronService.Create(dron);

                await provider.userService.ChangeAction(chatid, "Платная регистрация со страховкой", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Введите тип страховки");

                return;
            }
            if (currentStep == 4)
            {
                proposal.TypeOfInsurance = message;
                await provider.proposalService.Update(proposal);

                await provider.userService.ChangeAction(chatid, "Платная регистрация со страховкой", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Введите адрес");

                return;
            }
            if (currentStep == 5)
            {
                proposal.Adress = message;
                await provider.proposalService.Update(proposal);

                await provider.userService.ChangeAction(chatid, "Платная регистрация со страховкой", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Сбросьте вашу геопозицию");

                return;
            }
            if (currentStep == 6)
            {
                if (messageObject.Message.Location != null)
                {
                    proposal.longtitude = messageObject.Message.Location.Longitude;
                    proposal.latitude   = messageObject.Message.Location.Latitude;
                    string realAdres = await GeolocateHandler.GetAddressFromCordinat(proposal.longtitude, proposal.latitude);

                    proposal.Region     = GetGeolocateRegion.GetRegion(realAdres);
                    proposal.RealAdress = realAdres;
                    await provider.proposalService.Update(proposal);

                    await client.SendTextMessageAsync(chatid, "Ожидаем оплату,если все нормально - кидаем клаву с этими кнопками и если все оплатил кидаем в админ-уведомление"
                                                      , 0, false, false, 0, KeyBoardHandler.PilotWithSubscribe_Murkup());

                    await provider.proposeHandler.ChangeProposeCount();

                    user.PilotPrivilag = 2;
                    await provider.userService.Update(user);

                    await provider.adminPush.MessageAboutRegistrationPilot(client, provider, chatid);

                    await provider.userService.ChangeAction(chatid, "NULL", 0);

                    // можно считать человека зарегистрированым только после оплаты , и определяем насколько он крут в плане полномочий
                    string region = GetGeolocateRegion.GetRegion(realAdres);
                    await provider.regionService.Create(region);

                    await client.SendTextMessageAsync(chatid, "Вы успешно зарегистрировались");

                    return;
                }
            }
        }
Beispiel #6
0
        private async Task CommandHandler_PaidRegistrationWithoutInsurance(UserDTO user, string message, MessageEventArgs messageObject)
        {
            long chatid      = user.ChatId;
            int  currentStep = await provider.userService.GetCurrentActionStep(chatid);

            DronDTO     dron     = new DronDTO();
            ProposalDTO proposal = await provider.proposalService.FindById(chatid);

            if (currentStep == 1)
            {
                user.FIO = message;
                await provider.userService.Update(user);

                await provider.userService.ChangeAction(chatid, "Paid registarion w/o insurance", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Enter mobile phone number");

                return;
            }

            if (currentStep == 2)
            {
                if (RegularExpression.IsTelephoneCorrect(message))
                {
                    user.Phone = message;
                    await provider.userService.Update(user);

                    await provider.userService.ChangeAction(chatid, "Paid registarion w/o insurance", ++currentStep);

                    await client.SendTextMessageAsync(chatid, "Enter drone type");

                    return;
                }
                else
                {
                    await client.SendTextMessageAsync(chatid, "Wrong telephone number. Try again");
                }
            }

            if (currentStep == 3)
            {
                dron.Mark = message;
                await provider.dronService.Create(dron);

                await provider.userService.ChangeAction(chatid, "Paid registarion w/o insurance", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Enter your address");

                return;
            }

            if (currentStep == 4)
            {
                await provider.proposalService.Create(user);

                proposal.Address = message;
                await provider.proposalService.Update(proposal);

                await provider.userService.ChangeAction(chatid, "Paid registarion w/o insurance", ++currentStep);

                await client.SendTextMessageAsync(chatid, "Your geolocation");

                return;
            }

            if (currentStep == 5)
            {
                if (messageObject.Message.Location != null)
                {
                    proposal.longtitude = messageObject.Message.Location.Longitude;
                    proposal.latitude   = messageObject.Message.Location.Latitude;

                    string realAdres = await GeolocateHandler.GetAddressFromCordinat(proposal.longtitude, proposal.latitude);

                    proposal.Region      = GetGeolocateRegion.GetRegion(realAdres);
                    proposal.RealAddress = realAdres;

                    await provider.proposalService.Update(proposal);

                    await provider.proposeHandler.ChangeProposeCount();

                    user.PilotPrivilage = 1;

                    await provider.userService.Update(user);

                    await provider.adminPush.MessageAboutRegistrationPilot(client, provider, chatid);
                }
            }
        }