// List rental window public void InitializeComponent(Form parent) { // Window parameters this.BackColor = ColorTranslator.FromHtml("#6d6a75"); this.Font = new Font(this.Font, FontStyle.Bold); this.Size = new Size(600, 640); this.parent = parent; // PictureBox this.pb_Lista = new Library.PictureBox(); this.pb_Lista.Location = new Point(50, 0); this.pb_Lista.Size = new Size(470, 80); this.pb_Lista.ClientSize = new Size(470, 80); this.pb_Lista.Load("./Views/assets/lista.jpg"); this.Controls.Add(pb_Lista); // ListView - Rentals this.lv_ListaLocacoes = new Library.ListView(); this.lv_ListaLocacoes.Location = new Point(20, 100); this.lv_ListaLocacoes.Size = new Size(540, 400); ListViewItem locacoes = new ListViewItem(); List <LocacaoModels> locacoesLista = LocacaoController.GetLocacoes(); foreach (var locacao in locacoesLista) { ListViewItem lv_ListaLocacao = new ListViewItem(locacao.IdLocacao.ToString()); ClienteModels cliente = ClienteController.GetCliente(locacao.IdCliente); lv_ListaLocacao.SubItems.Add(cliente.NomeCliente.ToString()); lv_ListaLocacao.SubItems.Add(cliente.CpfCliente.ToString()); lv_ListaLocacao.SubItems.Add(locacao.DataLocacao.ToString("dd/MM/yyyy")); lv_ListaLocacao.SubItems.Add(locacao.CalculoDataDevol().ToString("dd/MM/yyyy")); lv_ListaLocacao.SubItems.Add(locacao.QtdeFilmes().ToString()); lv_ListaLocacao.SubItems.Add(locacao.ValorTotal().ToString("C2")); lv_ListaLocacoes.Items.Add(lv_ListaLocacao); } this.lv_ListaLocacoes.MultiSelect = false; this.lv_ListaLocacoes.Columns.Add("ID", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Locatário", -2, HorizontalAlignment.Left); this.lv_ListaLocacoes.Columns.Add("CPF", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Data Locação", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Data Devolução", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Qtde Filmes", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Total", -2, HorizontalAlignment.Left); this.Controls.Add(lv_ListaLocacoes); // List grouping box this.gb_ListaLocacoes = new Library.GroupBox(); this.gb_ListaLocacoes.Location = new Point(10, 80); this.gb_ListaLocacoes.Size = new Size(560, 430); this.gb_ListaLocacoes.Text = "LISTA DE LOCAÇÕES"; this.Controls.Add(gb_ListaLocacoes); // Buttons this.btn_ListaSair = new Library.Button(); this.btn_ListaSair.Text = "SAIR"; this.btn_ListaSair.Location = new Point(200, 530); this.btn_ListaSair.Click += new EventHandler(this.btn_ListaSairClick); this.Controls.Add(btn_ListaSair); }
public ConsultaLocacao(Form parent) { this.BackColor = ColorTranslator.FromHtml("#898989"); this.Font = new Font(this.Font, FontStyle.Bold); this.Size = new Size(500, 500); this.parent = parent; pb_Consulta = new PictureBox(); pb_Consulta.Location = new Point(10, 10); pb_Consulta.Size = new Size(480, 100); pb_Consulta.ClientSize = new Size(460, 60); pb_Consulta.BackColor = Color.Black; pb_Consulta.Load("./Views/assets/senac.jpg"); pb_Consulta.SizeMode = PictureBoxSizeMode.StretchImage; this.Controls.Add(pb_Consulta); lbl_NomeLocacao = new Label(); lbl_NomeLocacao.Text = "Nome do Locacao :"; lbl_NomeLocacao.Location = new Point(20, 100); lbl_NomeLocacao.AutoSize = true; this.Controls.Add(lbl_NomeLocacao); lbl_NomeFilme = new Label(); lbl_NomeFilme.Text = "Nome do Filme :"; lbl_NomeFilme.Location = new Point(20, 140); lbl_NomeFilme.AutoSize = true; this.Controls.Add(lbl_NomeFilme); rtxt_NomeLocacao = new RichTextBox(); rtxt_NomeLocacao.SelectionFont = new Font("verdana", 10, FontStyle.Bold); rtxt_NomeLocacao.SelectionColor = System.Drawing.Color.Black; rtxt_NomeLocacao.Location = new Point(150, 100); rtxt_NomeLocacao.Size = new Size(300, 20); this.Controls.Add(rtxt_NomeLocacao); rtxt_NomeLocacao.KeyPress += new KeyPressEventHandler(keypressed1); rtxt_NomeFilme = new RichTextBox(); rtxt_NomeFilme.SelectionFont = new Font("verdana", 10, FontStyle.Bold); rtxt_NomeFilme.SelectionColor = System.Drawing.Color.Black; rtxt_NomeFilme.Location = new Point(150, 140); rtxt_NomeFilme.Size = new Size(300, 20); this.Controls.Add(rtxt_NomeFilme); rtxt_NomeFilme.KeyPress += new KeyPressEventHandler(keypressed2); lv_ListaLocacoes = new ListView(); lv_ListaLocacoes.Location = new Point(30, 210); lv_ListaLocacoes.Size = new Size(420, 140); lv_ListaLocacoes.View = View.Details; foreach (LocacaoModels locacao in LocacaoController.GetLocacoes()) { ListViewItem lv_ListaLocacao = new ListViewItem(locacao.IdLocacao.ToString()); lv_ListaLocacoes.Items.Add(lv_ListaLocacao); } lv_ListaLocacoes.FullRowSelect = true; lv_ListaLocacoes.GridLines = true; lv_ListaLocacoes.AllowColumnReorder = true; lv_ListaLocacoes.Sorting = SortOrder.Ascending; lv_ListaLocacoes.Columns.Add("ID", -2, HorizontalAlignment.Center); lv_ListaLocacoes.Columns.Add("Locatário", -2, HorizontalAlignment.Center); lv_ListaLocacoes.Columns.Add("Qtde Filmes", -2, HorizontalAlignment.Center); lv_ListaLocacoes.Columns.Add("Total", -2, HorizontalAlignment.Center); lv_ListaLocacoes.Columns.Add("Pagto", -2, HorizontalAlignment.Center); this.Controls.Add(lv_ListaLocacoes); Task t = new Task(new Action(() => { RefreshForm(); })); t.Start(); gb_ConsultaLocacao = new GroupBox(); gb_ConsultaLocacao.Location = new Point(10, 80); gb_ConsultaLocacao.Size = new Size(460, 100); gb_ConsultaLocacao.Text = "BUSCAR LOCAÇÃO"; gb_ConsultaLocacao.ForeColor = ColorTranslator.FromHtml("#aa9270"); this.Controls.Add(gb_ConsultaLocacao); gb_ListaLocacoes = new GroupBox(); gb_ListaLocacoes.Location = new Point(10, 190); gb_ListaLocacoes.Size = new Size(460, 170); gb_ListaLocacoes.Text = "LISTA DE FILMES"; gb_ListaLocacoes.ForeColor = ColorTranslator.FromHtml("#aa9270"); this.Controls.Add(gb_ListaLocacoes); btn_ListaConsulta = new Button(); btn_ListaConsulta.Location = new Point(80, 390); btn_ListaConsulta.Size = new Size(150, 40); btn_ListaConsulta.Text = "CONSULTA"; this.btn_ListaConsulta.BackColor = ColorTranslator.FromHtml("#aa9270"); this.btn_ListaConsulta.ForeColor = Color.Black; btn_ListaConsulta.Click += new EventHandler(this.btn_ListaConsultaClick); this.Controls.Add(btn_ListaConsulta); btn_Cancelar = new Button(); btn_Cancelar.Location = new Point(260, 390); btn_Cancelar.Size = new Size(150, 40); btn_Cancelar.Text = "CANCELAR"; this.btn_Cancelar.BackColor = ColorTranslator.FromHtml("#aa9270"); this.btn_Cancelar.ForeColor = Color.Black; btn_Cancelar.Click += new EventHandler(this.btn_CancelarClick); this.Controls.Add(btn_Cancelar); }
// Consult registered rentals public void InitializeComponent(Form parent) { // Window parameters this.BackColor = ColorTranslator.FromHtml("#6d6a75"); this.Font = new Font(this.Font, FontStyle.Bold); this.Size = new Size(500, 500); this.parent = parent; // PictureBox this.pb_Consulta = new Library.PictureBox(); this.pb_Consulta.ClientSize = new Size(460, 80); this.pb_Consulta.Load("./Views/assets/locacao.jpg"); this.Controls.Add(pb_Consulta); // Label this.lbl_NomeLocacao = new Library.Label(); this.lbl_NomeLocacao.Text = "Busca Por Cliente :"; this.lbl_NomeLocacao.Location = new Point(20, 100); this.Controls.Add(lbl_NomeLocacao); // Fill orientation tip this.tt_BuscaCliente = new Library.ToolTip(); // RichTextBox (Edited text - Keypress mode to filter a rental by customer in ListView) this.rtxt_BuscaCliente = new Library.RichTextBox(); this.rtxt_BuscaCliente.Location = new Point(150, 100); this.Controls.Add(rtxt_BuscaCliente); this.tt_BuscaCliente.SetToolTip(rtxt_BuscaCliente, "Digite o nome ou selecione abaixo"); this.rtxt_BuscaCliente.KeyPress += new KeyPressEventHandler(keypressed); // ListView - Rentals this.lv_ListaLocacoes = new Library.ListView(); this.lv_ListaLocacoes.Location = new Point(20, 170); this.lv_ListaLocacoes.Size = new Size(440, 185); List <ClienteModels> listaCliente = (from cliente in ClienteController.GetClientes() where cliente.NomeCliente.Contains(rtxt_BuscaCliente.Text) select cliente).ToList(); ListViewItem locacoes = new ListViewItem(); foreach (LocacaoModels locacao in LocacaoController.GetLocacoes()) { ListViewItem lv_ListaLocacao = new ListViewItem(locacao.IdLocacao.ToString()); ClienteModels cliente = ClienteController.GetCliente(locacao.IdCliente); lv_ListaLocacao.SubItems.Add(cliente.NomeCliente.ToString()); lv_ListaLocacao.SubItems.Add(cliente.CpfCliente.ToString()); lv_ListaLocacao.SubItems.Add(locacao.DataLocacao.ToString("dd/MM/yyyy")); lv_ListaLocacao.SubItems.Add(locacao.CalculoDataDevol().ToString("dd/MM/yyyy")); lv_ListaLocacao.SubItems.Add(locacao.QtdeFilmes().ToString()); lv_ListaLocacao.SubItems.Add(locacao.ValorTotal().ToString("C2")); lv_ListaLocacoes.Items.Add(lv_ListaLocacao); } this.lv_ListaLocacoes.MultiSelect = false; this.lv_ListaLocacoes.Columns.Add("ID", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Locatário", -2, HorizontalAlignment.Left); this.lv_ListaLocacoes.Columns.Add("CPF", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Data Locação", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Data Devolução", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Qtde Filmes", -2, HorizontalAlignment.Center); this.lv_ListaLocacoes.Columns.Add("Total", -2, HorizontalAlignment.Left); this.Controls.Add(lv_ListaLocacoes); Task t = new Task(new Action(() => { RefreshForm(); })); t.Start(); // ListView grouping box this.gb_ConsultaLocacao = new Library.GroupBox(); this.gb_ConsultaLocacao.Location = new Point(10, 80); this.gb_ConsultaLocacao.Size = new Size(460, 55); this.gb_ConsultaLocacao.Text = "BUSCAR LOCAÇÃO"; this.Controls.Add(gb_ConsultaLocacao); this.gb_ListaLocacoes = new Library.GroupBox(); this.gb_ListaLocacoes.Location = new Point(10, 150); this.gb_ListaLocacoes.Size = new Size(460, 220); this.gb_ListaLocacoes.Text = "LISTA DE LOCAÇÕES"; this.Controls.Add(gb_ListaLocacoes); // Buttons this.btn_ListaConsulta = new Library.Button(); this.btn_ListaConsulta.Location = new Point(80, 390); this.btn_ListaConsulta.Text = "CONSULTA"; this.btn_ListaConsulta.Click += new EventHandler(this.btn_ListaConsultaClick); this.Controls.Add(btn_ListaConsulta); this.btn_ListaSair = new Library.Button(); this.btn_ListaSair.Location = new Point(260, 390); this.btn_ListaSair.Text = "CANCELAR"; this.btn_ListaSair.Click += new EventHandler(this.btn_ListaSairClick); this.Controls.Add(btn_ListaSair); }