public IActionResult Excluir(CalendarForm calendarForm) { //ViewBag.Message = "Ocorreu um erro. (" + ex.Message + ")"; //ViewBag.MessageClass = "alert-danger"; try { var calendar = calendarForm.ToCalendar(); if (string.IsNullOrEmpty(calendarForm.Id)) { throw new Exception("não foi possível excluir"); } else { (new Data.DataCalendar(config.Value.ConnectionString)).Delete(calendar); } } catch (Exception ex) { ViewBag.Message = "Ocorreu um erro. (" + ex.Message + ")"; ViewBag.MessageClass = "alert-danger"; } var colCalendar = new Data.DataCalendar(config.Value.ConnectionString).List().ToList <Calendar>(); var colCalendarForm = from calendar in colCalendar select calendar.ToCalendarForm(); return(View("Gerenciar", colCalendarForm.ToList())); }
public static void NewItemByFolderClass(string sFolderClass, ExchangeService oExchangeService, FolderId oFolderId) { switch (sFolderClass) { case "IPF.Note": MessageForm oMessageForm = new MessageForm(oExchangeService, WellKnownFolderName.Drafts); oMessageForm.ShowDialog(); oMessageForm = null; break; case "IPF.Contact": ContactsForm oContactsFormForm = new ContactsForm(oExchangeService, oFolderId); oContactsFormForm.ShowDialog(); oContactsFormForm = null; break; case "IPF.Appointment": CalendarForm oCalendarFormForm = new CalendarForm(oExchangeService, oFolderId); oCalendarFormForm.ShowDialog(); oCalendarFormForm = null; break; case "IPF.Task": TaskForm oTaskFormForm = new TaskForm(oExchangeService, oFolderId); oTaskFormForm.ShowDialog(); oTaskFormForm = null; break; } }
private void EditSelectedCalendarItem() { if (lvItems.SelectedItems.Count > 0) { ItemTag oItemTag = null; oItemTag = (ItemTag)lvItems.SelectedItems[0].Tag; //Item oSomeItem = Item.Bind(CurrentService, oItemTag.Id); _CurrentService.ClientRequestId = Guid.NewGuid().ToString(); // Set a new GUID Appointment oSomeAppointment = Appointment.Bind(_CurrentService, oItemTag.Id); string sAppointmentType = oSomeAppointment.AppointmentType.ToString(); if (sAppointmentType == "Single") { CalendarForm oForm = new CalendarForm(_CurrentService, oSomeAppointment.Id); oForm.ShowDialog(); oForm = null; } else { CalendarInstanceForm oForm = new CalendarInstanceForm(_CurrentService, oSomeAppointment.Id); oForm.ShowDialog(); oForm = null; } oItemTag = null; } }
private void Init() { try { UpdateAndwhoData(); screenRect = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; //程序启动后,窗体在屏幕右侧中部 this.Left = screenRect.Right - this.Width; this.Top = (screenRect.Bottom - this.Height) / 2; navigationForm = new NavigationForm(); calendarForm = new CalendarForm(); PhysicalMemoryTimer_Tick(null, null); System.Windows.Forms.Timer PhysicalMemoryTimer = new System.Windows.Forms.Timer(); PhysicalMemoryTimer.Tick += new EventHandler(PhysicalMemoryTimer_Tick); PhysicalMemoryTimer.Interval = 3000;//时间 PhysicalMemoryTimer.Enabled = true; System.Windows.Forms.Timer StopRectTimer = new System.Windows.Forms.Timer(); StopRectTimer.Tick += new EventHandler(StopRectTimer_Tick); StopRectTimer.Interval = 1000;//时间 StopRectTimer.Enabled = true; CheckNewVersion(); } catch { } }
private void btnNew_Click(object sender, EventArgs e) { CalendarForm oForm = new CalendarForm(_CurrentService, _SelectedFolder); oForm.ShowDialog(); oForm = null; }
private void openMasterToolStripMenuItem_Click(object sender, EventArgs e) { if (lvItems.SelectedItems.Count > 0) { ItemTag oItemTag = null; oItemTag = (ItemTag)lvItems.SelectedItems[0].Tag; if (lvItems.SelectedItems[0].SubItems[4].Text == "False") { CalendarForm oForm = new CalendarForm(_CurrentService, oItemTag.Id); oForm.ShowDialog(); oForm = null; } else { Appointment oAppointment = Appointment.BindToRecurringMaster(_CurrentService, oItemTag.Id); CalendarForm oForm = new CalendarForm(_CurrentService, oAppointment.Id); oForm.ShowDialog(); oForm = null; } oItemTag = null; } }
public void CalendarForm(Form _MdiForm) { CalendarForm Help = new CalendarForm(); Help.MdiParent = _MdiForm; Help.Show(); }
private void ButtonCalendar_Click(object sender, EventArgs e) { using (var frm = new CalendarForm()) { frm.ShowDialog(); } }
public IActionResult IncluirAlterar(CalendarForm calendarForm) { try { var calendar = calendarForm.ToCalendar(); if (string.IsNullOrEmpty(calendarForm.Id)) { (new Data.DataCalendar(config.Value.ConnectionString)).Insert(calendar); calendarForm = new CalendarForm(); calendarForm.StartDate = DateTime.Now.ToString("dd/MM/yyyy") + " 18:00:00"; calendarForm.EndDate = calendarForm.StartDate; ViewData["Message"] = "Programação incluída com sucesso!"; } else { (new Data.DataCalendar(config.Value.ConnectionString)).Update(calendar); ViewData["Message"] = "Programação alterada com sucesso!"; } ViewData["MessageClass"] = "alert-success"; } catch (Exception ex) { ViewData["Message"] = "Ocorreu um erro. (" + ex.Message + ")"; ViewData["MessageClass"] = "alert-danger"; } return(View(calendarForm)); }
private void SelectButton_Click(object sender, EventArgs e) { calendarForm = FormFactory.createCalendarForm(this, dateTime); calendarForm.ShowDialog(); this.date = calendarForm.Date; this.dateTime = calendarForm.Current; this.ColumnValue.Text = this.date; }
private void Login(string loginUserName) { UserController.LoggedUserName = loginUserName; this.Hide(); CalendarForm calendarForm = new CalendarForm(userController); calendarForm.ShowDialog(); this.Close(); }
private void extButton1_Click(object sender, EventArgs e) { CalendarForm frm = new CalendarForm(); frm.Value = new DateTime(2021, 4, 10); // frm.CloseOnChange = true; frm.Selected += (s, ev) => { System.Diagnostics.Debug.WriteLine("Date Sel " + ev); }; frm.Show(); }
public CalendarController() { //CanCreate = false; //CanDelete = true; //ForeignKey = ""; Form = new CalendarForm(); ReturnTo = new ReturnTo(this, "Index", null, "Name", new string[] { "Create", "Edit" }); TitlePlural = "Calendar"; SearchForms.Add(new CalendarSearchForm(Url)); }
public ActionResult Create(CalendarForm cform) { if (ModelState.IsValid) { db.CalendarForms.Add(cform); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cform)); }
private void BtnCalendar_Click(object sender, EventArgs e) { Hide(); var calendarForm = new CalendarForm(new CalendarViewModel(), this, SignInViewModel.currentUser.username); calendarForm.StartPosition = FormStartPosition.Manual; calendarForm.Location = Location; calendarForm.Show(); player.StopMusic(); }
public CreateAppointmentForm(CalendarForm calendarForm, AppointmentController appointmentController, UserController userController) { InitializeComponent(); calendar = calendarForm; AddUserNamesToAllUserNamesList(); allUserNamesListBox.DataSource = allUserNames; invitedUserNamesListBox.DataSource = invitedUserNames; this.appointmentController = appointmentController; this.userController = userController; }
public ActionResult Edit(CalendarForm cform) { if (ModelState.IsValid) { db.Entry(cform).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cform)); }
public static CalendarForm Instance() { if (sForm == null) { sForm = new CalendarForm(); } else { sForm.Close(); sForm = new CalendarForm(); } return(sForm); }
public EditAppointmentForm(Appointment appointment, AppointmentInformationForm appointmentInformationForm, CalendarForm calendarForm, AppointmentsInDayForm appointmentsInDayForm, AppointmentController appointmentController, UserController userController) { InitializeComponent(); this.appointment = appointment; appointmentInformation = appointmentInformationForm; calendar = calendarForm; appointmentsInDay = appointmentsInDayForm; AddUserNamesToLists(); SetPreviousValues(); notInvitedUserNamesListBox.DataSource = notInvitedUserNames; invitedUserNamesListBox.DataSource = invitedUserNames; this.appointmentController = appointmentController; this.userController = userController; }
private void logInBTN_Click(object sender, EventArgs e) { User user = new User(); if (dataHandler.CredentialsCheck(emailTB.Text, passwordTB.Text, out user)) { CalendarForm calendar = new CalendarForm(dataHandler, user); calendar.Show(); this.Hide(); } else { MessageBox.Show("Incorrect login details"); } }
public AppointmentsInDayForm(List <Appointment> appointmentsInDay, DateTime dayAndTime, CalendarForm calendarForm, AppointmentController appointmentController, UserController userController) { InitializeComponent(); this.calendar = calendarForm; if (appointmentsInDay == null) { throw new ArgumentNullException("appointmentsInDay"); } SeparateAppointments(appointmentsInDay); SetDateAndTimeLabel(dayAndTime); AddMyAppointmentsToListBox(); AddInvitedAppointmentsToListBox(); this.appointmentController = appointmentController; this.userController = userController; }
public static CalendarForm ToCalendarForm(this Calendar calendar) { var result = new CalendarForm { Id = calendar.Id.ToString(), Title = calendar.Title, Description = calendar.Description, StartDate = calendar.StartDate.ToString("dd/MM/yyyy HH:mm:ss"), EndDate = calendar.EndDate.ToString("dd/MM/yyyy HH:mm:ss"), Ministry = calendar.Ministry, BackgroundColor = calendar.BackgroundColor, TextColor = calendar.TextColor }; return(result); }
public IActionResult IncluirAlterar(string Id) { CalendarForm calendarForm; if (!string.IsNullOrEmpty(Id)) { calendarForm = (new Data.DataCalendar(config.Value.ConnectionString)).Find(Id).ToCalendarForm(); } else { calendarForm = new CalendarForm(); calendarForm.StartDate = DateTime.Now.ToString("dd/MM/yyyy") + " 18:00:00"; calendarForm.EndDate = calendarForm.StartDate; } return(View("IncluirAlterar", calendarForm)); }
public AppointmentInformationForm(Appointment appointment, CalendarForm calendarForm, AppointmentController appointmentController, UserController userController, AppointmentsInDayForm appointmentsInDayForm = null) { InitializeComponent(); if (appointment == null) { throw new ArgumentNullException("appointment"); } this.appointment = appointment; calendar = calendarForm; if (appointmentsInDayForm != null) { appointmentsInDayForm.Close(); } FillFields(); HideOwnerButtonsIfLoggedUserDoesNotOwnTheAppointment(); this.appointmentController = appointmentController; this.userController = userController; }
public static Calendar ToCalendar(this CalendarForm calendarForm) { DateTime startDate; DateTime endDate; if (!string.IsNullOrEmpty(calendarForm.StartDate)) { startDate = calendarForm.StartDate.FromBrToDateTime(); } else { startDate = new DateTime(); } if (!string.IsNullOrEmpty(calendarForm.EndDate)) { endDate = calendarForm.EndDate.FromBrToDateTime(); } else { endDate = new DateTime(); } var result = new Calendar() { Title = calendarForm.Title, Description = calendarForm.Description, StartDate = startDate, EndDate = endDate, Ministry = calendarForm.Ministry, BackgroundColor = calendarForm.BackgroundColor, TextColor = calendarForm.TextColor }; if (!string.IsNullOrEmpty(calendarForm.Id)) { result.Id = ObjectId.Parse(calendarForm.Id); } return(result); }
private void AdapterForm_Load(object sender, EventArgs e) { try { rectangle_Screen = SystemInformation.WorkingArea; //rectangle_Screen = Screen.GetWorkingArea(this); //程序启动后,窗体在屏幕右侧中部 this.Left = SystemInformation.PrimaryMonitorMaximizedWindowSize.Width; this.Top = (SystemInformation.PrimaryMonitorMaximizedWindowSize.Height - this.Height) / 2; form_Navigation = new NavigationForm(); form_Calendar = new CalendarForm(); form_Navigation.Owner = this; form_Calendar.Owner = this; PhysicalMemoryTimer_Tick(null, null); System.Windows.Forms.Timer PhysicalMemoryTimer = new System.Windows.Forms.Timer(); PhysicalMemoryTimer.Tick += new EventHandler(PhysicalMemoryTimer_Tick); PhysicalMemoryTimer.Interval = 3000; PhysicalMemoryTimer.Enabled = true; System.Windows.Forms.Timer StopRectTimer = new System.Windows.Forms.Timer(); StopRectTimer.Tick += new EventHandler(StopRectTimer_Tick); StopRectTimer.Interval = 1000; StopRectTimer.Enabled = true; this.RegisterAppBar(false); updateTimer = new System.Windows.Forms.Timer(); updateTimer.Tick += new EventHandler(CheckNewVersion_Tick); updateTimer.Interval = 10 * 1000; updateTimer.Enabled = true; } catch { } }
/// <summary> /// Prints charts over a specified month and year /// </summary> public static void Print_Chart(CalendarForm calForm, int _month, int _year) { //Exporting to PDF string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); folderPath.Replace(@"\\", "/"); try { string month = calForm.monthNames[_month]; string year = _year.ToString(); string fileName = "Summering_" + month + "_" + year; using (FileStream stream = new FileStream(folderPath + "/" + fileName + ".pdf", FileMode.Create)) { Document pdfDoc = new Document(PageSize.A4.Rotate(), 20f, 20f, 25f, 20f); PdfWriter.GetInstance(pdfDoc, stream); pdfDoc.Open(); iTextSharp.text.Paragraph p = new Paragraph($"Frånvarosummering - {month}, {year}\n"); p.SpacingAfter = 60; pdfDoc.Add(p); var img = Image.GetInstance(GetChartImage(_month, _year)); img.ScaleAbsolute(765, 500); img.SetAbsolutePosition(0, 0); pdfDoc.Add(img); pdfDoc.Close(); stream.Close(); } MessageBox.Show($"PDF sparad till \"{folderPath}\\{fileName}.pdf\"", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TryOpenPDF($"{folderPath}/{fileName}.pdf"); } catch (Exception) { MessageBox.Show($"Kan inte spara PDF - filen används av en annan process", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public CreateAppointmentForm(CalendarForm calendarForm) { InitializeComponent(); calendar = calendarForm; }
public IActionResult Visualizar(string Id) { CalendarForm calendarForm = (new Data.DataCalendar(config.Value.ConnectionString)).Find(Id).ToCalendarForm(); return(View("~/Views/Adm/Visualizar.cshtml", calendarForm)); }
/// <summary> /// Prints the calendar: <paramref name="calForm"/> to a PDF, from date: <paramref name="date"/> /// </summary> public static void Print_Calendar(CalendarForm calForm, DateTime date) { Font pdfFont = new Font(Font.FontFamily.HELVETICA, 6.0f, Font.NORMAL); //Creating iTextSharp Tables from the DataTable data PdfPTable headers = new PdfPTable(32); headers.DefaultCell.Padding = 2; headers.WidthPercentage = 100; headers.HorizontalAlignment = Element.ALIGN_LEFT; headers.DefaultCell.BorderWidth = 0.1f; headers.DefaultCell.BorderColor = BaseColor.LIGHT_GRAY; headers.SpacingAfter = 10.0f; PdfPTable items = new PdfPTable(32); items.DefaultCell.Padding = 2; items.WidthPercentage = 100; items.HorizontalAlignment = Element.ALIGN_LEFT; items.DefaultCell.BorderWidth = 0.1f; items.DefaultCell.BorderColor = BaseColor.LIGHT_GRAY; int[] widths = new int[32]; widths[0] = 15; for (int i = 1; i < widths.Length; i++) { widths[i] = 7; } items.SetWidths(widths); headers.SetWidths(widths); DateTime originalDate = calForm.viewDate; calForm.RefreshCal(date); DataGridView header = calForm.Header_Cal; DataGridView data = calForm.CalGrid_Cal; //Adding Header row for (int row = 0; row < header.RowCount; row++) { headers.AddCell(""); for (int col = 0; col < header.ColumnCount; col++) { PdfPCell cell; if (header[col, row].Value != null) { cell = new PdfPCell(new Phrase(header[col, row].Value.ToString(), pdfFont)); } else { cell = new PdfPCell(new Phrase("", pdfFont)); } System.Drawing.Color color = header[col, row].Style.BackColor; if (!(color.R == 0 && color.G == 0 && color.B == 0)) { cell.BackgroundColor = ColorToBase(header[col, row].Style.BackColor); } cell.BorderColor = BaseColor.LIGHT_GRAY; headers.AddCell(cell); } } //Adding DataRow for (int row = 0; row < data.RowCount; row++) { for (int col = 0; col < data.ColumnCount; col++) { PdfPCell cell; if (data[col, row].Value != null) { System.Drawing.Color c = data[col, row].Style.ForeColor; Font font = new Font(pdfFont.BaseFont, pdfFont.Size, pdfFont.Style, new BaseColor(c.R, c.G, c.B)); cell = new PdfPCell(new Phrase(data[col, row].Value.ToString(), font)); } else { cell = new PdfPCell(new Phrase("", pdfFont)); } System.Drawing.Color color = data[col, row].Style.BackColor; if (!(color.R == 0 && color.G == 0 && color.B == 0)) { cell.BackgroundColor = ColorToBase(data[col, row].Style.BackColor); } cell.BorderColor = BaseColor.LIGHT_GRAY; items.AddCell(cell); } } calForm.RefreshCal(originalDate); //Exporting to PDF string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); folderPath.Replace(@"\\", "/"); try { string month = calForm.monthNames[date.Date.Month - 1]; string year = date.Date.Year.ToString(); string fileName = "Kalender_" + month + "_" + year; using (FileStream stream = new FileStream(folderPath + "/" + fileName + ".pdf", FileMode.Create)) { Document pdfDoc = new Document(PageSize.A4.Rotate(), 20f, 20f, 25f, 20f); PdfWriter.GetInstance(pdfDoc, stream); pdfDoc.Open(); iTextSharp.text.Paragraph p = new Paragraph($"{month}, {year}\n"); p.SpacingAfter = 10; pdfDoc.Add(p); pdfDoc.Add(headers); pdfDoc.Add(items); pdfDoc.Close(); stream.Close(); } MessageBox.Show($"PDF sparad till \"{folderPath}\\{fileName}.pdf\"", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TryOpenPDF($"{folderPath}/{fileName}.pdf"); } catch (Exception) { MessageBox.Show($"Kan inte spara PDF - filen används av en annan process", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }