/// <summary> /// Carga informacion a la mascarilla por Location /// </summary> private Boolean ExistAndLoadLocationInformation() { string send = "*PDK"; string res = string.Empty; string location = string.Empty; using (CommandsAPI objCommand = new CommandsAPI()) { res = objCommand.SendReceive(send); } if (res.Trim() != "‡NO PSGR DATA‡") { location = res.Substring(18, 6); } WsMyCTS wsServ = new WsMyCTS(); MyCTS.Services.ValidateDKsAndCreditCards.Cat1stStarInfoByLocation star1InfoByLocation = null; try { star1InfoByLocation = wsServ.GetProfileInfo(location); } catch { } if (star1InfoByLocation != null) { if (!string.IsNullOrEmpty(star1InfoByLocation.CustomerName)) { string customer = star1InfoByLocation.CustomerName.ToString(); customer = customer.Replace("(", ""); customer = customer.Replace(")", ""); txtSocialReason.Text = customer.Replace(',', ' '); } if (!string.IsNullOrEmpty(star1InfoByLocation.Address1)) { txtStreet.Text = star1InfoByLocation.Address1.Replace(',', ' '); } ; if (!string.IsNullOrEmpty(star1InfoByLocation.Address2)) { star1InfoByLocation.Address2 = star1InfoByLocation.Address2.Replace("#", ""); star1InfoByLocation.Address2 = star1InfoByLocation.Address2.TrimStart().Replace(',', ' ');; txtNumberExt.Text = star1InfoByLocation.Address2; } if (!string.IsNullOrEmpty(star1InfoByLocation.Address3)) { star1InfoByLocation.Address3 = star1InfoByLocation.Address3.Replace("#", ""); star1InfoByLocation.Address3 = star1InfoByLocation.Address3.TrimStart().Replace(',', ' '); txtNumberInt.Text = star1InfoByLocation.Address3; } if (!string.IsNullOrEmpty(star1InfoByLocation.Address4)) { txtColony.Text = star1InfoByLocation.Address4; } if (star1InfoByLocation.Address4 == "") { txtColony.Enabled = true; } if (!string.IsNullOrEmpty(star1InfoByLocation.Municipality)) { txtDelegation.Text = star1InfoByLocation.Municipality.Replace(',', ' '); } if (!string.IsNullOrEmpty(star1InfoByLocation.PostalCode)) { txtCP.Text = star1InfoByLocation.PostalCode; } if (!string.IsNullOrEmpty(star1InfoByLocation.City)) { txtCity.Text = star1InfoByLocation.City.Replace(',', ' '); } if (!string.IsNullOrEmpty(star1InfoByLocation.State)) { txtState.Text = star1InfoByLocation.State.Replace(',', ' '); } if (!string.IsNullOrEmpty(star1InfoByLocation.RFC)) { bool IsRFC = ValidateRegularExpression.ValidateRFCFormat(star1InfoByLocation.RFC); if (IsRFC) { if (star1InfoByLocation.RFC.Length.Equals(13)) { txtRFC1.Text = star1InfoByLocation.RFC.Substring(0, 4); txtRFC2.Text = star1InfoByLocation.RFC.Substring(4, 6); txtRFC3.Text = star1InfoByLocation.RFC.Substring(10, 3); } else if (star1InfoByLocation.RFC.Length.Equals(12)) { txtRFC1.Text = star1InfoByLocation.RFC.Substring(0, 3); txtRFC2.Text = star1InfoByLocation.RFC.Substring(3, 6); txtRFC3.Text = star1InfoByLocation.RFC.Substring(9, 3); } } } return(true); } return(true); }
/// <summary> /// Carga informacion a la mascarilla por Location si falla el metodo principal /// </summary> private Boolean ExistLoadLocationInfoBackup() { string location = txtDK.Text; WsMyCTS wsServ = new WsMyCTS(); MyCTS.Services.ValidateDKsAndCreditCards.Cat1stStarInfoByLocation starFirstInfoByLocation; starFirstInfoByLocation = wsServ.Get1stStarInfoByLocation(location); //MyCTS.Entities.Cat1stStarInfoByLocation starFirstInfoByLocation = Cat1stStarInfoByLocationBL.Get1stStarInfoByLocation(location); if (starFirstInfoByLocation != null) { if (!string.IsNullOrEmpty(starFirstInfoByLocation.CustomerName)) { string customer = starFirstInfoByLocation.CustomerName.ToString(); customer = customer.Replace("(", ""); customer = customer.Replace(")", ""); txtEnterpriseName.Text = customer; txtSocialReason.Text = customer; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.MainPhone) && !starFirstInfoByLocation.MainPhone.Equals("()")) { string phone = starFirstInfoByLocation.MainPhone.Trim(new char[] { '(', ')' }); phone = phone.TrimEnd(); phone = phone.TrimStart(); txtPhone.Text = phone; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Address1)) { txtStreet.Text = starFirstInfoByLocation.Address1; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Address2)) { starFirstInfoByLocation.Address2 = starFirstInfoByLocation.Address2.Replace("#", ""); starFirstInfoByLocation.Address2 = starFirstInfoByLocation.Address2.TrimStart(); txtNumberExt.Text = starFirstInfoByLocation.Address2; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Address3)) { starFirstInfoByLocation.Address3 = starFirstInfoByLocation.Address3.Replace("#", ""); starFirstInfoByLocation.Address3 = starFirstInfoByLocation.Address3.TrimStart(); txtNumberInt.Text = starFirstInfoByLocation.Address3; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Address4)) { txtColony.Text = starFirstInfoByLocation.Address4; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Municipality)) { txtDelorMunicipality.Text = starFirstInfoByLocation.Municipality; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.PostalCode)) { txtPostalCode.Text = starFirstInfoByLocation.PostalCode; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.City)) { txtCity.Text = starFirstInfoByLocation.City; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.State)) { txtState.Text = starFirstInfoByLocation.State; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.RFC)) { bool IsRFC = ValidateRegularExpression.ValidateRFCFormat(starFirstInfoByLocation.RFC); if (IsRFC) { if (starFirstInfoByLocation.RFC.Length.Equals(13)) { txtRFC1.Text = starFirstInfoByLocation.RFC.Substring(0, 4); txtRFC2.Text = starFirstInfoByLocation.RFC.Substring(4, 6); txtRFC3.Text = starFirstInfoByLocation.RFC.Substring(10, 3); } else if (starFirstInfoByLocation.RFC.Length.Equals(12)) { txtRFC1.Text = starFirstInfoByLocation.RFC.Substring(0, 3); txtRFC2.Text = starFirstInfoByLocation.RFC.Substring(3, 6); txtRFC3.Text = starFirstInfoByLocation.RFC.Substring(9, 3); } } } return(true); } else { MessageBox.Show("El DK ingresado no existe", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } }
/// <summary> /// Carga informacion a la mascarilla por Location si falla el metodo principal /// </summary> private Boolean ExistLoadLocationInfoBackup() { string send = "*PDK"; string res = string.Empty; string location = string.Empty; using (CommandsAPI objCommand = new CommandsAPI()) { res = objCommand.SendReceive(send); } if (res.Trim() != "‡NO PSGR DATA‡") { location = res.Substring(18, 6); } MyCTS.Entities.Cat1stStarInfoByLocation starFirstInfoByLocation = Cat1stStarInfoByLocationBL.Get1stStarInfoByLocation(location); if (starFirstInfoByLocation != null) { if (!string.IsNullOrEmpty(starFirstInfoByLocation.CustomerName)) { string customer = starFirstInfoByLocation.CustomerName.ToString(); customer = customer.Replace("(", ""); customer = customer.Replace(")", ""); txtSocialReason.Text = customer.Replace(',', ' '); } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Address1)) { txtStreet.Text = starFirstInfoByLocation.Address1.Replace(',', ' '); } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Address2)) { starFirstInfoByLocation.Address2 = starFirstInfoByLocation.Address2.Replace("#", ""); starFirstInfoByLocation.Address2 = starFirstInfoByLocation.Address2.TrimStart(); txtNumberExt.Text = starFirstInfoByLocation.Address2.Replace(',', ' '); } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Address3)) { starFirstInfoByLocation.Address3 = starFirstInfoByLocation.Address3.Replace("#", ""); starFirstInfoByLocation.Address3 = starFirstInfoByLocation.Address3.TrimStart(); txtNumberInt.Text = starFirstInfoByLocation.Address3; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Address4)) { txtColony.Text = starFirstInfoByLocation.Address4.Replace(',', ' '); } if (!string.IsNullOrEmpty(starFirstInfoByLocation.Municipality)) { txtDelegation.Text = starFirstInfoByLocation.Municipality.Replace(',', ' '); } if (!string.IsNullOrEmpty(starFirstInfoByLocation.PostalCode)) { txtCP.Text = starFirstInfoByLocation.PostalCode; } if (!string.IsNullOrEmpty(starFirstInfoByLocation.City)) { txtCity.Text = starFirstInfoByLocation.City.Replace(',', ' '); } if (!string.IsNullOrEmpty(starFirstInfoByLocation.State)) { txtState.Text = starFirstInfoByLocation.State.Replace(',', ' '); } if (!string.IsNullOrEmpty(starFirstInfoByLocation.RFC)) { bool IsRFC = ValidateRegularExpression.ValidateRFCFormat(starFirstInfoByLocation.RFC); if (IsRFC) { if (starFirstInfoByLocation.RFC.Length.Equals(13)) { txtRFC1.Text = starFirstInfoByLocation.RFC.Substring(0, 4); txtRFC2.Text = starFirstInfoByLocation.RFC.Substring(4, 6); txtRFC3.Text = starFirstInfoByLocation.RFC.Substring(10, 3); } else if (starFirstInfoByLocation.RFC.Length.Equals(12)) { txtRFC1.Text = starFirstInfoByLocation.RFC.Substring(0, 3); txtRFC2.Text = starFirstInfoByLocation.RFC.Substring(3, 6); txtRFC3.Text = starFirstInfoByLocation.RFC.Substring(9, 3); } } } return(true); } return(true); }