Exemplo n.º 1
0
        private void SaveAction(object obj)
        {
            try
            {
                if (Helpers.ShowMessage("Yakin Menyimpan Data ? ", "Pilih", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    if (IsBusy)
                    {
                        return;
                    }
                    IsBusy = true;
                    pti model = (pti)this;
                    model.FromId = SettingConfiguration.GetIntValue("CityId");
                    if (IsListValid(model.Collies))
                    {
                        context.SaveChange(model);
                        Saved = true;
                        PTI p = new PTI
                        {
                            ShiperID     = this.ShiperID,
                            RecieverId   = this.RecieverId,
                            CreatedDate  = this.CreatedDate,
                            Id           = this.Id,
                            PayType      = this.PayType,
                            Pcs          = this.Collies.Sum(O => O.Pcs),
                            Weight       = this.Collies.Sum(O => O.Weight),
                            RecieverName = this.Reciever.Name,
                            ShiperName   = this.Shiper.Name,
                            Biaya        = this.Collies.Sum(O => O.Biaya),
                            User         = Authorization.User.Name
                        };
                        ParentSource.Add(p);



                        Helpers.ShowMessage("PTI Berhasil Disimpan");
                        if (Helpers.ShowMessage("Input PTI Baru ? ", "Pilih", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            SetNew();
                        }
                        else
                        {
                            WindowClose();
                        }
                    }
                    else
                    {
                        Helpers.ShowErrorMessage("Item Data Tidak Lengkap, Periksa Kembali");
                    }
                }
            }
            catch (Exception ex)
            {
                MyMessage.Show(ex.Message, "Error", MessageBoxButton.OK);
            }
            finally
            {
                IsBusy = false;
            }
        }
 protected override void Act()
 {
     //wire up
     var section = base.GetMergedSection();
     ParentSource.Remove(SectionName);
     ParentSource.Add(SectionName, new DummySectionWithCollections { Name = "parent", Value = 33 });
     ParentSource.DoSourceChanged(new []{base.SectionName});
 }