public string PhoneMask(atriumDB.AddressRow adr) { if (adr == null) { return(""); } if (adr.IsNull("CountryCode")) { return(""); } switch (adr.CountryCode) { case "US": case "CA": case "USA": case "CDN": return("(###) ###-####"); default: return(""); } }
protected override void AfterAdd(DataRow row) { atriumDB.AddressRow dr = (atriumDB.AddressRow)row; string ObjectName = this.myAddressDT.TableName; dr.Current = false; dr.AddressType = "RE"; dr.EffectiveTo = DateTime.Today; //System.Diagnostics.Debug.WriteLine(dr["AddressId"] + dr.RowState.ToString() ); if (dr.IsNull("AddressId") || dr.AddressId == 0) { dr.AddressId = this.myA.AtMng.PKIDGet(ObjectName, 10); } dr.CountryCode = "CDN"; dr.AddressSourceCode = "HRDC"; //if (!dr.IsContactIdNull()) //{ // if(!myA.CurrentFile.IsOpponentIDNull() && (myA.GetCLASMng().GetDebtor().CurrentDebtor.IsAddressCurrentIDNull() || myA.GetCLASMng().GetDebtor().CurrentDebtor.RowState==DataRowState.Added)) // myA.GetCLASMng().GetDebtor().CurrentDebtor.AddressCurrentID=dr.AddressId; //} }
private void AddOtherParty(MapBE map, DataRow drp) { atriumDB.ContactRow pr = null; //search for party if (!drp.IsNull("ID_SIN")) { string SIN = drp["ID_SIN"].ToString(); myA.FM.GetPerson().LoadBySIN(SIN); var ps = from p in myA.FM.DB.Contact where !p.IsSINNull() && p.SIN == SIN select p; if (ps.Count() == 1) { pr = ps.Single(); } } if (pr == null) { //create party pr = (atriumDB.ContactRow)myA.FM.GetPerson().Add(null); pr.SIN = drp["ID_SIN"].ToString(); } pr.ContactClass = "P"; //if (drp.IsNull("NAME_INDVDL_LST")) // pr.LastName = "Resources"; //else pr.LastName = drp["NAME_INDVDL_LST"].ToString(); //if (drp.IsNull("NAME_INDVDL_FRST")) // pr.FirstName = "Human"; //else pr.FirstName = drp["NAME_INDVDL_FRST"].ToString(); pr.LanguageCode = map.MapIn("LanguageCode", drp["CODE_LNG"].ToString()); pr.BusinessNumber = drp["ID_BSNS_NMBR"].ToString(); pr.LegalName = drp["NAME_ORG"].ToString(); pr.OperatingAs = drp["NAME_ORG_UNT"].ToString(); pr.PartyTypeCode = map.MapIn("ContactType", drp["CODE_PRTCPNT_TYP"].ToString()); pr.TelephoneNumber = drp["NMBR_TLPHN_AR_CD_H"].ToString() + "-" + drp["NMBR_TLPHN_LCL_H"].ToString(); //create address atriumDB.AddressRow ar = (atriumDB.AddressRow)myA.FM.GetAddress().Add(pr); // ar.ContactId = pr.ContactId; ar.EffectiveTo = DateTime.Today; ar.AddressSourceCode = "HRDC"; ar.Address1 = drp["ADRS_LN_1"].ToString(); ar.Address2 = drp["ADRS_LN_2"].ToString(); ar.Address3 = drp["ADRS_LN_3"].ToString(); string prov = map.MapIn("Province", drp["CODE_PRVNC_OR_ST"].ToString()); if (prov != null) { DataTable dtProv = myA.FM.Codes("Province"); DataRow drs = dtProv.Rows.Find(prov); if (drs != null) { ar.CountryCode = drs["CountryCode"].ToString(); } else { ar.CountryCode = "CDN"; } } else { ar.CountryCode = map.MapIn("Country", drp["NAME_CNTRY"].ToString()); if (drp.IsNull("NAME_CNTRY") || ar.IsNull("CountryCode")) { ar.CountryCode = "CDN"; } } ar.ProvinceCode = prov; ar.City = drp["ADRS_MNCPLTY"].ToString(); ar.PostalCode = drp["CODE_PSTL_OR_ZIP"].ToString(); // pr.AddressCurrentID = ar.AddressId; //create filecontact atriumDB.FileContactRow fcrp = (atriumDB.FileContactRow)myA.FM.GetFileContact().Add(myA.FM.CurrentFile); fcrp.ContactId = pr.ContactId; fcrp.ContactType = pr.PartyTypeCode; //create fileparty SST.FilePartyRow fpr = (SST.FilePartyRow)myA.GetFileParty().Add(myA.FM.CurrentFile); // fpr.PartyId = pr.PartyId; // fpr.ContactTypeCode = pr.PartyTypeCode; fpr.IsPending = true; fpr.FileContactId = fcrp.FileContactid; }
private void EI_WS(SST.ADMSLookupRow ADMSr, MapBE map, ADMS.ADMS_LookupClient ws) { ACEngine ace = myA.FM.CurrentActivityProcess.CurrentACE; DataSet ds = ws.Get_ADMS_SST_Info(ADMSr.ReconID, ADMSr.SIN, ADMSr.BusinessNumber); if (ds.Tables.Contains("ERROR")) { //get status message ADMSr.Message = ds.Tables["ERROR"].Rows[0]["MESSAGE"].ToString(); if (ADMSr.Message.ToUpper() == "SUCCESS") { if (ds.Tables.Contains("ADMS_SST_INFO")) { DataTable dtR = ds.Tables["ADMS_SST_INFO"]; DataRow dr = dtR.Rows[0]; SST.SSTCaseRow scr = (SST.SSTCaseRow)myA.GetSSTCase().GetCurrentRow()[0]; // scr.AppelantSourceId = System.Convert.ToInt32(map.MapIn("AppelantSource", dr["CODE_SRC"].ToString())); scr.ReconsiderationID = ADMSr.ReconID; if (!dr.IsNull("DATE_DCSN_ISD")) { scr.OrigDecisionDate = System.Convert.ToDateTime(dr["DATE_DCSN_ISD"]); } int officeid = System.Convert.ToInt32(map.MapIn("Office", dr["ID_OFC_ANCHR"].ToString())); atriumDB.FileOfficeRow focr = myA.FM.GetFileOffice().AddOfficeToFile(officeid, false, false, false); focr.OfficeFileNum = scr.ReconsiderationID.ToString(); //find the gd account OfficeManager om = myA.AtMng.GetOffice(focr.OfficeId); if (om.DB.Officer.Rows.Count == 0) { om.GetOfficer().LoadByOfficeId(focr.OfficeId); } var oGD = from o in om.DB.Officer where o.PositionCode == "GD" select o; if (oGD.Count() == 1) { atriumDB.FileContactRow fcr = myA.FM.GetFileContact().Add(oGD.Single(), "FHGD"); fcr.HideInToc = true; } if (ds.Tables.Contains("ADMS_SST_INFO_PARTICIPANTS")) { // string participantType = map.MapIn("Source2Participant", dr["CODE_SRC"].ToString()); foreach (DataRow drp in ds.Tables["ADMS_SST_INFO_PARTICIPANTS"].Rows) { bool isAppellant = false; if (!ADMSr.IsSINNull() && !drp.IsNull("ID_SIN") && ADMSr.SIN == drp["ID_SIN"].ToString()) { isAppellant = true; } else if (!ADMSr.IsBusinessNumberNull() && !drp.IsNull("ID_BSNS_NMBR")) { isAppellant = IsEmployerAppellant(ADMSr, drp, isAppellant); } if (isAppellant) { atriumDB.ContactRow pr = (atriumDB.ContactRow)ace.relTables["Party0"][0].Row; atriumDB.FileContactRow fcr4 = (atriumDB.FileContactRow)ace.relTables["FileContact4"][0].Row; SST.FilePartyRow fpr = (SST.FilePartyRow)ace.relTables["FileParty0"][0].Row; fpr.IsAppellant = true; pr.SIN = drp["ID_SIN"].ToString(); pr.ContactClass = "P"; //if (pr.GetColumnError("SIN") == Properties.Resources.DebtDuplicateSIN) //changed test to test for Added as the column error would never be present on the exisiting contact after the swap if (pr.RowState != DataRowState.Added) { //TFS#54669 CJW 2013-09-20 called in PersonBE beforechange now //pr = myA.FM.GetPerson().SwapBySIN(pr, pr.SIN); pr = (atriumDB.ContactRow)ace.relTables["Party0"][0].Row; fcr4 = (atriumDB.FileContactRow)ace.relTables["FileContact4"][0].Row; fpr = (SST.FilePartyRow)ace.relTables["FileParty0"][0].Row; //alert user off swap ADMSr.Message = Properties.Resources.ExistingPartyFound; } pr.LastName = drp["NAME_INDVDL_LST"].ToString(); pr.FirstName = drp["NAME_INDVDL_FRST"].ToString(); pr.LanguageCode = map.MapIn("LanguageCode", drp["CODE_LNG"].ToString()); pr.BusinessNumber = drp["ID_BSNS_NMBR"].ToString(); pr.LegalName = drp["NAME_ORG"].ToString(); pr.OperatingAs = drp["NAME_ORG_UNT"].ToString(); pr.PartyTypeCode = map.MapIn("ContactType", drp["CODE_PRTCPNT_TYP"].ToString()); fcr4.ContactId = pr.ContactId; fcr4.ContactType = pr.PartyTypeCode; fpr.FileContactId = fcr4.FileContactid; pr.TelephoneNumber = drp["NMBR_TLPHN_AR_CD_H"].ToString() + "-" + drp["NMBR_TLPHN_LCL_H"].ToString(); if (!pr.IsAddressCurrentIDNull()) { atriumDB.AddressRow ar = myA.FM.DB.Address.FindByAddressId(pr.AddressCurrentID); ar.ContactId = pr.ContactId; ar.EffectiveTo = DateTime.Today; ar.AddressSourceCode = "HRDC"; ar.Address1 = drp["ADRS_LN_1"].ToString(); ar.Address2 = drp["ADRS_LN_2"].ToString(); ar.Address3 = drp["ADRS_LN_3"].ToString(); string prov = map.MapIn("Province", drp["CODE_PRVNC_OR_ST"].ToString()); if (prov != null) { DataTable dtProv = myA.FM.Codes("Province"); DataRow drs = dtProv.Rows.Find(prov); if (drs != null) { ar.CountryCode = drs["CountryCode"].ToString(); } else { ar.CountryCode = "CDN"; } } else { ar.CountryCode = map.MapIn("Country", drp["NAME_CNTRY"].ToString()); if (drp.IsNull("NAME_CNTRY") || ar.IsNull("CountryCode")) { ar.CountryCode = "CDN"; } } ar.ProvinceCode = prov; ar.City = drp["ADRS_MNCPLTY"].ToString(); ar.PostalCode = drp["CODE_PSTL_OR_ZIP"].ToString(); } } else { //add other participants automatically AddOtherParty(map, drp); } } } } } else if (ADMSr.Message.ToUpper() == "ERROR") { // ADMSr.SetColumnError("Message", ADMSr.Message); ADMSr.Message = ds.Tables["ERROR"].Rows[0]["SQL"].ToString(); if (ADMSr.Message.StartsWith("ORA-01403")) { ADMSr.Message = "No matching reconsideration found in ADMS. / Aucune révision correspondante trouvée dans le SGPA."; } else if (ADMSr.Message.StartsWith("ORA-01422")) { ADMSr.Message = "More than one matching reconsideration found in ADMS. / Il y a plus qu'une révision correspondante trouvée dans le SGPA."; } else if (ADMSr.Message.StartsWith("ORA-1017")) { ADMSr.Message = "Configuration problem with ADMS EI web service. Contact IT support. / Il y a un problème de configuration avec le service web A-E SGPA. Contactez le support TI."; } else if (ADMSr.Message.StartsWith("ORA-12154")) { ADMSr.Message = "Configuration problem with ADMS EI web service. Contact IT support. / Il y a un problème de configuration avec le service web A-E SGPA. Contactez le support TI."; } } } }
protected override void BeforeChange(DataColumn dc, DataRow ddr) { string ObjectName = this.myAddressDT.TableName; atriumDB.AddressRow dr = (atriumDB.AddressRow)ddr; WhereClause whereCl = new WhereClause(); switch (dc.ColumnName) { case "City": if (!dr.IsNull("CountryCode") && dr.CountryCode == "CDN") { if (dr.IsCityNull()) { throw new RequiredException(Resources.AddressCity); } if (myA.AtMng.GetSetting(AppBoolSetting.ValidateCity)) { if (!dr.IsProvinceCodeNull()) { DataTable dt = myA.Codes("vCity"); whereCl.Add("ProvinceCode", "=", dr.ProvinceCode); if (dt.Select(whereCl.Filter()).Length != 0) { whereCl.Add("City", "=", dr.City); //dt = myA.AtMng.GetGeneralRec("City", whereCl); if (dt.Select(whereCl.Filter()).Length == 0) { throw new AtriumException(Resources.AddressCityNotInProv, Resources.AddressCity, Resources.AddressProvince); } } } } } break; case "ProvinceCode": if (dr.IsProvinceCodeNull()) { if (!dr.IsNull("CountryCode")) { if (dr.CountryCode == "CDN" || dr.CountryCode == "USA") { throw new RequiredException(Resources.AddressProvinceCode); } } } else { if (!dr.IsNull("CountryCode")) { if (dr.CountryCode == "CDN" || dr.CountryCode == "USA") { DataTable dtP = myA.Codes("Province"); atLogic.WhereClause wc = new atLogic.WhereClause(); wc.Add("CountryCode", "=", dr.CountryCode); //if (!myA.Codes("Province").Rows.Contains(dr.ProvinceCode)) if (!dtP.Rows.Contains(dr.ProvinceCode)) { throw new AtriumException(Resources.IsNotValid, Resources.AddressProvinceCode); } } } } break; case "CountryCode": if (dr.IsNull(dc)) { throw new RequiredException(Resources.AddressCountryCode); } else if (!myA.Codes("Country").Rows.Contains(dr.CountryCode)) { throw new AtriumException(Resources.IsNotValid, Resources.AddressCountryCode); } break; case "AddressSourceCode": if (dr.IsAddressSourceCodeNull()) { throw new RequiredException(Resources.AddressAddressSourceCode); } else if (!myA.Codes("AddressSource").Rows.Contains(dr.AddressSourceCode)) { throw new AtriumException(Resources.IsNotValid, Resources.AddressAddressSourceCode); } break; case "AddressType": if (dr.IsAddressTypeNull()) { throw new RequiredException(Resources.AddressAddressType); } else if (!myA.Codes("AddressType").Rows.Contains(dr.AddressType)) { throw new AtriumException(Resources.IsNotValid, Resources.AddressAddressType); } break; case "Address1": if (dr.IsNull(dc)) { throw new RequiredException(Resources.AddressAddress1); } break; case "EffectiveTo": if (dr.IsEffectiveToNull()) { throw new RequiredException(Resources.AddressEffectiveTo); } myA.IsValidDate(Resources.AddressEffectiveTo, dr.EffectiveTo, false, DebtorBE.CSLBegin, DateTime.Today, Resources.ValidationCSLBegin, Resources.ValidationToday); break; default: break; } }