public static UtilityValidation.ValidationState ValidateCommittente(CommittenteDto committente, AnagraficaCommittenteDto anagraficaCommittente, CommessaDto commessa) { try { var validation = new UtilityValidation.ValidationState(); if (committente != null && commessa != null && anagraficaCommittente != null) { var committenti = commessa.Committentes; if (committenti != null) { var exist = ((from q in committenti where q.Id != committente.Id && q.AnagraficaCommittenteId == anagraficaCommittente.Id select q).Count() >= 1); validation.State = !exist; if (exist) validation.Message = "Il committente selezionato " + BusinessLogic.Committente.GetCodifica(anagraficaCommittente) + " è già presente nella commessa " + BusinessLogic.Commessa.GetCodifica(commessa); } } return validation; } catch (Exception ex) { UtilityError.Write(ex); } return null; }
public static UtilityValidation.ValidationState ValidateAnagraficaCommittente(AnagraficaCommittenteDto anagraficaCommittente, IEnumerable<AnagraficaCommittenteDto> anagraficheCommittenti) { try { if (anagraficaCommittente != null && anagraficheCommittenti != null) { var validated = new UtilityValidation.ValidationState(); var exist = ((from q in anagraficheCommittenti where q.Id != anagraficaCommittente.Id && q.Codice == anagraficaCommittente.Codice select q).Count() >= 1); validated.State = !exist; if (exist) validated.Message = "Il committente con ragione sociale " + anagraficaCommittente.RagioneSociale + " è già presente in archivio con il codice "+anagraficaCommittente.Codice; return validated; } } catch (Exception ex) { UtilityError.Write(ex); } return null; }
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); } }
private void BindViewAnagraficaCommittente(AnagraficaCommittenteDto anagraficaCommittente) { try { editCodice.Model = anagraficaCommittente; if (anagraficaCommittente != null) { editCodice.Value = anagraficaCommittente.Codice; editCAP.Value = anagraficaCommittente.CAP; editComune.Value = new Library.Controls.Countries.City(anagraficaCommittente.Comune, anagraficaCommittente.CodiceCatastale, anagraficaCommittente.Provincia); editEmail.Value = anagraficaCommittente.Email; editFAX.Value = anagraficaCommittente.Fax; editIndirizzo.Value = anagraficaCommittente.Indirizzo; editMobile.Value = anagraficaCommittente.Mobile; editPartitaIVA.Value = anagraficaCommittente.PartitaIva; editRagioneSociale.Value = anagraficaCommittente.RagioneSociale; editTelefono.Value = anagraficaCommittente.Telefono; editLocalita.Value = anagraficaCommittente.Localita; } } catch (Exception ex) { UtilityError.Write(ex); } }
/// <summary> /// Adds a new anagraficacommittente from the given dto object into the database. /// </summary> /// <param name="anagraficacommittente">The dto object.</param> /// <returns>The dto key of the newly created anagraficacommittente.</returns> public string CreateAnagraficaCommittente(AnagraficaCommittenteDto anagraficacommittente) { string key = this.AnagraficaCommittenteService.Add(anagraficacommittente); this.UnitOfWork.SaveChanges(); return key; }
/// <summary> /// Deletes anagraficacommittente from the database by the given dto object. /// </summary> /// <param name="anagraficacommittente">The dto object.</param> public void DeleteAnagraficaCommittente(AnagraficaCommittenteDto anagraficacommittente) { this.AnagraficaCommittenteService.Delete(anagraficacommittente); this.UnitOfWork.SaveChanges(); }
private static void AddReportProspettoCommittente(AnagraficaCommittenteDto anagraficaCommittente, UtilityReport.Report report) { try { if (anagraficaCommittente != null) { report.AddData("RagioneSociale", anagraficaCommittente.RagioneSociale); report.AddData("PartitaIva", anagraficaCommittente.PartitaIva); report.AddData("Indirizzo", anagraficaCommittente.Indirizzo); report.AddData("CAP", anagraficaCommittente.CAP); report.AddData("Localita", anagraficaCommittente.Localita); report.AddData("Comune", anagraficaCommittente.Comune); report.AddData("Provincia", anagraficaCommittente.Provincia); } } catch (Exception ex) { UtilityError.Write(ex); } }
private static void AddReportCommittente(UtilityReport.Table tableCommittenti, AnagraficaCommittenteDto anagraficaCommittente, IList<CommittenteDto> committentiAnagrafica, DateTime data) { try { if (anagraficaCommittente != null && committentiAnagrafica != null) { var _totaleFatture = BusinessLogic.Commessa.GetTotaleFattureVendita(committentiAnagrafica, data); var _totaleIncassiAvuto = BusinessLogic.Commessa.GetTotaleIncassi(committentiAnagrafica, data); var _totaleIncassiAvere = BusinessLogic.Commessa.GetTotaleIncassiAvere(committentiAnagrafica, data); var totaleFatture = UtilityValidation.GetEuro(_totaleFatture); var totaleIncassiAvuto = UtilityValidation.GetEuro(_totaleIncassiAvuto); var totaleIncassiAvere = UtilityValidation.GetEuro(_totaleIncassiAvere); var codificaCommittente = BusinessLogic.Committente.GetCodifica(anagraficaCommittente); tableCommittenti.AddRow(codificaCommittente, totaleFatture, totaleIncassiAvuto, totaleIncassiAvere); } } catch (Exception ex) { UtilityError.Write(ex); } }
public static UtilityReport.Report GetReportCommittente(AziendaDto azienda, AnagraficaCommittenteDto anagraficaCommittente, List<CommittenteDto> committenti, DateTime data) { try { if (azienda != null && anagraficaCommittente != null && committenti != null) { var report = new UtilityReport.Report(); AddReportAzienda(azienda, report, data); AddReportProspettoCommittente(anagraficaCommittente, report); AddReportTotaliCommittente(committenti, report, data); var tableCommesse = new UtilityReport.Table("Commessa", "TotaleImponibile", "TotaleIVA", "TotaleFatture", "TotaleIncassiAvuto", "TotaleIncassiAvere"); var tableFatture = new UtilityReport.Table("Numero", "Data", "Scadenza", "Descrizione", "Imponibile", "IVA", "Totale", "TotaleIncassiAvuto", "TotaleIncassiAvere"); var tableIncassi = new UtilityReport.Table("Numero", "Data", "TipoPagamento", "Descrizione", "Note", "TransazionePagamento", "Importo"); foreach (var committente in committenti) { //totali per commessa var commessa = committente.Commessa; AddReportCommessaCommittente(tableCommesse, committente, commessa, data); //fatture per commessa var codificaCommessa = "COMMESSA " + BusinessLogic.Commessa.GetCodifica(commessa); tableFatture.AddRowMerge(Color.LightGray, codificaCommessa, "", "", "", "", "", "", "", ""); var fattureVendita = committente.FatturaVenditas; if (fattureVendita != null) { foreach (var fatturaVendita in fattureVendita) { AddReportFatturaVenditaCommittente(tableFatture, fatturaVendita, data); //pagamenti per fattura var totaleFattura = UtilityValidation.GetEuro(fatturaVendita.Totale); var _statoFattura = BusinessLogic.Fattura.GetStato(fatturaVendita); var statoFattura = UtilityEnum.GetDescription<Tipi.StatoFattura>(_statoFattura); var codificaFattura = "FATTURA " + BusinessLogic.Fattura.GetCodifica(fatturaVendita) + " - TOTALE IVATO " + totaleFattura + " - " + statoFattura.ToUpper(); tableIncassi.AddRowMerge(Color.LightGray, codificaFattura, "", "", "", "", "", ""); var incassi = (from q in fatturaVendita.Incassos orderby q.Data ascending select q).ToList(); if (incassi != null) { foreach (var incasso in incassi) AddReportIncassoCommittente(tableIncassi, incasso); } } } } report.Tables.Add(tableCommesse); report.Tables.Add(tableFatture); report.Tables.Add(tableIncassi); return report; } } catch (Exception ex) { UtilityError.Write(ex); } return null; }
public static string GetCodifica(AnagraficaCommittenteDto anagraficaCommittente) { try { if (anagraficaCommittente != null) { var codifica = anagraficaCommittente.Codice + " - " + anagraficaCommittente.RagioneSociale; return codifica; } } catch (Exception ex) { UtilityError.Write(ex); } return null; }
private void BindViewAnagraficaCommittente(AnagraficaCommittenteDto anagraficaCommittente) { try { editCommittente.Model = anagraficaCommittente; editCommittente.Value = BusinessLogic.Committente.GetCodifica(anagraficaCommittente); } catch (Exception ex) { UtilityError.Write(ex); } }
public CommittenteDto(int _id, decimal? _totaleFattureVendita, string _stato, decimal? _totaleIncassi, string _note, int _commessaId, int _anagraficaCommittenteId, CommessaDto _commessa, AnagraficaCommittenteDto _anagraficaCommittente, IList<FatturaVenditaDto> _fatturaVenditas) { this.Id = _id; this.TotaleFattureVendita = _totaleFattureVendita; this.Stato = _stato; this.TotaleIncassi = _totaleIncassi; this.Note = _note; this.CommessaId = _commessaId; this.AnagraficaCommittenteId = _anagraficaCommittenteId; this.Commessa = _commessa; this.AnagraficaCommittente = _anagraficaCommittente; this.FatturaVenditas = _fatturaVenditas; }
public ReportJobDto(int _id, DateTime? _creazione, string _codice, string _denominazione, string _tipo, DateTime? _elaborazione, string _note, string _nomeFile, int _aziendaId, int? _anagraficaCommittenteId, int? _anagraficaFornitoreId, AziendaDto _azienda, AnagraficaCommittenteDto _anagraficaCommittente, AnagraficaFornitoreDto _anagraficaFornitore) { this.Id = _id; this.Creazione = _creazione; this.Codice = _codice; this.Denominazione = _denominazione; this.Tipo = _tipo; this.Elaborazione = _elaborazione; this.Note = _note; this.NomeFile = _nomeFile; this.AziendaId = _aziendaId; this.AnagraficaCommittenteId = _anagraficaCommittenteId; this.AnagraficaFornitoreId = _anagraficaFornitoreId; this.Azienda = _azienda; this.AnagraficaCommittente = _anagraficaCommittente; this.AnagraficaFornitore = _anagraficaFornitore; }