示例#1
0
 /// <summary>
 /// getAddress - get client's address from database
 /// </summary>
 /// <param name="CPF">Client's CPF</param>
 /// <returns>Dataset containing address data</returns>
 public DataSet getAddress(String CPF)
 {
     if (IsCpf(CPF))
     {
         Address address = new Address(CPF);
         return address.getAdress();
     }
     else
     {
         //CPF invalido
         return null;
     }
 }
示例#2
0
 /// <summary>
 /// updateClient - update client's address in database
 /// </summary>
 /// <param name="CPF">Client's CPF</param>       
 /// <param name="Country">Client's Country</param>
 /// <param name="State">Client's State</param>
 /// <param name="City">Client's City</param>
 /// <param name="Address">Client's Address</param>  
 public void updateAddress(String CPF, String Country, String State, String City, String Address)
 {
     if (IsCpf(CPF) && validateString(Country) && validateString(State) && validateString(City) && validateString(Address))
     {
         Client client = new Client(CPF);
         if(client.getClient().Tables[0].Rows.Count > 0)
         {
             Address address = new Address(CPF, Country, State, City, Address);
             address.updateAddress();
         }
         else
         {
             //Usuario não existe
         }
     }
     else
     {
         //Dados Invalidos
     }
 }
示例#3
0
        /// <summary>
        /// insertClient - insert client in database
        /// </summary>
        /// <param name="CPF">Client's CPF</param>
        /// <param name="Nome">Client's Nome</param>
        /// <param name="Email">Client's Email</param>
        /// <param name="MaritalStatus">Client's MaritalStatus</param>
        /// <param name="Country">Client's Country</param>
        /// <param name="State">Client's State</param>
        /// <param name="City">Client's City</param>
        /// <param name="Address">Client's Address</param>
        /// <param name="PhoneDescription">Client's Phone's Description</param>
        /// <param name="PhoneNumber">Client's Phone's Number</param>
        public void insertClient(String CPF, String Nome, String Email, String MaritalStatus, String Country, String State, String City, String Address, String PhoneDescription, String PhoneNumber)
        {
            //Clean CPF
            CPF = CPF.Trim();
            CPF = CPF.Replace(".", "").Replace("-", "");

            if (IsCpf(CPF) && validateString(Nome) && validateString(Email) && validateString(MaritalStatus) && validateString(Country) && validateString(State) && validateString(City) && validateString(Address) && validateString(PhoneDescription) && validateString(PhoneNumber))
            {
                Client c = new Client(CPF);
                if (c.getClient().Tables[0].Rows.Count == 0)
                {
                    Client client = new Client(CPF, Nome, Email, MaritalStatus);
                    int afectedLinesClient = client.insertClient();

                    Address address = new Address(CPF, Country, State, City, Address);
                    int afectedLinesAddess = address.insertAddress();

                    PhoneNumber phone = new PhoneNumber(CPF, 0, PhoneDescription, PhoneNumber);
                    int afectedLinesPhoneNumber = phone.insertPhoneNumber();
                }
                else
                {
                    //Usuario ja existe
                }
            }
            else
            {
                //Dados Invalidos
            }
        }