/// create new PM data
        public static PDataLabelTable CreateNewPMData(long AFromPartnerKey, long AToPartnerKey, IndividualDataTDS AMainDS, TDataBase ADataBase = null)
        {
            TDataBase      db          = DBAccess.Connect("CreateNewPMData", ADataBase);
            TDBTransaction Transaction = db.BeginTransaction(IsolationLevel.ReadCommitted);

            // Create a new DataLabel record
            PDataLabelTable AllDataLabelTable = PDataLabelAccess.LoadAll(Transaction);
            PDataLabelTable DataLabelTable    = new PDataLabelTable();
            PDataLabelRow   DataLabelRow      = DataLabelTable.NewRowTyped();

            // Get the first available key, which is our unique primary key field
            Int32 Key = 1;

            while (AllDataLabelTable.Rows.Find(new object[] { Key }) != null)
            {
                Key++;
            }

            DataLabelRow.Key      = Key;
            DataLabelRow.DataType = "char";
            DataLabelTable.Rows.Add(DataLabelRow);

            // Create a new DataLabelValuePartner record
            PDataLabelValuePartnerRow DataLabelValuePartner = AMainDS.PDataLabelValuePartner.NewRowTyped();

            DataLabelValuePartner.PartnerKey   = AFromPartnerKey;
            DataLabelValuePartner.DataLabelKey = DataLabelRow.Key;
            AMainDS.PDataLabelValuePartner.Rows.Add(DataLabelValuePartner);

            // Create a new PassportDetails record
            IndividualDataTDSPmPassportDetailsRow PassportDetails = AMainDS.PmPassportDetails.NewRowTyped();

            PassportDetails.PartnerKey              = AFromPartnerKey;
            PassportDetails.PassportNumber          = "0";
            PassportDetails.PassportNationalityName = "IRELAND";
            AMainDS.PmPassportDetails.Rows.Add(PassportDetails);

            // Create two new PersonalData records
            PmPersonalDataRow FromPersonalData = AMainDS.PmPersonalData.NewRowTyped();

            FromPersonalData.PartnerKey = AFromPartnerKey;
            FromPersonalData.HeightCm   = 175;
            FromPersonalData.WeightKg   = 80;
            AMainDS.PmPersonalData.Rows.Add(FromPersonalData);

            PmPersonalDataRow ToPersonalData = AMainDS.PmPersonalData.NewRowTyped();

            ToPersonalData.PartnerKey = AToPartnerKey;
            ToPersonalData.WeightKg   = 95;
            AMainDS.PmPersonalData.Rows.Add(ToPersonalData);

            Transaction.Rollback();

            return(DataLabelTable);
        }
Example #2
0
        private void NewRowManual(ref IndividualDataTDSPmPassportDetailsRow ARow)
        {
            string newName;
            Int32  countNewDetail = 0;

            ARow.PartnerKey = FMainDS.PPerson[0].PartnerKey;
            newName         = "(Unspecified: " + countNewDetail.ToString() + ")";

            if (FMainDS.PmPassportDetails.Rows.Find(new object[] { ARow.PartnerKey, newName }) != null)
            {
                while (FMainDS.PmPassportDetails.Rows.Find(new object[] { ARow.PartnerKey, newName }) != null)
                {
                    countNewDetail++;
                    newName = "(Unspecified: " + countNewDetail.ToString() + ")";
                }
            }

            ARow.PassportNumber = newName;
        }
Example #3
0
 private void GetDetailDataFromControlsManual(IndividualDataTDSPmPassportDetailsRow ARow)
 {
     // update country name in grid from country code used in details part
     ARow.PassportNationalityName = cmbPassportNationality.GetSelectedDescription();
 }
 private void GetDetailDataFromControlsManual(IndividualDataTDSPmPassportDetailsRow ARow)
 {
     // update country name in grid from country code used in details part
     ARow.PassportNationalityName = cmbPassportNationality.GetSelectedDescription();
 }
        private void NewRowManual(ref IndividualDataTDSPmPassportDetailsRow ARow)
        {
            string newName;
            Int32 countNewDetail = 0;

            ARow.PartnerKey = FMainDS.PPerson[0].PartnerKey;
            newName = "(Unspecified: " + countNewDetail.ToString() + ")";

            if (FMainDS.PmPassportDetails.Rows.Find(new object[] { ARow.PartnerKey, newName }) != null)
            {
                while (FMainDS.PmPassportDetails.Rows.Find(new object[] { ARow.PartnerKey, newName }) != null)
                {
                    countNewDetail++;
                    newName = "(Unspecified: " + countNewDetail.ToString() + ")";
                }
            }

            ARow.PassportNumber = newName;
        }