private void approveButton_Click(object sender, RoutedEventArgs e) { if (maintainanceID != "") { string query = "UPDATE maintainance_request SET om_approved='1' WHERE maintainance_id='" + maintainanceID + "'"; if (DBManager.UpdateDatabaseQuery(query)) { valuesC.Rows.Add(values.Rows[myGridSelectedIndex].ItemArray); myMessageBox mm = new myMessageBox("Approved Succesfully", "Success", "OK", 0); mm.ShowDialog(); //MessageBox.Show("Approved Succefully", "Success", MessageBoxButton.OK, MessageBoxImage.Information); values = DBManager.selectForMaintainanceApproval(); approve_maintainance_request.ItemsSource = values.AsDataView(); maintainanceID = ""; } else { myMessageBox mm = new myMessageBox("Error Occured", "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("Error Occured", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void weekley_service_report_menu_Click(object sender, RoutedEventArgs e) { try { //string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //if (DBManager.ExportToPdf(DBManager.SelectForWeekleyServiceReport(), filePath + "\\weekley Service report.pdf")) //{ // MessageBox.Show("Succefully written to " + filePath + "\\weekley Service report.pdf", "Success", MessageBoxButton.OK, MessageBoxImage.Information); //} //else //{ // MessageBox.Show("Error Occured when Creating the pdf", "Error", MessageBoxButton.OK, MessageBoxImage.Error); //} if (Home.printDatatableToExcel("Weekley Service Report", "serviced_items", DBManager.SelectForWeekleyServiceReport())) { myMessageBox mm = new myMessageBox("Exported to Excel Successfully", "Success", "Ok", 0); mm.ShowDialog(); } else { myMessageBox mm = new myMessageBox("Error Occured", "Error", "Ok", 1); mm.ShowDialog(); } } catch { } }
private void addEquipmentButton_Click(object sender, RoutedEventArgs e) { string opId; if (operatorNameBox.SelectedValue == null) { opId = ""; } else { opId = operatorNameBox.SelectedValue.ToString(); } string resp = DBManager.InsertIntoEquipments("('" + equipmentIdBox.Text + "','" + machineTypeBox.SelectedValue.ToString() + "','" + plateNumberBox.Text + "','" + manufacturedYearBox.Text + "','" + currentLocationBox.SelectedValue.ToString() + "','" + currentStatusBox.SelectedValue.ToString() + "','" + investmentCostBox.Text + "','" + servicedEveryBox.Text + "','" + equipmentTypeBox.SelectedValue.ToString() + "','" + insuranceStatusBox.SelectedValue.ToString() + "','" + opId + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')"); if (resp.Contains("Success")) { myMessageBox mm = new myMessageBox("Equipment Added Successfully", "Success", "OK", 0); mm.ShowDialog(); //MessageBox.Show("Success", "Equipment added Succesfully!", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } else { myMessageBox mm = new myMessageBox(resp, "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("error", resp, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void approveButton_Click(object sender, RoutedEventArgs e) { if (purchaseID != "") { string query = "UPDATE sparepart_purchase SET om_approved='1',date_purchased='" + DateTime.Now.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' WHERE id='" + purchaseID + "'"; if (DBManager.UpdateDatabaseQuery(query)) { valuesC.Rows.Add(values.Rows[myGridSelectedIndex].ItemArray); myMessageBox mm = new myMessageBox("Approved Successfully", "Success", "OK", 0); mm.ShowDialog(); // MessageBox.Show("Approved Succefully", "Success", MessageBoxButton.OK, MessageBoxImage.Information); values = DBManager.selectForPurchaseApproval(); approve_sparepart_purchase.ItemsSource = values.AsDataView(); purchaseID = ""; } else { myMessageBox mm = new myMessageBox("Error Occured", "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("Error Occured", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (values == null || values.Columns.Count != 5) { this.Close(); // MessageBox.Show("Invalid Data size", "Error Occured", MessageBoxButton.OK, MessageBoxImage.Error); myMessageBox mm = new myMessageBox("Column Count Doesnt match or no data found", "Error", "OK", 1); mm.ShowDialog(); } }
private void printButton_Click(object sender, RoutedEventArgs e) { if (Home.printDatatableToExcel("Approved Maintainances", "approved_items", valuesC)) { myMessageBox mm = new myMessageBox("Exported to Excel Succefully", "Success", "Ok", 0); mm.ShowDialog(); } else { myMessageBox mm = new myMessageBox("Error Occured", "Error", "Ok", 1); mm.ShowDialog(); } }
private void addWorkorder_Click(object sender, RoutedEventArgs e) { try { if (sparePartBox.Text != null) { sparePart = sparePartBox.Text; } if (laboreBox.Text != null) { laborC = laboreBox.Text; } if (PriorityBox.SelectedValue != null) { priorityV = PriorityBox.SelectedValue.ToString(); } if (StatusBox.SelectedValue != null) { statuM = StatusBox.SelectedValue.ToString(); } if (completionDateBox.SelectedDate != null) { completionD = completionDateBox.SelectedDate.Value.ToString("yyyy-MM-dd HH:mm:ss"); } string query = "UPDATE maintainance_request SET request_status='2',em_approved='1', work_order_Id='" + workOrderID + "',maintainance_sparepart_cost='" + sparePart + "',maintainance_labor_cost='" + laborC + "',maintainance_priority='" + priorityV + "',maintainance_status='" + statuM + "',maintainance_completion_date='" + completionD + "' WHERE maintainance_id='" + maintainanceID + "'"; if (DBManager.UpdateDatabaseQuery(query)) { query = ""; if (StatusBox.SelectedValue.ToString() == "3") { query = "UPDATE equipment_list SET equipment_list.current_status = '2' WHERE equipment_list.equipment_id = '" + equipmentID + "'"; } else { query = "UPDATE equipment_list SET equipment_list.current_status = '3' WHERE equipment_list.equipment_id = '" + equipmentID + "'"; } if (DBManager.UpdateDatabaseQuery(query)) { myMessageBox mm = new myMessageBox("Successfully updated", "Success", "OK", 0); mm.ShowDialog(); // MessageBox.Show("Succesfully Updated", "Success", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } } } catch { } }
private void addSuppliersButton_Click(object sender, RoutedEventArgs e) { if (!myValidation.IsEmpty(supplierNameBox.Text)) { string retD = DBManager.InsertIntoSupplierInfo("('" + supplierNameBox.Text + "','" + supplierAddressBox.Text + "','" + supplierPhone1Box.Text + "','" + supplierPhone2Box.Text + "','" + supplierPoBox.Text + "','" + supplierEmailBox.Text + "')"); if (retD.Contains("Success")) { myMessageBox mm = new myMessageBox("Succesfully Added", "Success", "Ok", 0); mm.ShowDialog(); this.Close(); } else { myMessageBox mm = new myMessageBox("Error Occured", "Error", "Ok", 1); mm.ShowDialog(); } } }
private void insertButton_Click(object sender, RoutedEventArgs e) { int i = 0; string datas = ""; string updateQueries = ""; try { foreach (DataRow row in values.Rows) { if (i == 0) { datas = "('" + row[0].ToString() + "','" + Convert.ToDateTime(row[1].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + "','" + row[2].ToString() + "')"; } else { datas = datas + ",('" + row[0].ToString() + "','" + Convert.ToDateTime(row[1].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + "','" + row[2].ToString() + "')"; } updateQueries += "UPDATE equipment_list SET equipment_list.current_status = '7' WHERE equipment_list.equipment_id = '" + row[0].ToString() + "';\n"; i++; } string res = DBManager.InsertIntoServiceRequest(datas); if (!res.Contains("Success")) { myMessageBox mm = new myMessageBox("Invalid Data Found. Check your Data!", "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("Invalid Data Type Found. Check your data again", "Error Occured", MessageBoxButton.OK, MessageBoxImage.Error); } else { DBManager.UpdateDatabaseQuery(updateQueries); myMessageBox mm = new myMessageBox("Data Added Succefully", "Success", "OK", 0); mm.ShowDialog(); // MessageBox.Show("Data Added Succesfully", "Successfully Added", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } } catch (Exception ex) { // } }
private void addMachinesButton_Click(object sender, RoutedEventArgs e) { string resp = DBManager.InsertIntoMachines("('" + machineNameBox.Text + "','" + majorFunctionsBox.SelectedValue.ToString() + "','" + machineModelBox.Text + "','" + productionMeasurementBox.Text + "','" + machineCapacityBox.Text + "','" + machineGroupBox.SelectedValue.ToString() + "')"); if (resp.Contains("Success")) { myMessageBox mm = new myMessageBox("Machine Added Succesfully", "Success", "OK", 0); mm.ShowDialog(); // MessageBox.Show("Success", "Machine added Succesfully!", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } else { //MessageBox.Show("error", resp, MessageBoxButton.OK, MessageBoxImage.Error); myMessageBox mm = new myMessageBox(resp, "Error", "OK", 1); mm.ShowDialog(); } }
private void monthly_activity_Click(object sender, RoutedEventArgs e) { try { if (Home.printDatatableToExcel("Last 30 Days Transaction Summary", "Transaction Summary", DBManager.selectMonthlyTransaction())) { myMessageBox mm = new myMessageBox("Exported to Excel Successfully", "Success", "Ok", 0); mm.ShowDialog(); } else { myMessageBox mm = new myMessageBox("Error Occured", "Error", "Ok", 1); mm.ShowDialog(); } } catch { } }
private void addEmployee_Click(object sender, RoutedEventArgs e) { string resp = DBManager.InsertIntoEmployees("('" + userIdBox.Text + "','" + userNameBox.Text + "','" + fatherNameBox.Text + "','" + userDepartmentBox.SelectedValue.ToString() + "','" + userLocationBox.SelectedValue.ToString() + "','" + userEmailBox.Text + "','" + userphoneBox.Text + "','" + userPasswordBox.Password + "','" + userLevelBox.SelectedValue.ToString() + "','" + UserStatusBox.IsChecked.ToString() + "')"); if (resp.Contains("Success")) { myMessageBox mm = new myMessageBox("Employee Info Added Successfully!", "Success", "OK", 0); mm.ShowDialog(); // MessageBox.Show("Success", "Employee added Succesfully!", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } else { myMessageBox mm = new myMessageBox(resp, "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("error", resp, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void addSitesButton_Click(object sender, RoutedEventArgs e) { string resp = DBManager.InsertIntoSites("('" + codeNameBox.Text + "','" + siteNameBox.Text + "','" + siteStatusBox.SelectedValue.ToString() + "')"); if (resp.Contains("Success")) { myMessageBox mm = new myMessageBox("Site Added Succcessfully", "Success", "OK", 0); mm.ShowDialog(); //MessageBox.Show("Success", "Site added Succesfully!", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } else { myMessageBox mm = new myMessageBox(resp, "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("error", resp, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void update_button_Click(object sender, RoutedEventArgs e) { try { string query = "UPDATE equipment_list SET depreciated_cost='" + depreciated_value_box.Text + "' WHERE equipment_id='" + equipmentID_box.Text + "'"; if (DBManager.UpdateDatabaseQuery(query)) { myMessageBox mm = new myMessageBox("Updated Succefully", "Success", "Ok", 0); mm.ShowDialog(); } else { myMessageBox mm = new myMessageBox("Error Occured When Updating. The supplied equipment id doesnt Exist", "Error", "Ok", 1); mm.ShowDialog(); } } catch (Exception ex) { } }
private void insertButton_Click(object sender, RoutedEventArgs e) { int i = 0; string datas = ""; try { foreach (DataRow row in values.Rows) { if (i == 0) { datas = "('" + Convert.ToDateTime(row[0].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + "','" + row[1].ToString() + "','" + row[2].ToString() + "','" + row[3].ToString() + "','" + row[4].ToString() + "','" + row[5].ToString() + "','" + row[6].ToString() + "','" + row[7].ToString() + "','" + row[8].ToString() + "','" + row[9].ToString() + "','" + row[10].ToString() + "','" + row[11].ToString() + "')"; } else { datas = datas + ",('" + Convert.ToDateTime(row[0].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + "','" + row[1].ToString() + "','" + row[2].ToString() + "','" + row[3].ToString() + "','" + row[4].ToString() + "','" + row[5].ToString() + "','" + row[6].ToString() + "','" + row[7].ToString() + "','" + row[8].ToString() + "','" + row[9].ToString() + "','" + row[10].ToString() + "','" + row[11].ToString() + "')"; } i++; } string res = DBManager.InsertIntoEquipmenMonitoring(datas); if (!res.Contains("Success")) { myMessageBox mm = new myMessageBox("Invalid Data Type Found. Check your data again", "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("Invalid Data Type Found. Check your data again", "Error Occured", MessageBoxButton.OK, MessageBoxImage.Error); } else { myMessageBox mm = new myMessageBox("Data added successfully.", "Success", "OK", 0); mm.ShowDialog(); // MessageBox.Show("Data Added Succesfully", "Successfully Added", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } } catch (Exception ex) { // } }
private void ChangeMysqlButton_Click(object sender, RoutedEventArgs e) { try { string mserver, mdb, muser, mpass; mserver = mySqlServerBox.Text.Trim(' '); mdb = mySqlDatabaseNameBox.Text.Trim(' '); muser = mySqlUserNameBox.Text.Trim(' '); mpass = mySqlPassswordBox.Password.Trim(' '); if (myValidation.IsEmpty(mdb) || myValidation.IsEmpty(mserver) || myValidation.IsEmpty(muser) || myValidation.IsEmpty(mySqlPortBox.Text.Trim(' '))) { mm = new myMessageBox("One or more fields are empty correct them and try again", "Empty Fields", "Ok", 1); mm.ShowDialog(); return; } int mport = Convert.ToInt32(mySqlPortBox.Text.Trim(' ')); if (mport < 0 || mport > 65535) { mm = new myMessageBox("Invalid Port Number! it should be in the range 0-655535", "Invalid Port", "Ok", 1); mm.ShowDialog(); return; } Properties.Settings.Default.mySqlServerAdress = "Server=" + mserver + ";Port=" + mport + ";Database=" + mdb + ";Uid=" + muser + ";Pwd=" + mpass + "; CharSet=utf8"; Properties.Settings.Default.mySqlServerAdress = mserver; Properties.Settings.Default.mySqlPort = mySqlPortBox.Text.Trim(' '); Properties.Settings.Default.mySqlDatabase = mdb; Properties.Settings.Default.mySqlUserName = muser; Properties.Settings.Default.MysqlPassword = mpass; Properties.Settings.Default.Save(); mm = new myMessageBox("Connection String changed to \"Server=" + mySqlServerBox.Text + ";Port=" + mySqlPortBox.Text + ";Database=" + mySqlDatabaseNameBox.Text + ";Uid=" + mySqlUserNameBox.Text + ";Pwd=" + new String(mySqlPassswordBox.PasswordChar, mySqlPassswordBox.Password.Length) + "; CharSet=utf8\"", "Info", "OK", 0); mm.ShowDialog(); } catch { mm = new myMessageBox("Error Occured when prossesing Values", "Error", "Ok", 1); mm.ShowDialog(); return; } }
private void changePassword_Click(object sender, RoutedEventArgs e) { if (newPassword.Password.Count() >= 6) { if (newPassword.Password.Equals(newPassword1.Password)) { string passFromDB = DBManager.selectPasswordFromUsers(curruserID).Rows[0][0].ToString(); if (oldPassword.Password.Equals(passFromDB)) { if (DBManager.updatePasswordForUsers(curruserID, newPassword.Password)) { myMessageBox mm = new myMessageBox("Passwords Changed Succesfully", "Succesfully Updated", "OK", 0); mm.ShowDialog(); this.Close(); } else { myMessageBox mm = new myMessageBox("Error Occured when updating", "Database Error", "OK", 1); mm.ShowDialog(); } } else { myMessageBox mm = new myMessageBox("Old Password was wrong", "Incorrect input", "OK", 1); mm.ShowDialog(); } } else { myMessageBox mm = new myMessageBox("New Passwords doesnt match", "Incorrect input", "OK", 1); mm.ShowDialog(); } } else { myMessageBox mm = new myMessageBox("Password Length should be between 8 and 32", "Incorrect input", "OK", 1); mm.ShowDialog(); } }
private void approveButton_Click(object sender, RoutedEventArgs e) { try { if ((equipmentID != "") && (allocationID != "") && allocateToID != "") { string query = "UPDATE allocate_item SET allocation_date='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',om_approved='1' WHERE id='" + allocationID + "'"; string query2 = "UPDATE equipment_list SET current_Location='" + allocateToID + "' WHERE equipment_id='" + equipmentID + "'"; int allocatedNo = Convert.ToInt32(DBManager.selectAllocatedNumber(requestID).Rows[0][0].ToString()); string query3 = "UPDATE allocation_request SET allocated_item_no=" + (allocatedNo + 1) + " WHERE id='" + requestID + "'"; if (DBManager.UpdateDatabaseQuery(query) && DBManager.UpdateDatabaseQuery(query2) && DBManager.UpdateDatabaseQuery(query3)) { valuesC.Rows.Add(values.Rows[myGridSelectedIndex].ItemArray); //approved_Items.Columns.Add(approve_allocation_request.) myMessageBox mm = new myMessageBox("Approved Successfully", "Success", "OK", 0); mm.ShowDialog(); // MessageBox.Show("Approved Succefully", "Success", MessageBoxButton.OK, MessageBoxImage.Information); values = DBManager.selectForAllocationApproval(); approve_allocation_request.ItemsSource = values.AsDataView(); allocationID = ""; allocateToID = ""; equipmentID = ""; } else { myMessageBox mm = new myMessageBox("Error Occured", "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("Error Occured", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } catch { } }
private void alllocateButton_Click(object sender, RoutedEventArgs e) { try { if (selectedEqID != "" && selected_allocation_id != "") { string transportCost = ""; EnterTransportationCost nn = new EnterTransportationCost(); nn.ShowDialog(); if (nn.DialogResult.Value) { transportCost = nn.trCost; } string resp = DBManager.InsertIntoAllocationTable("('" + selected_allocation_id + "','" + selectedEqID + "','" + fromSiteID + "','" + toSiteID + "','" + transportCost + "')"); if (resp.Contains("Success")) { myMessageBox mm = new myMessageBox("Successfully allocated. Waiting for OM approval", "Success", "OK", 0); mm.ShowDialog(); // MessageBox.Show("Successfully Allocated waiting for OM approval", "Success", MessageBoxButton.OK, MessageBoxImage.Information); eqAll.Clear(); } else { myMessageBox mm = new myMessageBox("Allocation Failed!\n Maybe the selected equipment id was already allocated to this project", "Error", "OK", 1); mm.ShowDialog(); // MessageBox.Show("", "Error", MessageBoxButton.OK, MessageBoxImage.Error); eqAll.Clear(); } } } catch { } }
private void createButton_Click(object sender, RoutedEventArgs e) { myMessageBox mm = new myMessageBox(DBManager.RunScript("flintstones_db.sql").ToString(), "Database Creation", "Ok", 2); mm.ShowDialog(); }
private void contact_info_Click(object sender, RoutedEventArgs e) { myMessageBox mm = new myMessageBox("Email: [email protected] ---> Flintstones ", "Contact Info", "OK", 0); mm.ShowDialog(); }