Esempio n. 1
0
 public MessageBoxInformation AktualizujZPliku()
 {
     return(new MessageBoxInformation(Strings.Str_MsgTitle, Strings.Str_MsgText)
     {
         YesHandler = () => QueryContextInformation.Create <NamedStream>(importFile)
     });
 }
Esempio n. 2
0
 public QueryContextInformation QueryContextExample2()
 {
     return(QueryContextInformation.Create <WParams>(args => {
         using (var trans = Kontrahent.Session.Logout(true)) {
             Kontrahent.Adres.Telefon = args.NowyTelefon;
             Kontrahent.Adres.Faks = args.NowyFax;
             trans.CommitUI();
         }
         return null;
     }));
 }
Esempio n. 3
0
        protected object AddBusinessRow(Type rowType, Action <DBItemContext> preCheck = null)
        {
            if (Context == null)
            {
                return(null);
            }
            var dbic = new DBItemContext(DBItem);

            dbic.Init();
            preCheck?.Invoke(dbic);
            var contextParameters =
                from parameter in Table.GetRowConstructor(rowType).GetParameters()
                from ContextAttribute cxattr in parameter.GetCustomAttributes(typeof(ContextAttribute), true)
                select cxattr.ContextType ?? parameter.ParameterType;

            var qci = QueryContextInformation.CreateForTypes(contextParameters.ToArray());

            qci.Caption       = "Dodawanie zapisu";
            qci.Context       = dbic.Context;
            qci.AcceptHandler = () =>
            {
                var row = (Row)dbic.Context.CreateObject(null, Table.GetRowConstructor(rowType), null);
                if (row != null)
                {
                    var table = dbic.Session.Tables[rowType];
                    using (var t = dbic.Session.Logout(true))
                    {
                        table.AddRow(row);
                        t.Commit();
                    }

                    dbic.Context.Set(row);
                    return(new FormActionResult()
                    {
                        EditValue = row,
                        Context = dbic.Context,
                        CommittedHandler = (cx) =>
                        {
                            dbic.Dispose();
                            return null;
                        }
                    });
                }
                dbic.Dispose();
                return(null);
            };
            return(qci);
        }
Esempio n. 4
0
 public QueryContextInformation QueryContextExample()
 {
     return(QueryContextInformation.Create <WParams>(args => new MessageBoxInformation {
         Text = "Dane zostały zmienione. Potwierdzasz zapis ?",
         OKHandler = () => {
             using (var trans = Kontrahent.Session.Logout(true)) {
                 Kontrahent.Adres.Telefon = args.NowyTelefon;
                 Kontrahent.Adres.Faks = args.NowyFax;
                 trans.CommitUI();
             }
             return null;
         },
         CancelHandler = () => null,
         IsCancelVisible = true,
     }));
 }
Esempio n. 5
0
 public QueryContextInformation KontrahentQuery() {
     var qci = new QueryContextInformation(Kontrahent) {
         Caption = "Dodawanie ooby kontaktowej",
         AcceptHandler = () => {
             KontaktOsoba kontakt;
             using (var trans = Kontrahent.Session.Logout(true)) {
                 kontakt = new KontaktOsoba();
                 Kontrahent.Module.KontaktyOsoby.AddRow(kontakt);
                 kontakt.Kontrahent = Kontrahent;
                 trans.CommitUI();
             }
             return kontakt;
         }
     };
     return qci;
 }
Esempio n. 6
0
        public QueryContextInformation KontrahentQuery()
        {
            var qci = new QueryContextInformation(Kontrahent)
            {
                Caption       = "Dodawanie ooby kontaktowej",
                AcceptHandler = () => {
                    KontaktOsoba kontakt;
                    using (var trans = Kontrahent.Session.Logout(true)) {
                        kontakt = new KontaktOsoba();
                        Kontrahent.Module.KontaktyOsoby.AddRow(kontakt);
                        kontakt.Kontrahent = Kontrahent;
                        trans.CommitUI();
                    }
                    return(kontakt);
                }
            };

            return(qci);
        }
 /// <summary>
 /// Główna metoda import - wywoływana przez enova do przeprowadzenia wszystkich operacji
 /// </summary>
 public override object CreateReader10()
 {
     // żądanie odpytania o plik importowy i przekazanie sterowania do metody "Import" po wybraniu pliku
     return(QueryContextInformation.Create <NamedStream>(Import));
 }