Пример #1
0
        private void DataGridMain_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int    row      = dataGridMain.CurrentCell.RowIndex;
            string EvQId    = dataGridMain[0, row].Value.ToString();
            string Question = dataGridMain[2, row].Value.ToString();
            EvaluationQuestionDetail evQDetail = new EvaluationQuestionDetail(EvQId, Question);

            evQDetail.ShowDialog();
        }
Пример #2
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            //Question
            string description = txtQuestion.Text;
            string minScore    = comboMinScore.SelectedItem.ToString();
            string maxScore    = comboMaxScore.SelectedItem.ToString();
            string answer      = txtAnswer.Text;
            string createDate  = DateTime.Now.ToShortDateString();

            Entity.EvaluationQuestion evaluationQuestion = new Entity.EvaluationQuestion()
            {
                CreatedDate    = createDate,
                EvQDescription = description,
                EvQId          = "",
                StaffId        = GlobalVariable.StaffID
            };
            string json = JsonConvert.SerializeObject(evaluationQuestion);
            string url  = ApiRouting.GetUrl("", "", "evaluationQuestion", ApiFunction.Add).ToString();
            string responseInsertedId = "";
            bool   confirm            = url.Post <Entity.EvaluationQuestion>(json, ref responseInsertedId);

            if (confirm)
            {
                Entity.EvaluationQuestionDetail evaluationQuestionDetail = new EvaluationQuestionDetail()
                {
                    Answer      = answer,
                    EvQDetailId = "",
                    EvQId       = responseInsertedId,
                    EvQName     = "Unknown",
                    MaxScore    = maxScore,
                    MinScore    = minScore
                };
                url  = ApiRouting.GetUrl("", "", "evaluationQuestionDetail", ApiFunction.Add).ToString();
                json = JsonConvert.SerializeObject(evaluationQuestionDetail);
                bool deConfirm = url.Post <Entity.EvaluationQuestionDetail>(json);
                if (deConfirm)
                {
                    MessageBox.Show("Operation Successful");
                }
                var obj = Singleton.Instance.Container.Resolve <MainView>("evaluation question");
                obj.Init();
            }
        }