public RespCPostalList Search(string searchstring, string limit, string offset, string key) { try { RespCPostalList r = Auth.GetRespCPostalListAuth4Key(key); if (r.EqualsEStatus(r.GetStatus(), Response.EStatus.ERROR)) { return(r); } List <CPostal> lc = CPostal.Search(searchstring, int.Parse(limit), int.Parse(offset)); r.Cpostal = lc; return(r); } catch (Exception e) { RespCPostalList r = new RespCPostalList(); r.SetStatus(Response.EStatus.ERROR); r.error = e.Message; return(r); } }
/// <summary> /// Get a client /// </summary> /// <param name="client"></param> /// <param name="key"></param> /// <returns></returns> public RespPostalCode GetClient(string client, string key) { try { RespPostalCode r = Auth.GetRespCPostalAuth4Key(key); if (r.EqualsEStatus(r.GetStatus(), Response.EStatus.ERROR)) { return(r); } List <CPostal> ld = CPostal.GetClient(client); if (ld.Count == 0) { CPostal c = new CPostal(); r.Cpostal = c; r.SetStatus(Response.EStatus.ERROR); r.error = string.Format("Record not found, cliente = {0}", client); } else { r.Cpostal = ld[0]; } return(r); } catch (Exception e) { RespPostalCode r = new RespPostalCode(); r.SetStatus(Response.EStatus.ERROR); r.error = e.Message; return(r); } }
/// <summary> /// Get from a postal code /// </summary> /// <param name="cp4"></param> /// <param name="cp3"></param> /// <param name="key"></param> /// <returns></returns> public RespPostalCode GetPostalCode(string cp4, string cp3, string key) { try { RespPostalCode r = Auth.GetRespCPostalAuth4Key(key); if (r.EqualsEStatus(r.GetStatus(), Response.EStatus.ERROR)) { return(r); } List <CPostal> lc = CPostal.GetCPostal(cp4, cp3); if (lc.Count == 0) { CPostal c = new CPostal(); r.Cpostal = c; r.SetStatus(Response.EStatus.ERROR); r.error = string.Format("Record not found, cp3 = {0} e cp4 = {1}", cp4, cp3); } else { r.Cpostal = lc[0]; } return(r); } catch (Exception e) { RespPostalCode r = new RespPostalCode(); r.SetStatus(Response.EStatus.ERROR); r.error = e.Message; return(r); } }
public override string ToString() { return(Descripcion + " (" + CPostal.ToString() + ")"); }