Exemplo n.º 1
0
        protected override void BeforeUpdate(DataRow row)
        {
            base.BeforeUpdate(row);
            atriumDB.ContactRow dr = (atriumDB.ContactRow)row;

            //find the related filecontact record and force an update on it by setting updateDate = DateTime.Now.ToUniversalTime();
            atriumDB.FileContactRow fcr = (atriumDB.FileContactRow)myA.DB.FileContact.Select("ContactId=" + dr.ContactId.ToString())[0];
            if (fcr != null)
            {
                fcr.updateDate = DateTime.Now.ToUniversalTime();
            }
            if (row.RowState != DataRowState.Added && (!row["SIN", DataRowVersion.Original].Equals(row["SIN", DataRowVersion.Current]) || !row["LastName", DataRowVersion.Original].Equals(row["LastName", DataRowVersion.Current]) || !row["FirstName", DataRowVersion.Original].Equals(row["FirstName", DataRowVersion.Current])))
            {
                if (!row.IsNull(myPersonDT.LastNameColumn, DataRowVersion.Original) && !row.IsNull(myPersonDT.FirstNameColumn, DataRowVersion.Original))
                {
                    this.myA.GetAKA();

                    atriumDB.AKARow drAka = this.myA.DB.AKA.NewAKARow();
                    this.myA.DB.AKA.AddAKARow(drAka);
                    drAka.BeginEdit();
                    drAka.LastName  = row["LastName", DataRowVersion.Original].ToString();
                    drAka.FirstName = row["FirstName", DataRowVersion.Original].ToString();
                    drAka.SIN       = row["SIN", DataRowVersion.Original].ToString();
                    drAka.ContactId = (int)row["ContactId"];
                    drAka.EndEdit();
                }
                //this.myA.GetAKA().Update();
                //drAka.AcceptChanges();
            }
        }
Exemplo n.º 2
0
        protected override void BeforeUpdate(DataRow row)
        {
            base.BeforeUpdate(row);
            CLAS.DebtorRow dr = (CLAS.DebtorRow)row;
            this.BeforeChange(dr.Table.Columns["CeasedToBeStudentDate"], dr);
            this.BeforeChange(row.Table.Columns["SIN"], row);
            if (dr.IsNull(atriumBE.ContactFields.SIN))
            {
                throw new RequiredException(Resources.DebtorSIN);
            }


            if (row.RowState != DataRowState.Added && (!row["SIN", DataRowVersion.Original].Equals(row["SIN", DataRowVersion.Current]) || !row["LastName", DataRowVersion.Original].Equals(row["LastName", DataRowVersion.Current]) || !row["FirstName", DataRowVersion.Original].Equals(row["FirstName", DataRowVersion.Current])))
            {
                this.myA.FM.GetAKA();

                atriumDB.AKARow drAka = this.myA.FM.DB.AKA.NewAKARow();
                this.myA.FM.DB.AKA.AddAKARow(drAka);
                drAka.BeginEdit();
                drAka.LastName  = row["LastName", DataRowVersion.Original].ToString();
                drAka.FirstName = row["FirstName", DataRowVersion.Original].ToString();
                drAka.SIN       = row["SIN", DataRowVersion.Original].ToString();
                drAka.ContactId = (int)row["ContactId"];
                drAka.EndEdit();
            }

            if (this.myA.FM.CurrentFile.OpponentID == (int)row["ContactId"])
            {
                this.myA.FM.CurrentFile.NameE = String.Format("{0}, {1}", row["LastName"], row["FirstName"]);
                this.myA.FM.CurrentFile.NameF = String.Format("{0}, {1}", row["LastName"], row["FirstName"]);
            }
        }