コード例 #1
0
 private void SignUpBtn_Click(object sender, RoutedEventArgs e)
 {
     if ((string.IsNullOrEmpty(UsernameTxt.Text) == true) || (string.IsNullOrEmpty(PasswordTxt.Password) == true) || (string.IsNullOrEmpty(ConfirmPasswordTxt.Password) == true) || (AvatarComboBox.SelectedIndex == -1))
     {
         ErrorTxt.Text = "Enter all the fields!";
     }
     else
     {
         string userName = UsernameTxt.Text;
         bool   isValid  = UserDB.CheckValidUser(UsernameTxt.Text);
         if (isValid == true)
         {
             ErrorTxt.Text = "User Name already exists!";
         }
         else
         {
             if (PasswordTxt.Password.Equals(ConfirmPasswordTxt.Password))
             {
                 string avatar = ((string)AvatarComboBox.SelectedValue);
                 AvatarComboBox.SelectedIndex = -1;
                 UserDB.AddUser(UsernameTxt.Text, avatar);
                 var vault = new Windows.Security.Credentials.PasswordVault();
                 vault.Add(new Windows.Security.Credentials.PasswordCredential("TaskManagerApp", UsernameTxt.Text, PasswordTxt.Password));
                 Frame.Navigate(typeof(LoginPage));
             }
             else
             {
                 ErrorTxt.Text = "Passwords don't match!";
             }
         }
     }
 }
コード例 #2
0
        public async Task OnStart(ApplicationContext context, Message message, TelegramBotClient client)
        {
            long chatId = message.Chat.Id;

            if (!await UserDB.IsUserExists(context, chatId))
            {
                UserDB.AddUser(context, chatId, message.From.Username.Correct());
            }
            else if (!await UserDB.IsUserExistsAndAuthed(context, chatId))
            {
                await UserDB.UserLogin(context, chatId);

                await client.SendTextMessageAsync(chatId, "Мы рады вас снова видеть", ParseMode.Html);
            }
            else
            {
                await client.SendTextMessageAsync(chatId, "Мы вас уже знаем", ParseMode.Html);
            }

            await UserDB.ChangeUserActionAsync(context, chatId, Actions.None);

            TelegramKeyboard keyboard = new TelegramKeyboard();

            keyboard.AddRow("Войти по ивент-коду");
            keyboard.AddRow("Личный кабинет");

            await client.SendTextMessageAsync(chatId, "Чудненько " + "😇" + " Можем приступить", ParseMode.Markdown);

            await client.SendTextMessageAsync(chatId, "У вас есть личный кабинет? Если нет, то войдите по *ивент-коду* \n P.S.*Ивент-код* отправлен в письме регистрации", ParseMode.Markdown, replyMarkup : keyboard.Markup);
        }
コード例 #3
0
        private void txbx_reg_btn_Click(object sender, EventArgs e)
        {
            show_errors.Text = "";

            //adding input information to user class//
            User user = new User();

            user.Name             = txbx_reg_name.Text;
            user.Surname          = txbx_reg_surname.Text;
            user.Email            = txbx_reg_email.Text;
            user.Password         = txbx_reg_password.Text;
            user.Confirm_Password = txbx_reg_confirmPassword.Text;

            //validation textbox//
            Validator validator = new Validator();

            if (validator.CheckInputs(user))
            {
                string[] errors = validator.GetAllErrorArray();
                foreach (string error in errors)
                {
                    show_errors.Text += error + "\n";
                }
                //adding user to UserDB if errors doesn't has in erros array//
                if (errors.Length == 0)
                {
                    MessageBox.Show("Qeydiyyatınız uğurlu yekunlaşdı...");
                    UserDB.AddUser(user);
                }
            }
        }
コード例 #4
0
        public void adduser(object s, EventArgs args)
        {
            user.first_name     = firstname.Text;
            user.last_name      = lastname.Text;
            user.contact_number = contactno.Text;
            user.email_id       = emailaddress.Text;
            user.user_name      = username.Text;
            user.user_type      = userType.Items[userType.SelectedIndex];
            if (user.user_type.Equals("Borrower"))
            {
                string val = bookOwner.Items[bookOwner.SelectedIndex];
                Debug.WriteLine("BOOK OWNER NAME SELECTED :::::" + val);

                string[] name = val.Split(' ');
                User     u    = _userdb.GetBookOwnerId(name[0], name[1]);
                user.owner_id = u.user_id;
            }

            if (confirmPasswordBehavior.IsValid)
            {
                user.password = password.Text;
                _userdb.AddUser(user);
                DisplayAlert("Success", "Account Created!!", "OK");
                Navigation.PushModalAsync(new LoginPage());
            }
            else
            {
                DisplayAlert("Alert", "Confirm Password not correct", "OK");
            }
        }
コード例 #5
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            bool isValid          = true;
            bool isInsert         = true;
            bool addToStudentInfo = false;

            Models.User user = new Models.User();
            user.UserName  = txtUserName.Text;
            user.FirstName = txtFirstName.Text;
            user.LastName  = txtLastName.Text;
            user.Password  = txtPassword.Text;
            user.UserRole  = cboRole.SelectedItem.ToString();

            if (String.IsNullOrWhiteSpace(user.UserName))
            {
                isValid = false;
            }
            if (String.IsNullOrWhiteSpace(user.FirstName))
            {
                isValid = false;
            }
            if (String.IsNullOrWhiteSpace(user.LastName))
            {
                isValid = false;
            }
            if (String.IsNullOrWhiteSpace(user.Password))
            {
                isValid = false;
            }
            if (String.IsNullOrWhiteSpace(user.UserRole))
            {
                isValid = false;
            }

            if (isValid == true)
            {
                isInsert = UserDB.AddUser("insert into Users values('" + txtUserName.Text + "','" + txtPassword.Text + "','" + txtFirstName.Text + "','" + txtLastName.Text + "','" + cboRole.SelectedItem.ToString() + "')");
                if (isInsert == false)
                {
                    MessageBox.Show("insert data error");
                }
                else
                {
                    //After inserting the new user create a student and get that student info and store it in student
                    //Set the skill to 1 and default number of question to 20 so that student can take a placement test - Tai

                    Student student = new Student();
                    student = StudentDB.StudentLogin(txtUserName.Text, txtPassword.Text);
                    student.StudentLevel = 1;
                    student.classID      = Convert.ToInt16(txtClassroom.Text);
                    int numQuestion            = 20;
                    frmPlacementTest placement = new frmPlacementTest(student, numQuestion);
                    placement.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Please fill out all of the fields provided.");
            }
        }
コード例 #6
0
        /// <summary>
        /// Checks user input and adds new user to the database
        /// </summary>
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(newUserName) || string.IsNullOrWhiteSpace(newUserLogin) ||
                    string.IsNullOrWhiteSpace(newUserPassword))
                {
                    throw new EmptyFieldException();
                }
                if (!userDB.CheckLogin(newUserLogin))
                {
                    throw new UserDataFieldException();
                }

                if (userDB.AddUser(newUserLogin, newUserPassword, newUserName))
                {
                    MessageBox.Show("Пользователь успешно добавлен", "Выполнено");
                    this.DialogResult = true;
                }
                else
                {
                    MessageBox.Show("Неопознанная ошибка добавления пользователя.", "Ошибка");
                    this.DialogResult = true;
                }
            }
            catch (UserDataFieldException exception)
            {
                MessageBox.Show(exception.ErrorMessageExist, exception.Error);
                LoginTextBox.Clear();
            }
            catch (EmptyFieldException exception)
            {
                MessageBox.Show(exception.ErrorMessage, exception.Error);
            }
        }
コード例 #7
0
        public void ShouldReturnSuccess_WhenValidUsernameAndPasswordArePassed()
        {
            string expectedResult = "User added successfully";

            var actulaResult = userdb.AddUser(username, password);

            Assert.AreEqual(expectedResult, actulaResult);
        }
コード例 #8
0
        /// <summary>
        /// Signups the validation button clicked.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private async void SignupValidationButtonClicked(object sender, EventArgs e)
        {
            if ((string.IsNullOrWhiteSpace(userNameEntry.Text)) || (string.IsNullOrWhiteSpace(emailEntry.Text)) ||
                (string.IsNullOrWhiteSpace(passwordEntry.Text)) || (string.IsNullOrWhiteSpace(phoneEntry.Text)) ||
                (string.IsNullOrEmpty(userNameEntry.Text)) || (string.IsNullOrEmpty(emailEntry.Text)) ||
                (string.IsNullOrEmpty(passwordEntry.Text)) || (string.IsNullOrEmpty(phoneEntry.Text)))
            {
                await DisplayAlert("Enter Data", "Enter Valid Data", "OK");
            }
            else if (!string.Equals(passwordEntry.Text, confirmpasswordEntry.Text))
            {
                warningLabel.Text         = "Confirm Password";
                passwordEntry.Text        = string.Empty;
                confirmpasswordEntry.Text = string.Empty;
                warningLabel.TextColor    = Color.IndianRed;
                warningLabel.IsVisible    = true;
            }
            else if (phoneEntry.Text.Length < 10)
            {
                phoneEntry.Text         = string.Empty;
                phoneWarLabel.Text      = "Enter 10 digit Number";
                phoneWarLabel.TextColor = Color.IndianRed;
                phoneWarLabel.IsVisible = true;
            }
            else
            {
                users.Name     = emailEntry.Text;
                users.UserName = userNameEntry.Text;
                users.Password = passwordEntry.Text;
                //users.phone = phoneEntry.Text.ToString();
                try
                {
                    var retrunvalue = userDB.AddUser(users);
                    if (retrunvalue == "Sucessfully Added")
                    {
                        await DisplayAlert("User Add", retrunvalue, "OK");

                        await Navigation.PushAsync(new LoginPage());
                    }
                    else
                    {
                        await DisplayAlert("User Add", retrunvalue, "OK");

                        warningLabel.IsVisible    = false;
                        emailEntry.Text           = string.Empty;
                        userNameEntry.Text        = string.Empty;
                        passwordEntry.Text        = string.Empty;
                        confirmpasswordEntry.Text = string.Empty;
                        phoneEntry.Text           = string.Empty;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }
コード例 #9
0
        private async void SignupValidation_ButtonClicked(object sender, EventArgs e)
        {
            if ((string.IsNullOrWhiteSpace(userNameEntry.Text)) || (string.IsNullOrWhiteSpace(emailEntry.Text)) ||
                (string.IsNullOrEmpty(userNameEntry.Text)) || (string.IsNullOrEmpty(emailEntry.Text)))

            {
                await DisplayAlert("Preencha os dados", "Preencha com um dado válido", "OK");
            }
            else if (!string.Equals(passwordEntry.Text, confirmpasswordEntry.Text))
            {
                warningLabel.Text         = "Preencha a mesma senha";
                passwordEntry.Text        = string.Empty;
                confirmpasswordEntry.Text = string.Empty;
                warningLabel.TextColor    = Color.IndianRed;
                warningLabel.IsVisible    = true;
            }
            else
            {
                users.name     = emailEntry.Text;
                users.userName = userNameEntry.Text;
                users.password = passwordEntry.Text;
                try
                {
                    var retrunvalue = userDB.AddUser(users);
                    if (retrunvalue == "Adicionado com Sucesso")
                    {
                        await DisplayAlert("Usuário Adicionado", retrunvalue, "OK");

                        await Navigation.PushAsync(new LoginPage());
                    }
                    else
                    {
                        await DisplayAlert("Usuário Adicionado", retrunvalue, "OK");

                        warningLabel.IsVisible    = false;
                        emailEntry.Text           = string.Empty;
                        userNameEntry.Text        = string.Empty;
                        passwordEntry.Text        = string.Empty;
                        confirmpasswordEntry.Text = string.Empty;
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }
            //users.name = fullNameEntry.Text;
            //users.userName = userNameEntry.Text;
            //users.password = passwordEntry.Text;
            //users.phone = phoneEntry.Text.ToString();
        }
コード例 #10
0
ファイル: UserController.cs プロジェクト: naorsa/classManager
        public HttpResponseMessage AddUser()
        {
            var     content     = Request.Content;
            string  jsonContent = content.ReadAsStringAsync().Result;
            JObject o           = JObject.Parse(jsonContent);
            User    newUser     = new User();

            foreach (object item in o)
            {
                KeyValuePair <string, JToken> castItem = (KeyValuePair <string, JToken>)item;
                JToken jtoken;
                if (castItem.Key == "id")
                {
                    jtoken = castItem.Value;
                    string temp = jtoken.ToString();
                    newUser.userID = Int32.Parse(temp);
                }
                if (castItem.Key == "firstName")
                {
                    jtoken            = castItem.Value;
                    newUser.firstName = jtoken.ToString();
                }

                if (castItem.Key == "lastName")
                {
                    jtoken           = castItem.Value;
                    newUser.lastName = jtoken.ToString();
                }

                if (castItem.Key == "age")
                {
                    jtoken = castItem.Value;
                    string temp = jtoken.ToString();
                    newUser.age = Int32.Parse(temp);
                }
                if (castItem.Key == "email")
                {
                    jtoken        = castItem.Value;
                    newUser.email = jtoken.ToString();
                }
                if (castItem.Key == "permission")
                {
                    jtoken = castItem.Value;
                    string temp = jtoken.ToString();
                    newUser.permission = Int32.Parse(temp);
                }
            }
            newUser.makePassword();
            dbManager.AddUser(newUser);
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
コード例 #11
0
        public void TestLogin()
        {
            User u1 = new User
            {
                Address = "test",
                Age     = "1",
                Salt    = crypto.GenerateSaltString(),
                Email   = "test",
                Name    = "test",
                PWord   = "1",
                Phone   = "1234",
                Zipcode = "9200"
            };

            userDB.AddUser(u1);

            User expected = client.LoginUser(u1.Email, u1.PWord);

            userDB.RemoveUser(expected.Id);

            Assert.AreEqual(expected.Email, u1.Email);
            Assert.AreEqual(expected.PWord, u1.PWord);
        }
コード例 #12
0
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            try
            {
                User user = getUserInfo();

                IDBMUser db = new UserDB();
                db.AddUser(user);
                ///// EmptyControls();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #13
0
 //for adding the data in the tables
 public void AddData(object T, int b)
 {
     if (b == 1)
     {
         CountryBO.AddCountry((Country)T);
     }
     else if (b == 2)
     {
         StateBO.AddState((State)T);
     }
     else if (b == 3)
     {
         UserDB.AddUser((UserDetail)T);
     }
     if (b == 4)
     {
         AddressBookDB.AddAddress((Addressbook)T);
     }
 }
コード例 #14
0
        public async Task <ViewResult> SignUpAsync(User usr)
        {
            string filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images/" + usr.Image.FileName);

            using (Stream fileStream = new FileStream(filePath, FileMode.Create))
            {
                await usr.Image.CopyToAsync(fileStream);
            }
            UserData usrData = new UserData()
            {
                UserName = usr.UserName, Email = usr.Email, Password = usr.password, ImageAddress = $"/images/{usr.Image.FileName}"
            };

            UserDB.AddUser(usrData);

            PostsRepository.records.UserName = usr.UserName;
            HttpContext.Response.Cookies.Append("uName", usr.UserName);
            return(View("Blogs", PostsRepository.records));
        }
コード例 #15
0
        public bool Add(UserInfo userInfo, out string msg)
        {
            msg = null;
            bool isSuccess = false;

            if (userInfo.Username.Trim().Length != 0) //判断从传递来的username是否为空
            {
                if (!userDB.IsEquals(userInfo))       //传给DALl操作判断数据库中是否有重复值
                {
                    userDB.AddUser(userInfo);         //传给DAL操作增加一个新用户
                    isSuccess = true;
                }
                else
                {
                    msg = "有相同的值";
                }
            }
            else
            {
                msg = "不能为空";
            }
            return(isSuccess);//返回界面层是否添加成功
        }
コード例 #16
0
ファイル: UserBL.cs プロジェクト: nabeelbape/RnDProjects
        /// <summary>
        /// Adds user to User master table.
        /// </summary>
        /// <param name="userModel">User data</param>
        /// <returns>Database operation details</returns>
        public OperationDetails AddUser(UserModel userModel)
        {
            log.Debug(MethodHelper.GetCurrentMethodName() + " Method execution start.");
            OperationDetails operationDetails = null;

            try
            {
                using (UserDB userDB = new UserDB())
                {
                    operationDetails = userDB.AddUser(userModel);
                    return(operationDetails);
                }
            }
            catch (Exception exception)
            {
                errorLog.Fatal("Exception " + exception.Message + "\n" + exception.StackTrace);
                throw;
            }
            finally
            {
                log.Debug(MethodHelper.GetCurrentMethodName() + " Method execution end.");
            }
        }
コード例 #17
0
 public bool AddUser(User user)
 {
     return(UserDB.AddUser(user));
 }
コード例 #18
0
 public void Post([FromForm] User user)
 {
     UserDB.AddUser(user);
 }
コード例 #19
0
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            //declares a couple string variables that we'll use when checking the DB if the user already exists
            string userLastName  = LastName.Text;
            string userFirstName = FirstName.Text;
            string userName      = UserName.Text;

            //method that checks the DB using first and last name
            this.GetUser(userFirstName, userLastName, userName);

            if (DBUser == null)
            {
                DBUser = new User(); //creates user object

                //adds registration data into the DB as a new user
                this.PutCustomerData(DBUser);
                try
                {
                    DBUser.ID = UserDB.AddUser(DBUser);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.GetType().ToString());
                }
            }
            else
            {
                //user exists already
                MessageBox.Show("First and Last Name Have Already Been Taken Or Else The UserName's Been Taken");



                return; //user exists so cancel registering and return to page
            }

            //variables from template that store new user into local DB located in the App_Data folder
            var manager       = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var signInManager = Context.GetOwinContext().Get <ApplicationSignInManager>();
            var user          = new ApplicationUser()
            {
                UserName = UserName.Text, Email = UserName.Text
            };

            IdentityResult result = manager.Create(user, Password.Text);

            //logs into the DB
            if (result.Succeeded)
            {
                // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                //string code = manager.GenerateEmailConfirmationToken(user.Id);
                //string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request);
                //manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>.");

                signInManager.SignIn(user, isPersistent: false, rememberBrowser: false);
                IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
            }

            //catches any other errors
            else
            {
                ErrorMessage.Text = result.Errors.FirstOrDefault();
            }
            //encrypts the password
            byte[] data = UTF8Encoding.UTF8.GetBytes(Password.Text);
            using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
            {
                byte[] key = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
                using (TripleDESCryptoServiceProvider tripleDES =
                           new TripleDESCryptoServiceProvider()
                {
                    Key = key,
                    Mode = CipherMode.ECB,
                    Padding = PaddingMode.PKCS7
                }
                       )
                {
                    ICryptoTransform transform = tripleDES.CreateEncryptor();
                    //byte[] result = transform.TransformFinalBlock(data, 0, data.Length);
                    //txtEncrypted.Text = Convert.ToBase64String(result, 0, result.Length);
                }
            }
        }
コード例 #20
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (localSettings.Values["IsAppFirstTimeLaunch"] == null || (bool)value == true)
            {
                localSettings.Values["IsAppFirstTimeLaunch"] = false;
                var vault = new Windows.Security.Credentials.PasswordVault();
                vault.Add(new Windows.Security.Credentials.PasswordCredential("TaskManagerApp", "Sabi", "123"));
                vault.Add(new Windows.Security.Credentials.PasswordCredential("TaskManagerApp", "Sabitha", "123"));
                UserDB.AddUser("Sabi", "/Assets/avatar1.PNG");
                UserDB.AddUser("Sabitha", "/Assets/avatar4.PNG");
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Cliq Login Page",
                    TaskId         = 1223334444112,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 1,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "lopoioiui wtyetyuiyruiewo"
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Cliq SignIn Page",
                    TaskId         = 987654321112,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 2,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "Associated with an existing code-behind file using a qualifier that's part of the file or folder name"
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Content Writing",
                    TaskId         = 123456789112,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 1,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "lopoioiui wtyetyuiyruiewo yuwiyeueiytiu"
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Cliq List Tasks",
                    TaskId         = 123456789113,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 2,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "name the XAML view MainPage.DeviceFamily-Tablet.xaml. To create a view for PC devices, name the view MainPage.DeviceFamily-Desktop.xaml"
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Fix Bugs in List Tasks",
                    TaskId         = 123456789115,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 0,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Fix Bugs in List Tasks",
                    TaskId         = 123456789116,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 2,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "Load task module"
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName      = "Sabi",
                    CommentToTaskId = 123456789112,
                    Content         = " If you cannot find a way to fit supporting evidence in just one or two sentences, use a different example altogether. There are certain topics that require a lot of room for explanation, so be careful not to choose a topic for your essay that will require too much evidence to support.",
                    CommentId       = 99988660111,
                    Date            = DateTime.Now,
                    Heart           = 0,
                    Happy           = 0,
                    Sad             = 0,
                    Like            = 0
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName = "Sabitha", CommentToTaskId = 123456789112, Content = "Okay Done!", CommentId = 99988661111, Date = DateTime.Now, Heart = 0, Happy = 0, Sad = 0, Like = 0
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName = "Sabi", CommentToTaskId = 987654321112, Content = " Only by examining how you reflect on your qualities can college admissions officers gain an understanding", CommentId = 9998866211, Date = DateTime.Now, Heart = 0, Happy = 0, Sad = 0, Like = 0
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName = "Sabitha", CommentToTaskId = 1223334444112, Content = " Present, support, and introspect.", CommentId = 9998866311, Date = DateTime.Now, Heart = 0, Happy = 0, Sad = 0, Like = 0
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName = "Sabitha", CommentToTaskId = 123456789116, Content = " Make sure a folder or the project, and not the solution, is selected in Solution Explorer.", CommentId = 999886631121, Date = DateTime.Now, Heart = 0, Happy = 0, Sad = 0, Like = 0
                });
            }


            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter

                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
コード例 #21
0
 //Add User
 public JsonResult AddUser(Users us)
 {
     return(Json(userDB.AddUser(us), JsonRequestBehavior.AllowGet));
 }