Exemple #1
0
        private void addEventSaveBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(panelAddEventName.Text))
            {
                MessageBox.Show("Please enter event name", "Idiot control !!!!!!!!!");
                return;
            }

            DataRow newEventRecord = _dataModule.EventTable.NewRow();

            newEventRecord["eventName"]  = panelAddEventName.Text;
            newEventRecord["locationId"] = comboBoxLocations.SelectedValue;
            newEventRecord["EventDate"]  = eventDatePicker.Value;

            _dataModule.EventTable.Rows.Add(newEventRecord);
            _dataModule.UpdateEventTable();

            MessageBox.Show("New event record is now successfully added!", "Succeed");
            addEventCancelBtn_Click(sender, e);
        }
Exemple #2
0
        private void addKaiSaveBtn_Click(object sender, EventArgs e)
        {
            DataRow newKaiRecord   = _dataModule.KaiTable.NewRow();
            DataRow newEventRecord = _dataModule.EventTable.NewRow();

            if (string.IsNullOrEmpty(eventDisplay.Text) || string.IsNullOrEmpty(kaiNameDisplay.Text))
            {
                MessageBox.Show("You must enter a value for each of the text fields", "ERROR OCCURED");
                return;
            }

            newEventRecord["EventName"] = addPanelEventName.Text;
            _dataModule.EventTable.Rows.Add(newEventRecord);
            _dataModule.UpdateEventTable();

            try {
                newKaiRecord["EventId"]             = newEventRecord["EventId"];
                newKaiRecord["KaiName"]             = addFormKaiName.Text;
                newKaiRecord["ServeQuantity"]       = Int32.Parse(addPanelServingQuantity.Text.ToString());
                newKaiRecord["PreparationMinutes"]  = Int32.Parse(addPanelPreparationTime.Text.ToString());
                newKaiRecord["PreparationRequired"] = kaiAddCheckBox.Checked;
            }
            catch (FormatException) {
                MessageBox.Show("Please input correct format", "Input error!");
                return;
            }



            _dataModule.KaiTable.Rows.Add(newKaiRecord);
            _dataModule.UpdateKaiTable();



            MessageBox.Show("Kai updated successfully", "Action succeed!");
            addKaiCancelBtn_Click(sender, e);
        }