private void KeyDowns(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Escape: Close(); break; case Keys.F9: if (UserPermission.SetControlVisual(btnCFeSat, pictureBox6, "fiscal_emissaocfe")) { return; } Cfe(); break; case Keys.F10: if (!Support.CheckForInternetConnection()) { Alert.Message("Opps", "Você está sem conexão com a internet.", Alert.AlertType.warning); return; } if (UserPermission.SetControlVisual(btnNfe, pictureBox4, "fiscal_emissaonfe")) { return; } Nfe(); break; case Keys.F11: new PedidoImpressao().Print(idPedido); e.SuppressKeyPress = true; break; } }
private void Eventos() { KeyDown += KeyDowns; KeyPreview = true; btnExit.Click += (s, e) => Close(); Load += (s, e) => { LoadStatus(); var pedido = _modelPedido.FindById(idPedido).FirstOrDefault <Model.Pedido>(); pedido.Id = idPedido; pedido.status = _controllerTitulo.GetLancados(idPedido) < Validation.Round(_modelPedido.Total) ? 2 : 1; if (Home.pedidoPage == "Delivery" || Home.pedidoPage == "Balcao") { Status.SelectedValue = pedido.campoa; label19.Text = GetStatus(pedido.campoa); } pedido.Save(pedido); }; Activated += (s, e) => { LoadData(); }; btnPgtosLancado.Click += (s, e) => { OpenPedidoPagamentos(); }; btnRemove.Click += (s, e) => { if (labelCfe.Text != @"N/D" || labelNfe.Text != @"N/D") { Alert.Message("Ação não permitida", "Existem documentos fiscais vinculados!", Alert.AlertType.warning); return; } var result = AlertOptions.Message("Atenção!", "Deseja realmente apagar?", AlertBig.AlertType.warning, AlertBig.AlertBtn.YesNo); if (result) { var remove = new Controller.Pedido(); remove.Remove(idPedido); Close(); } }; btnImprimir.Click += (s, e) => { var f = new OptionBobinaA4(); string tipo; f.TopMost = true; var formResult = f.ShowDialog(); switch (formResult) { case DialogResult.OK: tipo = "Folha A4"; new Controller.Pedido().Imprimir(idPedido, tipo); break; case DialogResult.Cancel: tipo = "Bobina 80mm"; new Controller.Pedido().Imprimir(idPedido, tipo); break; } }; btnNfe.Click += (s, e) => { if (!Support.CheckForInternetConnection()) { Alert.Message("Opps", "Você está sem conexão com a internet.", Alert.AlertType.warning); return; } if (UserPermission.SetControlVisual(btnNfe, pictureBox4, "fiscal_emissaonfe")) { return; } Nfe(); }; btnCFeSat.Click += (s, e) => { if (UserPermission.SetControlVisual(btnCFeSat, pictureBox6, "fiscal_emissaocfe")) { return; } Cfe(); //Cfe(1); }; btnNfse.Click += (s, e) => { if (!Support.CheckForInternetConnection()) { Alert.Message("Opps", "Você está sem conexão com a internet.", Alert.AlertType.warning); return; } //if (UserPermission.SetControl(btnNfe, pictureBox4, "fiscal_emissaonfe")) // return; Nfse(); }; btnHelp.Click += (s, e) => Support.OpenLinkBrowser("http://ajuda.emiplus.com.br/"); SelecionarCliente.Click += (s, e) => { var checkNota = new Nota().FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault <Nota>(); if (checkNota != null) { if (checkNota.Status == "Autorizada") { Alert.Message("Ação não permitida", "Existem documentos fiscais vinculados!", Alert.AlertType.warning); return; } } ModalClientes(); }; SelecionarColaborador.Click += (s, e) => { var checkNota = new Nota().FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault <Nota>(); if (checkNota != null) { if (checkNota.Status == "Autorizada") { Alert.Message("Ação não permitida", "Existem documentos fiscais vinculados!", Alert.AlertType.warning); return; } } ModalColaborador(); }; impostos.CheckStateChanged += (s, e) => { PedidoItem.impostos = impostos.Checked; _controllerPedidoItem.GetDataTableItens(GridLista, idPedido); }; btnStatus.Click += (s, e) => { pictureBox7.Visible = true; visualPanel1.Visible = true; }; btnCancelStatus.Click += (s, e) => { pictureBox7.Visible = false; visualPanel1.Visible = false; }; btnSaveStatus.Click += (s, e) => { if (Status.SelectedValue.ToString() == "Selecione") { Alert.Message("Opss", "Selecione um status.", Alert.AlertType.error); return; } var pedido = _modelPedido.FindById(idPedido).FirstOrDefault <Model.Pedido>(); pedido.Id = idPedido; pedido.campoa = Status.SelectedValue.ToString(); label19.Text = GetStatus(pedido.campoa); if (pedido.Save(pedido)) { Alert.Message("Pronto", "Status atualizado.", Alert.AlertType.success); pictureBox7.Visible = false; visualPanel1.Visible = false; } }; }