Exemple #1
0
        private void buttonSbloccaUtenti_Click(object sender, RoutedEventArgs e)
        {
            //richiesta conferma
            Utilities u = new Utilities();

            if (MessageBoxResult.Yes == u.ConfermaSbloccoUtenti())
            {
                MasterFile mf = MasterFile.Create();
                bool       esportatipresenti = false;

                foreach (Hashtable item in mf.GetAnagrafiche())
                {
                    if (mf.GetAnafraficaStato(Convert.ToInt32(item["ID"].ToString())) != App.TipoAnagraficaStato.Esportato)
                    {
                        mf.SetAnafraficaStato(Convert.ToInt32(item["ID"].ToString()), App.TipoAnagraficaStato.Disponibile);
                    }
                    else
                    {
                        esportatipresenti = true;
                    }
                }

                ((RevisoftApplication.MainWindow)(this.Owner)).CaricaClienti();

                if (esportatipresenti == true)
                {
                    MessageBox.Show("Sblocco Utenti Esportati disponibile solo da HelpDesk");
                }
                else
                {
                    MessageBox.Show("Sblocco Utenti Avvenuto con successo");
                }
            }
        }
Exemple #2
0
        private void bindAll()
        {
            masterFile     = new MasterFile();
            tslblFIle.Text = masterFile.FileName;

            head = ZipHelper.ZipDeCompressToDic(GGCRStaticConfig.PATH + "\\images\\schips.txd");

            cboGuYou1.DataSource    = GGCRUtil.ListPeopleSkill();
            cboGuYou1.ValueMember   = "Key";
            cboGuYou1.DisplayMember = "Value";

            cboGuYou2.DataSource    = GGCRUtil.ListPeopleSkill();
            cboGuYou2.ValueMember   = "Key";
            cboGuYou2.DisplayMember = "Value";

            cboGuYou3.DataSource    = GGCRUtil.ListPeopleSkill();
            cboGuYou3.ValueMember   = "Key";
            cboGuYou3.DisplayMember = "Value";

            cboGrown.DataSource    = GGCRUtil.ListMasterGrown();
            cboGrown.ValueMember   = "Key";
            cboGrown.DisplayMember = "Value";

            cboLast4.DataSource    = GGCRUtil.ListMasterZhaoPin();
            cboLast4.ValueMember   = "Key";
            cboLast4.DisplayMember = "Value";
        }
        public static (DnsServer, Socket) CreateDNSServer(
            MasterFile masterFile,
            IPAddress defaultDnsServer,
            IPEndPoint localDnsServerBind,
            IPEndPoint localUDPBind,
            Action <Task> action)
        {
            //为什么要包装一下MasterFile
            //主要是因为有的浏览器假如应答的域名是通配符,他会认为DNS无效
            //所以把通配符改为请求中的绝对域名
            //也就是说MasterFile会返回通配符

            DnsServer server = new DnsServer(new LocalRequestResolver(masterFile), defaultDnsServer);

            var task = server.Listen(localDnsServerBind);

            action(task);



            Socket socket = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, ProtocolType.Udp);

            socket.Bind(localUDPBind);

            socket.Connect(localDnsServerBind);

            return(server, socket);
        }
        private static UpdateHelper CreateUpdateHelper(MasterFile masterFile, GracenoteSong songFromAPI, IEnumerable <string> propertiesToVerify)
        {
            var oldProps = new List <string>();
            var newProps = new List <string>();

            foreach (var property in propertiesToVerify)
            {
                oldProps.Add(masterFile.TagLibProps[property].ToString());
                switch (property)
                {
                case "Artist":
                    newProps.Add(songFromAPI.Artist);
                    break;

                case "Album":
                    newProps.Add(songFromAPI.Album);
                    break;

                case "Title":
                    newProps.Add(songFromAPI.Title);
                    break;

                default:
                    break;
                }
            }
            return(new UpdateHelper(masterFile, propertiesToVerify.ToList(), oldProps, newProps));
        }
Exemple #5
0
        /// <summary>
        /// Move documents inside selected category
        /// </summary>
        /// <param name="Id">Category ID</param>
        /// <param name="files">List of document IDs to be moved</param>
        /// <returns><param name="StatusResult">Simple result struct</param></returns>
        public async Task <StatusResult> MoveFilesAsync(int Id, int[] files)
        {
            Folder item = _db.Folder.Find(Id);

            if (files == null)
            {
                return(new StatusResult(false, StatusCode.Error, "Empty list of document"));
            }

            try
            {
                foreach (int i in files)
                {
                    MasterFile file = _db.MasterFile.Find(i);
                    file.Changelog = file.Changelog + string.Format("{0} - Document category change \n", DateTime.Now);
                    item.Files.Add(file);
                }
                await _db.SaveChangesAsync();

                return(new StatusResult(true, StatusCode.Success, "Documents moved"));
            }
            catch (Exception e)
            {
                return(new StatusResult(false, StatusCode.ExceptionThrown, e.InnerException.Message));
            }
        }
Exemple #6
0
 public static void SetDnsRedirects(MasterFile mF)
 {
     mF.AddIPAddressResourceRecord("manuals.playstation.net", GetLocalIPAddress());
     mF.AddIPAddressResourceRecord("fjp01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("fus01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("fau01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("fuk01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("feu01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("fkr01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("fsa01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("ftw01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("fru01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("fmx01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("fcn01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("djp01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("dus01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("dau01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("duk01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("deu01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("dkr01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("dsa01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("dtw01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("dru01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("dmx01.ps5.update.playstation.net", "127.0.0.1");
     mF.AddIPAddressResourceRecord("dcn01.ps5.update.playstation.net", "127.0.0.1");
 }
        public void Mf_Equals_Test_DifferentMasterFiles()
        {
            var masterFile1 = MasterFile.GetMasterFileFromFilepath(validFilepath1);
            var masterFile2 = MasterFile.GetMasterFileFromFilepath(validFilepath2);

            Assert.AreNotEqual(masterFile1, masterFile2);
        }
Exemple #8
0
        /// <summary>
        /// Remove document from selected category
        /// </summary>
        /// <param name="id">Document ID</param>
        /// <param name="folderId">Parent category ID</param>
        /// <returns><param name="StatusResult">Simple result struct</param></returns>
        public async Task <StatusResult> DeleteAsync(int id, int folderId)
        {
            try
            {
                MasterFile item = await _db.MasterFile.FindAsync(id);

                if (folderId < 0)
                {
                    var fols = item.Folders.Select(s => s.Id).ToArray();
                    foreach (int fol in fols)
                    {
                        Folder folder = _db.Folder.Find(fol);
                        item.Folders.Remove(folder);
                        await _db.SaveChangesAsync();
                    }
                }
                else
                {
                    Folder folder = _db.Folder.Find(folderId);
                    item.Folders.Remove(folder);
                    await _db.SaveChangesAsync();
                }

                return(new StatusResult(true, StatusCode.Success, item.Number + " document removed"));
            }
            catch (Exception e)
            {
                return(new StatusResult(false, StatusCode.ExceptionThrown, e.Message));
            }
        }
        public string GetPossibleInvasionEncounters()
        {
            var toInt = new Func <string, int>(x =>
            {
                var val = x.Split('_')[0];
                if (!int.TryParse(val, out var result))
                {
                    Console.Error.WriteLine($"Failed to parse {val} as integer");
                }
                return(result);
            });
            var first  = string.Join(", ", Encounters.First.Select(x => MasterFile.GetPokemon(toInt(x), 0)?.Name));
            var second = string.Join(", ", Encounters.Second.Select(x => MasterFile.GetPokemon(toInt(x), 0)?.Name));
            //var third = string.Join(", ", invasion.Encounters.Third.Select(x => Database.Instance.Pokemon[x].Name));
            var msg = string.Empty;

            if (SecondReward ?? false)
            {
                //85%/15% Rate
                msg += $"85% - {first}\r\n";
                msg += $"15% - {second}\r\n";
            }
            else
            {
                //100% Rate
                msg += $"100% - {first}\r\n";
            }
            return(msg);
        }
        public IStore OpenStore(string storeLocation, bool readOnly)
        {
            Logging.LogInfo("Open Store {0}", storeLocation);
            var masterFile        = MasterFile.Open(_persistenceManager, storeLocation);
            var latestCommitPoint = masterFile.GetLatestCommitPoint();
            var dataFilePath      = Path.Combine(storeLocation, DataFileName);
            var resourceFilePath  = Path.Combine(storeLocation, ResourceFileName);

            if (_persistenceManager.FileExists(dataFilePath))
            {
                IPageStore dataPageStore = null;
                switch (masterFile.PersistenceType)
                {
                case PersistenceType.AppendOnly:
                    dataPageStore = new AppendOnlyFilePageStore(_persistenceManager, dataFilePath, PageSize, readOnly, _storeConfiguration.DisableBackgroundWrites);
                    break;

                case PersistenceType.Rewrite:
                    dataPageStore = new BinaryFilePageStore(_persistenceManager, dataFilePath, PageSize, readOnly, latestCommitPoint.CommitNumber);
                    break;
                }
                var resourcePageStore = new AppendOnlyFilePageStore(_persistenceManager, resourceFilePath, PageSize, readOnly, _storeConfiguration.DisableBackgroundWrites);
                var resourceTable     = new ResourceTable(resourcePageStore);
                var store             = new Store(storeLocation, dataPageStore, resourceTable, latestCommitPoint.LocationOffset, null);
                Logging.LogInfo("Store {0} opened successfully", storeLocation);
                return(store);
            }
            throw new StoreManagerException(storeLocation, "Data file not found");
        }
Exemple #11
0
        public async static Task MainAsync(string[] args)
        {
            MasterFile masterFile = new MasterFile();
            DnsServer  server     = new DnsServer(masterFile, "8.8.8.8");

            masterFile.remo

            foreach (string domain in args)
            {
                Console.WriteLine("Redirecting {0} to localhost", domain);
                masterFile.AddIPAddressResourceRecord(domain, "127.0.0.1");
            }

            server.Responded += (sender, e) => Console.WriteLine("{0} => {1}", e.Request, e.Response);
            server.Listening += (sender, e) => Console.WriteLine("Listening");
            server.Errored   += (sender, e) => {
                Console.WriteLine("Errored: {0}", e.Exception);
                ResponseException responseError = e.Exception as ResponseException;
                if (responseError != null)
                {
                    Console.WriteLine(responseError.Response);
                }
            };

            await server.Listen();
        }
        private void functionCmbDataChanged(ComboBox cmb)
        {
            if (cmb.SelectedIndex != -1)
            {
                try
                {
                    _InCaricamento = true;

                    string IDPianificazioniVigilanza = htDate[cmb.SelectedIndex].ToString();

                    MasterFile mf          = MasterFile.Create();
                    Hashtable  htVigilanza = new Hashtable();

                    htVigilanza             = mf.GetPianificazioniVigilanza(IDPianificazioniVigilanza);
                    dtpDataInizio.IsEnabled = true;
                    dtpDataFine.IsEnabled   = true;

                    dtpDataInizio.Text = htVigilanza["DataInizio"].ToString();
                    dtpDataFine.Text   = (htVigilanza["DataFine"] != null) ? htVigilanza["DataFine"].ToString() : htVigilanza["DataInizio"].ToString();

                    _InCaricamento = false;
                }
                catch (Exception ex)
                {
                    cBusinessObjects.logger.Error(ex, "wSchedaPianificazioneVigilanza.functionCmbDataChanged exception");
                    string log = ex.Message;
                }
            }
        }
Exemple #13
0
        public void TestCreateNewMaster()
        {
            var pm      = new FilePersistenceManager();
            var dirName = "TestCreateNewMaster1";

            pm.CreateDirectory(dirName);
            var storeConfig = new StoreConfiguration {
                PersistenceType = PersistenceType.AppendOnly
            };
            var storeSetId = Guid.NewGuid();
            var mf         = MasterFile.Create(pm, dirName, storeConfig, storeSetId);
            var storeId    = mf.StoreId;

            mf = MasterFile.Open(pm, dirName);
            Assert.AreEqual(storeId, mf.StoreId);
            Assert.AreEqual(storeSetId, mf.StoreSetId);
            Assert.AreEqual(StoreType.Standard, mf.StoreType);
            Assert.AreEqual(PersistenceType.AppendOnly, mf.PersistenceType);

            dirName = "TestCreateNewMaster2";
            pm.CreateDirectory(dirName);
            storeConfig.PersistenceType = PersistenceType.Rewrite;
            storeSetId = Guid.NewGuid();
            mf         = MasterFile.Create(pm, dirName, storeConfig, storeSetId);
            storeId    = mf.StoreId;
            mf         = MasterFile.Open(pm, dirName);
            Assert.AreEqual(storeId, mf.StoreId);
            Assert.AreEqual(storeSetId, mf.StoreSetId);
            Assert.AreEqual(StoreType.Standard, mf.StoreType);
            Assert.AreEqual(PersistenceType.Rewrite, mf.PersistenceType);

            // Enumerating commit points of a new master file should not throw an error
            Assert.AreEqual(0, mf.GetCommitPoints().Count());
        }
Exemple #14
0
        private void startServer(string serverAddress, List <string> officalServerAddress)
        {
            masterFile = new MasterFile();
            server     = new DnsServer(masterFile, "223.5.5.5");

            if (radioButton1.Checked)
            {
                masterFile.AddIPAddressResourceRecord(officalServerAddress[0], serverAddress);
            }
            else if (radioButton2.Checked)
            {
                masterFile.AddIPAddressResourceRecord(officalServerAddress[1], serverAddress);
            }
            else if (radioButton3.Checked)
            {
                masterFile.AddIPAddressResourceRecord(officalServerAddress[2], serverAddress);
            }
            else if (radioButton4.Checked)
            {
                masterFile.AddIPAddressResourceRecord(officalServerAddress[3], serverAddress);
            }
            else if (radioButton5.Checked)
            {
                masterFile.AddIPAddressResourceRecord(officalServerAddress[4], serverAddress);
            }

            server.Listen();
        }
Exemple #15
0
        static async Task startServer(string ip)
        {
            Console.WriteLine("Starting Nameserver to redirect all known Minecraft \"Featured Servers\" to " + ip);

            MasterFile masterFile = new MasterFile();
            DnsServer  server     = new DnsServer(masterFile, "8.8.8.8");

            // Resolve these domain to given ip
            masterFile.AddIPAddressResourceRecord("play.inpvp.net", ip);
            masterFile.AddIPAddressResourceRecord("play.lbsg.net", ip);
            masterFile.AddIPAddressResourceRecord("pe.mineplex.com", ip);
            masterFile.AddIPAddressResourceRecord("mco.cubecraft.net", ip);
            masterFile.AddIPAddressResourceRecord("geo.hivebedrock.network", "173.199.115.154");
            masterFile.AddIPAddressResourceRecord("play.galaxite.net", "104.238.130.180");

            // Log every request
            server.Requested += (sender, e) => Console.WriteLine(e.Request);
            // On every successful request log the request and the response
            server.Responded += (sender, e) => Console.WriteLine("{0} => {1}", e.Request, e.Response);
            // Log errors
            server.Errored += (sender, e) => Console.WriteLine(e.Exception.Message);

            // Start the server (by default it listents on port 53)
            Console.WriteLine("Looks like we are all set. Set your Switch's DNS to the IP of this computer!");
            await server.Listen();
        }
Exemple #16
0
        private void ConfigureService()
        {
            _masterFile = new MasterFile();
            var soaoptions = new StartOfAuthorityResourceRecord.Options()
            {
                SerialNumber      = GenerateSerialNumber(),
                RefreshInterval   = new TimeSpan(0, 0, _options.Value.RefreshInterval),
                RetryInterval     = new TimeSpan(0, 0, _options.Value.RetryInterval),
                ExpireInterval    = new TimeSpan(0, 0, _options.Value.ExpireInterval),
                MinimumTimeToLive = new TimeSpan(0, 0, _options.Value.MinTTL)
            };
            var domain = new Domain(_options.Value.Domain);
            var soa    = new StartOfAuthorityResourceRecord(
                domain, domain, domain, soaoptions, new TimeSpan(0, 0, _options.Value.TTL));

            _masterFile.Add(soa);
            var record = new IPAddressResourceRecord(
                new Domain(GetRecordFqdn()), IPAddress.Parse(_options.Value.TargetNormal), new TimeSpan(0, 0, _options.Value.RecordTtl));

            _masterFile.Add(record);
            _server            = new DnsServer(_masterFile, _options.Value.Forwarder);
            _server.Listening += ServerListening;
            _server.Responded += ServerResponded;
            _server.Errored   += ServerErrored;
        }
        private void GestoreEvento_ChiusuraFinestra(object sender, CancelEventArgs e)
        {
            if (IDClienteImport != "-1")
            {
                ;// MessageBox.Show( "La Sessione viene adesso generata\r\nDovrà essere selezionata nella tendina Destinazione della finestra di Import\r\nScegliere le CdL da Importare e premere Importa\r\nPer accedere alla sessione appena importata bisognerà chiudere la Sessione in corso e aprire quella nuova.", "Attenzione" );
                return;
            }

            //Configuro stato
            if (TipologiaAttivita != App.TipoAttivitaScheda.View && cmbClienti.SelectedIndex != -1)
            {
                string     IDCliente = htClienti[cmbClienti.SelectedIndex].ToString();
                MasterFile mf        = MasterFile.Create();
                mf.SetAnafraficaStato(Convert.ToInt32(IDCliente), App.TipoAnagraficaStato.Disponibile);
            }
            //dati non modificati
            if (!_DatiCambiati)
            {
                return;
            }


            //dati modificati
            Utilities u = new Utilities();

            if (MessageBoxResult.No == u.AvvisoPerditaDati())
            {
                e.Cancel = true;
            }
        }
        public void Mf_Equals_Test_IdenticalMasterFiles()
        {
            var masterFile1 = MasterFile.GetMasterFileFromFilepath(validFilepath1);
            var masterFile2 = MasterFile.GetMasterFileFromFilepath(validFilepath1);

            Assert.AreEqual(masterFile1, masterFile2);
        }
Exemple #19
0
        public void TestCorruptCommitPoint()
        {
            var pm      = new FilePersistenceManager();
            var dirName = "TestCorruptCommitPoint";

            pm.CreateDirectory(dirName);
            var storeConfig = new StoreConfiguration {
                PersistenceType = PersistenceType.AppendOnly
            };
            var      storeSetId   = Guid.NewGuid();
            var      mf           = MasterFile.Create(pm, dirName, storeConfig, storeSetId);
            DateTime commit1Time  = DateTime.UtcNow;
            Guid     commit1JobId = Guid.NewGuid();

            mf = MasterFile.Open(pm, dirName);
            mf.AppendCommitPoint(new CommitPoint(1ul, 1ul, commit1Time, commit1JobId));
            DateTime commit2Time  = DateTime.UtcNow;
            Guid     commit2JobId = Guid.NewGuid();

            mf = MasterFile.Open(pm, dirName);
            mf.AppendCommitPoint(new CommitPoint(2ul, 2ul, commit2Time, commit2JobId));

            mf = MasterFile.Open(pm, dirName);
            var allCommits = mf.GetCommitPoints().ToList();

            Assert.AreEqual(2, allCommits.Count);

            using (var fs = pm.GetOutputStream(Path.Combine(dirName, MasterFile.MasterFileName), FileMode.Open))
            {
                fs.Seek(-250, SeekOrigin.End);
                fs.WriteByte(255);
            }
            // Error in one half of commit point should not cause a problem
            mf = MasterFile.Open(pm, dirName);
            var lastCommit = mf.GetLatestCommitPoint();

            allCommits = mf.GetCommitPoints().ToList();
            Assert.AreEqual(2, allCommits.Count);
            Assert.AreEqual(2ul, lastCommit.CommitNumber);
            Assert.AreEqual(2ul, lastCommit.LocationOffset);
            Assert.AreEqual(commit2JobId, lastCommit.JobId);
            Assert.AreEqual(commit2Time.Ticks, lastCommit.CommitTime.Ticks);

            using (var fs = pm.GetOutputStream(Path.Combine(dirName, MasterFile.MasterFileName), FileMode.Open))
            {
                fs.Seek(-120, SeekOrigin.End);
                fs.WriteByte(255);
            }
            // Error in both halves of commit point should force a rewind to previous commit point
            mf         = MasterFile.Open(pm, dirName);
            lastCommit = mf.GetLatestCommitPoint();
            allCommits = mf.GetCommitPoints().ToList();
            Assert.AreEqual(1, allCommits.Count);

            Assert.AreEqual(1ul, lastCommit.CommitNumber);
            Assert.AreEqual(1ul, lastCommit.LocationOffset);
            Assert.AreEqual(commit1JobId, lastCommit.JobId);
            Assert.AreEqual(commit1Time.Ticks, lastCommit.CommitTime.Ticks);
        }
        private void ButtonApri_Click(object sender, RoutedEventArgs e)
        {
            //controllo selezione clienti
            if (cmbClienti.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare un cliente");
                return;
            }

            //dati modificati
            if (_DatiCambiati)
            {
                //Utilities u = new Utilities();
                //if (MessageBoxResult.No == u.AvvisoPerditaDati("Alcuni dati sono stati modificati, confermi apertura?"))
                //    return;

                //Salvataggio automatico come richiesto da 2.3
                App.TipoAttivitaScheda OLDTipologiaAttivita = TipologiaAttivita;
                TipologiaAttivita = App.TipoAttivitaScheda.Edit;
                buttonComando_Click(sender, e);
                TipologiaAttivita = OLDTipologiaAttivita;
            }

            //disponibile: blocco cliente
            int        IDCliente = Convert.ToInt32(htClienti[cmbClienti.SelectedIndex].ToString());
            MasterFile mf        = MasterFile.Create();

            App.TipoAnagraficaStato anaStato = mf.GetAnafraficaStato(IDCliente);

            if (anaStato == App.TipoAnagraficaStato.Disponibile && TipologiaAttivita != App.TipoAttivitaScheda.View)
            {
                mf.SetAnafraficaStato(Convert.ToInt32(IDCliente), App.TipoAnagraficaStato.InUso);
            }

            //apre treee
            int IDPianificazioniVerifica = App.MasterFile_NewID;

            try
            {
                IDPianificazioniVerifica = Convert.ToInt32(htDate[cmbData.SelectedIndex].ToString());
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wSchedaPianificazioneVerifica.ButtonApri_Click exception");
                string log = ex.Message;
            }

            if (IDPianificazioniVerifica == -1)
            {
                MessageBox.Show("selezionare una sessione");
            }
            else
            {
                bool isSchedaReadOnly = TipologiaAttivita == App.TipoAttivitaScheda.View || anaStato == App.TipoAnagraficaStato.InUso;
                cBusinessObjects.VerificaSessione("PianificazioniVerifica", cmbData.SelectedValue.ToString(), IDPianificazioniVerifica, IDCliente);

                Accedi_Click(IDPianificazioniVerifica.ToString(), isSchedaReadOnly);
            }
        }
Exemple #21
0
 /// <summary>
 /// 終了処理
 /// </summary>
 public void Dispose()
 {
     if (_File != null)
     {
         _File.Dispose();
         _File = null;
     }
 }
Exemple #22
0
 /// <summary>
 /// Load the configuration from a file
 /// </summary>
 /// <param name="filePath">Path to load the configuration file from</param>
 /// <returns>Returns the deserialized configuration object</returns>
 public static WhConfig Load(string filePath)
 {
     if (!File.Exists(filePath))
     {
         throw new FileNotFoundException("Config not loaded because file not found.", filePath);
     }
     return(MasterFile.LoadInit <WhConfig>(filePath));
 }
Exemple #23
0
        /// <summary>
        /// マスタ管理.Model
        /// </summary>
        public MasterInfo()
        {
            _File = new MasterFile();

            PostalCode = _File.PostalCode.Split('-');
            PhoneNo    = _File.PhoneNo.Split('-');
            FaxNo      = _File.FaxNo.Split('-');
        }
        public void CreateSnapshot(string srcStoreLocation, string destStoreLocation,
                                   PersistenceType storePersistenceType, ulong commitPointId = StoreConstants.NullUlong)
        {
            Logging.LogInfo("Snapshot store {0} to new store {1} with persistence type {2}", srcStoreLocation,
                            destStoreLocation, storePersistenceType);
            if (_persistenceManager.DirectoryExists(destStoreLocation))
            {
                throw new StoreManagerException(destStoreLocation, "Store already exists");
            }

            // Open the source store for reading
            using (IStore srcStore = commitPointId == StoreConstants.NullUlong
                                         ? OpenStore(srcStoreLocation, true)
                                         : OpenStore(srcStoreLocation, commitPointId))
            {
                // Create the directory for the destination store
                _persistenceManager.CreateDirectory(destStoreLocation);

                // Create empty data file
                var dataFilePath = Path.Combine(destStoreLocation, DataFileName);
                _persistenceManager.CreateFile(dataFilePath);

                // Create initial master file
                var destStoreConfiguration = _storeConfiguration.Clone() as StoreConfiguration;
                destStoreConfiguration.PersistenceType = storePersistenceType;
                var destMasterFile = MasterFile.Create(_persistenceManager, destStoreLocation, destStoreConfiguration,
                                                       Guid.NewGuid());

                // Copy resource files from source store
                var resourceFilePath = Path.Combine(destStoreLocation, ResourceFileName);
                _persistenceManager.CopyFile(Path.Combine(srcStoreLocation, ResourceFileName), resourceFilePath, true);

                // Initialize data page store
                IPageStore destPageStore = null;
                switch (storePersistenceType)
                {
                case PersistenceType.AppendOnly:
                    destPageStore = new AppendOnlyFilePageStore(_persistenceManager, dataFilePath, PageSize, false,
                                                                _storeConfiguration.DisableBackgroundWrites);
                    break;

                case PersistenceType.Rewrite:
                    destPageStore = new BinaryFilePageStore(_persistenceManager, dataFilePath, PageSize, false, 0, 1, _storeConfiguration.DisableBackgroundWrites);
                    break;

                default:
                    throw new BrightstarInternalException("Unrecognized target store type: " + storePersistenceType);
                }

                // Copy Data
                ulong destStorePageId = srcStore.CopyTo(destPageStore, 1ul);

                destPageStore.Close();

                destMasterFile.AppendCommitPoint(
                    new CommitPoint(destStorePageId, 1ul, DateTime.UtcNow, Guid.Empty), true);
            }
        }
        public wWorkAreaTreeLimited()
        {
            InitializeComponent();
            txtTitoloAttivita.Foreground       = App._arrBrushes[0];
            txtTitoloRagioneSociale.Foreground = App._arrBrushes[9];
            ButtonBar.Background = App._arrBrushes[12];
            SolidColorBrush tmpBrush = (SolidColorBrush)Resources["buttonHover"];

            tmpBrush.Color = ((SolidColorBrush)App._arrBrushes[13]).Color;

            MasterFile mf = MasterFile.Create();

            //string date = mf.GetData();

            //try
            //{
            //    if (Convert.ToDateTime(date) < DateTime.Now)
            //    {
            //        MessageBox.Show("Licenza scaduta");
            //        this.Close();
            //        return;
            //    }
            //}
            //catch (Exception ex)
            //{
            //    string log = ex.Message;
            //    this.Close();
            //    return;
            //}


            TreeXmlProvider = this.FindResource("xdpTree") as XmlDataProvider;

            //Colonna selezionata
            YearColor.Add(-1, "82BDE4");
            //Colori colonne di sezione
            YearColor.Add(2000, "F1F1F1");
            YearColor.Add(2001, "D3D3D3");
            YearColor.Add(2002, "F1F1F1");
            YearColor.Add(2003, "D3D3D3");
            YearColor.Add(2004, "F1F1F1");
            YearColor.Add(2005, "D3D3D3");
            YearColor.Add(2006, "F1F1F1");
            YearColor.Add(2007, "D3D3D3");
            YearColor.Add(2008, "F1F1F1");
            YearColor.Add(2009, "D3D3D3");
            YearColor.Add(2010, "F1F1F1");
            YearColor.Add(2011, "D3D3D3");
            YearColor.Add(2012, "F1F1F1");
            YearColor.Add(2013, "D3D3D3");
            YearColor.Add(2014, "F1F1F1");
            YearColor.Add(2015, "D3D3D3");
            YearColor.Add(2016, "F1F1F1");
            YearColor.Add(2017, "D3D3D3");
            YearColor.Add(2018, "F1F1F1");
            YearColor.Add(2019, "D3D3D3");
            YearColor.Add(2020, "F1F1F1");
        }
Exemple #26
0
        public void ConfiguraMaschera()
        {
            MasterFile mf = MasterFile.Create();

            int index = 0;

            int selectedIndex = -1;

            if (cmbClienti.Items.Count != 0)
            {
                selectedIndex = cmbClienti.SelectedIndex;
                cmbClienti.Items.Clear();
                htClienti.Clear();
            }

            List <KeyValuePair <string, string> > myList = new List <KeyValuePair <string, string> >();

            foreach (Hashtable item in mf.GetAnagrafiche())
            {
                if (mf.GetBilanci(item["ID"].ToString()).Count == 0 && mf.GetRevisioni(item["ID"].ToString()).Count == 0 && mf.GetISQCs(item["ID"].ToString()).Count == 0 && mf.GetIncarichi(item["ID"].ToString()).Count == 0 && mf.GetConclusioni(item["ID"].ToString()).Count == 0 && mf.GetVerifiche(item["ID"].ToString()).Count == 0)
                {
                    continue;
                }

                string cliente = item["RagioneSociale"].ToString();

                myList.Add(new KeyValuePair <string, string>(item["ID"].ToString(), cliente));
            }

            myList.Sort
            (
                delegate(KeyValuePair <string, string> firstPair, KeyValuePair <string, string> nextPair)
            {
                return(firstPair.Value.CompareTo(nextPair.Value));
            }
            );

            foreach (KeyValuePair <string, string> item in myList)
            {
                cmbClienti.Items.Add(item.Value);
                htClienti.Add(index, item.Key);
                index++;
            }

            cmbClienti.SelectedIndex = selectedIndex;

            string IDCliente = mf.GetClienteFissato();

            foreach (DictionaryEntry item in htClienti)
            {
                if (item.Value.ToString() == IDCliente)
                {
                    cmbClienti.SelectedIndex = Convert.ToInt32(item.Key.ToString());
                    return;
                }
            }
        }
 public void Mf_GetMasterFileFromDatabase_Test_PartiallyNullOrEmptyInput()
 {
     var emptyProperties = new Dictionary <string, object>[]
     {
         new Dictionary <string, object>(),
         new Dictionary <string, object>()
     };
     var invalidMasterFile = MasterFile.GetMasterFileFromDB(emptyProperties);
 }
Exemple #28
0
        private async static Task RunDnsAsync(string backupDnsServer, params RedirectPair[] args)
        {
            MasterFile masterFile = new MasterFile();
            DnsServer  server     = new DnsServer(masterFile, backupDnsServer);

            foreach (RedirectPair redirect in args)
            {
                masterFile.AddIPAddressResourceRecord(redirect.Domain, redirect.IPAddress);
            }
            await server.Run();
        }
Exemple #29
0
        /// <summary>
        /// Load the configuration from a file
        /// </summary>
        /// <param name="filePath">Path to load the configuration file from</param>
        /// <returns>Returns the deserialized configuration object</returns>
        public static WhConfig Load(string filePath)
        {
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException("Config not loaded because file not found.", filePath);
            }
            var config = MasterFile.LoadInit <WhConfig>(filePath);

            config.LoadDiscordServers();
            return(config);
        }
        public MasterFile GetMasterFile(string storeLocation)
        {
            MasterFile masterFile;

            if (!MasterFileCache.TryGetValue(storeLocation, out masterFile))
            {
                masterFile = MasterFile.Open(_persistenceManager, storeLocation);
                MasterFileCache.TryAdd(storeLocation, masterFile);
            }
            return(masterFile);
        }