Beispiel #1
0
 public void ViewLoadingEvent(object sender, EventArgs e)
 {
     if (DesignMode || (Site != null && Site.DesignMode))
     {
         return;
     }
     Controller = DBControllersFactory.GetController <C>();
     new Thread(delegate() {
         BeginInvoke((Action) delegate() { InitializeView(); });
     }).Start();
 }
Beispiel #2
0
 private void PickListButton_Click(object sender, EventArgs e)
 {
     picklistboxForm             = new PickListBox(Source, DBControllersFactory.GetController(Source).GetKeysAndValues().ToDataTable());
     picklistboxForm.FormClosed += (s, ee) => {
         if (picklistboxForm.DialogResult != DialogResult.OK)
         {
             return;
         }
         SendKeys.Send("\t");
         PickListItemSelected?.Invoke(picklistboxForm.SelectedValue.ToInteger());
     };
     picklistboxForm.Show();
     FormsHelper.ApplyLanguageLocalization(picklistboxForm);
 }
Beispiel #3
0
        public Dictionary <int, string> GetKeysAndValues()
        {
            if (dtGetKeysAndValues != null)
            {
                return(dtGetKeysAndValues);
            }
            var UK = new[] { "Id" }.Concat(GetMetaData().UniqueKeyFields.SelectMany(x => x)).Distinct();//.OrderBy(x => x);
            var FK = GetMetaData().ForeignKeys.Where(x => UK.Contains(x.Key));
            var MD = Select(NewModel(), string.Join(",", UK), false);

            dtGetKeysAndValues = new Dictionary <int, string>();

            OnSaveAction   += Clear_dtGetKeysAndValues;
            OnDeleteAction += Clear_dtGetKeysAndValues;

            foreach (var record in MD)
            {
                var           objects = new object[2];
                int           id      = (int)typeof(M).GetProperty("Id").GetValue(record);
                List <string> sb      = new List <string>();
                foreach (var u in UK.Where(x => "Id" != x))
                {
                    object val = typeof(M).GetProperty(u).GetValue(record);
                    var    f   = FK.Where(x => x.Key == u);
                    if (f.Count() > 0)
                    {
                        var Cntrl = DBControllersFactory.GetController(f.FirstOrDefault().Value.Item1);
                        sb.Add(Cntrl.GetValues((int)val));
                        Cntrl.OnSaveAction   += Clear_dtGetKeysAndValues;
                        Cntrl.OnDeleteAction += Clear_dtGetKeysAndValues;
                    }
                    else
                    {
                        sb.Add(val.ToString());
                    }
                }
                dtGetKeysAndValues[id] = string.Join(" | ", sb);
            }
            return(dtGetKeysAndValues);
        }
Beispiel #4
0
 private void TxtLanguageId_TextChanged(object sender, EventArgs e)
 {
     txtLanguageName.Text = DBControllersFactory.FK(MODELS.Language, txtLanguageId.Text);
 }
Beispiel #5
0
 private void TxtWordId_TextChanged(object sender, EventArgs e)
 {
     txtWordInEnglish.Text = DBControllersFactory.FK(MODELS.Word, txtWordId.Text);
 }