private ClientInfo CreateClientTest(string phoneNumber)
        {
            Assert.IsTrue(ClientsRepository.GetInstance().Insert(ClientTest));

            ClientInfo tempClient = ClientsRepository.GetInstance().SelectByPhone(phoneNumber);

            return(tempClient);
        }
Ejemplo n.º 2
0
 private void SetList()
 {
     Clients.Clear();
     foreach (var item in ClientsRepository.GetInstance().GetAll())
     {
         Clients.Add(item as Clients);
     }
 }
        public void TestClientsSelectByPhone()
        {
            ClientInfo tempClient = CreateClientTest(PHONE_NUMBER);

            ClientInfo client = ClientsRepository.GetInstance().SelectByPhone(tempClient.Phone);

            Assert.AreEqual(PHONE_NUMBER, client.Phone);

            DeleteClientTest(tempClient);
        }
        public void TestClientsSelectAll()
        {
            ClientInfo tempClient = CreateClientTest(PHONE_NUMBER);

            var QuantityClients = ClientsRepository.GetInstance().SelectAll();

            Assert.IsTrue(QuantityClients.Exists(x => x.Id == tempClient.Id));

            DeleteClientTest(tempClient);
        }
        public void TestClientsUpdate()
        {
            ClientInfo tempClient = CreateClientTest(PHONE_NUMBER);

            tempClient.Readed       = true;
            tempClient.LastReading += tempClient.LastReading;

            Assert.IsTrue(ClientsRepository.GetInstance().Update(tempClient));

            DeleteClientTest(tempClient);
        }
        public void TestClientsSelectByDocument()
        {
            ClientInfo tempClient = CreateClientTest(PHONE_NUMBER);

            ClientInfo client = ClientsRepository.GetInstance().SelectByDocument(tempClient.DocumentTypeId, tempClient.DocumentNumber);

            Assert.AreEqual(DOCUMENT_TYPE_ID, client.DocumentTypeId);
            Assert.AreEqual(DOCUMENT_NUMBER, client.DocumentNumber);

            DeleteClientTest(tempClient);
        }
        protected void ButtonSave_Click(object sender, EventArgs e)
        {
            var client = new ClientInfo
            {
                Id          = string.IsNullOrWhiteSpace(TextBoxIDClient.Text) ? 0 : int.Parse(TextBoxIDClient.Text),
                Phone       = string.IsNullOrWhiteSpace(TextBoxPhone.Text) ? string.Empty : TextBoxPhone.Text,
                LastReading = string.IsNullOrWhiteSpace(TextBoxReadLast.Text) ? 0 : int.Parse(TextBoxReadLast.Text),
                Readed      = CheckBoxReaded.Checked
            };

            ClientsRepository.GetInstance().Insert(client);
            GridViewClients.DataSource = ClientsRepository.GetInstance().SelectAll();
            GridViewClients.DataBind();
        }
Ejemplo n.º 8
0
 private void AddFinallyBtn_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(ClientsNameTb.Text) && !string.IsNullOrEmpty(ClientsSurNameTb.Text) && !string.IsNullOrEmpty(ClientsPhoneTb.Text))
     {
         NewClients = new Clients
         {
             Name        = ClientsNameTb.Text,
             SurName     = ClientsSurNameTb.Text,
             PhoneNumber = ClientsPhoneTb.Text
         };
     }
     else
     {
         return;
     }
     ClientsRepository.GetInstance().Add(NewClients);
     IsAdded = true;
     Close();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     GridViewClients.DataSource = ClientsRepository.GetInstance().SelectAll();
     GridViewClients.DataBind();
 }
 private static void DeleteClientTest(ClientInfo tempClient)
 {
     Assert.IsTrue(ClientsRepository.GetInstance().Delete(tempClient.Id));
 }