Ejemplo n.º 1
0
 public API.Towary.CenaGrupowa this[API.CRM.Kontrahent kontrahent, API.Business.DictionaryItem grupa, API.Business.DictionaryItem grupaTowarowa]
 {
     get
     {
         var view = GetValue("WgGrupaTowarowa");
         if (view != null && kontrahent != null)
         {
             var cg = GetObjValue(view, "Item", new Type[] {
                 Type.GetType("Soneta.Business.Db.DictionaryItem, Soneta.Business"),
                 Type.GetType("Soneta.CRM.Kontrahent, Soneta.CRM"),
                 Type.GetType("Soneta.Business.Db.DictionaryItem, Soneta.Business")
             },
                                  new object[] {
                 grupaTowarowa == null ? null : grupaTowarowa.EnovaObject,
                 kontrahent.EnovaObject,
                 grupa == null ? null : grupa.EnovaObject
             });
             return(cg == null ? null : new CenaGrupowa()
             {
                 EnovaObject = cg
             });
         }
         return(null);
     }
 }
Ejemplo n.º 2
0
        public IEnumerable <API.Handel.DokumentHandlowy> WgKontrahentDataDefinicja(API.CRM.Kontrahent kontrahent, API.Magazyny.Magazyn magazyn,
                                                                                   API.Types.FromTo fromTo, API.Handel.DefDokHandlowego definicja, API.Handel.StanDokumentuHandlowego stan)
        {
            string filter = "";

            if (magazyn != null)
            {
                filter += " AND Magazyn = " + magazyn.ID;
            }
            if (fromTo != null)
            {
                filter += " AND Data >='" + fromTo.From.ToString() + "' AND Data <= '" + fromTo.To.ToString() + "'";
            }
            if (definicja != null)
            {
                filter += " AND Definicja = " + definicja.ID;
            }

            /*
             * if (stan == API.Handel.StanDokumentuHandlowego.Zatwierdzony || stan == API.Handel.StanDokumentuHandlowego.Zablokowany)
             *  filter += " AND (Stan = " + (int)API.Handel.StanDokumentuHandlowego.Zatwierdzony + " OR Stan = " + (int)API.Handel.StanDokumentuHandlowego.Zablokowany + ")";
             */
            //return WgKontrahent(kontrahent).CreateView().SetFilter(filter).Cast<API.Handel.DokumentHandlowy>();
            if (filter != "")
            {
                filter = filter.Substring(5);
            }
            return(new Business.EnovaEnumerable <API.Handel.DokumentHandlowy>(WgKontrahent(kontrahent).CreateView().SetFilter(filter)));
        }
Ejemplo n.º 3
0
        public API.Handel.DokumentHandlowy NowyDokument(API.CRM.Kontrahent kontrahent, API.Magazyny.Magazyn magazyn)
        {
            throw new NotImplementedException("Enova.API.Connector.Handel.DefDokHandlowego.NowyDokument()");

            /*
             * var dokument = new Soneta.Handel.DokumentHandlowy();
             * dokument.Definicja = (Soneta.Handel.DefDokHandlowego)this.Record;
             * dokument.Kontrahent = (Soneta.CRM.Kontrahent)((Business.Row)kontrahent).Record;
             * if (magazyn != null)
             *  dokument.Magazyn = (Soneta.Magazyny.Magazyn)((Business.Row)magazyn).Record;
             * else
             *  dokument.Magazyn = Soneta.Magazyny.MagazynyModule.GetInstance(this).Magazyny.Firma;
             * Soneta.Handel.HandelModule.GetInstance(this).DokHandlowe.AddRow(dokument);
             * dokument.Data = Soneta.Types.Date.Today;
             * return new DokumentHandlowy() { Record = dokument };
             */
        }
Ejemplo n.º 4
0
        public API.Towary.CenaGrupowa Create(API.Business.DictionaryItem grupaTowarowa, API.CRM.Kontrahent kontrahent)
        {
            var row = Type.GetType("Soneta.Towary.CenaGrupowa, Soneta.Handel").GetConstructor(new Type[] {
                Type.GetType("Soneta.Business.Db.DictionaryItem, Soneta.Business"),
                Type.GetType("Soneta.CRM.Kontrahent, Soneta.CRM")
            }).Invoke(new object[] {
                grupaTowarowa == null ? null : grupaTowarowa.EnovaObject,
                kontrahent == null ? null : kontrahent.EnovaObject
            });

            return(row == null ? null : new CenaGrupowa()
            {
                EnovaObject = row
            });
        }
Ejemplo n.º 5
0
 public IEnumerable <API.Towary.CenaGrupowa> this[API.CRM.Kontrahent kontrahent]
 {
     get { throw new NotImplementedException(); }
 }
Ejemplo n.º 6
0
 public IEnumerable <API.Kasa.DokRozliczBase> WgTypDokumentu(API.Core.TypDokumentu typ, Types.FromTo fromTo, API.CRM.Kontrahent kontrahent)
 {
     API.Business.View view = null;
     if (kontrahent != null)
     {
         view = WgPodmiot(kontrahent, typ).CreateView();
     }
     else
     {
         view = WgTypData(typ).CreateView();
     }
     view.Filter = "Data >= '" + fromTo.From + "' AND Data <= '" + fromTo.To + "'";
     return(view.Cast <API.Kasa.DokRozliczBase>().ToList());;
 }
Ejemplo n.º 7
0
 public RozrachunkiView(string key, API.CRM.Kontrahent kontrahent)
     : base(key)
 {
     this.kontrahent = kontrahent;
 }
Ejemplo n.º 8
0
        public static Enova.Business.Old.DB.Web.Kontrahent GetWebKontrahent(API.CRM.Kontrahent enova, bool insert)
        {
            Web.Kontrahent kontrahent = Enova.Business.Old.Core.ContextManager.WebContext.Kontrahenci.Where(k => k.Guid == enova.Guid).FirstOrDefault();
            if (kontrahent == null)
            {
                kontrahent = Core.ContextManager.WebContext.Kontrahenci.Where(k => k.Kod == enova.Kod && k.Nip == enova.NIP).FirstOrDefault();
                if (kontrahent == null && insert)
                {
                    try
                    {
                        kontrahent = new Web.Kontrahent(enova);
                        Core.ContextManager.WebContext.AddToKontrahenci(kontrahent);
                        kontrahent.Synchronizacja = (int)Types.RowSynchronizeOld.Notsaved;
                        kontrahent.DoSaveChanges(Core.ContextManager.WebContext);

                        //ContextManager.WebContext.SaveChanges();

                        Enova.Business.Old.DB.Web.Adres adres    = null;
                        Enova.Business.Old.DB.Web.Adres adresKor = null;

                        if (enova.Adres != null)
                        {
                            adres = new Web.Adres(enova, enova.Adres, 1);
                            kontrahent.Adresy.Add(adres);
                            adres.DoSaveChanges(Core.ContextManager.WebContext);
                        }

                        if (enova.AdresDoKorespondencji != null && !string.IsNullOrEmpty(enova.AdresDoKorespondencji.KodPocztowy))
                        {
                            adresKor = new Web.Adres(enova, enova.AdresDoKorespondencji, 2);
                            kontrahent.Adresy.Add(adresKor);
                            adresKor.DoSaveChanges(Core.ContextManager.WebContext);
                        }

                        if (adresKor == null)
                        {
                            adres.DomyslnyAdresWysylki = true;
                        }


                        /*
                         * foreach (var cenaGrupowa in enova.CenyGrupowe)
                         * {
                         *  Web.GrupaRabatowa grupaRabatowa = ContextManager.WebContext.GrupyRabatowe.Where(gr => gr.GUID == cenaGrupowa.GrupaTowarowa.Guid).FirstOrDefault();
                         *  if (grupaRabatowa == null)
                         *      grupaRabatowa = new Web.GrupaRabatowa()
                         *      {
                         *          EnovaStamp = cenaGrupowa.GrupaTowarowa.Stamp,
                         *          GUID = cenaGrupowa.GrupaTowarowa.Guid,
                         *          Kategoria = cenaGrupowa.GrupaTowarowa.Category,
                         *          Wartosc = cenaGrupowa.GrupaTowarowa.Value
                         *      };
                         *
                         *  kontrahent.GrupyRabatowe.Add(new Web.KontrahentRabatGrupowy()
                         *  {
                         *      EnovaStamp = cenaGrupowa.Stamp,
                         *      GrupaRabatowa = grupaRabatowa,
                         *      GUID = cenaGrupowa.Guid,
                         *      Rabat = (decimal)cenaGrupowa.Rabat,
                         *      RabatZdefiniowany = (bool)cenaGrupowa.RabatZdefiniowany
                         *  });
                         * }
                         */

                        kontrahent.Synchronizacja = (int)Types.RowSynchronizeOld.NotsynchronizedNew;
                        kontrahent.DoSaveChanges(Core.ContextManager.WebContext);
                    }
                    catch (Exception ex)
                    {
                        BAL.Business.AppController.ThrowException(ex);
                    }
                }
                else if (kontrahent != null)
                {
                    kontrahent.Guid = enova.Guid;
                }
                //ContextManager.WebContext.SaveChanges();
            }

            return(kontrahent);
        }
Ejemplo n.º 9
0
 public static Web.Kontrahent GetWebKontrahent(API.CRM.Kontrahent kontrahent)
 {
     return(GetWebKontrahent(kontrahent, true));
 }
Ejemplo n.º 10
0
 public IEnumerable <API.Handel.DokumentHandlowy> WgKontrahentDataDefinicja(API.CRM.Kontrahent kontrahent, API.Magazyny.Magazyn magazyn, Types.FromTo fromTo, API.Handel.DefDokHandlowego definicja, API.Handel.StanDokumentuHandlowego stan)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 11
0
 public Business.SubTable WgKontrahent(API.CRM.Kontrahent kontrahent)
 {
     return(GetSubTable("WgKontrahent", kontrahent));
 }
Ejemplo n.º 12
0
 public API.Business.SubTable WgRozchodKontrahentMagazyn(API.CRM.Kontrahent rozchodkontrahent, API.Magazyny.Magazyn magazyn = null, Types.Date data = null, Types.Time czas = null)
 {
     return(GetSubTable("WgRozchodKontrahentMagazyn", rozchodkontrahent, magazyn, data, czas));
 }
Ejemplo n.º 13
0
 public API.Business.SubTable WgPrzychodKontrahent(API.CRM.Kontrahent przychodkontrahent, API.Magazyny.OkresMagazynowy okres = null, API.Magazyny.Magazyn magazyn = null, Types.Date data = null, Types.Time czas = null)
 {
     return(GetSubTable("WgPrzychodKontrahent", przychodkontrahent, okres, magazyn, data, czas));
 }