public override void LoadDati(object exampleInstance) { CabDTO cabDto; if (exampleInstance == null) { cabDto = new CabDTO {Abi = (string) abi.Value, Cab = (string) cab.Value}; cabDto.ID = cabDto.Cab; cabDto.DescrizioneAbi = (string)descrizioneAbi.Value; cabDto.DescrizioneCab = (string)descrizioneCab.Value; cabDto.Localita = (string)localita.Value; cabDto.Indirizzo = (string)indirizzo.Value; } else cabDto = (CabDTO)exampleInstance; listaElementi.DataSource = cabBindingSource; cabBindingSource.DataSource = _abiCabService.GetCabByExample(cabDto); }
public List<CabDTO> GetAllCab() { string abiCabPath; if (ApplicationDeployment.IsNetworkDeployed) abiCabPath = ApplicationDeployment.CurrentDeployment.DataDirectory + @"\" + "TabAbiCab.txt"; else if (!ConfigurationManager.AppSettings["AbiCabPath"].Contains(":")) abiCabPath = Application.StartupPath + @"\" + ConfigurationManager.AppSettings["AbiCabPath"]; else abiCabPath = ConfigurationManager.AppSettings["AbiCabPath"]; if (abiCabPath != string.Empty) { var abiCabPreferiti = GetServiceClient().GetAbiCabPreferiti(GetUserInfo()); _listaCab.Clear(); using (var csv = new CsvReader(new StreamReader(abiCabPath), true, '\t')) { while (csv.ReadNextRecord()) { try { var cab = new CabDTO { Abi = csv["AbiCode"], Cab = csv["CabCode"], DescrizioneAbi = csv["Descrizione"], DescrizioneCab = csv["Filiale"], DescrizioneAbiCompleta = csv["AbiCode"] + " - " + csv["Descrizione"], DescrizioneCabCompleta = csv["CabCode"] + " - " + csv["Filiale"], Indirizzo = csv["Indirizzo"], Localita = csv["Localita"] }; cab.FrequentlyAccessed = abiCabPreferiti.Any(item => item.Cab == cab.Cab && item.Abi == cab.Abi); _listaCab.Add(cab); } catch (Exception ex) { _log.Error("Errore nel caricamento di una riga AbiCab - " + Utility.GetMethodDescription() + " - csv index:" + csv.CurrentRecordIndex, ex); throw; } } } return _listaCab; } return null; }
public List<CabDTO> GetCabByExample(CabDTO item) { var banche = from cab in GetAllCab() where (item.Abi == null || cab.Abi == item.Abi) && (item.Cab == null || cab.Cab == item.Cab) && (item.DescrizioneAbi == null || (cab.DescrizioneAbi != null && cab.DescrizioneAbi.ToLower().Contains(item.DescrizioneAbi.ToLower()))) && (item.DescrizioneCab == null || (cab.DescrizioneCab != null && cab.DescrizioneCab.ToLower().Contains(item.DescrizioneCab.ToLower()))) && (item.Indirizzo == null || (cab.Indirizzo != null && cab.Indirizzo.ToLower().Contains(item.Indirizzo.ToLower()))) && (item.Localita == null || (cab.Localita != null && cab.Localita.ToLower().Contains(item.Localita.ToLower()))) && (item.FrequentlyAccessed == null || (cab.FrequentlyAccessed != null && cab.FrequentlyAccessed == item.FrequentlyAccessed)) select cab; return new List<CabDTO>(banche.ToList()); }
private void setDatiBancari(CabDTO cabDto) { abi.Value = cabDto.Abi; cab.Value = cabDto.Cab; descrizioneAbi.Text = cabDto.DescrizioneAbi; descrizioneCab.Text = cabDto.DescrizioneCab; Fornitore.PersonaRiferimento.Abi = cabDto.Abi; Fornitore.PersonaRiferimento.Cab = cabDto.Cab; var coord = new CoordinateBancarie {Abi = cabDto.Abi, Cab = cabDto.Cab, ContoCorrente = contoCorrente.Text}; iban.Text = coord.CalcolaIBAN(); Fornitore.PersonaRiferimento.Iban = iban.Text; cin.Text = coord.CalcolaCin(); Fornitore.PersonaRiferimento.Cin = cin.Text; }
private void btnCercaAbiCabClick(object sender, EventArgs e) { var cabExample = new CabDTO(); if (abi.Value != null) cabExample.Abi = abi.Value.ToString(); if (cab.Value != null) cabExample.Cab = cab.Value.ToString(); var form = new SceltaAbiCab(); form.LoadDati(cabExample); form.SelectItem += formSelectItem; form.ShowDialog(); form.Dispose(); }
private void listaBancheClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (getAbiCabService().IsValidableIBAN()) { //this.ValidateDataRowCell(e.Cell.Row, e.Cell.Column, e.Cell.Value); // Scelta ABI - CAB if (e.Cell.Column.Key == "Abi") { var form = new SceltaAbiCab(); var cabExample = new CabDTO { Abi = e.Cell.Row.Cells["Abi"].Value.ToString(), Cab = e.Cell.Row.Cells["Cab"].Value.ToString() }; form.LoadDati(cabExample); form.SelectItem += formAbiCabSelectItem; form.ShowDialog(); form.Dispose(); } } if (e.Cell.Column.Key == "DeleteColumn") { // Le righe nuove sono sempre eliminabili var dto = e.Cell.Row.ListObject as DatiBancariDTO; if (dto != null) { var datiBancari = dto; if (datiBancari.Stato != "D") { if (datiBancari.ID == 0) { datiBancari.IsDeleteAllow = true; e.Cell.Row.Delete(); } else { string message = getCondominioService().IsAllowDeleteBanca(datiBancari); if (!string.IsNullOrEmpty(message)) { CommonMessages.DisplayWarning("Non è ammessa la cancellazione del conto bancario:" + Environment.NewLine + message); datiBancari.IsDeleteAllow = false; } else { base.SetDirty(true); datiBancari.Stato = "D"; e.Cell.Row.Appearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.True; } } } else { datiBancari.Stato = string.Empty; e.Cell.Row.Appearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.False; } } } }
private void listaBancheAfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e) { if (getAbiCabService().IsValidableIBAN()) { var cabExample = new CabDTO { Abi = (string) e.Row.Cells["Abi"].Value, Cab = (string) e.Row.Cells["Cab"].Value, FrequentlyAccessed = true }; var formAbiCab = new SceltaAbiCab(); formAbiCab.LoadDati(cabExample); formAbiCab.SelectItem += formAbiCabSelectItem; if (formAbiCab.ShowDialog() == DialogResult.Cancel) e.Row.Delete(false); formAbiCab.Dispose(); } if (_condominio.DatiBancari.Count == 1) e.Row.Cells["Principale"].Value = true; }
private void setDatiBancari(CabDTO abiCab) { listaBanche.ActiveRow.Cells["DescrizioneAbi"].Value = abiCab.DescrizioneAbiCompleta; listaBanche.ActiveRow.Cells["DescrizioneCab"].Value = abiCab.DescrizioneCabCompleta; listaBanche.ActiveRow.Cells["Abi"].Value = abiCab.Abi; listaBanche.ActiveRow.Cells["Cab"].Value = abiCab.Cab; }
void workerDoWork(object sender, DoWorkEventArgs e) { var cache = CacheFactory.GetCacheManager(); switch (e.Argument.ToString()) { case "AllCondomini": cache.Add("AllCondomini", GetServiceClient().GetCondominiByAzienda(GetUserInfo()).ToArray(), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(300))); break; case "AllFornitori": cache.Add("AllFornitori", GetServiceClient().GetFornitoriByAzienda(GetUserInfo()).ToArray(), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(300))); break; case "AllPersone": cache.Add("AllPersone", GetServiceClient().GetPersoneByAzienda(GetUserInfo()).ToArray(), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(300))); break; case "AllUnitaImmobiliari": cache.Add("AllUnitaImmobiliari", GetServiceClient().GetUnitaImmobiliariByAzienda(GetUserInfo()).ToArray(), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(300))); break; case "AllReferenti": cache.Add("AllReferenti", GetServiceClient().GetReferentiByAzienda(GetUserInfo()), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(900))); break; case "AllComuni": cache.Add("AllComuni", GetServiceClient().GetComuni(GetUserInfo()), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllProvince": cache.Add("AllProvince", GetServiceClient().GetProvincie(GetUserInfo()), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllRegioni": cache.Add("AllRegioni", GetServiceClient().GetRegioni(GetUserInfo()), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllTipoFornitori": cache.Add("AllTipoFornitori", GetServiceClient().GetTipoFornitori(GetUserInfo()), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllGruppi": cache.Add("AllGruppi", GetServiceClient().GetGruppi(GetUserInfo()), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllTipoUnitaImmobiliari": cache.Add("AllTipoUnitaImmobiliari", GetServiceClient().GetTipoUnitaImmobiliariByAzienda(GetUserInfo()).ToArray(), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllCompagnieAssicurative": cache.Add("AllCompagnieAssicurative", GetServiceClient().GetCompagnieAssicurativeByAzienda(GetUserInfo()).ToArray(), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllTipoContratti": cache.Add("AllTipoContratti", GetServiceClient().GetTipiContratti(GetUserInfo()), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllModalitaPagamento": cache.Add("AllModalitaPagamento", GetServiceClient().GetModalitaPagamento(GetUserInfo()).ToArray(), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "AllModuliSfera": cache.Add("AllModuliSfera", GetServiceClient().GetModuliSfera(GetUserInfo()), CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59))); break; case "formLayouts": var infragisticsLayout = new Dictionary<string, Stream>(); var layoutDirectory = Utility.GetLayoutFolder(); // Directory.GetFiles accetta un solo filtro per volta const string strFilter = "*layout.xml;*_gr.xml"; var mArExt = strFilter.Split(';'); foreach (var filter in mArExt) { if (layoutDirectory != null) { string[] layoutfiles = Directory.GetFiles(layoutDirectory, filter, SearchOption.TopDirectoryOnly); foreach (string t in layoutfiles) { try { var stream = new FileStream(t, FileMode.Open, FileAccess.Read, FileShare.Read); infragisticsLayout.Add(t, stream); } catch(Exception ex) { _log.Error("Errore nel caricamento del layout di un form - " + Utility.GetMethodDescription() + " - azienda:" + Login.Instance.CurrentLogin().Azienda, ex); } } } } cache.Add("formLayouts", infragisticsLayout, CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(3000))); break; case "AllCab": var ds = new DataSet(); ds.ReadXml(@"C:\Clienti\Sfera\Dati originali\AbiCab\AbiCab.xml"); var listaCab = new List<CabDTO>(); foreach (DataRow dr in ds.Tables[0].Rows) { var cab = new CabDTO { Abi = dr["AbiCode"].ToString(), Cab = dr["CabCode"].ToString(), DescrizioneAbi = dr["Descrizione"].ToString(), DescrizioneCab = dr["Filiale"].ToString(), DescrizioneAbiCompleta = dr["AbiCode"] + " - " + dr["Descrizione"], DescrizioneCabCompleta = dr["CabCode"] + " - " + dr["Filiale"], Indirizzo = dr["Indirizzo"].ToString(), Localita = dr["Localita"].ToString() }; switch (dr["FrequentlyAccessed"].ToString()) { case "0": cab.FrequentlyAccessed = false; break; case "1": cab.FrequentlyAccessed = true; break; } listaCab.Add(cab); } cache.Add("AllCab", listaCab, CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(300))); break; } CloseService(); }
public void LoadCab() { try { string abiCabPath; if (ApplicationDeployment.IsNetworkDeployed) abiCabPath = ApplicationDeployment.CurrentDeployment.DataDirectory + @"\" + "TabAbiCab.txt"; else if (!ConfigurationManager.AppSettings["AbiCabPath"].Contains(":")) abiCabPath = Application.StartupPath + @"\" + ConfigurationManager.AppSettings["AbiCabPath"]; else abiCabPath = ConfigurationManager.AppSettings["AbiCabPath"]; if (abiCabPath != string.Empty) { IList<CabDTO> abiCabPreferiti = GetServiceClient().GetAbiCabPreferiti(GetUserInfo()); var listaCab = new List<CabDTO>(); using (var csv = new CsvReader(new StreamReader(abiCabPath), true, '\t')) { while (csv.ReadNextRecord()) { try { var cab = new CabDTO { Abi = csv["AbiCode"], Cab = csv["CabCode"], DescrizioneAbi = csv["Descrizione"], DescrizioneCab = csv["Filiale"], DescrizioneAbiCompleta = csv["AbiCode"] + " - " + csv["Descrizione"], DescrizioneCabCompleta = csv["CabCode"] + " - " + csv["Filiale"], Indirizzo = csv["Indirizzo"], Localita = csv["Localita"] }; cab.FrequentlyAccessed = abiCabPreferiti.Any(item => item.Cab == cab.Cab && item.Abi == cab.Abi); listaCab.Add(cab); } catch (Exception ex) { _log.Error("Errore nel caricamento di una riga AbiCab - " + Utility.GetMethodDescription() + " - csv index:" + csv.CurrentRecordIndex, ex); throw; } } } _cache.Add("AllCab", listaCab, CacheItemPriority.Normal, new CollectionCacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(300))); } } catch (Exception ex) { _log.Error("Errore nel caricamento della tabella AbiCab - " + Utility.GetMethodDescription(), ex); throw; } }
private CabDTO setCabDto(AbiCab item) { var dto = new CabDTO { ID = item.ID.Cab, Cab = item.ID.Cab, Abi = item.ID.Abi, DescrizioneAbi = item.DescrizioneAbi, DescrizioneCab = item.DescrizioneCab, Indirizzo = item.Indirizzo, Localita = item.Localita, DisplayName = item.ID.Abi + " " + item.DescrizioneAbi + " - " + item.ID.Cab + " " + item.DescrizioneCab }; return dto; }