Esempio n. 1
0
        private void addNewAttitudeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MaterialMessageInput.MessageBoxResultInput result = MaterialMessageInput.Show("Ce nume are noua atitudine?", "Easy Survey - Add New Attitude", MaterialMessageInput.MessageBoxButtonsInput.OKCancel, addAttitude: true);

            if (result == MaterialMessageInput.MessageBoxResultInput.OK)
            {
                string AttitudeName = MaterialMessageInput.Answer;

                Attitude newAttitude = new Attitude {
                    AttitudeName = AttitudeName
                };
                using (AttitudeController attitudeController = new AttitudeController())
                    attitudeController.Add(ref newAttitude);
                Attitudes.Add(newAttitude);

                ListViewItem newAttitudeItem = new ListViewItem(listView_AllAttitudes.Groups["default"])
                {
                    Tag = newAttitude.AttitudeID.ToString(), Text = newAttitude.AttitudeName
                };
                listView_AllAttitudes.Items.Add(newAttitudeItem);

                int AttitudeIndex = listView_AllAttitudes.Items.Count - 1;
                listView_AllAttitudes.Items[AttitudeIndex].Selected = true;
                listView_AllAttitudes.Items[AttitudeIndex].Focused  = true;
                listView_AllAttitudes.Items[AttitudeIndex].EnsureVisible();
            }
        }
Esempio n. 2
0
        private void addNewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MaterialMessageInput.MessageBoxResultInput result = MaterialMessageInput.Show("Ce nume are noul chestionar?", "Easy Survey - Add New Survey", MaterialMessageInput.MessageBoxButtonsInput.OKCancel, addSurvey: true);

            if (result == MaterialMessageInput.MessageBoxResultInput.OK)
            {
                using (SurveyController surveyController = new SurveyController())
                {
                    string SurveyName = MaterialMessageInput.Answer;

                    Survey newSurvey = new Survey {
                        SurveyName = SurveyName
                    };
                    surveyController.Add(ref newSurvey);
                    Surveys.Add(newSurvey);
                    ListViewItem newSurveyItem = new ListViewItem(listView_AllSurveys.Groups["default"])
                    {
                        Tag = newSurvey.SurveyID.ToString(), Text = newSurvey.SurveyName
                    };
                    listView_AllSurveys.Items.Add(newSurveyItem);
                    int SurveyIndex = listView_AllSurveys.Items.Count - 1;
                    listView_AllSurveys.Items[SurveyIndex].Selected = true;
                    listView_AllSurveys.Items[SurveyIndex].Focused  = true;
                    listView_AllSurveys.Items[SurveyIndex].EnsureVisible();
                }
            }
        }
Esempio n. 3
0
        private void toolStripMenuItem_AddNewQuestion_Click(object sender, EventArgs e)
        {
            MaterialMessageInput.MessageBoxResultInput result = MaterialMessageInput.MessageBoxResultInput.None;
            long SurveyID = Convert.ToInt64(txt_EditSurveyDetailsName.Tag);

            if (SurveyID != -1)
            {
                result = MaterialMessageInput.Show("Noua intrebare care sa fie adaugata in chestionar:", "Easy Survey - Add New Question", MaterialMessageInput.MessageBoxButtonsInput.OKCancel, addQuestion: true);
            }

            if (result == MaterialMessageInput.MessageBoxResultInput.OK)
            {
                using (QuestionController questionController = new QuestionController())
                {
                    string QuestionName = MaterialMessageInput.Answer;
                    // long SurveyID = Convert.ToInt64(txt_EditSurveyDetailsName.Tag);
                    Question newQuestion = new Question {
                        Question1 = QuestionName
                    };
                    questionController.Add(ref newQuestion, SurveyID);

                    ListViewItem newQuestionItem = new ListViewItem()
                    {
                        Tag = newQuestion.QuestionID.ToString(), Text = newQuestion.Question1
                    };
                    listView_EditSurveyQuestions.Items.Add(newQuestionItem);
                    int QuestionIndex = listView_EditSurveyQuestions.Items.Count - 1;
                    listView_EditSurveyQuestions.Items[QuestionIndex].Selected = true;
                    listView_EditSurveyQuestions.Items[QuestionIndex].Focused  = true;
                    listView_EditSurveyQuestions.Items[QuestionIndex].EnsureVisible();
                }
            }
        }
Esempio n. 4
0
        // Change / New password protection
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            long SelectedUsers = listView_Users.SelectedItems.Count;

            if (SelectedUsers == 0)
            {
                return;
            }

            MaterialMessageInput.MessageBoxResultInput result = MaterialMessageInput.MessageBoxResultInput.None;
            result = MaterialMessageInput.Show("New password for " + SelectedUsers + " selected users is:",
                                               "Easy Survey - Change Users Password",
                                               MaterialMessageInput.MessageBoxButtonsInput.OKCancel,
                                               isPassword: true);

            if (result == MaterialMessageInput.MessageBoxResultInput.OK)
            {
                string NewPlainPassword = MaterialMessageInput.Answer;
                string NewPassword      = SHA256.Hash(NewPlainPassword);

                using (UserController userController = new UserController())
                    foreach (ListViewItem item in listView_Users.SelectedItems)
                    {
                        long UserID = Convert.ToInt64(item.Tag);
                        userController.UpdatePassword(UserID, NewPassword);
                        item.ForeColor = Color.Black;
                    }
            }
        }
Esempio n. 5
0
        private void editToolStripMenuItem_EditQuestion_Click(object sender, EventArgs e)
        {
            int SelectedQuestionsCount = listView_EditSurveyQuestions.SelectedItems.Count;

            MaterialMessageInput.MessageBoxResultInput result = MaterialMessageInput.MessageBoxResultInput.None;

            if (SelectedQuestionsCount == 0)
            {
                return;
            }

            int CurrentQuestion = 0;

            foreach (ListViewItem SelectedQuestion in listView_EditSurveyQuestions.SelectedItems)
            {
                result = MaterialMessageInput.MessageBoxResultInput.None;

                result = MaterialMessageInput.Show("Editeaza intrebarea:", "Easy Survey - Edit Question (" + ++CurrentQuestion + "/" + SelectedQuestionsCount + ")", MaterialMessageInput.MessageBoxButtonsInput.OKCancel, SelectedQuestion.Text, editQuestion: true);

                if (result == MaterialMessageInput.MessageBoxResultInput.OK)
                {
                    using (QuestionController questionController = new QuestionController())
                    {
                        string NewQuestionName = MaterialMessageInput.Answer;
                        long   QuestionID      = Convert.ToInt64(SelectedQuestion.Tag.ToString());

                        questionController.Update(QuestionID, NewQuestionName);

                        int QuestionIndex = listView_EditSurveyQuestions.Items.IndexOf(SelectedQuestion);
                        listView_EditSurveyQuestions.Items[QuestionIndex].Text = NewQuestionName;
                    }
                }
                else if (result == MaterialMessageInput.MessageBoxResultInput.None)
                {
                    break;
                }
            }
        }