Esempio n. 1
0
 public bool InsertDatas(Harp datas)
 {
     try
     {
         //BsonMapper.Global.Entity<IdentityServer4.Models.IdentityResources.OpenId>().Id(oid => oid.Name);
         using (var db = new LiteDatabase(DatabaseName))
         {
             var dataobject = db.GetCollection <Harp>("datas");
             dataobject.EnsureIndex(x => x.Name);
             var results = dataobject.Find(X => X.Name == datas.Name);
             if (results.Count() > 0)
             {
                 dataobject.Update(datas);
             }
             else
             {
                 dataobject.Insert(datas);
                 dataobject.EnsureIndex(x => x.Id);
                 dataobject.EnsureIndex(x => x.Name);
                 dataobject.EnsureIndex(x => x.Stamp);
             }
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Fremde Notify Routinen werden der zentralen HarpNoties zugeordnet.
        /// </summary>
        /// <param name="notify"></param>

        /*
         * public void RegisterFormsInfoNotify(RaiseNotifyHandler notify)
         * {
         *  List<string> lst = HarpNotifies.Notify.GetInfoTargedList();
         *  if (lst.Contains(notify.Target.ToString())) return;
         *  HarpNotifies.Notify.OnRaiseInfoHandler -= notify;
         *  HarpNotifies.Notify.OnRaiseInfoHandler += notify;
         * }
         * public void RegisterFormsErrorNotify(RaiseNotifyHandler notify)
         * {
         *  List<string> lst = HarpNotifies.Notify.GetErrorTargedList();
         *  if (lst.Contains(notify.Target.ToString())) return;
         *  HarpNotifies.Notify.OnRaiseErrorHandler -= notify;
         *  HarpNotifies.Notify.OnRaiseErrorHandler += notify;
         *
         * }
         */
        public void SelectHarpByName(string name)
        {
            Harp harp = hc.Harps.Find(X => X.Name == name);

            hc.ActualHarpInstrument = HarpInstrumentFactory.HarpDatabaeObject2HarpInstrument(harp);
            soundAttributeForm.SetHarp(harp);
        }
Esempio n. 3
0
 private void SetAirSlots(Harp lst)
 {
     if (lst != null)
     {
         var list = sq.GetSortAirSlots(lst.AirSlots);
         dgvSLOTS.DataSource = list;
     }
 }
Esempio n. 4
0
        public void SetData(Guid guid)
        {
            List <Harp> harps = sq.GetID(guid);

            if (harps.Count == 1)
            {
                harp = harps[0];
            }
        }
Esempio n. 5
0
        private void cbReferenzHarpInstruments_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (FormInstances.Instance().hc == null)
            {
                return;
            }
            Harp harp = (Harp)cbReferenzHarpInstruments.SelectedItem;

            //  FormInstances.Instance().hc.ReferenceHarpInstrument = HarpInstrumentFactory.HarpDatabaeObject2HarpInstrument(harp);
        }
Esempio n. 6
0
        public void SetIntrument(SimpleApi saa, Instrument instrument, Harp harp)
        {
            harpIntrument = HarpInstrumentFactory.HarpDatabaeObject2HarpInstrument(harp);

            if (harpIntrument.InstrumentNotesDefinition.Count <= 0)
            {
                return;
            }

            var inn = harpIntrument.InstrumentNotesDefinition.Keys.Select(m => m).Where(kvp => kvp.BreathDirection == eBreathDirection.blow).Select(k => k.Slot).ToList();
        }
Esempio n. 7
0
        public int FindCountEntry(Harp sql)
        {
            int count = 0;

            using (var db = new LiteDatabase(DatabaseName))
            {
                var datas = db.GetCollection <Harp>("datas");
                datas.EnsureIndex(x => x.Id);
                var r = datas.Find(x => x.Id == sql.Id);
                count = r.Count();
            }
            return(count);
        }
Esempio n. 8
0
        public void SaveInitialHarps(string fileName)
        {
            if (File.Exists(FormInstances.Instance().DatabaseFile))
            {
                File.Delete(FormInstances.Instance().DatabaseFile);
            }
            HarpInstrumentClass hi = HarpInstrumentFactory.SeydelDeLuxeSteelOrchestra(eKey.C_DUR);

            Harp ins = new Harp();
            List <AirSlotAttributesClass> airSlots = new List <AirSlotAttributesClass>();

            airSlots.AddRange(hi.InstrumentNotesDefinition.Keys);
            ins.AirSlots    = airSlots;
            ins.Name        = hi.Name;
            ins.Description = hi.Name;
            ins.Stamp       = DateTime.Now;
            ins.Key         = hi.Key;
            var sq = new SQLDataClass(fileName);

            sq.InsertDatas(ins);


            hi       = HarpInstrumentFactory.HohnerUnsereLieblinge(eKey.C_DUR);
            ins      = new Harp();
            airSlots = new List <AirSlotAttributesClass>();
            airSlots.AddRange(hi.InstrumentNotesDefinition.Keys);
            ins.AirSlots    = airSlots;
            ins.Name        = hi.Name;
            ins.Description = hi.Name;
            ins.Stamp       = DateTime.Now;
            ins.Key         = hi.Key;

            sq.InsertDatas(ins);

            hi       = HarpInstrumentFactory.ChroamticStandard(eKey.C_DUR);
            ins      = new Harp();
            airSlots = new List <AirSlotAttributesClass>();
            airSlots.AddRange(hi.InstrumentNotesDefinition.Keys);
            ins.AirSlots    = airSlots;
            ins.Name        = hi.Name;
            ins.Description = hi.Name;
            ins.Stamp       = DateTime.Now;
            ins.Key         = hi.Key;

            sq.InsertDatas(ins);
        }
Esempio n. 9
0
 public bool UpdateDatas(Harp datas)
 {
     try
     {
         //BsonMapper.Global.Entity<IdentityServer4.Models.IdentityResources.OpenId>().Id(oid => oid.Name);
         using (var db = new LiteDatabase(DatabaseName))
         {
             var dataobject = db.GetCollection <Harp>("datas");
             dataobject.EnsureIndex(x => x.Id);
             dataobject.Update(datas);
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 10
0
 public void SelectRefHarpByName(string name)
 {
     Harp harp = hc.Harps.Find(X => X.Name == name);
     //  hc.ReferenceHarpInstrument = HarpInstrumentFactory.HarpDatabaeObject2HarpInstrument(harp);
     //  soundAttributeForm.SetRefHarp(harp);
 }
Esempio n. 11
0
        public int Create(Control parent, Control songTextControl, SimpleApi saa, Instrument instrument, Harp harp)
        {
            FormInstances.Instance().hc.ActualHarpInstrument = HarpInstrumentFactory.HarpDatabaeObject2HarpInstrument(harp);

            if (FormInstances.Instance().hc.ActualHarpInstrument.InstrumentNotesDefinition.Count <= 0)
            {
                return(0);
            }

            var inn = FormInstances.Instance().hc.ActualHarpInstrument.InstrumentNotesDefinition.Keys.Select(m => m).Where(kvp => kvp.BreathDirection == eBreathDirection.blow).Select(k => k.Slot).ToList();

            gb         = new GroupBox();
            gb.Parent  = parent;
            gb.Width   = (inn.Count + 1) * (Statics.SlotButtonWitdh + 2) + 16;
            gb.Height  = 500;
            gb.Left    = 8;
            gb.Top     = 16;
            gb.Text    = string.Empty; //harp.Name;
            gb.Dock    = DockStyle.Left;
            gb.Visible = true;
            //Für alle im Instrument definierten HarpSlotn wird die UI angelegt
            int witdh = 0;

            foreach (KeyValuePair <AirSlotAttributesClass, InstrumentsNotesClass> inf in FormInstances.Instance().hc.ActualHarpInstrument.InstrumentNotesDefinition)
            {
                if (inf.Key.BreathDirection == eBreathDirection.blow)
                {
                    witdh += 1;
                }
                AirSlotClass aslot = new AirSlotClass(gb, songTextControl, inf, FormInstances.Instance().sa);

                Slots.Add(aslot);
            }

            return((witdh * (Statics.SlotButtonWitdh + 2)) + 86);
        }
Esempio n. 12
0
 public void SetRefHarp(Harp harp)
 {
     cbReferenzHarpInstruments.Text = harp.Name;
 }
Esempio n. 13
0
 public void SetHarp(Harp harp)
 {
     cbHarpInstrument.Text = harp.Name;
 }