private void btn_Login_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(this.txt_IDEntry.Text) || string.IsNullOrWhiteSpace(this.txt_PINEntry.Password)) { WPFMessageBox.Show("Please enter a User ID and a PIN."); } else { GuardianLogin(); } }
private void btn_Submit_Click(object sender, RoutedEventArgs e) { if (this.valueChanged) { ProcessModification(); } else { WPFMessageBox.Show("You have not changed any values! If you would like to return to the previous window without making changes, please hit cancel."); } }
private void BtnItemSave_Click(object sender, RoutedEventArgs e) { FmsActionFormulaMain main = tvMain.SelectedItem as FmsActionFormulaMain; if ((main == null) || (string.IsNullOrEmpty(main.PKNO))) { return; } FmsActionFormulaDetail detail = gbItem.DataContext as FmsActionFormulaDetail; if (detail == null) { return; } #region 校验 if (string.IsNullOrEmpty(detail.FORMULA_CODE)) { WPFMessageBox.ShowWarring("请选择配方主信息。", "保存"); return; } if (string.IsNullOrEmpty(detail.FORMULA_DETAIL_NAME)) { WPFMessageBox.ShowWarring("请输入配方明细名称。", "保存"); return; } #endregion if (string.IsNullOrEmpty(detail.PKNO)) //新增 { detail.PKNO = CBaseData.NewGuid(); ws.UseService(s => s.AddFmsActionFormulaDetail(detail)); //重新刷新数据 List <FmsActionFormulaDetail> details = ws.UseService(s => s.GetFmsActionFormulaDetails($"FORMULA_CODE = {main.FORMULA_CODE} AND USE_FLAG >= 0")) .OrderBy(c => c.PROCESS_INDEX) .ToList(); gridItem.ItemsSource = details; } else //修改 { ws.UseService(s => s.UpdateFmsActionFormulaDetail(detail)); } //提示保存成功 gbItem.IsCollapsed = true; gbItem.Visibility = Visibility.Collapsed; BindHelper.SetDictDataBindingGridItem(gbItem, gridItem); }
private void StoreRequest_ProcessSuccessfully(object sender) { Dispatcher.BeginInvoke((Action) delegate { DialogResult = true; Close(); var title = (string)TryFindResource("DownloadCompletedText"); WPFMessageBox.Show(StaticMainWindow.Window, "", title, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); }); }
private void btnDeleteAll_Click(object sender, RoutedEventArgs e) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2951"), string.Format(Translator.GetInstance().GetString("MessageBox", "2951", "message")), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { GameObject.GetInstance().NewsBox.clear(); showNews(true); } }
private void btn_changePIN_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = WPFMessageBox.Show("Are you sure you wish to permanently change this person's PIN?", "PIN Chnage Conformation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { string pID = txt_IDNumber.Text; AdminChangeGuardianPIN adminChangeGuardianPIN = new AdminChangeGuardianPIN(pID); adminChangeGuardianPIN.ShowDialog(); } }
//完成当前 private void bFinishThis_click(object sender, RoutedEventArgs e) { MesJobOrder mesJobOrder = gridorder.GetFocusedRow() as MesJobOrder; if (mesJobOrder == null) { return; } if (WPFMessageBox.ShowConfirm("确定要完成当前工序吗?", "完成当前工序") != WPFMessageBoxResult.OK) { return; } List <MesProcessCtrol> processCtrols = ws.UseService(s => s.GetMesProcessCtrols($"PROCESS_STATE < 10 ")) .OrderBy(c => c.PROCESS_INDEX).ThenBy(c => c.CREATION_DATE).ToList(); //执行的动作 MesProcessCtrol processCtrol = processCtrols.FirstOrDefault(c => c.JOB_ORDER_PKNO == mesJobOrder.PKNO); if (processCtrol == null) { return; } var result = DeviceProcessControl.FinishCurBusiness(processCtrol); if (result != "OK") { WPFMessageBox.ShowError("当前工序的业务层完成错误,请核实。\r\n错误为:" + result, "完成当前工序"); return; } processCtrol.PROCESS_STATE = 10; //执行完成 ws.UseService(s => s.UpdateMesProcessCtrol(processCtrol)); if (processCtrol == processCtrols.LastOrDefault()) { mesJobOrder.PROCESS_INFO = "手动完成当前过程"; //生产执行信息 mesJobOrder.ACT_FINISH_TIME = DateTime.Now; mesJobOrder.RUN_STATE = 101; //手动完成 mesJobOrder.ONCE_QTY = 1; //默认订单为1 mesJobOrder.COMPLETE_QTY = 1; } else { mesJobOrder.PROCESS_INFO = "手动完成当前订单"; //生产执行信息 } ws.UseService(s => s.UpdateMesJobOrder(mesJobOrder)); gridItem.ItemsSource = ws.UseService(s => s.GetMesProcessCtrols($"JOB_ORDER_PKNO = '{mesJobOrder.PKNO}' ")) .OrderBy(c => c.PROCESS_INDEX).ThenBy(c => c.CREATION_DATE).ToList(); }
private void btnBuyAsSubsidiary_Click(object sender, RoutedEventArgs e) { double buyingPrice = this.Airline.Airline.getValue() * 1000000 * 1.10; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2113"), string.Format(Translator.GetInstance().GetString("MessageBox", "2113", "message"), this.Airline.Airline.Profile.Name, buyingPrice), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { List <AirlineLogo> oldLogos = this.Airline.Airline.Profile.Logos; string oldColor = this.Airline.Airline.Profile.Color; //creates independent airlines for each subsidiary while (this.Airline.Subsidiaries.Count > 0) { SubsidiaryAirline subAirline = this.Airline.Subsidiaries[0]; subAirline.Airline = null; this.Airline.removeSubsidiaryAirline(subAirline); } if (this.Airline.License > GameObject.GetInstance().HumanAirline.License) { GameObject.GetInstance().HumanAirline.License = this.Airline.License; } SubsidiaryAirline sAirline = new SubsidiaryAirline(GameObject.GetInstance().HumanAirline, this.Airline.Airline.Profile, this.Airline.Airline.Mentality, this.Airline.Airline.MarketFocus, this.Airline.License, this.Airline.Airline.AirlineRouteFocus); AirlineHelpers.SwitchAirline(this.Airline.Airline, sAirline); GameObject.GetInstance().HumanAirline.addSubsidiaryAirline(sAirline); AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -buyingPrice); Airlines.RemoveAirline(this.Airline.Airline); Airlines.AddAirline(sAirline); sAirline.Profile.Logos = oldLogos; sAirline.Profile.Color = oldColor; foreach (AirlinePolicy policy in this.Airline.Airline.Policies) { sAirline.addAirlinePolicy(policy); } sAirline.Money = this.Airline.Money; sAirline.StartMoney = this.Airline.Money; sAirline.Fees = new AirlineFees(); PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline)); } }
private void btn_Enter_Click(object sender, RoutedEventArgs e) { ConnectionsDB conDB = new ConnectionsDB(); GuardianInfoDB gdb = new GuardianInfoDB(); string fID = "", pID = ""; bool formNotComplete = CheckIfNull(); if (!formNotComplete)//form is completed { bool sameID = CheckIfSame(txt_GuardianID.Text, txt_GuardianID2.Text); bool regexID = RegExpressions.RegexID(txt_GuardianID.Text); if (sameID && regexID)//both IDand PIN are the same vlues { pID = txt_GuardianID.Text; MakeFamilyID(pID); if (linked == 0) //link child { int connID = this.db.GetMaxConnectionID(); connID = connID + 1; string connectionID = string.Format("{0:000000}", connID); fID = MakeFamilyID(pID); bool guardianExists = false; guardianExists = gdb.GuardianNotDeletedAndExists(pID); if (guardianExists) { conDB.UpdateAllowedConnections(connectionID, pID, childID, fID); } else { WPFMessageBox.Show("Guardian with ID: " + pID + " does not exist."); } } else if (linked == 1) //delink child { bool connExists = conDB.ConnectionExists(pID, childID); bool guardianExists = gdb.GuardianNotDeletedAndExists(pID); if (connExists && guardianExists) { conDB.DeleteAllowedConnection(childID, pID); } else { WPFMessageBox.Show("No connection to the Guardian with ID: " + pID + " exists or no Guardian with that ID exists."); } } this.Close(); } } }
private void TimeCheckingC(TextBox openTime, TextBox closeTime) { if (SettingsValidation.ValidHours(openTime.Text, closeTime.Text)) { statusGood(); } else if (!errorPresent) { WPFMessageBox.Show("Invalid Input. Closing time must be a valid time greater than opening time"); statusBad(closeTime, openTime); } }
private void txt_RegularAge_LostFocus(object sender, RoutedEventArgs e) { if (SettingsValidation.ValidAge(txt_InfantAge.Text, txt_RegularAge.Text)) { statusGood(); } else if (!errorPresent) { WPFMessageBox.Show("Invalid Input. Regular Age must be a positive number greater than Infant Age"); statusBad(txt_RegularAge, txt_InfantAge); } }
private void btnDeleteGame_Click(object sender, RoutedEventArgs e) { string file = (string)lbSaves.SelectedItem; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "1009"), Translator.GetInstance().GetString("MessageBox", "1009", "message"), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { SerializedLoadSaveHelpers.DeleteSavedGame(file); Saves.Remove(file); } }
private void txt_MaxMonthlyFee_LostFocus(object sender, RoutedEventArgs e) { if (SettingsValidation.PositiveInteger(txt_MaxMonthlyFee.Text)) { statusGood(); } else if (!errorPresent) { WPFMessageBox.Show("Invalid Input. Maximum Monthly Fee must be a positive number"); statusBad(txt_MaxMonthlyFee); } }
//////////////////// //LostFocus Events// //////////////////// private void txt_BillingDate_LostFocus(object sender, RoutedEventArgs e) { if (SettingsValidation.ValidBillingDate(txt_BillingDate.Text)) { statusGood(); } else if (!errorPresent) { WPFMessageBox.Show("Invalid Input. Billing Date must be a number from 2 to 27"); statusBad(txt_BillingDate); } }
private void Request_ProcessError(DownloadMotionStoreRequest.DownloadMotionErrorCode errorcode, string errorMessage) { Dispatcher.BeginInvoke((Action) delegate { DialogResult = false; DebugHelper.WriteLine(errorMessage); Close(); var title = (string)TryFindResource("DownloadErrorText"); WPFMessageBox.Show(StaticMainWindow.Window, "", title, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); }); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2603"), string.Format(Translator.GetInstance().GetString("MessageBox", "2603", "message"), this.Alliance.Name), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.Alliance.removeMember(GameObject.GetInstance().HumanAirline); Alliances.RemoveAlliance(this.Alliance); } this.ParentPage.updatePage(); }
private void txt_ExpirationDays_LostFocus(object sender, RoutedEventArgs e) { if (SettingsValidation.PositiveInteger(txt_ExpirationDays.Text)) { statusGood(); } else if (!errorPresent) { WPFMessageBox.Show("Invalid Input. Days to hold expired records must be a positive number"); statusBad(txt_ExpirationDays); } }
private void btn_Delete_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = WPFMessageBox.Show("Are you sure you wish to delete this person?", "Deletion Conformation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { string pID = txt_IDNumber.Text; this.db.DeleteParentInfo(pID); ClearFields(); DisableForm(); } }
private void KeyPressedValidateNumber(Object o, KeyEventArgs e) { if (e.Key == Key.Enter) { SubmitID(); } else if (!((e.Key >= Key.D0 && e.Key <= Key.D9) || (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || e.Key == Key.Back)) { WPFMessageBox.Show("Please use only numbers."); e.Handled = true; } }
private void btnOk_Click(object sender, RoutedEventArgs e) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2108"), Translator.GetInstance().GetString("MessageBox", "2108", "message"), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { foreach (FeeType type in this.FeeValues.Keys) { this.Airline.Fees.setValue(type, this.FeeValues[type]); } } }
//creates a route and returns if success private Boolean createRoute() { Route route = null; Airport destination1 = (Airport)cbDestination1.SelectedItem; Airport destination2 = (Airport)cbDestination2.SelectedItem; Airport stopover1 = (Airport)cbStopover1.SelectedItem; Airport stopover2 = cbStopover2.Visibility == System.Windows.Visibility.Visible ? (Airport)cbStopover2.SelectedItem : null; try { if (AirlineHelpers.IsRouteDestinationsOk(GameObject.GetInstance().HumanAirline, destination1, destination2, rbPassenger.IsChecked.Value ? Route.RouteType.Passenger : Route.RouteType.Cargo, stopover1, stopover2)) { Guid id = Guid.NewGuid(); //passenger route if (rbPassenger.IsChecked.Value) { route = new PassengerRoute(id.ToString(), destination1, destination2, 0); foreach (MVVMRouteClass rac in this.Classes) { ((PassengerRoute)route).getRouteAirlinerClass(rac.Type).FarePrice = rac.FarePrice; foreach (MVVMRouteFacility facility in rac.Facilities) { ((PassengerRoute)route).getRouteAirlinerClass(rac.Type).addFacility(facility.SelectedFacility); } } } //cargo route else { double cargoPrice = Convert.ToDouble(txtCargoPrice.Text); route = new CargoRoute(id.ToString(), destination1, destination2, cargoPrice); } FleetAirlinerHelpers.CreateStopoverRoute(route, stopover1, stopover2); GameObject.GetInstance().HumanAirline.addRoute(route); return(true); } } catch (Exception ex) { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", ex.Message), Translator.GetInstance().GetString("MessageBox", ex.Message, "message"), WPFMessageBoxButtons.Ok); return(false); } return(false); }
private void btn_ChangePW_Click(object sender, RoutedEventArgs e) { if (!editingPW) { lst_AdminList.IsEnabled = false; btn_AddAdmin.IsEnabled = false; btn_DelAdmin.IsEnabled = false; btn_Save.IsEnabled = false; btn_Cancel.IsEnabled = false; txt_LoginName.IsEnabled = false; txt_Email.IsEnabled = false; rdb_Full.IsEnabled = false; rdb_Limited.IsEnabled = false; txt_Password.IsEnabled = true; txt_ConfirmPass.IsEnabled = true; editingPW = true; lbl_PassText.Text = "Confirm Changes"; } else if (editingPW) { if (txt_Password.Password != AdminTools.Hashing.HashPass("")) { if (passwordsMatch()) { lst_AdminList.IsEnabled = true; btn_AddAdmin.IsEnabled = true; btn_DelAdmin.IsEnabled = true; btn_Save.IsEnabled = true; btn_Cancel.IsEnabled = true; txt_LoginName.IsEnabled = true; txt_Email.IsEnabled = true; rdb_Full.IsEnabled = true; rdb_Limited.IsEnabled = true; txt_Password.IsEnabled = false; txt_ConfirmPass.IsEnabled = false; editingPW = false; lbl_PassText.Text = "Change Password"; pwChanged = true; } else { WPFMessageBox.Show("Passwords do not match. Please try again"); } } else { WPFMessageBox.Show("Password must not be blank!"); } } }
private bool FormDataValid() { if (!EventNameValid(txt_EventName.Text)) { txt_EventName.Focus(); return(false); } if (cmb_PriceType.SelectedIndex == -1) { WPFMessageBox.Show("You must select a price type from the drop down menu."); cmb_PriceType.Focus(); return(false); } if (!ValidDoubleGreaterThanZero(txt_Rate.Text)) { WPFMessageBox.Show("You must enter a valid dollar figure greater than zero in the Rate box."); txt_Rate.Focus(); return(false); } if (txt_DiscountPrice.Text != "" && !ValidDoubleGreaterThanZero(txt_DiscountPrice.Text)) { WPFMessageBox.Show("You must enter a valid dollar figure greater than zero in the Discount Price box."); txt_DiscountPrice.Focus(); return(false); } if (cmb_Occurence.SelectedIndex == -1) { WPFMessageBox.Show("You must select an event occurence from the drop down menu."); cmb_Occurence.Focus(); return(false); } if (cmb_Occurence.SelectedIndex == 1) { if (!DateValid()) { return(false); } } if (cmb_Occurence.SelectedIndex == 2 && cmb_DayName.SelectedIndex == -1) { WPFMessageBox.Show("You must select a valid day of the week from the drop down menu."); cmb_Occurence.Focus(); return(false); } if (txt_MaxHours.Text != "" && !ValidDoubleGreaterThanZero(txt_MaxHours.Text)) { WPFMessageBox.Show("You must enter a valid number greater than zero in the maximum hours text box."); txt_MaxHours.Focus(); return(false); } return(true); }
private void ButtonRemove_Click(object sender, RoutedEventArgs e) { AirlineFacility facility = (AirlineFacility)((Button)sender).Tag; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2103"), string.Format(Translator.GetInstance().GetString("MessageBox", "2103", "message"), facility.Name), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.Airline.removeFacility(facility); showFacilities(); } }
private void btn_Select_Click(object sender, RoutedEventArgs e) { if (this.dta_GuardianList.SelectedIndex != -1) { DataRowView row = (DataRowView)this.dta_GuardianList.SelectedItem; this.transWin.SetAllowanceID(row.Row[2].ToString()); this.Close(); } else { WPFMessageBox.Show("You must select a guardian from the list!"); } }
}//end CheckIfNull internal bool CheckIfSame(string str1, string str2) { if (str1.Equals(str2)) { return(true); } else { WPFMessageBox.Show("Your ID or PIN numbers do not match. Please re-enter"); return(false); } }
private void btn_AddAdmin_Click(object sender, RoutedEventArgs e) { if (lst_AdminList.Items.Contains("default")) { WPFMessageBox.Show("You cannot add a new administrator while there is still a default administrator.\nPlease edit the default administrator before adding a new one"); } else { this.db.AddNewAdmin(); lst_AdminList.ItemsSource = db.FindAdmins(); lst_AdminList.UnselectAll(); } }
private void txt_LoginName_LostFocus(object sender, RoutedEventArgs e) { if (!RegExpressions.RegexValidateEventName(txt_LoginName.Text)) { WPFMessageBox.Show("Administrator names may only include numbers and letters."); btn_Save.IsEnabled = false; } else if ((lst_AdminList.Items.Contains(txt_LoginName.Text) && !(lst_AdminList.SelectedItem.ToString().Equals(txt_LoginName.Text))) || txt_LoginName.Text.Equals("superuser")) { WPFMessageBox.Show("An administrator with that name already exists. Please change the login name to be unique before continuing"); btn_Save.IsEnabled = false; } }
private void Hyperlink_Click(object sender, RoutedEventArgs e) { string type = ((Hyperlink)sender).TargetName; if (GameObject.GetInstance().HumanAirline.Airports.FindAll((delegate(Airport airport) { return(airport.getCurrentAirportFacility(GameObject.GetInstance().HumanAirline, AirportFacility.FacilityType.Service).TypeLevel > 0); })).Count == 0) { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2000"), Translator.GetInstance().GetString("MessageBox", "2000", "message"), WPFMessageBoxButtons.Ok); } else { sideFrame.Content = new PanelUsedAirliner(this, (Airliner)((Hyperlink)sender).Tag); } }
private void btn_Save_Click(object sender, RoutedEventArgs e) { if (this.reportLoaded && this.table.Rows.Count > 0) { PDFCreator pdfCreator = new PDFCreator(this.table); PdfDocument pdf = pdfCreator.CreatePDF(this.parentDataGrid.Columns.Count); pdfCreator.SavePDF(pdf); } else { WPFMessageBox.Show("You must load a report before you can save one!"); } }