Exemple #1
0
 public override IList GetFilteredList(List <WACParameter> parms)
 {
     try
     {
         using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
         {
             int pk_participant = WACGlobal_Methods.KeyAsInt(WACParameter.GetPrimaryKey(parms).ParmValue);
             var e = wac.participants.Where(w => w.pk_participant == pk_participant).Select(s =>
                                                                                            new Participant(s.pk_participant, s.lname, s.fname, s.email, s.fk_gender_code, s.list_gender.gender, s.fk_ethnicity_code,
                                                                                                            s.list_ethnicity.ethnicity, s.fk_race_code, s.list_race.race, s.fk_diversityData_code, s.list_diversityData.dataSetVia,
                                                                                                            s.fk_mailingStatus_code, s.list_mailingStatus.status, s.fk_property, s.fk_organization, s.organization.org, s.active,
                                                                                                            s.form_W9_signed_date, s.fk_regionWAC_code, s.list_regionWAC.regionWAC, s.fk_prefix_code, s.list_prefix.prefix, s.mname,
                                                                                                            s.nickname, s.fk_suffix_code, s.list_suffix.suffix, s.fullname_LF_dnd, s.fullname_FL_dnd, s.web, s.fk_dataReview_code,
                                                                                                            s.dataReview_note, s.fk_participant_split));
             if (e.Any())
             {
                 return(e.ToList <Participant>());
             }
             else
             {
                 return(new List <Participant>());
             }
         }
     }
     catch (Exception ex)
     {
         throw new WACEX_GeneralDatabaseException("Error loading Participant. " + ex.Message, -1);
     }
 }
Exemple #2
0
        public bool PrimaryKeyVerify(ref List <WACParameter> parms)
        {
            Object       pk = null;
            WACParameter wp = null;

            if (parms.Count() < 1)
            {
                return(false);
            }
            try
            {
                // get pk parameter based on parameter type
                wp = WACParameter.GetPrimaryKey(parms);
                if (wp == null)
                {
                    return(false);
                }
                // if pk parameter exists, make sure the pk property name is set in the parameter
                if (string.IsNullOrEmpty(wp.ParmName))
                {
                    parms.Remove(wp);
                    wp.ParmName = PrimaryKeyName();
                    parms.Add(wp);
                }
                // verify the pk parameter has a value
                pk = WACParameter.GetParameterValue(parms, PrimaryKeyName());
                if (pk == null)
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                WACAlert.Show(ex.Message + " in WACDataProvider.PrimaryKeyVerify()", 0);
                return(false);
            }
        }