Example #1
0
        //Update
        private void buttonClUpdate_Click(object sender, EventArgs e)
        {
            DialogResult ans = MessageBox.Show("Are you sure you want to update the Client information?", "Update Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (ans == DialogResult.Yes)
            {
                ClientDA.Update(createClient());
            }
            ClientDA.List(listViewSales);
            UpdateComboBoxes();
        }
Example #2
0
        //Add
        private void buttonOrdAdd_Click(object sender, EventArgs e)
        {
            Validator checker = new Validator();

            if (checker.isNotNull(comboBoxOrdClient.Text, "Client") && checker.isNotNull(comboBoxOrdISBN.Text, "Book ISBN") && checker.isNotNull(textBoxOrdBkQt.Text, "Quantity") && checker.isNotNull(comboBoxOrdMadeBy.Text, "Order made by?"))
            {
                Order  aorder  = createOrder();
                Book   abook   = BookDA.SearchISBN(Convert.ToInt64(comboBoxOrdISBN.Text));
                Client aclient = ClientDA.SearchName(comboBoxOrdClient.Text);
                abook.BkQOH = abook.BkQOH - aorder.OrdBkQuantity;
                BookDA.Update(abook);
                aclient.ClientCredit = aclient.ClientCredit - aorder.OrdCost;
                ClientDA.Update(aclient);
                OrderDA.SaveOrder(aorder);
                UpdateComboBoxes();
            }
        }
Example #3
0
        //Update
        private void buttonOrdUpd_Click(object sender, EventArgs e)
        {
            Order aorder   = createOrder();
            Order oldorder = OrderDA.SearchID(Convert.ToInt32(textBoxOrId.Text));

            Book   abook   = BookDA.SearchISBN(Convert.ToInt64(comboBoxOrdISBN.Text));
            Client aclient = ClientDA.SearchName(comboBoxOrdClient.Text);

            abook.BkQOH = (abook.BkQOH + oldorder.OrdBkQuantity) - aorder.OrdBkQuantity;
            BookDA.Update(abook);

            aclient.ClientCredit = (aclient.ClientCredit + aorder.OrdCost) - aorder.OrdCost;
            ClientDA.Update(aclient);

            OrderDA.Update(aorder);
            OrderDA.ListOrder(listViewOrder);
            UpdateComboBoxes();
        }
Example #4
0
        public ResultEntity <ClientEntity> Update(ClientEntity clientEntity)
        {
            var validationResult = new ResultEntity <ClientEntity>();

            using (var clientDA = new ClientDA())
            {
                var resultUpdate = clientDA.Update(clientEntity);

                if (resultUpdate <= 0)
                {
                    validationResult.Warning.Add("Failed Updating Client!");
                    return(validationResult);
                }

                validationResult.Value = clientEntity;
            }

            return(validationResult);
        }
Example #5
0
        private void buttonUpdateClient_Click(object sender, EventArgs e)
        {
            List <Client> listC = ClientDA.ListClient();

            if (IsValidClientData())
            {
                Client Client = new Client();
                Client.ClientID               = Convert.ToInt32(textBoxClientID.Text);
                Client.InstitutionName        = textBoxInstitutionName.Text;
                Client.InstitutionAddress     = textBoxInstitutionAddress.Text;
                Client.InstitutionCity        = textBoxInstitutionCity.Text;
                Client.InstitutionZipCode     = textBoxZipCode.Text;
                Client.InstitutionPhoneNumber = maskedTextBoxPhoneClient.Text;
                Client.InstitutionEmail       = textBoxEmailClient.Text;
                DialogResult ans = MessageBox.Show("Do you really want to update this Client?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (ans == DialogResult.Yes)
                {
                    ClientDA.Update(Client);
                    MessageBox.Show("Client record has been updated successfully", "Confirmation");
                    ClearAll();
                    textBoxClientID.Enabled = true;
                }
            }
        }