private void buttonUserUnregister_Click(object sender, EventArgs e) { try { if (this.SelectedUserControlIndex != null && this.SelectedUserControlIndex.UserID > 0 && this.SelectedUserControlIndex.SecurityIdentifier != ContextAttributes.User.SecurityIdentifier) { if (CustomMsgBox.Show(this, "Are you sure you want to deregister this user?" + "\r\n" + "\r\nUser: "******"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { if (this.userControlRepository.GetEditable((int)this.selectedUserControlIndex.UserID)) { this.userControlAPIs.UserControlUnregister(this.SelectedUserControlIndex.UserID, this.SelectedUserControlIndex.UserName, this.SelectedUserControlIndex.SecurityIdentifier); this.LoadUserControls(); } else { throw new Exception("Can not deregister this user. Please check again!"); } } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
public void Escape() { if (this.EditableMode) { if (this.IsDirty) { DialogResult dialogResult = CustomMsgBox.Show(this, "Do you want to save your change?", "Warning", MessageBoxButtons.YesNoCancel); if (dialogResult == DialogResult.Yes) { this.Save(); if (!this.IsDirty) { this.CancelDirty(false); } } else if (dialogResult == DialogResult.No) { this.CancelDirty(true); } else { return; } } else { this.CancelDirty(false); } } else { this.Close(); //Unload this module } }
private void button_Click(object sender, EventArgs e) { if (sender.Equals(this.buttonUpdate)) { if (this.textexApplicationRoleName.Text.Trim() != "" && this.textexApplicationRolePassword.Text.Trim() != "") { IBaseRepository baseRepository = CommonNinject.Kernel.Get <IBaseRepository>(); if (baseRepository.UpdateApplicationRole(SecurePassword.Encrypt(this.textexApplicationRoleName.Text.Trim()), SecurePassword.Encrypt(this.textexApplicationRolePassword.Text.Trim())) == 1) { this.DialogResult = DialogResult.OK; } else { throw new Exception("Fail to update application role."); } } } else if (sender.Equals(this.buttonApplicationRoleRequired) || sender.Equals(this.buttonApplicationRoleIgnored)) { CommonConfigs.AddUpdateAppSetting("ApplicationRoleRequired", sender.Equals(this.buttonApplicationRoleRequired) ? "true" : "false"); CustomMsgBox.Show(this, "Please open your program again in order to take new effect.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.DialogResult = DialogResult.Cancel; } else { this.DialogResult = DialogResult.Cancel; } }
private void buttonOKESC_Click(object sender, EventArgs e) { try { if (sender.Equals(this.buttonOK)) { if (this.pickupViewModel.FillingLineID != null && this.pickupViewModel.WarehouseID != null && this.pickupViewModel.ForkliftDriverID != null && this.pickupViewModel.StorekeeperID != null) { this.DialogResult = DialogResult.OK; } else { CustomMsgBox.Show(this, "Vui lòng chọn kho, tài xế và nhân viên kho.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop); } } if (sender.Equals(this.buttonESC)) { this.DialogResult = DialogResult.Cancel; } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
public void Escape() { if (this.EditableMode) { if (this.IsDirty) { DialogResult dialogResult = CustomMsgBox.Show(this, "Dữ liệu chưa lưu. Bạn có muốn lưu lại không?", "Warning", MessageBoxButtons.YesNoCancel); if (dialogResult == DialogResult.Yes) { this.Save(); if (!this.IsDirty) { this.CancelDirty(false); } } else if (dialogResult == DialogResult.No) { this.CancelDirty(true); } else { return; } } else { this.CancelDirty(false); } } else if (GlobalVariables.ConfigID == (int)GlobalVariables.FillingLine.None || this.NMVNTaskID == GlobalEnums.NmvnTaskID.Report) { this.Close(); //Unload this module } }
private void labelLock_Click(object sender, EventArgs e) { try { PalletDTO palletDTO = this.fastBarcodes.SelectedObject as PalletDTO; if (palletDTO != null) { PalletViewModel palletViewModel = CommonNinject.Kernel.Get <PalletViewModel>(); PalletController palletController = new PalletController(CommonNinject.Kernel.Get <IPalletService>(), palletViewModel); palletController.Lock(palletDTO.PalletID); if (CustomMsgBox.Show(this, "Are you sure you want to " + (palletViewModel.Lockable ? "lock" : "un-lock") + " this entry data" + "?", "Warning", MessageBoxButtons.YesNo, (palletViewModel.Lockable ? MessageBoxIcon.Information : MessageBoxIcon.Warning)) == DialogResult.Yes) { if (palletController.LockConfirmed()) { ((PalletDTO)this.fastBarcodes.SelectedObject).Locked = !palletViewModel.Locked; this.fastBarcodes.RefreshObject(this.fastBarcodes.SelectedObject); } else { throw new Exception("Lỗi khóa hay mở khóa pallet: " + palletViewModel.Code + "\r\n\r\nVui lòng đóng phần mềm và thử lại sau."); } } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
/// <summary> /// The doubleclick function for the praticaltest button. /// Allows the sysmin to confirm the specific praticaltest. /// </summary> /// <param name="sender">The object sender</param> /// <param name="e">The event args</param> private void praticalTestPictureButton_DoubleClick(object sender, EventArgs e) { if (!Session.LoggedInUser.Sysmin) { return; } PictureBox icon = sender as PictureBox; DialogResult confirmamtionBox = CustomMsgBox.ShowYesNo($"Are you sure {_user.Fullname} has completed a {practicalTestLabel.Text.ToLower()}", "Confirm", CustomMsgBoxIcon.Warrning); if (confirmamtionBox == DialogResult.Yes) { DatabaseParser.SetUserPracticalTestDone(_user.Id, true); DatabaseParser.SetUserActive(_user.Id, false); _user = DatabaseParser.GetUserById(_user.Id); icon.Image = completedImage; } else if (confirmamtionBox == DialogResult.No) { DatabaseParser.SetUserPracticalTestDone(_user.Id, false); DatabaseParser.SetUserActive(_user.Id, true); _user = DatabaseParser.GetUserById(_user.Id); icon.Image = incompleteImage; } }
private void buttonDownload_Click(object sender, EventArgs e) { try { ChangePassword changePassword = new ChangePassword(); //new ChangePassword(true): checkPasswordOnly DialogResult dialogResult = changePassword.ShowDialog(); changePassword.Dispose(); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { CustomMsgBox.Show(this, "Mật khẩu vừa thay đổi thành công." + "\r\n" + "\r\n" + "Vui lòng mở lại phần mềm để đăng nhập bằng mật khẩu mới.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.DialogResult = DialogResult.Yes; } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } //try //{ // throw new Exception("Please open your program again in order to update new version." + "\r\n" + "\r\n" + "Contact your admin for more information. Thank you!" + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "Vui lòng mở lại phần mềm để cập nhật phiên bản mới nhất. Cám ơn."); //} //catch (Exception exception) //{ // CommonConfigs.AddUpdateAppSetting("VersionID", "-9"); // ExceptionHandlers.ShowExceptionMessageBox(this, exception); // this.DialogResult = DialogResult.Cancel; //} }
public void CheckForUpdate() { try { Dispatcher.Invoke(() => richTextBox.Document.Blocks.Clear()); Dispatcher.Invoke(() => richTextBoxDonate.Document.Blocks.Clear()); var result = CheckUpdate.Run <SBUpdate>(); var releasesLatest = CheckUpdate.Run <Release>("https://api.github.com/repos/mohamm4dx/SilverBullet/releases/latest"); if (releasesLatest.Assets != null && releasesLatest.Assets.Length > 0) { result.DownloadUrl = releasesLatest.Assets.First().Browser_Download_Url; } result.Available = releasesLatest.Available; releasesLatest.Body.Split('\n') .ToList().ForEach(re => { re = re.Replace("•", string.Empty) .Replace("•", string.Empty).Trim(); if (result.ReleaseNotes.Any(r => r.Note.Trim() .Replace("•", string.Empty) .Replace("•", string.Empty) != re)) { result.ReleaseNotes.Add(new ReleaseNotes() { Note = re }); } }); Dispatcher.Invoke(() => DataContext = result); try { for (var i = 0; i < result.Donate.Length; i++) { Dispatcher.Invoke(() => AppendParagraph(richTextBoxDonate, new[] { result.Donate[i].Address })); } } catch { } if (result.Available) { try { for (var i = 0; i < result.ReleaseNotes.Count; i++) { Dispatcher.Invoke(() => AppendParagraph(richTextBox, new[] { result.ReleaseNotes[i].Note })); } } catch { } if (!string.IsNullOrWhiteSpace(result.Message)) { Dispatcher.Invoke(() => CustomMsgBox.Show(result.Message)); } } else { Dispatcher.Invoke(() => CustomMsgBox.Show("there are currently no updates available")); } } catch { } }
private void btn_ExcluirTime_Click(object sender, EventArgs e) { if (lbTimes.SelectedIndex == -1) { var errorMsgBox = new CustomMsgBox("Ops!", $"Selecione um time para remover.", MessageBoxType.E_OK); var errorResult = errorMsgBox.ShowDialog(); return; } int id = (int)lbTimes.SelectedItem; var remover = Manager.Instance.dBTimes.Times.Find(x => x.ID == id); var msgBox = new CustomMsgBox("Remover Time", $"Tem certeza de que deseja remover o time {remover.Nome}?", MessageBoxType.E_CancelarConfirmar); var result = msgBox.ShowDialog(); if (result == DialogResult.OK) { Manager.Instance.dBTimes.Times.Remove(remover); Manager.Instance.dBEstadios.Estadios.Find(x => x.ID == id).IDTimes.Remove(id); DBManager.Serialize(Manager.Instance.dBTimes); var infoMsgBox = new CustomMsgBox("Informações Atualizadas!", $"Time {remover.Nome} removido com sucesso.", MessageBoxType.E_CancelarConfirmar); var infoResult = infoMsgBox.ShowDialog(); } Refresh(); }
private void BtnAdd_Click(object sender, EventArgs e) { if (lbDisponiveis.Items.Count == 0) { var msgBox = new CustomMsgBox("Ops!", $"Para adicionar, é necessário selecionar um jogador disponível.", MessageBoxType.E_OK); var result = msgBox.ShowDialog(); return; } if (lbDisponiveis.SelectedIndex == -1) { var msgBox = new CustomMsgBox("Ops!", $"Para adicionar, é necessário selecionar um jogador disponível.", MessageBoxType.E_OK); var result = msgBox.ShowDialog(); return; } if (_time.Jogadores.Count >= 24) { var msgBox = new CustomMsgBox("Limite máximo atingido!", $"O máximo de jogadores por time foi atingido.", MessageBoxType.E_OK); var result = msgBox.ShowDialog(); return; } var selID = (int)lbDisponiveis.SelectedItem; _time.Jogadores.Add(selID); Refresh(); }
private void buttonOKESC_Click(object sender, EventArgs e) { try { if (sender.Equals(this.buttonOK)) { if (this.forecastViewModel.ForecastLocationID != null) { this.forecastViewModel.EntryDate = new DateTime(((DateTime)this.forecastViewModel.EntryDate).Year, ((DateTime)this.forecastViewModel.EntryDate).Month, 1); this.DialogResult = DialogResult.OK; } else { CustomMsgBox.Show(this, "Vui lòng chọn forecast location.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop); } } if (sender.Equals(this.buttonESC)) { this.DialogResult = DialogResult.Cancel; } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void buttonOKESC_Click(object sender, EventArgs e) { try { if (sender.Equals(this.buttonOK)) { if (this.salesOrderViewModel.CustomerID != null && this.salesOrderViewModel.ReceiverID != null && this.salesOrderViewModel.SalespersonID != null) { this.DialogResult = DialogResult.OK; } else { CustomMsgBox.Show(this, "Vui lòng chọn khách hàng, nhân viên kinh doanh.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop); } } if (sender.Equals(this.buttonESC)) { this.DialogResult = DialogResult.Cancel; } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
public static DialogResult Show(string _message, string _title) { CustomMsgBox msg = new CustomMsgBox(_message); msg.Text = _title; rturn msg.ShowDialog(); }
private void BtnSalvar_Click(object sender, EventArgs e) { if (txtNome.Text.Length == 0) { var msgBox = new CustomMsgBox("Nome Inválido", $"Insira um nome válido!", MessageBoxType.E_OK); var result = msgBox.ShowDialog(); return; } _time.Nome = txtNome.Text; if (bEdit) { var find = Manager.Instance.dBTimes.Times.Find(x => x.ID == _time.ID); find = _time; } else { _time.ID = ++Manager.Instance.dBTimes.UltimoID; Manager.Instance.dBTimes.Times.Add(_time); } var infoMsgBox = new CustomMsgBox("Informações Atualizadas!", $"Informações de times atualizadas com sucesso!", MessageBoxType.E_OK); var infoResult = infoMsgBox.ShowDialog(); DBManager.Serialize(Manager.Instance.dBTimes); this.Close(); }
private void buttonRemoveLOT_Click(object sender, EventArgs e) { try { if (this.fastBatchMasterIndex.SelectedObject != null) { BatchMasterIndex batchMasterIndex = (BatchMasterIndex)this.fastBatchMasterIndex.SelectedObject; if (batchMasterIndex != null && batchMasterIndex.LotID != null) { DialogResult dialogResult = CustomMsgBox.Show(this, "Vui lòng xác nhận xóa LOT đang chọn?" + "\r\n" + "\r\n" + "Batch: " + batchMasterIndex.BatchMasterCode + ", Lot: " + batchMasterIndex.LotCode, "Warning", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (this.batchMasterController.RemoveLot((int)batchMasterIndex.LotID)) { this.Loading(); } } } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void buttonWebapi_Click(object sender, EventArgs e) { Webapi webapi = new Webapi(); DialogResult dialogResult = webapi.ShowDialog(); webapi.Dispose(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { CustomMsgBox.Show(this, "Please open your program again in order to take new effect.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.DialogResult = DialogResult.Cancel; } }
/// <summary> /// Shows how to use the WPF CustomMsgBox /// </summary> internal void ShowOtherCustomMessageBox() { ModalViewModel modalDataContext = new ModalViewModel("Mise à jour disponible", "No buttons have been added to this MsgBox", CustomMsgBoxIcon.Question, 1); CustomMsgBox b = new CustomMsgBox(ref modalDataContext); b.ShowDialog(); Console.Out.WriteLine(String.Format("result : {0}", modalDataContext.ModalResult + " \r\n checkbox checked : " + modalDataContext.IsCheckboxChecked)); }
/// <summary> /// Shows how to use the WPF CustomMsgBox /// </summary> internal void ShowCustomMessageBox() { ModalViewModel modalDataContext = new ModalViewModel("Mise à jour disponible", String.Format("Testing TextWrapping to make sure that the window {0}won't end up extremely wide.", Environment.NewLine), true, "Remember my choice test", CustomMsgBoxIcon.Question, 1); modalDataContext.Buttons.Add(new ModalButton(modalDataContext, "OK", null, ModalResult.Ok)); modalDataContext.Buttons.Add(new ModalButton(modalDataContext, "Cancel", () => Console.Out.WriteLine("Testing Cancel"), ModalResult.Cancel)); CustomMsgBox b = new CustomMsgBox(ref modalDataContext); b.ShowDialog(); Console.Out.WriteLine(String.Format("result : {0}", modalDataContext.ModalResult + " \r\n checkbox checked : " + modalDataContext.IsCheckboxChecked)); }
private void btnTodasRodadas_Click(object sender, EventArgs e) { if (Manager.Instance.dBRodadas.Rodadas.Any(r => !r.FoiJogada)) { Manager.Instance.JogarTodasRodadas(); } else { TodasAsRodadasJaForamJogadas(); } var msgBox = new CustomMsgBox("Jogar rodadas restantes", $"Todas as rodadas restantes foram jogadas com sucesso!", MessageBoxType.E_OK); var result = msgBox.ShowDialog(); }
private void buttonOKESC_Click(object sender, EventArgs e) { try { if (sender.Equals(this.buttonOK)) { this.goodsReceiptViewModel.HasPickup = true; bool nextOK = false; Object selectedObject = this.customTabMain.SelectedIndex == 0 ? this.fastPendingPickups.SelectedObject : (this.customTabMain.SelectedIndex == 1 ? this.fastPendingPickupWarehouses.SelectedObject : (this.customTabMain.SelectedIndex == 2 ? this.fastPendingGoodsIssueTransfers.SelectedObject : this.customTabMain.SelectedIndex == 3 ? this.fastPendingGoodsIssueTransferWarehouses.SelectedObject : null)); if (selectedObject != null) { IPendingforGoodsReceipt pendingforGoodsReceipt = (IPendingforGoodsReceipt)selectedObject; if (pendingforGoodsReceipt != null) { this.goodsReceiptViewModel.PickupID = pendingforGoodsReceipt.PickupID > 0 ? pendingforGoodsReceipt.PickupID : (int?)null; this.goodsReceiptViewModel.GoodsIssueID = pendingforGoodsReceipt.GoodsIssueID > 0 ? pendingforGoodsReceipt.GoodsIssueID : (int?)null; this.goodsReceiptViewModel.PickupReference = pendingforGoodsReceipt.PrimaryReference; this.goodsReceiptViewModel.GoodsIssueReference = pendingforGoodsReceipt.PrimaryReference; this.goodsReceiptViewModel.GoodsReceiptTypeID = pendingforGoodsReceipt.GoodsReceiptTypeID; this.goodsReceiptViewModel.GoodsReceiptTypeName = pendingforGoodsReceipt.GoodsReceiptTypeName; this.goodsReceiptViewModel.WarehouseID = pendingforGoodsReceipt.WarehouseID; this.goodsReceiptViewModel.WarehouseName = pendingforGoodsReceipt.WarehouseName; nextOK = true; } } if (nextOK) { this.DialogResult = DialogResult.OK; } else { CustomMsgBox.Show(this, "Vui lòng chọn phiếu giao thành phẩm sau đóng gói, hoặc kho nhận.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } if (sender.Equals(this.buttonESC)) { this.DialogResult = DialogResult.Cancel; } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void buttonOKESC_Click(object sender, EventArgs e) { try { if (sender.Equals(this.buttonOK)) { PendingLot pendingLot = (PendingLot)this.fastPendingLots.SelectedObject; if (pendingLot != null) { this.batchViewModel.LotID = pendingLot.LotID; this.batchViewModel.Code = pendingLot.Code; this.batchViewModel.LotCode = pendingLot.LotCode; this.batchViewModel.EntryDate = pendingLot.EntryDate; this.batchViewModel.BatchMasterID = pendingLot.BatchMasterID; this.batchViewModel.BatchTypeID = 1; // INIT DEFAULT pendingLot.BatchTypeID; this.batchViewModel.CommodityID = pendingLot.CommodityID; this.batchViewModel.CommodityCode = pendingLot.CommodityCode; this.batchViewModel.CommodityName = pendingLot.CommodityName; this.batchViewModel.CommodityAPICode = pendingLot.CommodityAPICode; this.batchViewModel.CommodityCartonCode = pendingLot.CommodityCartonCode; this.batchViewModel.Volume = pendingLot.Volume; this.batchViewModel.PlannedQuantity = pendingLot.PlannedQuantity; this.batchViewModel.BatchStatusCode = pendingLot.BatchStatusCode; this.batchViewModel.Remarks = pendingLot.Remarks; this.batchViewModel.NextPackNo = this.getNextNo(pendingLot.NextPackNo); this.batchViewModel.NextCartonNo = this.getNextNo(pendingLot.NextCartonNo); this.batchViewModel.NextPalletNo = this.getNextNo(pendingLot.NextPalletNo); this.DialogResult = DialogResult.OK; } else { CustomMsgBox.Show(this, "Vui lòng chọn chọn batch và lot.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop); } } if (sender.Equals(this.buttonESC)) { this.DialogResult = DialogResult.Cancel; } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void btnJogarRodada_Click(object sender, EventArgs e) { var rodada = Manager.Instance.dBRodadas.Rodadas.FirstOrDefault(x => !x.FoiJogada); if (rodada == null) { TodasAsRodadasJaForamJogadas(); return; } Manager.Instance.JogarRodada(rodada); var msgBox = new CustomMsgBox("Jogar 1 Rodada", $"Rodada {rodada.Rodada} foi jogada com sucesso!", MessageBoxType.E_OK); var result = msgBox.ShowDialog(); }
/// <summary> /// Method used when the calendar button is clicked opening a window depending on the button text /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bookingInformationButton_Click(object sender, EventArgs e) { if (bookingInformationButton.Text == BookingText) { BookAppointmentWindow bookingWindow = new BookAppointmentWindow(selectedAppointment, MousePosition); bookingWindow.ShowDialog(); Session.GetProgress(); UpdateCalendar(0); } else if (bookingInformationButton.Text == CancelBookingText) { if (Session.LoggedInUser.Sysmin) { List <Lesson> cancelTheseLessons = new List <Lesson>(); List <Lesson> usersOnAppointment = DatabaseParser.GetUsersAndLessonsOnAppointmentID(selectedAppointment.Id); foreach (Lesson lessonToCancel in usersOnAppointment) { cancelTheseLessons.AddRange(DatabaseParser.FindLessonsToCancel(lessonToCancel.TemplateID, lessonToCancel.Progress, lessonToCancel.UserID)); } DialogResult result = CustomMsgBox.ShowYesNoInstructor("", "Cancel lesson", cancelTheseLessons, CustomMsgBoxIcon.Warrning); if (result == DialogResult.Yes) { DatabaseParser.DeleteLessons(cancelTheseLessons); DatabaseParser.DeleteAppointment(selectedAppointment.Id); DeleteAppointment(selectedAppointment); Session.LoggedInUser.GetLessonList(); Session.GetProgress(); UpdateCalendar(0); } } else { List <Lesson> cancelTheseLessons = DatabaseParser.FindLessonsToCancel(selectedAppointment.bookedLessons.First().TemplateID, selectedAppointment.bookedLessons.First().Progress, Session.LoggedInUser.Id); DialogResult result = CustomMsgBox.ShowYesNo("", "Cancel lesson", cancelTheseLessons, CustomMsgBoxIcon.Warrning); if (result == DialogResult.Yes) { DatabaseParser.DeleteLessons(cancelTheseLessons); Session.LoggedInUser.GetLessonList(); Session.GetProgress(); UpdateCalendar(0); } } } }
private void buttonUserToggleVoid_Click(object sender, EventArgs e) { try { if (this.SelectedUserControlIndex != null && this.SelectedUserControlIndex.UserID > 0 && this.SelectedUserControlIndex.SecurityIdentifier != ContextAttributes.User.SecurityIdentifier) { if (CustomMsgBox.Show(this, "Are you sure you want to " + (this.SelectedUserControlIndex.InActive ? "enable" : "disable") + " this user registration?" + "\r\n" + "\r\nUser: "******"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { this.userControlAPIs.UserControlToggleVoid(this.SelectedUserControlIndex.UserID, this.SelectedUserControlIndex.UserName, this.SelectedUserControlIndex.SecurityIdentifier, !this.SelectedUserControlIndex.InActive); this.LoadUserControls(); } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void buttonUserRemove_Click(object sender, EventArgs e) { try { if (this.UserID > 0) { if (CustomMsgBox.Show(this, "Are you sure you want to delete " + this.comboUserID.Text + "?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { this.userAPIs.UserRemove(this.UserID); this.comboUserID.ComboBox.DataSource = this.userAPIs.GetUserIndexes(); } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void buttonUserToggleVoid_Click(object sender, EventArgs e) { try { if (this.SelectedUserIndex != null && this.SelectedUserIndex.UserID > 0 && !this.SelectedUserIndex.IsDatabaseAdmin) { if (CustomMsgBox.Show(this, "Are you sure you want to " + (this.SelectedUserIndex.InActive ? "enable" : "disable") + " this user registration?" + "\r\n" + "\r\nUser: "******"\r\nAt: " + this.SelectedUserIndex.FullyQualifiedOrganizationalUnitName, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { this.userAPIs.UserToggleVoid(this.SelectedUserIndex.UserID, !this.SelectedUserIndex.InActive); this.LoadUserTrees(); } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void buttonUserAdmin_Click(object sender, EventArgs e) { try { if (this.SelectedUserControlIndex != null && this.SelectedUserControlIndex.UserID > 0 && this.SelectedUserControlIndex.SecurityIdentifier != ContextAttributes.User.SecurityIdentifier) { if (CustomMsgBox.Show(this, "Are you sure you want to " + (this.SelectedUserControlIndex.IsDatabaseAdmin ? "unset" : "set") + " as admin for this user?" + "\r\n" + "\r\nUser: "******"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { this.userControlAPIs.UserControlSetAdmin(this.SelectedUserControlIndex.UserID, this.SelectedUserControlIndex.UserName, this.SelectedUserControlIndex.SecurityIdentifier, !this.SelectedUserControlIndex.IsDatabaseAdmin); this.LoadUserControls(); } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
/// <summary> /// Method to Open a file dialog which can take a pdf or image file and upload it to the database. /// </summary> private void OpenFileDialog() { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); fileDialog.Filter = "Files(*.BMP;*.JPG;*.JPEG;*.PDF)|*.BMP;*.JPG;*.JPEG;*.PDF"; if (fileDialog.ShowDialog() == DialogResult.OK) { IUploadHandler uploader = new UploadHandler(); if (fileDialog.CheckFileExists) { if (_documentType == Session.TypeFirstAid) { if (uploader.UploadFirstAid(_documentName, fileDialog.FileName, Properties.Settings.Default["DocumentUpload"].ToString())) { LoadFirstAid(Session.LoggedInUser); } else { CustomMsgBox.ShowOk("Unable to upload document", "Error", CustomMsgBoxIcon.Error); } } else if (_documentType == Session.TypeDoctorsNote) { if (uploader.UploadDoctorsNote(_documentName, fileDialog.FileName, Properties.Settings.Default["DocumentUpload"].ToString())) { LoadDoctorsNote(Session.LoggedInUser); } else { CustomMsgBox.ShowOk("Unable to upload document", "Error", CustomMsgBoxIcon.Error); } } } else { CustomMsgBox.ShowOk("File does not exist", "Warrning!", CustomMsgBoxIcon.Warrning); } } }
private void buttonRemoveDetailItem_Click(object sender, EventArgs e) { try { if (this.EditableMode && this.pickupViewModel.Editable) { PickupDetailDTO pickupDetailDTO = this.gridexPalletDetails.CurrentRow.DataBoundItem as PickupDetailDTO; if (pickupDetailDTO != null && CustomMsgBox.Show(this, "Xác nhận xóa pallet:" + (char)13 + (char)13 + pickupDetailDTO.PalletCode + (char)13 + (char)13 + "Tại vi trí: " + (char)13 + (char)13 + pickupDetailDTO.BinLocationCode, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { this.pickupViewModel.ViewDetails.Remove(pickupDetailDTO); this.callAutoSave(); } } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }