/// <summary> /// Обновляет информацию в данном элементе управления /// </summary> /// <param name="reloadReport">Синхронизировать ли с базой данных</param> private void UpdateInformation(bool reloadReport) { if (reloadReport) { #if RELEASE try { #endif report.Reload(); RemoveTempFile(); #if RELEASE } catch (Exception ex) { MessageBox.Show("Error while loading data" + Environment.NewLine + ex.Message, (string)new StaticProjectTermsProvider()["SystemName"], MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #endif } textBoxShortName.Text = report.ShortName; textBoxReportName.Text = report.RealName; textBoxDescription.Text = report.FullName; if (mode == ScreenMode.Edit) { labelDownloadDateValue.Text = UsefulMethods.NormalizeDate(report.RecievedDate); } else { labelDownloadDateValue.Text = UsefulMethods.NormalizeDate(DateTime.Now); } tempReport = new BiWeekly(report.RealName, report.Report); if (tempReport.Report != null) { tempReport.SaveReportToFile(out tempFilePath); } bool permission = report.HasPermission(Users.CurrentUser, DataEvent.Update); if (mode == ScreenMode.Edit) { headerControl.ButtonEdit.Enabled = permission; } buttonLoad.Enabled = permission; buttonSaveToFile.Enabled = !(tempReport.Report == null); textBoxShortName.ReadOnly = !permission; textBoxReportName.ReadOnly = !permission; textBoxDescription.ReadOnly = !permission; buttonDeleteReport.Visible = (mode == ScreenMode.Edit); buttonDeleteReport.Enabled = report.HasPermission(Users.CurrentUser, DataEvent.Remove); }
private void UpdateInformation() { textBoxShortName.Text = currentBiWeeklyReport.ShortName; textBoxDescription.Text = currentBiWeeklyReport.FullName; bool permission = currentBiWeeklyReport.HasPermission(Users.CurrentUser, DataEvent.Update); textBoxShortName.ReadOnly = !permission; textBoxDescription.ReadOnly = !permission; }