Exemplo n.º 1
0
        public bool SaveChanges()
        {
            EnovaContext dc = ContextManager.DataContext;

            if (this.EntityState == EntityState.Detached || this.EntityState == EntityState.Added)
            {
                if (this.EntityState == EntityState.Detached)
                {
                    dc.AddToDictionarySet(this);
                }

                if (Enova.Business.Old.DB.Web.User.LoginedUser.EnovaOperator != null)
                {
                    ChangeInfo ci = new ChangeInfo()
                    {
                        Operator    = Enova.Business.Old.DB.Web.User.LoginedUser.EnovaOperator,
                        SourceGuid  = this.Guid,
                        SourceTable = "Dictionary",
                        Type        = 1,
                        Time        = DateTime.Now,
                        Info        = string.Empty
                    };
                    dc.AddToChangeInfos(ci);
                }
            }

            dc.SaveChanges();

            return(true);
        }
Exemplo n.º 2
0
        public bool DeleteRecord()
        {
            EnovaContext dc = ContextManager.DataContext;

            deleteDictionary(dc, this);

            dc.SaveChanges();

            return(true);
        }
Exemplo n.º 3
0
 public void SetOgraniczenieSprzedazyStan(EnovaContext ec, Web.WebContext lc, int stanMagazynu)
 {
     if (ec != null)
     {
         Feature feature = this.Features.Where(f => f.Name == "STAN MAGAZYNU").FirstOrDefault();
         if (feature != null)
         {
             feature.Data = stanMagazynu.ToString();
             ec.SaveChanges();
             if (stanMagazynu <= 0)
             {
                 this.UstawDostepnosc(ec, lc, false);
             }
         }
     }
 }
Exemplo n.º 4
0
        public bool DeleteRecord()
        {
            if (Enova.Business.Old.DB.Web.User.LoginedUser.CheckPerissions(true, null))
            {
                EnovaContext dc = Enova.Business.Old.Core.ContextManager.DataContext;
                dc.DeleteObject(this);
                foreach (var fe in dc.Features.Where(f => f.ParentType == "Kontrahenci" && f.Parent == this.ID).ToList())
                {
                    dc.DeleteObject(fe);
                }

                Operator op = null;
                if (!string.IsNullOrEmpty(Enova.Business.Old.DB.Web.User.LoginedUser.EnovaOperatorLogin))
                {
                    op = dc.OperatorByName(Enova.Business.Old.DB.Web.User.LoginedUser.EnovaOperatorLogin);
                }
                else
                {
                    op = dc.OperatorByName(Enova.Business.Old.DB.Web.User.LoginedUser.Login);
                }

                if (op != null)
                {
                    dc.AddToChangeInfos(new ChangeInfo()
                    {
                        Operator    = op,
                        SourceGuid  = this.Guid,
                        SourceTable = "Kontrahenci",
                        Type        = (int)Enova.Business.Old.Types.ChangeInfoType.Deleted,
                        Time        = DateTime.Now,
                        Info        = this.Nazwa + " (" + this.Kod + ")"
                    });
                }

                foreach (var k in this.KontaktyOsoby)
                {
                    if (k.EntityState != EntityState.Deleted && k.EntityState != EntityState.Detached)
                    {
                        ContextManager.DataContext.DeleteObject(k);
                    }
                }

                dc.SaveChanges();
            }
            return(true);
        }
Exemplo n.º 5
0
        public bool DeleteRecord()
        {
            EnovaContext dc = Enova.Business.Old.Core.ContextManager.DataContext;

            dc.DeleteObject(this);

            if (Enova.Business.Old.DB.Web.User.LoginedUser.EnovaOperator != null)
            {
                ChangeInfo ci = new ChangeInfo()
                {
                    Operator    = Enova.Business.Old.DB.Web.User.LoginedUser.EnovaOperator,
                    SourceGuid  = this.Guid,
                    SourceTable = "FeatureDefs",
                    Type        = 4,
                    Time        = DateTime.Now,
                    Info        = this.Name + " (" + this.TableName + ")"
                };
                dc.AddToChangeInfos(ci);
            }

            dc.SaveChanges();

            return(true);
        }