예제 #1
0
파일: Login.cs 프로젝트: NP-coder/Fitness
        public void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string name   = nameField.Text;
                string gender = comboBox1.SelectedItem.ToString();
                int    age    = int.Parse(ageField.Text);
                double weight = double.Parse(weightField.Text);
                double height = double.Parse(heightField.Text);

                userController = new UserControler(name, "Users");


                if (userController.NewUser == true && age > 0 && age < 150 && weight > 0 && weight < 400 && height > 0 && height < 300)
                {
                    userController.SetNewUserData(name, gender, age, weight, height);
                    this.Hide();
                    main mainform = new main(this);
                    mainform.Owner = this;
                    mainform.Show();
                }
                else
                {
                    MessageBox.Show("Користувач з таким іменем вже існує", "Помилка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                MessageBox.Show("Введені некоректні дані", "Помилка", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
            }
        }
예제 #2
0
        private void SetStatus()
        {
            Status status = UserControler.GetStatus(_slackAdapter, _slackAdapter.CurrentUser);

            if (status != null && status.Presence != null)
            {
                switch (status.Presence)
                {
                case "active":
                    pictureBoxStatus.Image = status.Last_Activity == null ? imageListStatus.Images[imageListStatus.Images.IndexOfKey("connected")] : imageListStatus.Images[imageListStatus.Images.IndexOfKey("disconnected")];
                    break;

                case "away":
                    pictureBoxStatus.Image = imageListStatus.Images[imageListStatus.Images.IndexOfKey("disconnected")];
                    break;

                default:
                    pictureBoxStatus.Image = imageListStatus.Images[imageListStatus.Images.IndexOfKey("unknow")];
                    break;
                }
            }
            else
            {
                pictureBoxStatus.Image = imageListStatus.Images[imageListStatus.Images.IndexOfKey("unknow")];
            }
        }
예제 #3
0
        public main(Login login)
        {
            InitializeComponent();

            usercontroler = login.userController;
            username.Text = usercontroler.CurrentUser.Name;
        }
        private void FindUser()
        {
            SearchUserResult searchUserResult = UserControler.SearchUser(FindUserUsername);

            if (searchUserResult.Success && searchUserResult.UserFound != null)
            {
                FindedUser = searchUserResult.UserFound;
            }
        }
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("More than one of instance of UserControler found!");
         return;
     }
     instance = this;
 }
예제 #6
0
        public void LoadData()
        {
            _channels = ChannelsControler.List(this);
            _channels.AddRange(GroupControler.List(this));
            _channels.AddRange(ImControler.List(this));
            _users = UserControler.List(this);
            _team  = TeamControler.Info(this);

            InitRtm();
        }
예제 #7
0
        private void Init()
        {
            _currentUser     = UserControler.GetProfile(this);
            _channels        = new List <Channel>();
            _users           = new List <Member>();
            _currentMessages = new List <SlackMessage>();

            _slackRtm          = new SlackRtm();
            _slackRtm.OnEvent += Instance_OnEvent1;
            _slackRtm.OnAck   += Instance_OnAck;

            LoadData();
        }
예제 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Your name:");
            var name = Console.ReadLine();

            var userController    = new UserControler(name);
            var eatingController  = new EatControl(userController.CurrentUser);
            var exerciseControler = new ExerciseControl(userController.CurrentUser);

            if (userController.NewUser)
            {
                Console.WriteLine("Gender:");
                var gender = Console.ReadLine();
                var birth  = ParseDateTime("Birth");
                var weight = ParseDouble("weight");
                var height = ParseDouble("height");

                userController.SetNewUserData(gender, birth, weight, height);
            }

            Console.WriteLine(userController.CurrentUser);

            Console.WriteLine("Press E - for eating");
            Console.WriteLine("Press A - for exercise");
            var key = Console.ReadKey();

            switch (key.Key)
            {
            case ConsoleKey.E:
                var foods = EnterEating();
                eatingController.Add(foods.Food, foods.Weight);

                foreach (var item in eatingController.Eating.Foods)
                {
                    Console.WriteLine($"\t{item.Key} - {item.Value}");
                }
                break;

            case ConsoleKey.A:
                var exe = EnterExercise();
                exerciseControler.Add(exe.Activity, exe.Begin, exe.End);
                foreach (var item in exerciseControler.Exercises)
                {
                    Console.WriteLine($"\t{item.Activity} from {item.Start} to {item.Finish}");
                }
                break;
            }
            Console.ReadLine();
        }
예제 #9
0
파일: Login.cs 프로젝트: NP-coder/Fitness
        public void button2_Click(object sender, EventArgs e)
        {
            string name = nameField2.Text;

            userController = new UserControler(name, "Users");

            if (userController.NewUser == false)
            {
                this.Hide();
                main mainform = new main(this);
                mainform.Show();
            }
            else
            {
                MessageBox.Show("Користувача з таким іменем не існує", "Помилка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #10
0
        private void LoadUsers()
        {
            try
            {
                Status   connected;
                TreeNode tn;
                if (_tmpTnUsers == null)
                {
                    _tmpTnUsers = new TreeView();
                }
                _tmpTnUsers.Nodes.Clear();
                if (SlackAdapter.Users != null)
                {
                    TreeNode root = _tmpTnUsers.Nodes.Add("Members");
                    root.ImageIndex = -1;
                    root.ImageKey   = null;
                    foreach (Member item in SlackAdapter.Users)
                    {
                        connected = UserControler.GetStatus(_slackAdapter, item);
                        tn        = new TreeNode(item.Name);
                        tn.Tag    = item;
                        switch (connected.Presence)
                        {
                        case "active":
                            tn.ImageKey = connected.Last_Activity == null ? "connected" : "unactive";
                            break;

                        case "away":
                            tn.ImageKey = "disconnected";
                            break;

                        default:
                            tn.ImageKey = "unknow";
                            break;
                        }
                        tn.ImageIndex = imageListStatus.Images.IndexOfKey(tn.ImageKey);
                        root.Nodes.Add(tn);
                    }
                    root.ExpandAll();
                }
            }
            catch (Exception exp)
            {
            }
        }
예제 #11
0
        public void button2_Click(object sender, EventArgs e)
        {
            try
            {
                string name = nameField2.Text;
                userController = new UserControler(name, "Users");

                if (userController.NewUser == false)
                {
                    this.Hide();
                    main mainform = new main(this);
                    mainform.Show();
                }
                else
                {
                    MessageBox.Show("Користувача з таким іменем не існує", "Помилка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                MessageBox.Show("Введені некоректні дані", "Помилка", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
            }
        }
 public static InfoObject setCurrBaord(string email, String currBoardName)
 {
     return(UserControler.setCurrBaord(email, currBoardName));
 }
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(62, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 5 "D:\itea\homework\webregistration\lasthomework\Pages\Registration.cshtml"

            if (HttpContext.Request.Method == "POST")
            {
                string        login      = Request.Form["login"];
                string        password   = Request.Form["password"];
                string        repassword = Request.Form["repassword"];
                string        name       = Request.Form["name"];
                string        address    = Request.Form["address"];
                string        age        = Request.Form["age"];
                string        sex        = Request.Form["sex"];
                UserControler uc         = new UserControler();
                string        result     = uc.AddUser(login, password, repassword, name, address, age, sex);

#line default
#line hidden
                BeginContext(601, 12, true);
                WriteLiteral("        <h2>");
                EndContext();
                BeginContext(614, 6, false);
#line 17 "D:\itea\homework\webregistration\lasthomework\Pages\Registration.cshtml"
                Write(result);

#line default
#line hidden
                EndContext();
                BeginContext(620, 7, true);
                WriteLiteral("</h2>\r\n");
                EndContext();
#line 18 "D:\itea\homework\webregistration\lasthomework\Pages\Registration.cshtml"
            }

#line default
#line hidden
            BeginContext(637, 119, true);
            WriteLiteral("<div class=\"profile\">\r\n    <h1>REGISTRATION FORM</h1>\r\n    <h3>Use this form to registration in DATABASE</h3>\r\n</div>\r\n");
            EndContext();
            BeginContext(756, 1265, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "09196b07ed734e18991296c36ef3b9ca", async() => {
                BeginContext(786, 1228, true);
                WriteLiteral(@"
    <div>
        <label for=""login"">Login (email)</label>
        <input type=""email"" name=""login"" autofocus required>
    </div>
    <div>
        <label for=""password"">Password</label>
        <input type=""password"" class =""pass"" name=""password"" autofocus required>
    </div>
    <div>
        <label for=""repassword"">RePassword</label>
        <input type=""password"" name=""repassword"" autofocus required>
    </div>
        
    <div>
        <label for=""name"">Name</label>
        <input type=""text"" name=""name"" autofocus required>
    </div>
    <div>
        <label for=""address"">Address</label>
        <input type=""text"" name=""address"" autofocus required>
    </div>
    <div>
        <label for=""age"">Age</label>
        <input type=""text"" name=""age"" autofocus required>
    </div>
    <div class=""radio"">
        <p><b>Gender</b></p>
        <label>
            <input type=""radio"" name=""sex"" value=""male"">Man
            <div class=""radio-control male""></div>
        </label>
 ");
                WriteLiteral("       <label>\r\n            <input type=\"radio\" name=\"sex\" value=\"female\">Woman\r\n            <div class=\"radio-control female\"></div>\r\n        </label>\r\n    </div>\r\n    <button type=\"submit\">OK</button>\r\n");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
        }
 public static InfoObject removeBoard(string email, String BoardName)
 {
     return(UserControler.removeBoard(email, BoardName));
 }
 // this function attempts to logout from the system.
 public static InfoObject logout(string email)
 {
     return(UserControler.logout(email));
 }
 // this functin attempts to forward task to the next coulmn in the board.
 public static Boolean moveTask(string email, int taskID, int status)
 {
     return(UserControler.moveTask(email, taskID, status).getIsSucceeded());
 }
 // this function attempts to change the max capacity to a coulmn.
 public static Boolean changeColumnCapacity(string email, int columnNumber, int capacity)
 {
     return(UserControler.changeColumnCapacity(email, columnNumber, capacity).getIsSucceeded());
 }
 // this function attempts to remove coulmn from the board.
 public static InfoObject removeColumn(string email, string columnName)
 {
     return(UserControler.removeColumn(email, columnName));
 }
 public static InfoObject AddBoard(string email, string boardToAdd)
 {
     return(UserControler.AddBoard(email, boardToAdd));
 }
 // this functin attempts to forward task to the next coulmn in the board.
 public static InfoObject moveTask(string email, int taskID, int status)
 {
     return(UserControler.moveTask(email, taskID, status));
 }
 // this function attempts to edit the due date of a task.
 public static InfoObject editTaskDueDate(string email, int taskID, int status, string newDueDate)
 {
     return(UserControler.editTaskDueDate(email, taskID, status, newDueDate));
 }
 // this function attempts to edit the description of a task.
 public static InfoObject editTaskDescription(string email, int taskID, int status, string newDescription)
 {
     return(UserControler.editTaskDescription(email, taskID, status, newDescription));
 }
 // this function attempts to add new task to the board.
 public static InfoObject addTask(string email, string title, string description, string dueDate)
 {
     return(UserControler.addTask(email, title, description, dueDate));
 }
 // this function attempts to register new user to the system.
 public static InfoObject register(string email, string password)
 {
     return(UserControler.register(email, password));
 }
 // this function attempts to add new coulmn to the board.
 public static Boolean addColumn(string email, string columnName)
 {
     return(UserControler.addColumn(email, columnName).getIsSucceeded());
 }
 public static InfoObject moveColumnBack(string email, int columnNumber)
 {
     return(UserControler.moveColumnBack(email, columnNumber));
 }
 // this function attempts to login to the system.
 public static InfoObject login(string email, string password)
 {
     return(UserControler.login(email, password));
 }
 public static Board getBoard(String user)
 {
     return(UserControler.getBoard(user));
 }
 // this function attempts to change the max capacity to a coulmn.
 public static InfoObject changeColumnCapacity(string email, int columnNumber, int capacity)
 {
     return(UserControler.changeColumnCapacity(email, columnNumber, capacity));
 }
 public static Hashtable getBoards(String user)
 {
     return(UserControler.getBoards(user));
 }