private void btnEventSubmit_Click(object sender, EventArgs e) { if (!ValidationEvent.validateName(txtEName.Text) || txtEName.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Name"); } else if (!ValidationEvent.validatePhoneNo(txtEContactNo.Text) || txtEContactNo.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Phone number"); } else if (!ValidationEvent.validateNic(txtENic.Text) || txtENic.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Nic NO"); } else if (txtEAddress.Text == "") { MessageBox.Show("Please enter the Address"); } else if (!rdbELocal.Checked && !rdbEForeign.Checked) { MessageBox.Show("Please enter Select The Standards"); } else if (cmbEType.Text == "") { MessageBox.Show("Please enter a valid Hall Type"); } else if (txtECount.Text == "") { MessageBox.Show("Please enter a valid Hall Type"); } else { Event ev = new Event(); ev.EName = txtEName.Text; ev.EContactNo = txtEContactNo.Text; ev.ENic = txtENic.Text; ev.EAddress = txtEAddress.Text; String standards = ""; if (rdbELocal.Checked) { standards = "Local"; } else if (rdbEForeign.Checked) { standards = "Foreign"; } ev.EStandards = standards; ev.EType = cmbEType.Text; ev.EDate = EDate.Value.ToString("yyyy-MM-dd"); ev.ECount = Int32.Parse(txtECount.Text); ev.InsertEvent(); //getEventPrice(); } }
private void button3_Click_1(object sender, EventArgs e) { if (!ValidationEvent.validateName(txtName.Text) || txtName.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Name"); } else if (!ValidationEvent.validatePhoneNo(txtHallContactNo.Text) || txtHallContactNo.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Phone number"); } else if (!ValidationEvent.validateNic(txtNic.Text) || txtNic.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Nic NO"); } else if (txtHallAddress.Text == "") { MessageBox.Show("Please enter the Address"); } else if (comHallType.Text == "") { MessageBox.Show("Please enter a valid Hall Type"); } else if (txtHallCount.Text == "") { MessageBox.Show("Please enter the Member Count"); } else { Hall h = new Hall(); h.Name = txtName.Text; h.ContactNo = txtHallContactNo.Text; h.Nic = txtNic.Text; h.Address = txtHallAddress.Text; h.HallType = comHallType.Text; h.HallDate = hallDate.Value.ToShortDateString(); h.HallCount = txtHallCount.Text; h.InsertHall(); getHallPrice(h.HallType); } /*bool result = Hall.InsertHall(h); * if (result) * { * MessageBox.Show("Employee inserted successfully"); * } * else * { * MessageBox.Show("Employee insertion failed"); * }*/ dgvHallBookings.DataSource = loadDataToDgvHallBookings(); }
private void btnEventUpdate_Click(object sender, EventArgs e) { /*string NamePattern = "^[a-zA-Z][a-zA-Z\\s]+$"; * string AddressPattern = "^[a-zA-Z][a-zA-Z\\s]+$"; * string ContactPattern = "[0-9]{10}";*/ /*bool isNameValid = Regex.IsMatch(txtEName.Text, NamePattern); * bool isAddressValid = Regex.IsMatch(txtEAddress.Text, AddressPattern); * bool isContactValid = Regex.IsMatch(txtEContactNo.Text, ContactPattern);*/ if (!ValidationEvent.validateName(txtEName.Text) || txtEName.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Name"); } else if (!ValidationEvent.validatePhoneNo(txtEContactNo.Text) || txtEContactNo.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Phone number"); } else if (!ValidationEvent.validateNic(txtENic.Text) || txtENic.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Nic NO"); } else if (txtEAddress.Text == "") { MessageBox.Show("Please enter the Address"); } else if (!rdbELocal.Checked && !rdbEForeign.Checked) { MessageBox.Show("Please enter Select The Standards"); } else if (cmbEType.Text == "") { MessageBox.Show("Please enter a valid Hall Type"); } else if (txtECount.Text == "") { MessageBox.Show("Please enter a valid Hall Type"); } else { Event ev = new Event(); ev.CustomerEId = Int32.Parse(txtESearch.Text); ev.EName = txtEName.Text; ev.EContactNo = txtEContactNo.Text; ev.ENic = txtENic.Text; ev.EAddress = txtEAddress.Text; String standards = ""; if (rdbELocal.Checked) { standards = "Local"; } else if (rdbEForeign.Checked) { standards = "Foreign"; } ev.EStandards = standards; ev.EType = cmbEType.Text; ev.EDate = EDate.Value.ToShortDateString(); ev.ECount = Int32.Parse(txtECount.Text); ev.UpdateEvent(); clearAddEventForm(); } }
private void btnHallUpdate_Click(object sender, EventArgs e) { /*string NamePattern = "^[a-zA-Z][a-zA-Z\\s]+$"; * string AddressPattern = "^[a-zA-Z][a-zA-Z\\s]+$"; * string ContactPattern = "[0-9]{10}"; * * bool isNameValid = Regex.IsMatch(txtName.Text, NamePattern); * bool isAddressValid = Regex.IsMatch(txtHallAddress.Text, AddressPattern); * bool isContactValid = Regex.IsMatch(txtHallContactNo.Text, ContactPattern);*/ if (!ValidationEvent.validateName(txtName.Text) || txtName.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Name"); } else if (!ValidationEvent.validatePhoneNo(txtHallContactNo.Text) || txtHallContactNo.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Phone number"); } else if (!ValidationEvent.validateNic(txtNic.Text) || txtNic.Equals(String.Empty)) { MessageBox.Show("Please enter a valid Nic NO"); } else if (txtHallAddress.Text == "") { MessageBox.Show("Please enter the Address"); } else if (comHallType.Text == "") { MessageBox.Show("Please enter a valid Hall Type"); } else if (txtHallCount.Text == "") { MessageBox.Show("Please enter the Member Count"); } else { Hall h = new Hall(); h.HallId = Int32.Parse(txtHallSearch.Text); h.Name = txtName.Text; h.ContactNo = txtHallContactNo.Text; h.Nic = txtNic.Text; h.Address = txtHallAddress.Text; h.HallType = comHallType.Text; h.HallDate = hallDate.Value.ToShortDateString(); h.HallCount = txtHallCount.Text; h.UpdateHall(); getHallPrice(h.HallType); clearAddEventForm(); } /*bool result = Hall.InsertHall(h); * if (result) * { * MessageBox.Show("Employee inserted successfully"); * } * else * { * MessageBox.Show("Employee insertion failed"); * }*/ dgvHallBookings.DataSource = loadDataToDgvHallBookings(); }