Exemplo n.º 1
0
        private async void btnSubmit_Click(object sender, EventArgs e)
        {
            //this is accessing record management class
            RecordManagement recordModel = new RecordManagement();
            //this will call the the validation method to check if any of the textboes are null or empty
            var outcome = CheckTextBoxes(txtCustomer.Text, txtPayment.Text, txtTransfer.Text, txtTransaction.Text);

            if (outcome != "success")                                                          //if the result does not return a success string....
            {
                MessageBox.Show($"{outcome} textbox is required", "Detected Empty Textboxes"); //display a message to the admin that there is a textbox is null/empty
            }
            else//otherwise
            {
                await dataService.InsertAsync(new RecordManagement() //call the data services class, assign each textbox text to the model class
                                                                     //and send it to the database
                {
                    CustomerID    = txtCustomer.Text,
                    PaymentID     = txtPayment.Text,
                    TransferID    = txtTransfer.Text,
                    TransactionID = txtTransaction.Text
                }, CollectionName);

                MessageBox.Show("Record has been saved to the database", "Insert Successful"); //display a message to the admin that the record has been successfully sent

                ClearAllTextboxes();                                                           //call the clear all textboxes method
            }
        }
        private async void btnSubmit_Click(object sender, EventArgs e)
        {
            RecordManagement record  = new RecordManagement();
            string           outcome = CheckTextBoxes(txtRecord.Text, txtCustomer.Text, txtPayment.Text, txtTransfer.Text, txtTransaction.Text);

            if (outcome != "success")
            {
                MessageBox.Show($"{outcome} ID is required", "Detected Empty Textboxes");
            }
            else
            {
                record.id            = txtRecord.Text;
                record.CustomerID    = txtCustomer.Text;
                record.PaymentID     = txtPayment.Text;
                record.TransferID    = txtTransfer.Text;
                record.TransactionID = txtTransaction.Text;

                bool result = await dataService.UpdateAsync(txtRecord.Text, record, CollectionName);

                if (!result)
                {
                    MessageBox.Show("Unable to Update please check if your Record ID is correct", "Update FAILED");
                }
                else
                {
                    MessageBox.Show("Update has been made", "Update Successful");
                }

                ClearAllTextboxes();
            }
        }
Exemplo n.º 3
0
 public JsonResult Update(RecordAjaxParam ajaxParam)
 {
     return(RecordManagement.Update(ajaxParam));
 }