示例#1
0
 private void frmMemberQB_Load(object sender, EventArgs e)
 {
     listboxSourcePartiQB  = new Dictionary <string, string>();
     eidtedParticipentInfo = new ParticeipentInfo();
     selectedQBIDValue     = new Dictionary <string, string>();
     eidtedParticipentInfo.ParticeipentAssesmentEntityState = EntityOperationalState.None;
     eidtedParticipentInfo.EntityState = EntityOperationalState.New;
     LoadAllQB();
     LoadParticipentCombo();
 }
示例#2
0
        private void ResetAll()
        {
            txtPartiCode.Text = string.Empty;
            txtPartiName.Text = string.Empty;
            txtEmail.Text     = string.Empty;
            txtRemarks.Text   = string.Empty;

            cbParticipent.DataSource  = null;
            lstAvailableQB.DataSource = null;
            lstSelectedQB.DataSource  = null;
            ParticipentQBEntityState  = EntityOperationalState.New;
            eidtedParticipentInfo     = new ParticeipentInfo();
        }
示例#3
0
        public void AddParticipant(oEEntiti Participant)
        {
            DataTable      dtParticipant          = null;
            DataTable      dtParticipantAssesment = null;
            DataRow        drNew             = null;
            DataRow        drNewPartiAss     = null;
            List <DataRow> drParticepentColl = null;
            //Participant participant = null;
            ParticeipentInfo particeipentInfo = null;
            string           participentID    = string.Empty;

            try
            {
                particeipentInfo = Participant as ParticeipentInfo;
                LoadXML();
                dtParticipant          = oeEntity.Tables[EntityConstents.TBL_PARTICIPANT];
                dtParticipantAssesment = oeEntity.Tables[EntityConstents.TBL_PARTICIPANTASSESMENT];

                if (particeipentInfo.EntityState == EntityOperationalState.New)
                {
                    drNew         = dtParticipant.NewRow();
                    participentID = Guid.NewGuid().ToString();
                    drNew[EntityConstents.COL_PARTICIPANT_ID] = participentID;
                    dtParticipant.Rows.Add(drNew);
                }
                else
                {
                    participentID = particeipentInfo.ID;
                    drNew         = dtParticipant.AsEnumerable().Where(ans => ans.Field <string>("ID") == particeipentInfo.ID).SingleOrDefault();
                }

                drNew[EntityConstents.COL_PARTICIPANT_CODE]    = particeipentInfo.Code;
                drNew[EntityConstents.COL_PARTICIPANT_NAME]    = particeipentInfo.Name;
                drNew[EntityConstents.COL_PARTICIPANT_ACTIVE]  = particeipentInfo.Active;
                drNew[EntityConstents.COL_PARTICIPANT_EMAIL]   = particeipentInfo.Email;
                drNew[EntityConstents.COL_PARTICIPANT_GENDER]  = particeipentInfo.Gender;
                drNew[EntityConstents.COL_PARTICIPANT_REMARKS] = particeipentInfo.Remarks;

                if (particeipentInfo.ParticeipentAssesmentEntityState == EntityOperationalState.New || particeipentInfo.ParticeipentAssesmentEntityState == EntityOperationalState.Update)
                {
                    if (particeipentInfo.ParticeipentAssesmentEntityState == EntityOperationalState.Update)
                    {
                        drParticepentColl = dtParticipantAssesment.AsEnumerable().Where(partiass => partiass.Field <string>("Fk_Participant") == participentID).ToList();
                        if (drParticepentColl != null && drParticepentColl.Count > 0)
                        {
                            for (int cnt = drParticepentColl.Count; cnt >= 0; cnt--)
                            {
                                dtParticipantAssesment.Rows.Remove(drParticepentColl[cnt]);
                            }
                        }
                    }

                    foreach (string qbID in particeipentInfo.QBIds)
                    {
                        drNewPartiAss = dtParticipantAssesment.NewRow();
                        drNewPartiAss[EntityConstents.COL_PARTICIPANTASSESMENT_ID]           = Guid.NewGuid().ToString();
                        drNewPartiAss[EntityConstents.COL_PARTICIPANTASSESMENT_QUESTIONBANK] = qbID;
                        drNewPartiAss[EntityConstents.COL_PARTICIPANTASSESMENT_PARTICIPANT]  = participentID;
                        dtParticipantAssesment.Rows.Add(drNewPartiAss);
                    }
                }

                saveXML(oeEntity);
            }
            catch
            {
                throw;
            }
        }