private void butOK_Click(object sender, System.EventArgs e) { if (textCarrierName.Text == "") { MessageBox.Show(Lan.g(this, "Carrier Name cannot be blank.")); return; } string carrierNameOld = CarrierCur.CarrierName; CarrierCur.CarrierName = textCarrierName.Text; CarrierCur.Phone = textPhone.Text; CarrierCur.Address = textAddress.Text; CarrierCur.Address2 = textAddress2.Text; CarrierCur.City = textCity.Text; CarrierCur.State = textState.Text; CarrierCur.Zip = textZip.Text; CarrierCur.ElectID = textElectID.Text; CarrierCur.NoSendElect = checkNoSendElect.Checked; CarrierCur.IsHidden = checkIsHidden.Checked; CarrierCur.IsCDA = checkIsCDAnet.Checked; if (IsNew) { try{ Carriers.Insert(CarrierCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } } else { try{ Carriers.Update(CarrierCur); //If the carrier name has changed loop through all the insplans that use this carrier and make a securitylog entry. if (carrierNameOld != CarrierCur.CarrierName) { List <long> insPlanNums = InsPlans.GetPlanNumsByCarrierNum(CarrierCur.CarrierNum); for (int i = 0; i < insPlanNums.Count; i++) { SecurityLogs.MakeLogEntry(Permissions.InsPlanChangeCarrierName, 0, Lan.g(this, "Carrier name changed in Edit Carrier window from") + " " + carrierNameOld + " " + Lan.g(this, "to") + " " + CarrierCur.CarrierName, insPlanNums[i]); } } } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textCarrierName.Text == "") { MessageBox.Show(Lan.g(this, "Carrier Name cannot be blank.")); return; } CarrierCur.CarrierName = textCarrierName.Text; CarrierCur.Phone = textPhone.Text; CarrierCur.Address = textAddress.Text; CarrierCur.Address2 = textAddress2.Text; CarrierCur.City = textCity.Text; CarrierCur.State = textState.Text; CarrierCur.Zip = textZip.Text; CarrierCur.ElectID = textElectID.Text; CarrierCur.NoSendElect = checkNoSendElect.Checked; CarrierCur.IsHidden = checkIsHidden.Checked; CarrierCur.IsCDA = checkIsCDAnet.Checked; if (IsNew) { try{ Carriers.Insert(CarrierCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } } else { try{ Carriers.Update(CarrierCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textCarrierName.Text == "") { MessageBox.Show(Lan.g(this, "Carrier Name cannot be blank.")); return; } if (textVersion.Visible && textVersion.Text != "" && textVersion.Text != "2" && textVersion.Text != "3" && textVersion.Text != "4") { MsgBox.Show(this, "Version Number must be 2, 3, or 4."); return; } CarrierCur.CarrierName = textCarrierName.Text; CarrierCur.Phone = textPhone.Text; CarrierCur.Address = textAddress.Text; CarrierCur.Address2 = textAddress2.Text; CarrierCur.City = textCity.Text; CarrierCur.State = textState.Text; CarrierCur.Zip = textZip.Text; CarrierCur.ElectID = textElectID.Text; CarrierCur.NoSendElect = checkNoSendElect.Checked; if (checkIsCDAnet.Checked) { CarrierCur.IsCDA = true; //CarrierCur.IsPMP=checkPMP.Checked; if (comboNetwork.SelectedIndex == 0) { CarrierCur.CanadianNetworkNum = 0; } else { CarrierCur.CanadianNetworkNum = CanadianNetworks.Listt[comboNetwork.SelectedIndex - 1].CanadianNetworkNum; } CarrierCur.CDAnetVersion = textVersion.Text; } else { CarrierCur.IsCDA = false; //CarrierCur.IsPMP=false; } if (IsNew) { try{ Carriers.Insert(CarrierCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } } else { try{ Carriers.Update(CarrierCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } } DialogResult = DialogResult.OK; }