private void CheckStatiCommittenti() { try { AddLog("Avvio controllo stati committenti"); var viewModel = new Committente.CommittenteViewModel(); var committenti = viewModel.ReadCommittenti(); foreach (var committente in committenti) { committente.Stato = BusinessLogic.Committente.GetStatoDescrizione(committente); bool saved = viewModel.Save(committente, false); var codifica = BusinessLogic.Committente.GetCodifica(committente); if (saved) { AddLog("Committente " + codifica + " aggiornato con successo ... OK"); } else { AddLog("Committente " + codifica + " non aggiornato ... ERROR"); } } AddLog("Fine controllo stati committenti"); } catch (Exception ex) { UtilityError.Write(ex); } }
private void btnStampaReport_Click(object sender, EventArgs e) { try { var anagraficaCommittente = (AnagraficaCommittenteDto)editCommittente.Model; if (anagraficaCommittente != null) { var ragioneSociale = (anagraficaCommittente.RagioneSociale != null ? anagraficaCommittente.RagioneSociale.Replace(" ", "") : null); var data = DateTime.Today.ToString("ddMMyyyy"); var elaborazione = UtilityValidation.GetData(editElaborazione.Value); string pathTemplate = UtilityWeb.GetRootPath(Context) + @"Resources\Templates\TemplateSituazioneCommittente.doc"; var fileName = "SituazioneCommittente_" + ragioneSociale + "_" + data + ".PDF"; var pathReport = UtilityWeb.GetRootPath(Context) + @"Resources\Reports\" + fileName; var azienda = (AziendaDto)editAzienda.Model; var viewModel = new Committente.CommittenteViewModel(); var committenti = viewModel.ReadCommittenti(anagraficaCommittente).ToList(); var report = BusinessLogic.ReportJob.GetReportCommittente(azienda, anagraficaCommittente, committenti, elaborazione); if (report != null) { bool performed = report.Create(pathTemplate, pathReport); if (performed) { string url = UtilityWeb.GetRootUrl(Context) + @"/Resources/Reports/" + fileName; editNomeFile.Url = url; editNomeFile.Value = fileName; } } } } catch (Exception ex) { UtilityError.Write(ex); } }
private void BindViewCommittenti(CommessaDto commessa) { try { if (commessa != null) { editCommessa.Value = BusinessLogic.Commessa.GetCodifica(commessa); var viewModel = new Committente.CommittenteViewModel(); var committenti = viewModel.ReadCommittenti(commessa); committentiCommessaId = (from q in committenti select q.Id).ToList(); } } catch (Exception ex) { UtilityError.Write(ex); } }
private void BindViewAnagraficaCommittente(AnagraficaCommittenteDto anagraficaCommittente) { try { editCommittente.Model = anagraficaCommittente; if (anagraficaCommittente != null) { editCommittente.Value = BusinessLogic.Committente.GetCodifica(anagraficaCommittente); var viewModel = new Committente.CommittenteViewModel(); var committenti = viewModel.ReadCommittenti(anagraficaCommittente); committentiAnagraficaId = (from q in committenti select q.Id).ToList(); } } catch (Exception ex) { UtilityError.Write(ex); } }
public CommessaDto ReadCommessa(FatturaVenditaDto fatturaVendita) { try { if (fatturaVendita != null) { var committenteId = fatturaVendita.CommittenteId; var viewModel = new Committente.CommittenteViewModel(); var committente = (CommittenteDto)viewModel.Read(committenteId); if (committente != null) { var commessa = committente.Commessa; return(commessa); } } } catch (Exception ex) { UtilityError.Write(ex); } return(null); }
private void btnStampaReport_Click(object sender, EventArgs e) { try { bool saved = Save(); if (saved) { var azienda = (AziendaDto)editAzienda.Model; if (azienda != null) { var viewModelAnagraficaCommittente = new AnagraficaCommittente.AnagraficaCommittenteViewModel(); var anagraficheCommittenti = viewModelAnagraficaCommittente.ReadAnagraficheCommittenti(azienda).ToList(); if (anagraficheCommittenti != null) { var data = DateTime.Today.ToString("ddMMyyyy"); var elaborazione = UtilityValidation.GetData(editElaborazione.Value); string pathTemplate = UtilityWeb.GetRootPath(Context) + @"Resources\Templates\TemplateResocontoCommittenti.doc"; var fileName = "ResocontoCommittenti_" + data + ".PDF"; var pathReport = UtilityWeb.GetRootPath(Context) + @"Resources\Reports\" + fileName; var viewModel = new Committente.CommittenteViewModel(); var committenti = viewModel.ReadCommittenti(anagraficheCommittenti).ToList(); var report = BusinessLogic.ReportJob.GetReportCommittenti(azienda, anagraficheCommittenti, committenti, elaborazione); if (report != null) { bool performed = report.Create(pathTemplate, pathReport); if (performed) { string url = UtilityWeb.GetRootUrl(Context) + @"/Resources/Reports/" + fileName; editNomeFile.Url = url; editNomeFile.Value = fileName; } } } } } } catch (Exception ex) { UtilityError.Write(ex); } }
private void CheckStatiCommittenti() { try { AddLog("Avvio controllo stati committenti"); var viewModel = new Committente.CommittenteViewModel(); var committenti = viewModel.ReadCommittenti(); foreach (var committente in committenti) { committente.Stato = BusinessLogic.Committente.GetStatoDescrizione(committente); bool saved = viewModel.Save(committente, false); var codifica = BusinessLogic.Committente.GetCodifica(committente); if (saved) AddLog("Committente " + codifica + " aggiornato con successo ... OK"); else AddLog("Committente " + codifica + " non aggiornato ... ERROR"); } AddLog("Fine controllo stati committenti"); } catch (Exception ex) { UtilityError.Write(ex); } }