private void addMarker(GMapMarker marker, string toolTip) { GMapOverlay markersOverlay_i = new GMapOverlay("markersLayer"); markersOverlay = markersOverlay_i; if (!AdditionalFunctions.isEmpty(toolTip)) { marker.ToolTipMode = MarkerTooltipMode.OnMouseOver; marker.ToolTipText = toolTip; } markersOverlay_i.Markers.Add(marker); map.Overlays.Add(markersOverlay); // Adding markers overlay to the map }
private void createCarBtn_Click(object sender, EventArgs e) { if (createCarBtn.Text == "Update" && carId != null) { if ( !AdditionalFunctions.isEmpty(code) && !AdditionalFunctions.isEmpty(model) && !AdditionalFunctions.isEmpty(creationDate) && !AdditionalFunctions.isEmpty(driverId) && isChanged ) { try { bool res = db.updateCar( new Car( AdditionalFunctions.trimFlWhitespaces(code), AdditionalFunctions.trimFlWhitespaces(model), new SqlDate(AdditionalFunctions.trimFlWhitespaces(creationDate)), AdditionalFunctions.trimFlWhitespaces(driverId) ), carId); if (res) { Close(); parent.refreshTable(TabChooser.Cars); } else { MessageBox.Show("Error occord with Car's update, Please try again later."); Close(); } } catch (Exception ex) { MessageBox.Show("Error occord with Car's update, Please try again later."); Close(); } } else { if (!isChanged) { MessageBox.Show("No data has changed, If you want to close please click the X button on the top"); } else { MessageBox.Show("One of the fields are not filled, Please fill and try again."); } } } else { if ( !AdditionalFunctions.isEmpty(code) && !AdditionalFunctions.isEmpty(model) && !AdditionalFunctions.isEmpty(creationDate) && !AdditionalFunctions.isEmpty(driverId) ) { bool res = db.addNewCar(new Car( AdditionalFunctions.trimFlWhitespaces(code), AdditionalFunctions.trimFlWhitespaces(model), new SqlDate(AdditionalFunctions.trimFlWhitespaces(creationDate)), AdditionalFunctions.trimFlWhitespaces(driverId) )); if (res) { Close(); parent.refreshTable(TabChooser.Cars); } else { MessageBox.Show("Error occord with Car's creation, Please try again later."); Close(); } } else { MessageBox.Show("One of the fields are not filled, Please fill and try again."); } } }
private void submitButton_Click(object sender, EventArgs e) { if ( !AdditionalFunctions.isEmpty(id) && !AdditionalFunctions.isEmpty(name) && !AdditionalFunctions.isEmpty(birth_date) && !AdditionalFunctions.isEmpty(role) && !AdditionalFunctions.isEmpty(username) && !AdditionalFunctions.isEmpty(password) && !AdditionalFunctions.isEmpty(secPassword) && !AdditionalFunctions.isEmpty(phoneNumber) && !AdditionalFunctions.isEmpty(gender) && !AdditionalFunctions.isEmpty(street) && !AdditionalFunctions.isEmpty(house_num) && !AdditionalFunctions.isEmpty(city) && !AdditionalFunctions.isEmpty(zip_code) && isChanged ) { if (password == secPassword) { if (submitButton.Text == "Update") { try { bool res = db.updateEmployee( new Employee( id, name, new SqlDate(birth_date), role, username, password, phoneNumber, new Address( street, int.Parse(house_num), city, zip_code, 0.0, 0.0 ) ), address, addressID ); if (res) { Close(); parent.refreshTable(TabChooser.Employees); } else { MessageBox.Show($"Error occord with { name }'s update, Please try again later."); Close(); } } catch (Exception ex) { MessageBox.Show($"Error occord with { name }'s update, Please try again later."); Close(); } } else { db.addNewEmploeey( new Employee( id, name, new SqlDate(birth_date), role, username, AdditionalFunctions.MD5(AdditionalFunctions.MD5(password)), phoneNumber, gender, address ) ); } } } else { if (!isChanged) { MessageBox.Show("No data has changed, If you want to close please click the X button on the top"); } else { MessageBox.Show("One of the fields are not filled, Please fill and try again."); } if (AdditionalFunctions.isEmpty(id)) { idTextBox.BackColor = Color.Red; } } }
private void addNewATMButton_Click(object sender, EventArgs e) { if ( atmSize != (int)AtmSize.NONE && capacity > 0 && !AdditionalFunctions.isEmpty(brand) && !AdditionalFunctions.isEmpty(street) && !AdditionalFunctions.isEmpty(houseNumber) && !AdditionalFunctions.isEmpty(zipCode) && !AdditionalFunctions.isEmpty(city) && !AdditionalFunctions.isEmpty(lat) && !AdditionalFunctions.isEmpty(lng) && isChanged ) { // Add new changes into the database Address addr = new Address( AdditionalFunctions.trimFlWhitespaces(street), int.Parse(AdditionalFunctions.trimFlWhitespaces(houseNumber)), AdditionalFunctions.trimFlWhitespaces(city), AdditionalFunctions.trimFlWhitespaces(zipCode), AdditionalFunctions.isEmpty(AdditionalFunctions.trimFlWhitespaces(lat)) ? 0.0 : double.Parse(lat), AdditionalFunctions.isEmpty(AdditionalFunctions.trimFlWhitespaces(lng)) ? 0.0 : double.Parse(lng) ); if (addNewATMButton.Text == "Update") { try { bool res = db.updateATM( new ATM( addr, capacity, (int)atmSize, brand ), db.getAddressByID(baseAddressId), atmId, baseAddressId ); MessageBox.Show($"ATM number {atmId} updated successfuly"); Close(); } catch (Exception ex) { Console.WriteLine(ex); MessageBox.Show("Error occord with ATM's update, Please try again later."); Close(); } } else { bool res = db.addNewATM( new ATM( addr, capacity, (int)atmSize, AdditionalFunctions.trimFlWhitespaces(brand) ) ); } } else { if (!isChanged) { MessageBox.Show("No data has changed, If you want to close please click the X button on the top"); } else { MessageBox.Show("One of the fields are not filled, Please fill and try again."); } } }