예제 #1
0
        private void btnAddSType_Click(object sender, EventArgs e)
        {
            if (!System.Text.RegularExpressions.Regex.IsMatch(txtRate.Text, @"^[0-9]+$"))
            {
                MessageBox.Show("Invalid Data inserted for rate number");
                return;
            }
            lblSTypeID.Text = null;
            DataRow newSTypeRow = DM.dtServiceType.NewRow();

            if (txtDescription.Text == "")
            {
                MessageBox.Show("You must type in a Service Description ", "Error");
            }
            else
            {
                newSTypeRow["Description"] = txtDescription.Text;
                newSTypeRow["HourlyRate"]  = txtRate.Text;
                DM.dtServiceType.Rows.Add(newSTypeRow);
                DM.UpdatedServiceType();
                MessageBox.Show("Service Type added successfully", "Success");
            }

            return;
        }