예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow newServicEqRow = DM.dtServiceTypeEquipment.NewRow();

                //If any of the text areas are empty then do not write data and return
                if ((cmboEquipmentID.Text == "") && (cmboServiceTypeID.Text == ""))
                {
                    MessageBox.Show("You must enter both values", "Error");
                }
                else
                {
                    newServicEqRow["ServiceTypeID"] = cmboServiceTypeID.Text;
                    newServicEqRow["EquipmentID"]   = cmboEquipmentID.Text;
                    DM.dtServiceTypeEquipment.Rows.Add(newServicEqRow);
                    DM.UpdatedServiceTypeEquipment();
                    MessageBox.Show("Service & Equipment mapped successfully", "Success");
                }
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }