示例#1
0
 private void PozycjaAdding()
 {
     if (Zwrot.Status != null && Zwrot.Status.Typ == (int)TypStatusuZwrotu.Zarejestrowany)
     {
         Zwrot.SetStatus(TypStatusuZwrotu.Liczony);
         DbContext.OptimisticSaveChanges();
         DbContext.Refresh(RefreshMode.StoreWins, Zwrot);
         Zwrot.HistoriaZwrotu.Load();
         DataSourceBinding.ResetCurrentItem();
     }
 }
示例#2
0
        private void ZwrotEditForm_Load(object sender, EventArgs e)
        {
            if (this.DataSource != null)
            {
                if (this.Zwrot.EntityState == EntityState.Detached)
                {
                    this.DbContext.Zwroty.AddObject(this.Zwrot);
                }
                if (this.Zwrot.EntityState == EntityState.Added || this.Zwrot.EntityState == EntityState.Detached)
                {
                    this.Zwrot.DataDodania     = DateTime.Now.Date;
                    this.Zwrot.DataModyfikacji = this.Zwrot.DataDodania;
                }
                else if (this.Zwrot.EntityState != EntityState.Deleted)
                {
                    this.DbContext.Refresh(RefreshMode.StoreWins, this.Zwrot);
                    this.Zwrot.Pozycje.Load();
                    this.Zwrot.HistoriaZwrotu.Load();
                    this.Zwrot.OstatniaHistoriaUserReference.Load();
                    this.Zwrot.OstatniStatusReference.Load();
                }

                if (this.Zwrot.Kontrahent != null)
                {
                    var service = Enova.API.EnovaService.Instance;
                    using (var session = service.CreateSession())
                        kontrahentEnovaSelect.SelectedItem = session.GetModule <Enova.API.CRM.CRMModule>().Kontrahenci[this.Zwrot.Kontrahent.Guid.Value];
                }


                statusyBindingSource.DataSource = DbContext.StatusyZwrotow
                                                  .Where(s => s.Deleted == false && s.Synchronize != (int)RowSynchronizeOld.NotsynchronizedDelete).OrderBy(s => s.ID).ToList();

                if (Zwrot.Status == null)
                {
                    Zwrot.SetStatus(TypStatusuZwrotu.Zarejestrowany);
                    DataSourceBinding.ResetCurrentItem();
                }

                loadSezony();
                loadPozycje();
            }
        }
        internal void Copy()
        {
            var binding = this.binder.Bindings.FirstOrDefault(b => b.PropertyName == "Value");

            if (binding != null)
            {
                this.binder.Bindings.Remove(binding);
            }

            if (!string.IsNullOrWhiteSpace(this.ValueBindingExpression))
            {
                var newBinding = new DataSourceBinding
                {
                    Expression   = this.ValueBindingExpression,
                    PropertyName = "Value",
                    Type         = this.ValueBindingType
                };

                this.binder.Bindings.Add(newBinding);
            }

            binding = this.binder.Bindings.FirstOrDefault(b => b.PropertyName == "Type");
            if (binding != null)
            {
                this.binder.Bindings.Remove(binding);
            }

            if (!string.IsNullOrWhiteSpace(this.TypeBndingExpression))
            {
                var newBinding = new DataSourceBinding
                {
                    Expression   = this.TypeBndingExpression,
                    PropertyName = "Type",
                    Type         = this.TypeBindingType
                };

                this.binder.Bindings.Add(newBinding);
            }
        }
示例#4
0
 private void zmienButton_Click(object sender, EventArgs e)
 {
     if (statusComboBox.SelectedItem != null)
     {
         var status = (StatusZwrotu)statusComboBox.SelectedItem;
         if (Zwrot.Status == null || Zwrot.Status.ID != status.ID)
         {
             Zwrot.SetStatus(status);
             DbContext.OptimisticSaveChanges();
             DbContext.Refresh(RefreshMode.StoreWins, Zwrot);
             Zwrot.HistoriaZwrotu.Load();
             DataSourceBinding.ResetCurrentItem();
         }
         else if (Zwrot.OstatniStatusID == null || Zwrot.OstatniStatusID.Value != status.ID)
         {
             Zwrot.OstatniStatusID        = status.ID;
             Zwrot.OstatniaHistoriaUserID = User.LoginedUser.ID;
             DbContext.OptimisticSaveChanges();
             DbContext.Refresh(RefreshMode.StoreWins, Zwrot);
         }
     }
 }