Пример #1
0
        private void btnAddParticipant_Click(object sender, EventArgs e)
        {
            try
            {
                FrmEditParticipants frmEditPartpnt = new FrmEditParticipants();
                if (frmEditPartpnt.ShowDialog() == DialogResult.OK)
                {
                    ParticipantInfo objPartpnt = frmEditPartpnt.PaticipantData;
                    objPartpnt.ReactionID = ReactionID;
                    objPartpnt.RxnStepID  = StepID;
                    objPartpnt.StepNo     = SerialNo == 0 ? 1 : SerialNo;
                    objPartpnt.Option     = objPartpnt.ParticipantID > 0 ? DmlOperations.UPDATE.ToString() : DmlOperations.INSERT.ToString();

                    DataTable dtPartpnt = new DataTable();

                    if (ReactionCurationDB.SaveReactionParticipants(objPartpnt, out dtPartpnt))
                    {
                        MessageBox.Show("Participant updated successfully.", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        BindDataToParticipantsGrid(dtPartpnt);
                    }
                    else
                    {
                        MessageBox.Show("Error accured in participant updation.", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.WriteErrorLog(ex.ToString());
            }
        }
Пример #2
0
 private void newRowTSMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (cntMnuTab.SourceControl.Name == "dgvParticipants")
         {
             using (FrmEditParticipants fParticipants = new FrmEditParticipants())
             {
                 fParticipants.ShowDialog();
             }
             RefreshParticipantsGrid();
         }
         if (cntMnuTab.SourceControl.Name == "dgvConditions")
         {
             using (FrmEditConditions fConditions = new FrmEditConditions())
             {
                 fConditions.ShowDialog();
             }
             RefreshConditionsGrid();
         }
     }
     catch (Exception ex)
     {
         ErrorHandling.WriteErrorLog(ex.ToString());
     }
 }
Пример #3
0
        private void dgvParticipants_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
                {
                    ParticipantInfo objPartpnt = new ParticipantInfo();
                    DataTable       dtPartpnt  = new DataTable();
                    if (dgvParticipants.Columns[e.ColumnIndex].HeaderText.ToString().ToUpper() == "EDIT")
                    {
                        using (FrmEditParticipants fParticipants = new FrmEditParticipants())
                        {
                            editRowIndxPartpnt = e.RowIndex;
                            blEditPartpnt      = true;

                            objPartpnt.ReactionID      = ReactionID;
                            objPartpnt.StepNo          = SerialNo;
                            objPartpnt.RxnStepID       = StepID;
                            objPartpnt.ParticipantID   = Convert.ToInt32(dgvParticipants.Rows[e.RowIndex].Cells[colParticipantID.Name].Value);
                            objPartpnt.ParticipantName = dgvParticipants.Rows[e.RowIndex].Cells[colParticipantName.Name].Value != null ? dgvParticipants.Rows[e.RowIndex].Cells[colParticipantName.Name].Value.ToString() : "";
                            objPartpnt.StructureNo     = dgvParticipants.Rows[e.RowIndex].Cells[colParticipantStructNo.Name].Value.ToString();
                            objPartpnt.Structure       = dgvParticipants.Rows[e.RowIndex].Cells[colParticipantStructure.Name].Value != null ? dgvParticipants.Rows[e.RowIndex].Cells[colParticipantStructure.Name].Value.ToString() : "";
                            objPartpnt.Grade           = dgvParticipants.Rows[e.RowIndex].Cells[colParticipantGrade.Name].Value != null ? dgvParticipants.Rows[e.RowIndex].Cells[colParticipantGrade.Name].Value.ToString() : "";
                            objPartpnt.ParticipantType = dgvParticipants.Rows[e.RowIndex].Cells[colParticipantType.Name].Value.ToString();

                            fParticipants.PaticipantData = objPartpnt;
                            if (fParticipants.ShowDialog() == DialogResult.OK)
                            {
                                objPartpnt               = fParticipants.PaticipantData;
                                objPartpnt.RxnStepID     = StepID;
                                objPartpnt.StepNo        = SerialNo;
                                objPartpnt.ReactionID    = ReactionID;
                                objPartpnt.ParticipantID = Convert.ToInt32(dgvParticipants.Rows[e.RowIndex].Cells[colParticipantID.Name].Value);
                                objPartpnt.Option        = objPartpnt.ParticipantID > 0 ? DmlOperations.UPDATE.ToString() : DmlOperations.INSERT.ToString();

                                if (ReactionCurationDB.SaveReactionParticipants(objPartpnt, out dtPartpnt))
                                {
                                    MessageBox.Show("Participant updated successfully", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    BindDataToParticipantsGrid(dtPartpnt);
                                }
                                else
                                {
                                    MessageBox.Show("Error in participant update.", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                        }
                    }
                    else if (dgvParticipants.Columns[e.ColumnIndex].HeaderText.ToString().ToUpper() == "DELETE")
                    {
                        if (MessageBox.Show("Do you want to delete the selected participant?", GlobalVariables.MessageCaption, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            objPartpnt.ReactionID    = ReactionID;
                            objPartpnt.ParticipantID = Convert.ToInt32(dgvParticipants.Rows[e.RowIndex].Cells[colParticipantID.Name].Value);
                            objPartpnt.Option        = DmlOperations.DELETE.ToString();

                            if (ReactionCurationDB.SaveReactionParticipants(objPartpnt, out dtPartpnt))
                            {
                                MessageBox.Show("Participant deleted successfully", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                BindDataToParticipantsGrid(dtPartpnt);
                            }
                            else
                            {
                                MessageBox.Show("Error in participant delete.", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.WriteErrorLog(ex.ToString());
            }
        }