/// <summary> /// Busca si existe el DK /// </summary> /// private Boolean ExistLocationInformation() { string location = txtDK.Text; WsMyCTS wsServ = new WsMyCTS(); MyCTS.Services.ValidateDKsAndCreditCards.Cat1stStarInfoByLocation star1InfoByLocation = null; MyCTS.Services.ValidateDKsAndCreditCards.Cat1stStarInfoByLocation star1InfoByLocation1 = null; //OracleConnection GetProfile = new OracleConnection(); //MyCTS.Services.MyCTSOracleConnection.Cat1stStarInfoByLocation star1InfoByLocation = null; //MyCTS.Services.MyCTSOracleConnectionDev.Cat1stStarInfoByLocation star1InfoByLocation1 = null; try { star1InfoByLocation = wsServ.Get1stStarInfoByLocation(location); return(true); } catch { star1InfoByLocation = wsServ.Get1stStarInfoByLocation(location); return(true); } return(false); }
/// <summary> /// Carga informacion a la mascarilla por Location /// </summary> private Boolean ExistAndLoadLocationInformation( ) { string location = txtDK.Text; WsMyCTS wsServ = new WsMyCTS(); MyCTS.Services.ValidateDKsAndCreditCards.Cat1stStarInfoByLocation star1InfoByLocation = null; MyCTS.Services.ValidateDKsAndCreditCards.Cat1stStarInfoByLocation star1InfoByLocation1 = null; try { star1InfoByLocation = wsServ.Get1stStarInfoByLocation(location); } catch { star1InfoByLocation = wsServ.Get1stStarInfoByLocation(location); } if (star1InfoByLocation != null) { if (!string.IsNullOrEmpty(star1InfoByLocation.CustomerName)) { string customer = star1InfoByLocation.CustomerName.ToString(); customer = customer.Replace("(", ""); customer = customer.Replace(")", ""); txtEnterpriseName.Text = customer; txtSocialReason.Text = customer; if (customer == "") { txtEnterpriseName.Enabled = true; txtSocialReason.Enabled = true; } else { txtEnterpriseName.Enabled = false; txtSocialReason.Enabled = false; } } if (!string.IsNullOrEmpty(star1InfoByLocation.MainPhone) && !star1InfoByLocation.MainPhone.Equals("()")) { string phone = star1InfoByLocation.MainPhone.Trim(new char[] { '(', ')' }); phone = phone.TrimEnd(); phone = phone.TrimStart(); txtPhone.Text = phone; if (phone == "") { txtPhone.Enabled = true; } else { txtPhone.Enabled = false; } } if (!string.IsNullOrEmpty(star1InfoByLocation.Address1)) { txtStreet.Text = star1InfoByLocation.Address1; } if (star1InfoByLocation.Address1 == "") { txtStreet.Enabled = true; } else { txtStreet.Enabled = false; } if (!string.IsNullOrEmpty(star1InfoByLocation.Address2)) { star1InfoByLocation.Address2 = star1InfoByLocation.Address2.Replace("#", ""); star1InfoByLocation.Address2 = star1InfoByLocation.Address2.TrimStart(); txtNumberExt.Text = star1InfoByLocation.Address2; if (star1InfoByLocation.Address2 == "") { txtNumberExt.Enabled = true; } else { txtNumberExt.Enabled = false; } } if (!string.IsNullOrEmpty(star1InfoByLocation.Address3)) { star1InfoByLocation.Address3 = star1InfoByLocation.Address3.Replace("#", ""); star1InfoByLocation.Address3 = star1InfoByLocation.Address3.TrimStart(); txtNumberInt.Text = star1InfoByLocation.Address3; txtNumberInt.Enabled = false; } else { txtNumberInt.Enabled = true; } if (!string.IsNullOrEmpty(star1InfoByLocation.Address4)) { txtColony.Text = star1InfoByLocation.Address4; } if (star1InfoByLocation.Address4 == "") { txtColony.Enabled = true; } else { txtColony.Enabled = false; } if (!string.IsNullOrEmpty(star1InfoByLocation.Municipality)) { txtDelorMunicipality.Text = star1InfoByLocation.Municipality; txtDelorMunicipality.Enabled = false; } else { txtDelorMunicipality.Enabled = true; } if (!string.IsNullOrEmpty(star1InfoByLocation.PostalCode)) { txtPostalCode.Text = star1InfoByLocation.PostalCode; txtPostalCode.Enabled = false; } else { txtPostalCode.Enabled = true; } if (!string.IsNullOrEmpty(star1InfoByLocation.City)) { txtCity.Text = star1InfoByLocation.City; txtCity.Enabled = false; } else { txtCity.Enabled = true; } if (!string.IsNullOrEmpty(star1InfoByLocation.State)) { txtState.Text = star1InfoByLocation.State; txtState.Enabled = false; } else { txtState.Enabled = true; } 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); } else if (star1InfoByLocation1 != null) { if (!string.IsNullOrEmpty(star1InfoByLocation1.CustomerName)) { string customer = star1InfoByLocation1.CustomerName.ToString(); customer = customer.Replace("(", ""); customer = customer.Replace(")", ""); txtEnterpriseName.Text = customer; txtSocialReason.Text = customer; } if (!string.IsNullOrEmpty(star1InfoByLocation1.MainPhone) && !star1InfoByLocation1.MainPhone.Equals("()")) { string phone = star1InfoByLocation1.MainPhone.Trim(new char[] { '(', ')' }); phone = phone.TrimEnd(); phone = phone.TrimStart(); txtPhone.Text = phone; } if (!string.IsNullOrEmpty(star1InfoByLocation1.Address1)) { txtStreet.Text = star1InfoByLocation1.Address1; } if (!string.IsNullOrEmpty(star1InfoByLocation1.Address2)) { star1InfoByLocation1.Address2 = star1InfoByLocation1.Address2.Replace("#", ""); star1InfoByLocation1.Address2 = star1InfoByLocation1.Address2.TrimStart(); txtNumberExt.Text = star1InfoByLocation1.Address2; } if (!string.IsNullOrEmpty(star1InfoByLocation1.Address3)) { star1InfoByLocation1.Address3 = star1InfoByLocation1.Address3.Replace("#", ""); star1InfoByLocation1.Address3 = star1InfoByLocation1.Address3.TrimStart(); txtNumberInt.Text = star1InfoByLocation1.Address3; } if (!string.IsNullOrEmpty(star1InfoByLocation1.Address4)) { txtColony.Text = star1InfoByLocation1.Address4; } if (!string.IsNullOrEmpty(star1InfoByLocation1.Municipality)) { txtDelorMunicipality.Text = star1InfoByLocation1.Municipality; } if (!string.IsNullOrEmpty(star1InfoByLocation1.PostalCode)) { txtPostalCode.Text = star1InfoByLocation1.PostalCode; } if (!string.IsNullOrEmpty(star1InfoByLocation1.City)) { txtCity.Text = star1InfoByLocation1.City; } if (!string.IsNullOrEmpty(star1InfoByLocation1.State)) { txtState.Text = star1InfoByLocation1.State; } if (!string.IsNullOrEmpty(star1InfoByLocation1.RFC)) { bool IsRFC = ValidateRegularExpression.ValidateRFCFormat(star1InfoByLocation1.RFC); if (IsRFC) { if (star1InfoByLocation1.RFC.Length.Equals(13)) { txtRFC1.Text = star1InfoByLocation1.RFC.Substring(0, 4); txtRFC2.Text = star1InfoByLocation1.RFC.Substring(4, 6); txtRFC3.Text = star1InfoByLocation1.RFC.Substring(10, 3); } else if (star1InfoByLocation1.RFC.Length.Equals(12)) { txtRFC1.Text = star1InfoByLocation1.RFC.Substring(0, 3); txtRFC2.Text = star1InfoByLocation1.RFC.Substring(3, 6); txtRFC3.Text = star1InfoByLocation1.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 /// </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); }