public BusinessLayer() { validation = new ErrorValidation(); businessLayerSearch = new SearchPhoneRepo(); businessLayerAdd = new UpdatePhoneRepo(); }
private void button1_Click(object sender, EventArgs e) { textBox3.Clear(); long _number; if ((!(long.TryParse(textBox2.Text, out _number))) | _number==0) { MessageBox.Show("Invalid Number"); } else if (string.IsNullOrWhiteSpace(textBox1.Text) | textBox1.Text.StartsWith(" ")) { MessageBox.Show("Invalid Name"); } else { var _phoneEntry = new PhoneEntry(textBox1.Text, _number); if (_phoneEntry.IsValidNumber()) { validation = businessLayer.AddToDictionary(_phoneEntry); if (validation.isError) { MessageBox.Show(validation.description); validation.isError = false; } else { gridDisplay(null); button2_Click(sender,e); } } else MessageBox.Show("Number should be of length 10"); } }
public UpdatePhoneRepo() { phoneRepo = new PhoneDirectoryRepository(); PK_Validation = new SearchPhoneRepo(); validation = new ErrorValidation(); }
public PhoneDirectoryRepository() { validation = new ErrorValidation(); sqlConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SqlConnection"].ConnectionString; }