Пример #1
0
 private void ListOfQuestion_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         QuestionsInformation.ReturnNewQuestion = GetObjectSelect();
         Qustion OldObject = QuestionsInformation.ReturnNewQuestion;
         Operation.ListOfAllQuestion.Remove(OldObject);
         ListOfQuestion.ClearSelection();
         if (QuestionsInformation.ReturnNewQuestion != null)
         {
             QuestionsInformation QuestionsInformationPage = new QuestionsInformation(TypeOfChoice.Edit);
             if (QuestionsInformationPage.ShowDialog() == DialogResult.OK)
             {
                 Operation.ListOfAllQuestion.Remove(OldObject);
                 Operation.ListOfAllQuestion.Add(QuestionsInformation.ReturnNewQuestion);
                 ShowData(Operation.ListOfAllQuestion);
             }
         }
         else
         {
             MessageBox.Show(Survey.Properties.Messages.NoSelectItem, GenralVariables.ErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         GenralVariables.Errors.Log(ex.Message);
         MessageBox.Show(Survey.Properties.Messages.MessageError);
     }
 }
Пример #2
0
 /// <summary>
 /// This Listener for Edit button when press add button
 /// </summary>
 private void Edit_Click(object sender, EventArgs e)
 {
     try
     {
         QuestionWillDeleteOrEdit = GetObjectSelect();
         ListOfQuestion.ClearSelection();
         if (QuestionWillDeleteOrEdit != null)
         {
             QuestionsInformation QuestionsInformationPage = new QuestionsInformation(QuestionWillDeleteOrEdit, Global.TypeOfChoice.Edit.ToString());
             QuestionsInformationPage.ShowDialog();
             if (StaticObjects.SuccOfFail == 1)
             {
                 ListOfAllQuestion = Operation.GetQustion();
                 ShowData();
                 StaticObjects.SuccOfFail = 0;
             }
         }
         else
         {
             MessageBox.Show(Survey.Properties.Resource1.NoSelectItem, Global.Constant.ErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         StaticObjects.Erros.Log(ex);
         MessageBox.Show(Survey.Properties.Resource1.MessageError);
     }
 }
Пример #3
0
 /// <summary>
 /// This Listener for Add button when press add button
 /// </summary>
 private void Add_Click(object sender, EventArgs e)
 {
     try
     {
         ListOfQuestion.ClearSelection();
         QuestionsInformation QuestionsInformationPage = new QuestionsInformation(TypeOfChoice.Add);
         if (QuestionsInformationPage.ShowDialog() == DialogResult.OK)
         {
             Operation.ListOfAllQuestion.Add(QuestionsInformation.ReturnNewQuestion);
             ShowData(Operation.ListOfAllQuestion);
         }
     } catch (Exception ex)
     {
         GenralVariables.Errors.Log(ex.Message);
         MessageBox.Show(Survey.Properties.Messages.MessageError);
     }
 }
Пример #4
0
 /// <summary>
 /// This Listener for Add button when press add button
 /// </summary>
 private void Add_Click(object sender, EventArgs e)
 {
     try
     {
         ListOfQuestion.ClearSelection();
         QuestionsInformation QuestionsInformationPage = new QuestionsInformation(QuestionWillDeleteOrEdit, Global.TypeOfChoice.Add.ToString());
         QuestionsInformationPage.ShowDialog();
         if (StaticObjects.SuccOfFail == 1)
         {
             ListOfAllQuestion = Operation.GetQustion();
             ShowData();
             StaticObjects.SuccOfFail = 0;
         }
     }catch (Exception ex)
     {
         StaticObjects.Erros.Log(ex);
         MessageBox.Show(Survey.Properties.Resource1.MessageError);
     }
 }
Пример #5
0
 /// <summary>
 /// Show data function get the question from MyList and show it in datagridview
 /// </summary>
 private void ShowData()
 {
     try
     {
         ListOfQuestion.Rows.Clear();
         foreach (Qustions Temp in ListOfAllQuestion)
         {
             int Index = ListOfQuestion.Rows.Add();
             ListOfQuestion.Rows[Index].Cells[0].Value = Temp.NewText;
             ListOfQuestion.Rows[Index].Cells[2].Value = Temp.Order;
             ListOfQuestion.Rows[Index].Cells[1].Value = Temp.TypeOfQuestion;
         }
     }catch (Exception ex)
     {
         StaticObjects.Erros.Log(ex);
         MessageBox.Show(Survey.Properties.Resource1.MessageError);
     }
     ListOfQuestion.ClearSelection();
 }
Пример #6
0
 /// <summary>
 /// Show data function get the question from MyList and show it in datagridview
 /// </summary>
 private void ShowData(List <Qustion> ListOfAllQuestion)
 {
     try
     {
         ListOfQuestion.Rows.Clear();
         foreach (Qustion Temp in ListOfAllQuestion)
         {
             if (Temp != null)
             {
                 int Index = ListOfQuestion.Rows.Add();
                 ListOfQuestion.Rows[Index].Cells[0].Value = Temp.NewText;
                 ListOfQuestion.Rows[Index].Cells[2].Value = Temp.Order;
                 ListOfQuestion.Rows[Index].Cells[1].Value = Temp.TypeOfQuestion;
             }
         }
         ListOfQuestion.ClearSelection();
     } catch (Exception ex)
     {
         GenralVariables.Errors.Log(ex.Message);
         MessageBox.Show(Survey.Properties.Messages.MessageError);
     }
 }