示例#1
0
//		public FlowDirect CurrentDirect = FlowDirect.WaitingOutPut;
//
//		public void Add(BaseDCTAction action)
//		{
//			if(alWorkingAction.Count < 1)
//			{
//				this.alWorkingAction.Add(action);
//			}
//		}
//
        public override void Login()
        {
            this.WorkingActionList.Clear();
            ActionUser action = new ActionUser();

            this.WorkingActionList.Add(action);
        }
示例#2
0
        //logon mes
        protected override void Login()
        {
            BaseDCTAction action = stack.GetNextAction();

            if (stack.CurrentDirect == FlowDirect.WaitingOutput)
            {
                if (action == null)
                {
                    action = new ActionUser();
                    stack.Add(action);
                }


                try
                {
                    stack.SendMessage(client, action.Do(client), "");

                    //stack.CurrentDirect = action.FlowDirect;
                }
                catch (Exception ex)
                {
                    UserControl.Messages msg = new UserControl.Messages();
                    msg.Add(new UserControl.Message(ex));
                    stack.SendMessage(client, msg, "");
                }
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            ActionUser  actionUser  = new ActionUser();
            ActionAdmin actionAdmin = new ActionAdmin();

            while (true)
            {
                Console.Clear();
                Console.WriteLine("Selamat Datang di Covinfo, silakan pilih menu");
                Console.WriteLine("\nMenu: ");
                Console.WriteLine("1. Lihat Kasus Covid-19");
                Console.WriteLine("2. CovBot (Bot informasi Covid-19)");
                Console.WriteLine(!ActionAdmin.AdminStatus ? "3. Masuk sebagai admin" : "3. Menu admin");
                Console.WriteLine("4. exit");
                Console.Write("\nPilihan: ");

                try {
                    int choose = int.Parse(Console.ReadLine());
                    switch (choose)
                    {
                    case 1:
                        Console.Clear();
                        actionUser.GetCovid().Wait();
                        MenuCovid();
                        break;

                    case 2:
                        Console.Clear();
                        actionUser.Bot();
                        break;

                    case 3:
                        if (!ActionAdmin.AdminStatus)
                        {
                            actionAdmin.LoginAdmin();
                        }
                        else
                        {
                            MenuAdmin();
                        }
                        break;

                    case 4:
                        goto exit;

                    default:
                        Console.WriteLine("Harap pilih menu yang tersedia");
                        Console.ReadLine();
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.ReadLine();
                }
            }
            exit :;
        }
        public IActionResult Get(long id)
        {
            ActionUser actions = _actionRepository.Get(id);

            if (actions == null)
            {
                return(NotFound("Não foi possível encontrar comando."));
            }

            return(Ok(actions));
        }
        public IActionResult Delete(long id)
        {
            ActionUser action = _actionRepository.Get(id);

            if (action == null)
            {
                return(NotFound("Nenhum comando encontrado."));
            }

            _actionRepository.Delete(action);
            return(NoContent());
        }
        public IActionResult Post([FromBody] ActionUser action)
        {
            if (action == null)
            {
                return(BadRequest("Nenhum comando encontrado."));
            }

            _actionRepository.Add(action);
            return(CreatedAtRoute(
                       "Get",
                       new { Id = action.IdAction },
                       action));
        }
示例#7
0
        public static void MenuCovid()
        {
            ActionUser actionUser = new ActionUser();

            while (true)
            {
                Console.WriteLine("Menu: ");
                Console.WriteLine("1. Lihat negara lain");
                Console.WriteLine("2. Bandingkan negara");
                Console.WriteLine("3. Kembali ke menu utama");
                Console.Write("Pilihan: ");

                try
                {
                    int choose = int.Parse(Console.ReadLine());
                    switch (choose)
                    {
                    case 1:
                        actionUser.GetSpecificCovid().Wait();
                        break;

                    case 2:
                        actionUser.CompareCovid().Wait();
                        break;

                    case 3:
                        goto exit;

                    default:
                        Console.WriteLine("Harap pilih menu yang tersedia");
                        _ = Console.ReadLine();
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            exit :;
        }