Beispiel #1
0
        private void btnClose_Click(object sender, EventArgs e)
        {
            int  choiceId      = dbOps.getChoice(sysMessages.msgClose);
            bool goodToProceed = entryVal.validateCookieEntry(choiceId,
                                                              txtCookie.Text,
                                                              txtDescription.Text,
                                                              double.Parse(numPrice.Value.ToString()));

            if (goodToProceed)
            {
                string msg = sysMessages.msgThereIs + sysMessages.msgSpace + sysMessages.msgCookie.ToLower() + sysMessages.msgSpace +
                             sysMessages.msgDataEntered + sysMessages.msgSpace + sysMessages.msgSaved + sysMessages.msgPeriod + sysMessages.msgSpace +
                             sysMessages.msgAreYouSure + sysMessages.msgSpace + sysMessages.msgYouWishTo + sysMessages.msgSpace +
                             sysMessages.msgSave + sysMessages.msgSpace + sysMessages.msgProcess + sysMessages.msgQuestion;
                result = MessageBox.Show(msg,
                                         sysMessages.msgAttention,
                                         MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Exclamation);

                if (result == DialogResult.Yes)
                {
                    this.Close();
                }
            }
            else
            {
                this.Close();
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string updatedValues = dataUpdated();
            int    recordTypeId  = dbOps.getRecordUpdateType(sysMessages.msgCookie);
            int    processId     = dbOps.getSystemProcess(sysMessages.msgCookie);
            int    cookieId      = dbOps.getRecordIdByNameValue(processId, cboRecords.Text, false);

            try
            {
                int  choiceId      = dbOps.getChoice(sysMessages.msgSaveCap);
                bool goodToProceed = entryVal.validateCookieEntry(choiceId,
                                                                  txtCookie.Text,
                                                                  txtDescription.Text,
                                                                  double.Parse(numPrice.Value.ToString()));

                //if (cboRecords.Text != String.Empty)
                if (goodToProceed)
                {
                    cookieUpdate.CookieUpdate(recordTypeId,
                                              cookieId,
                                              txtCookie.Text,
                                              txtDescription.Text,
                                              double.Parse(numPrice.Value.ToString()),
                                              int.Parse(txtCount.Text),
                                              double.Parse(txtWeight.Text),
                                              int.Parse(txtServing.Text),
                                              int.Parse(txtCalories.Text),
                                              userId,
                                              updatedValues);
                }
                else
                {
                    MessageBox.Show(sysMessages.msgMakeChoice,
                                    sysMessages.msgAttention,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.ToString(),
                                sysMessages.dbError,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                if (cboRecords.Text != String.Empty)
                {
                    cboRecords.Text = String.Empty;
                    this.Close();
                }
                else
                {
                    cboRecords.Focus();
                }
            }
        }