public void initialAddressType() { string s_type = ADR_ID.Substring(0, 2); int.TryParse(s_type, out int type); BitArray b = new BitArray(new int[] { type }); AddressTypeFlags = new bool[b.Count]; b.CopyTo(AddressTypeFlags, 0); }
protected override void OnSaving() { bool inserted = ((ADR_ID == 0) || (ADR_ID == null)); base.OnSaving(); DBValue dbv = DBValue.Instance(this.Session); LOGIN = dbv.DBUserName; LASTUPDATE = dbv.DBSysDateTime; if (inserted) { DBUtil dbu = new DBUtil(this.Session); ADR_ID = dbu.LIZNI_SEQ("P_SEQ_ADR_ID"); if (this.ADR_ICO_OPROS == null) { ADR_ICO_OPROS = "-1"; } ADR_OPROS_ROZH = Convert.ToChar("N"); ADR_ADRPOPL = -1m; //neodsouhlasena adresa if (ADR_PLATCEDPH == null) { ADR_PLATCEDPH = "N"; } if ((string.IsNullOrEmpty(ADR_NAZEV1)) && (!string.IsNullOrEmpty(ADR_JMENO) || !string.IsNullOrEmpty(ADR_PRIJMENI))) { ADR_NAZEV1 = (ADR_PRIJMENI + ' ' + ADR_JMENO).Trim(); } if (!string.IsNullOrEmpty(ADR_NAZEV1) && !string.IsNullOrEmpty(ADR_TITUL_PRED)) { ADR_NAZEV1 = ADR_TITUL_PRED + " " + ADR_NAZEV1; } if (!string.IsNullOrEmpty(ADR_NAZEV1) && !string.IsNullOrEmpty(ADR_TITUL_ZA)) { ADR_NAZEV1 += ", " + ADR_TITUL_ZA; } if (string.IsNullOrWhiteSpace(ADR_ICO)) { ADR_ICO = null; //0.8 } if ((ADR_ICO != null) && ADR_ICO.Contains('#')) { throw new Exception("nepovolený tvar IČ/RČ"); } //0.8 if (ADR_ICO == null) { ADR_ICO = "#" + ADR_ID.ToString(); } if (ADR_TYP == null) { throw new Exception("TYP osoby musí být vyplněn"); } if (ADR_NAZEV1 == null) { throw new Exception("NAZEV osoby musí být vyplněn"); } if (((ADR_TYP == "F") || (ADR_TYP == "C")) && (ADR_DATNAR == null)) { throw new Exception("datum narození osoby musí být vyplněn"); } if (((ADR_ICZUJ_NAZEV == null) && (ADR_ZAHR == 0)) || ((ADR_ZAHR_ULICE_A_CISLO == null) && (ADR_ZAHR == 1))) { throw new Exception("název ulice musí být vyplněn"); } if ((ADR_PLATCEDPH != "N") && (ADR_PLATCEDPH != "A")) { throw new Exception("chybná hodnota plátce DPH (povolená hodnota-[A/N])"); } } }