private void gerarpontoButton_Click(object sender, EventArgs e) { try { List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(codigopontoGroupBox, ref ErrosTela); if (ErrosTela.Count > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(codigopontoGroupBox, ErrosTela); MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { string[] aArquivoOriginal = File.ReadAllLines(lerdiretorioTextBox.Text, Encoding.Default); if (aArquivoOriginal.Length == 0) { throw new Exception("Arquivo em branco."); } Empresa objEmpresa = DataBaseBLL.BuscarEmpresaPorId(codigoempresaComboBox.Text); Layout objLayout = DataBaseBLL.BuscarLayoutPorNome(nomelayoutComboBox.Text); ConversorBLL.ConverterArquivo(aArquivoOriginal, objEmpresa, objLayout, diretoriogravarTextBox.Text); MessageBox.Show("Arquivo gerado com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } Utilities.ResetarControles(this); }
public ActionResult GetChildID(FormCollection form) { string bookID = form["BookID"]; string cataID = form["CataID"]; string cataIDs = DataBaseBLL.GetChildCataByCataID(Int32.Parse(bookID), Int32.Parse(cataID)); return(Json(cataIDs)); }
private void AlterarempresaButton_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Deseja alterar a empresa?", ParametroInfo.SistemaVersao, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { statusempresaLabel.Text = "Processando..."; statusempresaLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(layoutempresaGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(layoutempresaGroupBox, ErrosTela); statusempresaLabel.Text = "Não foi possível alterar..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DataBaseBLL.AlterarEmpresa( new Empresa() { Id = codigoempresaComboBox.Text, Nome = nomeempresaTextBox.Text, InicioEvento = int.Parse(inicioeventoTextBox.Text), TamanhoEvento = int.Parse(tamanhoeventoTextBox.Text), InicioFuncionario = int.Parse(iniciofuncionarioTextBox.Text), TamanhoFuncionario = int.Parse(tamanhofuncionarioTextBox.Text), InicioHoras = int.Parse(iniciohorasTextBox.Text), TamanhoHoras = int.Parse(tamanhohorasTextBox.Text) } ); statusempresaLabel.Text = "Empresa alterada com sucesso."; MessageBox.Show("Empresa alterada com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Utilities.ResetarControles(layoutempresaGroupBox); empresaComboBox.DataSource = DataBaseBLL.CarregarEmpresasComboBox(); inicioeventoTextBox.Focus(); Close(); } } } catch (Exception ex) { if (ex.Message == "23505") { MessageBox.Show("Empresa já cadastrado.", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statusempresaLabel.Text = "Não foi possível alterar..."; } else { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statusempresaLabel.Text = "Não foi possível alterar..."; } } }
/// <summary> /// 初始化页面 /// </summary> /// <returns></returns> public ActionResult Index(int BookID) { ResourcePageModel model = new ResourcePageModel(); model.Book = DataBaseBLL.GetStandBookByID(BookID); //////////////通过教材ID加载教材目录列表/////////////////// model.StandBookCataList = DataBaseBLL.GetCataByBookID(BookID); model.ShowMsg = "义务教育教科书" + model.Book.EditionName + model.Book.StageName + model.Book.SubjectName; model.FileUrl = ConfigurationManager.AppSettings["File_Url"]; return(View(model)); }
private void IncluirempresaButton_Click(object sender, EventArgs e) { try { statusempresaLabel.Text = "Processando..."; statusempresaLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(empresaGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(eventoGroupBox, ErrosTela); statusempresaLabel.Text = "Não foi possível incluir..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DataBaseBLL.GravarEmpresa( new Empresa() { Id = codigoempresaMaskedTextBox.Text, Nome = nomeempresaTextBox.Text, InicioEvento = int.Parse(inicioeventoTextBox.Text), TamanhoEvento = int.Parse(tamanhoeventoTextBox.Text), InicioFuncionario = int.Parse(iniciofuncionarioTextBox.Text), TamanhoFuncionario = int.Parse(tamanhofuncionarioTextBox.Text), InicioHoras = int.Parse(iniciohorasTextBox.Text), TamanhoHoras = int.Parse(tamanhohorasTextBox.Text) } ); statusempresaLabel.Text = "Empresa incluída com sucesso."; //Habilitar e Desabilitar eventoGroupBox.Enabled = true; funcionarioGroupBox.Enabled = true; novaempresaButton.Enabled = true; empresaGroupBox.Enabled = false; eventoexternoTextBox.Focus(); } } catch (Exception ex) { if (ex.Message == "23505") { MessageBox.Show("Empresa já cadastrada.", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statusempresaLabel.Text = "Não foi possível incluir..."; } else { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statusempresaLabel.Text = "Não foi possível incluir..."; } } }
public ActionResult GetResourceByKey(FormCollection form) { ResourceBLL resourceBLL = new ResourceBLL(); int bookID = Int32.Parse(form["BookID"]); string keyword = form["KeyWord"]; List <StandBookCata> catalist = DataBaseBLL.GetCataByBookID(bookID); string cataIDs = DataBaseBLL.GetCataID(catalist); List <Resource> list = resourceBLL.GetResourceListByKey(cataIDs, keyword); return(Json(list)); }
private void NomelayoutComboBox_SelectedIndexChanged(object sender, EventArgs e) { Layout layoutSelecionado = (Layout)nomelayoutComboBox.SelectedItem; consultalayoutGridView.DataSource = DataBaseBLL.CarregarLayoutGrid(layoutSelecionado.Nome); if (string.IsNullOrEmpty(nomelayoutComboBox.Text)) { detalheslayoutButton.Enabled = false; } else { detalheslayoutButton.Enabled = true; } }
private void IncluireventoButton_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Deseja incluir esse evento?", ParametroInfo.SistemaVersao, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { statuseventoLabel.Text = "Processando..."; statuseventoLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(eventoGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(eventoGroupBox, ErrosTela); statuseventoLabel.Text = "Não foi possível incluir..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DataBaseBLL.GravarEvento( new Evento() { IdEmpresa = codigoempresaComboBox.Text, NomeEmpresa = nomeempresaTextBox.Text, Externo = eventoexternoTextBox.Text, Interno = eventointernoTextBox.Text, Transferivel = eventotrensferivelCheckBox.Checked, } ); statuseventoLabel.Text = "Evento incluído com sucesso."; MessageBox.Show("Evento incluído com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Utilities.ResetarControles(eventoGroupBox); eventoexternoTextBox.Focus(); Close(); } } } catch (Exception ex) { if (ex.Message == "23505") { MessageBox.Show("Evento já cadastrado.", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statuseventoLabel.Text = "Não foi possível incluir..."; } else { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statuseventoLabel.Text = "Não foi possível incluir..."; } } }
private void AlterarfuncionarioButton_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Deseja alterar esse funcionário?", ParametroInfo.SistemaVersao, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { statusfuncionarioLabel.Text = "Processando..."; statusfuncionarioLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(funcionarioGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(funcionarioGroupBox, ErrosTela); statusfuncionarioLabel.Text = "Não foi possível alterar..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DataBaseBLL.AlterarFuncionario( new Funcionario() { IdEmpresa = codigoempresaComboBox.Text, NomeEmpresa = nomeempresaTextBox.Text, Externo = funcionarioexternoTextBox.Text, Interno = funcionariointernoTextBox.Text, }, linhaSelecionada["externoDataGridViewTextBoxColumn"].Value.ToString() ); statusfuncionarioLabel.Text = "Funcionário alterado com sucesso."; MessageBox.Show("Funcionário alterado com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Utilities.ResetarControles(funcionarioGroupBox); funcionarioexternoTextBox.Focus(); Close(); } } } catch (Exception ex) { if (ex.Message == "23505") { MessageBox.Show("Funcionário já cadastrado.", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statusfuncionarioLabel.Text = "Não foi possível alterar..."; } else { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statusfuncionarioLabel.Text = "Não foi possível alterar..."; } } }
private void CodigoempresaComboBox_SelectedIndexChanged(object sender, EventArgs e) { nomeempresaTextBox.Text = codigoempresaComboBox.SelectedValue.ToString(); Empresa empresaSelecionada = (Empresa)codigoempresaComboBox.SelectedItem; consultaempresaGridView.DataSource = DataBaseBLL.CarregarEmpresaGrid(empresaSelecionada.Id); if (string.IsNullOrEmpty(codigoempresaComboBox.Text)) { detalhesempresaButton.Enabled = false; } else { detalhesempresaButton.Enabled = true; } }
public ActionResult GetResourceTypeList(FormCollection form) { string bookID = form["BookID"]; string parentID = form["ParentID"]; List <ResourceType> list = new List <ResourceType>(); List <ResourceType> type_list = DataBaseBLL.GetResourceTypeList(); ResourceBLL resourceBLL = new ResourceBLL(); string cataIDs = DataBaseBLL.GetChildCataByCataID(Int32.Parse(bookID), Int32.Parse(parentID)); List <Resource> resource_list = resourceBLL.GetResourceList(cataIDs, 0, 0); foreach (var type in type_list) { var result = false; foreach (var resource in resource_list) { if (type.ID == resource.ResourceType && resource.ResourceStyle == 0) { list.Add(type); result = true; break; } } if (!result) { foreach (var child in type.Child) { foreach (var resource in resource_list) { if (child.ID == resource.ResourceStyle && child.ParentID == resource.ResourceType) { list.Add(child); result = true; break; } } } } } ResourceAndType modellist = new ResourceAndType(); modellist.ResourceList = resource_list; modellist.TypeList = list; return(Json(modellist)); }
private void IncluirfuncionarioButton_Click(object sender, EventArgs e) { try { statusfuncionarioLabel.Text = "Processando..."; statusfuncionarioLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(funcionarioGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(funcionarioGroupBox, ErrosTela); statusfuncionarioLabel.Text = "Não foi possível incluir..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DataBaseBLL.GravarFuncionario( new Funcionario() { IdEmpresa = codigoempresaMaskedTextBox.Text, NomeEmpresa = nomeempresaTextBox.Text, Externo = funcionarioexternoTextBox.Text, Interno = funcionariointernoTextBox.Text } ); statusfuncionarioLabel.Text = "Funcionário incluído com sucesso."; Utilities.ResetarControles(funcionarioGroupBox); funcionarioexternoTextBox.Focus(); } } catch (Exception ex) { if (ex.Message == "23505") { MessageBox.Show("Funcionário já cadastrado.", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statusfuncionarioLabel.Text = "Não foi possível incluir..."; } else { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); statusfuncionarioLabel.Text = "Não foi possível incluir..."; } } }
private void ExcluirlayoutButton_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Deseja excluir o layout?", ParametroInfo.SistemaVersao, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DataBaseBLL.ExcluirLayout(new Layout() { Nome = nomelayoutTextBox.Text }); statuslayoutLabel.Text = "Processando..."; statuslayoutLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(conteudoGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(conteudoGroupBox, ErrosTela); statuslayoutLabel.Text = "Não foi possível alterar..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { statuslayoutLabel.Text = "Layout excluído com sucesso."; MessageBox.Show("Layout excluído com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Utilities.ResetarControles(conteudoGroupBox); if (consultaLayoutGridView != null) { consultaLayoutGridView.DataSource = DataBaseBLL.CarregarLayoutGrid(nomelayoutTextBox.Text); } if (nomelayoutComboBox != null) { nomelayoutComboBox.DataSource = DataBaseBLL.CarregarLayoutComboBox(); } nomelayoutTextBox.Focus(); Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public ActionResult GetResource(FormCollection form) { ResourceBLL resourceBLL = new ResourceBLL(); string bookID = form["BookID"]; string cataID = form["CataID"]; int resourceType = Int32.Parse(form["ResourceType"]); int resourceStyle = Int32.Parse(form["ResourceStyle"]); string cataIDs = DataBaseBLL.GetChildCataByCataID(Int32.Parse(bookID), Int32.Parse(cataID)); List <Resource> list = new List <Resource>(); if (resourceStyle == 0) { list = resourceBLL.GetResourceList(cataIDs, resourceType, resourceStyle); } else { list = resourceBLL.GetResourceList(cataIDs, resourceStyle, resourceType); } return(Json(list)); }
private void ExcluirempresaButton_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Deseja excluir a empresa?", ParametroInfo.SistemaVersao, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DataBaseBLL.ExcluirEmpresa(new Empresa() { Id = codigoempresaComboBox.Text }); statusempresaLabel.Text = "Processando..."; statusempresaLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(layoutempresaGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(layoutempresaGroupBox, ErrosTela); statusempresaLabel.Text = "Não foi possível excluir..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { statusempresaLabel.Text = "Empresa excluída com sucesso."; MessageBox.Show("Empresa excluída com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Utilities.ResetarControles(layoutempresaGroupBox); empresaComboBox.DataSource = DataBaseBLL.CarregarEmpresasComboBox(); inicioeventoTextBox.Focus(); Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void ExcluirfuncionarioButton_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Deseja excluir esse funcionário?", ParametroInfo.SistemaVersao, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DataBaseBLL.ExcluirFuncionario(new Funcionario() { IdEmpresa = codigoempresaComboBox.Text, Externo = funcionarioexternoTextBox.Text }); statusfuncionarioLabel.Text = "Processando..."; statusfuncionarioLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(funcionarioGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(funcionarioGroupBox, ErrosTela); statusfuncionarioLabel.Text = "Não foi possível excluir..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { statusfuncionarioLabel.Text = "Funcionário excluído com sucesso."; MessageBox.Show("Funcionário excluído com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Utilities.ResetarControles(funcionarioGroupBox); funcionarioexternoTextBox.Focus(); Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void conversorForm_Load(object sender, EventArgs e) { codigoempresaComboBox.DataSource = DataBaseBLL.CarregarEmpresasComboBox(); nomeempresaTextBox.Text = codigoempresaComboBox.SelectedValue.ToString(); nomelayoutComboBox.DataSource = DataBaseBLL.CarregarLayoutComboBox(); }
private void CadastrareventoForm_FormClosing(object sender, FormClosingEventArgs e) { consultaeventoGridView.DataSource = DataBaseBLL.CarregarEventoGrid(codigoempresaComboBox.Text); }
private void AlterarlayoutButton_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Deseja alterar o layout? ", ParametroInfo.SistemaVersao, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { statuslayoutLabel.Text = "Processando..."; statuslayoutLabel.Visible = true; List <ErrosTela> ErrosTela = new List <ErrosTela>(); Utilities.ValidarTextBoxes(conteudoGroupBox, ref ErrosTela); if (ErrosTela.Count() > 0) { string strCamposInvalidos = Utilities.CriarMensagemErro(conteudoGroupBox, ErrosTela); statuslayoutLabel.Text = "Não foi possível alterar..."; MessageBox.Show("Preencher Campo(s):" + Environment.NewLine + strCamposInvalidos, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (string.IsNullOrEmpty(nomelayoutTextBox.Text)) { throw new Exception("Favor preencher o nome do layout."); } Layout ObjLayout = new Layout() { Nome = nomelayoutTextBox.Text }; for (int i = 0; i < ConteudoComboBoxes.Count(); i++) { switch (ConteudoComboBoxes.ElementAt(i).SelectedIndex) { case 1: //Código Empresa if (!string.IsNullOrEmpty(InicioComboBoxes.ElementAt(i).Text)) { ObjLayout.InicioEmpresa = int.Parse(InicioComboBoxes.ElementAt(i).Text); } if (!string.IsNullOrEmpty(TamanhoComboBoxes.ElementAt(i).Text)) { ObjLayout.TamanhoEmpresa = int.Parse(TamanhoComboBoxes.ElementAt(i).Text); } break; case 2: //Código Funcionário if (!string.IsNullOrEmpty(InicioComboBoxes.ElementAt(i).Text)) { ObjLayout.InicioFuncionario = int.Parse(InicioComboBoxes.ElementAt(i).Text); } if (!string.IsNullOrEmpty(TamanhoComboBoxes.ElementAt(i).Text)) { ObjLayout.TamanhoFuncionario = int.Parse(TamanhoComboBoxes.ElementAt(i).Text); } break; case 3: //Código Evento if (!string.IsNullOrEmpty(InicioComboBoxes.ElementAt(i).Text)) { ObjLayout.InicioEvento = int.Parse(InicioComboBoxes.ElementAt(i).Text); } if (!string.IsNullOrEmpty(TamanhoComboBoxes.ElementAt(i).Text)) { ObjLayout.TamanhoEvento = int.Parse(TamanhoComboBoxes.ElementAt(i).Text); } break; case 4: //Horas if (!string.IsNullOrEmpty(InicioComboBoxes.ElementAt(i).Text)) { ObjLayout.InicioHoras = int.Parse(InicioComboBoxes.ElementAt(i).Text); } if (!string.IsNullOrEmpty(TamanhoComboBoxes.ElementAt(i).Text)) { ObjLayout.TamanhoHoras = int.Parse(TamanhoComboBoxes.ElementAt(i).Text); } break; } } statuslayoutLabel.Text = "Layout alterado com sucesso."; DataBaseBLL.AlterarLayout(ObjLayout, linhaSelecionada["nomeDataGridViewTextBoxColumn"].Value.ToString()); MessageBox.Show("Layout alterado com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); VerificarLayoutVazio(ObjLayout); if (consultaLayoutGridView != null) { consultaLayoutGridView.DataSource = DataBaseBLL.CarregarLayoutGrid(nomelayoutTextBox.Text); } if (nomelayoutComboBox != null) { nomelayoutComboBox.DataSource = DataBaseBLL.CarregarLayoutComboBox(); } Close(); } } } catch (Exception ex) { if (ex.Message == "23505") { MessageBox.Show("Layout já cadastrado.", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void IncluirlayoutButton_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(nomelayoutTextBox.Text)) { throw new Exception("Favor preencher o nome do layout."); } Layout ObjLayout = new Layout() { Nome = nomelayoutTextBox.Text }; for (int i = 0; i < ConteudoComboBoxes.Count(); i++) { switch (ConteudoComboBoxes.ElementAt(i).SelectedIndex) { case 1: //Código Empresa if (!string.IsNullOrEmpty(InicioComboBoxes.ElementAt(i).Text)) { ObjLayout.InicioEmpresa = int.Parse(InicioComboBoxes.ElementAt(i).Text); } if (!string.IsNullOrEmpty(TamanhoComboBoxes.ElementAt(i).Text)) { ObjLayout.TamanhoEmpresa = int.Parse(TamanhoComboBoxes.ElementAt(i).Text); } break; case 2: //Código Funcionário if (!string.IsNullOrEmpty(InicioComboBoxes.ElementAt(i).Text)) { ObjLayout.InicioFuncionario = int.Parse(InicioComboBoxes.ElementAt(i).Text); } if (!string.IsNullOrEmpty(TamanhoComboBoxes.ElementAt(i).Text)) { ObjLayout.TamanhoFuncionario = int.Parse(TamanhoComboBoxes.ElementAt(i).Text); } break; case 3: //Código Evento if (!string.IsNullOrEmpty(InicioComboBoxes.ElementAt(i).Text)) { ObjLayout.InicioEvento = int.Parse(InicioComboBoxes.ElementAt(i).Text); } if (!string.IsNullOrEmpty(TamanhoComboBoxes.ElementAt(i).Text)) { ObjLayout.TamanhoEvento = int.Parse(TamanhoComboBoxes.ElementAt(i).Text); } break; case 4: //Horas if (!string.IsNullOrEmpty(InicioComboBoxes.ElementAt(i).Text)) { ObjLayout.InicioHoras = int.Parse(InicioComboBoxes.ElementAt(i).Text); } if (!string.IsNullOrEmpty(TamanhoComboBoxes.ElementAt(i).Text)) { ObjLayout.TamanhoHoras = int.Parse(TamanhoComboBoxes.ElementAt(i).Text); } break; } } VerificarLayoutVazio(ObjLayout); DataBaseBLL.GravarLayout(ObjLayout); MessageBox.Show("Layout cadastrado com sucesso!", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Utilities.ResetarControles(cadastrolayoutGroupBox); nomelayoutTextBox.Focus(); } catch (Exception ex) { if (ex.Message == "23505") { MessageBox.Show("Layout já cadastrado.", ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show(ex.Message, ParametroInfo.SistemaVersao, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void FuncionariomanutencaoForm_Load(object sender, EventArgs e) { codigoempresaComboBox.DataSource = DataBaseBLL.CarregarEmpresasComboBox(); nomeempresaTextBox.Text = codigoempresaComboBox.SelectedValue.ToString(); //consultafuncionarioGridView.DataSource = DataBaseBLL.CarregarFuncionarioGrid(codigoempresaComboBox.SelectedText); }
private void DefaultForm_FormClosing(object sender, FormClosingEventArgs e) { //备份数据库 DataBaseBLL bll = new DataBaseBLL(); bool resu = bll.saveData(); }
private void LayoutmanutencaoForm_Load(object sender, EventArgs e) { nomelayoutComboBox.DataSource = DataBaseBLL.CarregarLayoutComboBox(); }