public async void GetDataPenjualanAsync(DateTime start, DateTime end)
        {
            this.context = ResourcesBase.GetMainWindowViewModel().PenjualanCollection;
            if (StartDate != null && EndDate != null && StartDate <= EndDate)
            {
                var result = await context.GetPenjualanFromTo(start, end);

                if (result != null)
                {
                    if (vm.ShiperSelected != null && vm.ShiperSelected.Id != 0)
                    {
                        reportDataSource.Value = result.Where(O => O.Shiper == vm.ShiperSelected.Name).ToList();
                    }
                    else if (result != null)
                    {
                        reportDataSource.Value = result;
                    }
                    reportViewer.RefreshReport();
                }
                else
                {
                    ModernDialog.ShowMessage("Data Tidak Ada", "Not Found", MessageBoxButton.OK);
                }
            }
        }
Beispiel #2
0
        private void AbsenCollection_OnChangeSource(absen obj)
        {
            var MainCollection = ResourcesBase.GetMainWindowViewModel().AbsenTodayCollection;

            Pegawai.AbsenToday = obj;
            MainCollection.SourceView.Refresh();
        }
Beispiel #3
0
        public void Add(T item)
        {
            Client        client  = new Client();
            var           obj     = JsonConvert.SerializeObject(item);
            StringContent content = new StringContent(obj, Encoding.UTF8, "application/json");

            try
            {
                var response = client.ClientContext.PostAsync(uri, content).Result;
                if (response.IsSuccessStatusCode == true)
                {
                    var result = JsonConvert.DeserializeObject <T>(response.Content.ReadAsStringAsync().Result);
                    if (response != null)
                    {
                        list.Add(result);
                        OnChangeSource?.Invoke(result);
                        SourceView.Refresh();
                    }
                    ResourcesBase.ShowMessage("Data Berhasil Ditambah");
                }
                else
                {
                    throw new SystemException(response.ReasonPhrase);
                }
            }
            catch (Exception ex)
            {
                ResourcesBase.ShowMessageError(ex.Message);
            }
        }
        private async void SaveAction()
        {
            var item = new ModelsShared.Models.userprofile
            {
                Address   = this.Address,
                FirstName = this.FirstName,
                LastName  = this.LastName,
                UserId    = this.UserId,
                Photo     = this.Photo,
                UserName  = this.UserName
            };

            bool result = false;

            if (IsNew)
            {
                result = await MainVM.UserProfileCollections.Add(item);
            }
            else
            {
                result = await MainVM.UserProfileCollections.Update(this.UserId, item);
            }

            if (result)
            {
                ResourcesBase.ShowMessage("Data Berhasil Disimpan");
            }
            else
            {
                ResourcesBase.ShowMessageError("Data Tidak Tersimpan");
            }
        }
        public async Task <bool> Add(userprofile item)
        {
            try
            {
                var           obj     = JsonConvert.SerializeObject(item);
                StringContent content = new StringContent(obj);
                var           result  = await client.ClientContext.PostAsync("/Api/UserProfile", content);

                if (result.IsSuccessStatusCode)
                {
                    var newitem = JsonConvert.DeserializeObject <userprofile>(result.Content.ReadAsStringAsync().Result);
                    this.Source.Add(newitem);
                    return(true);
                }
                else
                {
                    throw new SystemException("Data Tidak Tersimpan");
                }
            }
            catch (Exception ex)
            {
                ResourcesBase.ShowMessageError(ex.Message);
                return(false);
            }
        }
        internal async void GetPenjualan()
        {
            if (this.PortType != PortType.None)
            {
                this.PenjualanTemporaty.Clear();
                OriginView.Refresh();
                DestinationView.Refresh();
                this.PenjualanTemporaryView.Refresh();
                this.SourceFromDatabase = new List <Models.PenjualanView>();
                if (this.AgentId > 0 && this.PortType != ModelsShared.Models.PortType.None)
                {
                    var result = await ResourcesBase.GetMainWindowViewModel().PenjualanCollection.GetByParameter(new Manifestoutgoing {
                        AgentId = this.AgentId, PortType = this.PortType
                    });

                    var customers = ResourcesBase.GetMainWindowViewModel().CustomerCollection.Source;
                    if (result != null && customers != null)
                    {
                        var a = from r in result
                                select new Models.PenjualanView {
                            Id = r.Id, STT = r.STT, Colly = r.Colly, Shiper = r.Shiper, Reciver = r.Reciver
                        };

                        this.SourceFromDatabase.Clear();
                        foreach (var item in a)
                        {
                            this.SourceFromDatabase.Add(item);
                        }
                    }
                }
            }
        }
Beispiel #7
0
        private async void AddNewPictureAction(object obj)
        {
            ModelsShared.Photo ph = new ModelsShared.Photo();
            var    dialogresult   = ResourcesBase.ShowOpenFileDialog();
            string filename       = dialogresult.FileName;

            if (!string.IsNullOrEmpty(filename))
            {
                using (var stream = new MemoryStream())
                {
                    var file = File.Open(filename, FileMode.Open);
                    file.CopyTo(stream);
                    file.Close();
                    ph.Picture = stream.ToArray();
                }
                ph.PenjualanId = PenjualanItem.Id;
                ph.Ext         = filename.Split('.')[1];
                var context = ResourcesBase.GetMainWindowViewModel().PenjualanCollection;
                var res     = await context.AddNewPhoto(ph);

                if (res != null)
                {
                    Galeries.Add(res);
                    GaleriesView.Refresh();
                    SelectedPhoto = res;
                }
            }
        }
 public static ResourcesBase getResources()
 {
     if (resourcesBase == null) {
         resourcesBase = new ResourcesBase ();
     }
     return resourcesBase;
 }
Beispiel #9
0
        public bool  Remove(T item)
        {
            dynamic a      = item;
            var     ApiUrl = uri + "?id=" + a.Id;

            try
            {
                if (ResourcesBase.MessageAsk("Yakin Hapus Data ?"))
                {
                    Client client   = new Client();
                    var    response = client.ClientContext.DeleteAsync(ApiUrl).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        list.Remove(item);
                        OnChangeSource(item);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                ResourcesBase.ShowMessageError(ex.Message);
                return(false);
            }
        }
Beispiel #10
0
        private void DeleteCommandAction(object obj)
        {
            var sure = ResourcesBase.MessageAsk("Yakin Hapus Data ?");

            if (sure)
            {
            }
        }
Beispiel #11
0
 public AbsenVerification(pegawai selectedPegawai)
 {
     InitializeComponent();
     Pegawai          = selectedPegawai;
     Finger           = ResourcesBase.GetFinger();
     this.DataContext = this;
     this.Loaded     += AbsenVerification_Loaded;
 }
 private void PrintPictureAction(object obj)
 {
     ResourcesBase.PrintPreview("Print Photo", "TrireksaApp.Reports.Layouts.PrintImageLayout.rdlc",
                                new Microsoft.Reporting.WinForms.ReportDataSource {
         Value = new List <Photo> {
             SelectedPhoto
         }
     }, null);
 }
 public CustomerCreateVM()
 {
     MainVM = ResourcesBase.GetMainWindowViewModel();
     this.CustomersTypes = new List <ModelsShared.Models.CustomerType>();
     CustomersTypes.Add(ModelsShared.Models.CustomerType.Organization);
     CustomersTypes.Add(ModelsShared.Models.CustomerType.Person);
     Save = new CommandHandler {
         CanExecuteAction = x => SaveValidation(), ExecuteAction = x => SaveAction()
     };
 }
        private void Enrollpage_On_Enroll(DPCtlXUru.EnrollmentXControl enrollmentControl, XFmdResult result, int fingerPosition)
        {
            // Helper.Fmds.Add(fingerPosition, result.Fmd.Fmd);//Helper.Source.Add(result.Fmd.Fmd.Bytes);
            var fmdxml = Fmd.SerializeXml(result.Fmd.Fmd);
            var main   = ResourcesBase.GetMainWindowViewModel();

            Pegawai.Enrollment = fmdxml;
            var res = main.PegawaiCollection.Updated(Pegawai);

            SendMessage(ActionMessage.SendMessage, "Enroll Complete");
        }
Beispiel #15
0
        private async void DeletePictureAction(object obj)
        {
            var context   = ResourcesBase.GetMainWindowViewModel().PenjualanCollection;
            var isDeleted = await context.DeletePhoto(SelectedPhoto);

            if (isDeleted)
            {
                Galeries.Remove(SelectedPhoto);
                GaleriesView.Refresh();
            }
        }
Beispiel #16
0
        public Nota()
        {
            InitializeComponent();
            this.DataContext = this;
            var main = ResourcesBase.GetMainWindowViewModel();

            Config        = main.SystemConfiguration;
            ShiperCities  = (CollectionView)CollectionViewSource.GetDefaultView(main.CityCollection.Source);
            ReciverCities = (CollectionView)CollectionViewSource.GetDefaultView(main.CityCollection.Source);
            this.Loaded  += Nota_Loaded;
        }
 private void Load()
 {
     SaveCommand = new CommandHandler {
         CanExecuteAction = x => string.IsNullOrEmpty(error), ExecuteAction = SaveCommandAction
     };
     CancelCommand = new CommandHandler {
         CanExecuteAction = x => true, ExecuteAction = x => WindowClose()
     };
     this.main    = ResourcesBase.GetMainWindowViewModel();
     this.Bidangs = (CollectionView)CollectionViewSource.GetDefaultView(main.BidangCollection);
 }
Beispiel #18
0
        public AgentCreateVM()
        {
            this.CitySourceView  = ResourcesBase.GetMainWindowViewModel().CityCollection.SourceView;
            this.AgentCollection = ResourcesBase.GetMainWindowViewModel().AgentCollection;

            Save = new CommandHandler {
                CanExecuteAction = x => SaveValidation(), ExecuteAction = x => SaveAction()
            };
            Cancel = new CommandHandler {
                CanExecuteAction = x => true, ExecuteAction = x => CancelAction()
            };
        }
Beispiel #19
0
 private void DeletePackAction()
 {
     if (SimulationPack.PackSelectedItem.PackingLists.Count > 0)
     {
         ResourcesBase.ShowMessageError("Kosongkan Pack Sebelum Dihapus");
     }
     else
     {
         SimulationPack.Packs.Remove(SimulationPack.PackSelectedItem);
         SimulationPack.PacksView.Refresh();
     }
 }
Beispiel #20
0
        public HomeViewModel()
        {
            MainCollection = ResourcesBase.GetMainWindowViewModel().AbsenTodayCollection;

            RingProgressActive = true;
            Today = DateTime.Now;
            MainCollection.SourceView.Refresh();
            SetAbsenCommand = new CommandHandler {
                CanExecuteAction = x => true, ExecuteAction = SetAbsenAction
            };
            RingProgressActive = false;
        }
 private void LoadAsync()
 {
     MainVM      = ResourcesBase.GetMainWindowViewModel();
     Jenises     = ResourcesBase.GetEnumCollection <StatusKehadiran>();
     SaveCommand = new CommandHandler {
         CanExecuteAction = SaveValidate, ExecuteAction = SaveCommandAction
     };
     CloseCommand = new CommandHandler {
         CanExecuteAction = x => true, ExecuteAction = x => WindowClose()
     };
     MainVM.PerizinanCollection.OnChangeSource += PerizinanCollection_OnChangeSource;
 }
 public PegawaiViewModel()
 {
     this.MainViewModel = ResourcesBase.GetMainWindowViewModel();
    MainPegawai=MainViewModel.PegawaiCollection;
     MainPegawai.SourceView.Refresh();
     AddCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = AddCommandAction };
     EditCommand = new CommandHandler { CanExecuteAction = x => SelectedItem != null, ExecuteAction = EditCommandAction };
     AddPengawasCommand = new CommandHandler { CanExecuteAction = AddPengawasCommandValidation, ExecuteAction = AddPengawasCommandAction };
     DeleteCommand = new CommandHandler { CanExecuteAction = x => SelectedItem != null, ExecuteAction = DeleteCommandAction };
     ViewAbsenCommand = new CommandHandler { CanExecuteAction = x => SelectedItem != null, ExecuteAction = ViewAbsenCommandAction };
     ChangeFotoCommand = new CommandHandler { CanExecuteAction = x => SelectedItem != null, ExecuteAction = ChangeFotoAction };
     EnrollmentCommand = new CommandHandler { CanExecuteAction = x => SelectedItem != null, ExecuteAction = EnrollmentCommandAction };
 }
Beispiel #23
0
        public PortListVM()
        {
            Delete = new CommandHandler {
                CanExecuteAction = x => DeleteValidation(), ExecuteAction = x => DeleteAction()
            };
            Edit = new CommandHandler {
                CanExecuteAction = x => EditValidation(), ExecuteAction = x => EditAction()
            };

            MainVm          = ResourcesBase.GetMainWindowViewModel();
            this.Collection = MainVm.PortCollection;
            Collection.SourceView.Filter = FilterItem;
        }
Beispiel #24
0
        public PengaturanViewModel()
        {
            SaveCommand = new CommandHandler {
                CanExecuteAction = SaveValidate, ExecuteAction = SaveAction
            };
            var main = ResourcesBase.GetMainWindowViewModel();

            MainCollection = main.PengaturanCollection;
            MainCollection.OnChangeSource += MainCollection_OnChangeSource;
            MainCollection.SourceView.Refresh();
            RingProgressActive = true;
            LoadAsync();
        }
Beispiel #25
0
        public PenjualanCreateVM()
        {
            this.MainVM        = ResourcesBase.GetMainWindowViewModel();
            this.AppConfig     = MainVM.SystemConfiguration;
            this.TypeOfWeights = ResourcesBase.GetEnumCollection <TypeOfWeight>();
            this.PortTypes     = ResourcesBase.GetEnumCollection <PortType>();
            this.PayTypes      = ResourcesBase.GetEnumCollection <PayType>();

            ShipersSource  = new ObservableCollection <customer>(MainVM.CustomerCollection.Source);
            ReciversSource = new ObservableCollection <customer>(MainVM.CustomerCollection.Source);
            WillPaySource  = new ObservableCollection <customer>(MainVM.CustomerCollection.Source);
            CitiesSource   = new ObservableCollection <city>(MainVM.CityCollection.Source);

            this.Origins      = (CollectionView)CollectionViewSource.GetDefaultView(CitiesSource);
            this.Destinations = (CollectionView)CollectionViewSource.GetDefaultView(CitiesSource);
            this.Shipers      = (CollectionView)CollectionViewSource.GetDefaultView(ShipersSource);
            this.Recivers     = (CollectionView)CollectionViewSource.GetDefaultView(ReciversSource);
            this.WillPays     = (CollectionView)CollectionViewSource.GetDefaultView(WillPaySource);


            Shipers.Filter  = ShiperFilter;
            Recivers.Filter = ReciverFilter;
            WillPays.Filter = WillPayFilter;


            Save = new CommandHandler {
                CanExecuteAction = x => SaveValidation(), ExecuteAction = SaveAction
            };
            Print = new CommandHandler {
                CanExecuteAction = x => PrintSelected != null, ExecuteAction = x => PrintAction()
            };
            PrintWithForm = new CommandHandler {
                CanExecuteAction = x => PrintSelected != null, ExecuteAction = x => PrintFormAction()
            };
            SaveAndPrint = new CommandHandler {
                CanExecuteAction = x => SaveValidation(), ExecuteAction = x => SaveAndPrintAction()
            };
            Cancel = new CommandHandler {
                CanExecuteAction = x => true, ExecuteAction = x => CancalAction()
            };
            Search = new CommandHandler {
                ExecuteAction = SearchAction
            };
            ChangeWeight = new CommandHandler {
                ExecuteAction = x => ChangeWeightAction()
            };
            PriceUpdate = new CommandHandler {
                CanExecuteAction = PriceUpdateValidation, ExecuteAction = PriceUpdateAction
            };
            CreateNewSTT();
        }
Beispiel #26
0
 public BidangViewModel()
 {
     MainCollection = ResourcesBase.GetMainWindowViewModel().BidangCollection;
     MainCollection.SourceView.Refresh();
     AddCommand = new CommandHandler {
         CanExecuteAction = x => true, ExecuteAction = AddCommandAction
     };
     EditCommand = new CommandHandler {
         CanExecuteAction = x => SelectedItem != null, ExecuteAction = EditCommandAction
     };
     DeleteCommand = new CommandHandler {
         CanExecuteAction = x => SelectedItem != null, ExecuteAction = DeleteCommandAction
     };
 }
        private async void SetInvoice(ModelsShared.Models.penjualan selected)
        {
            var context = ResourcesBase.GetMainWindowViewModel().InvoiceCollections;
            var x       = await context.GetInvoiceForPenjualanInfo(selected.Id);

            if (x != null)
            {
                this.InvoiceStatusView               = new invoice();
                this.InvoiceStatusView.Number        = x.Number;
                this.InvoiceStatusView.CreateDate    = x.CreateDate;
                this.InvoiceStatusView.IsDelivery    = x.IsDelivery;
                this.InvoiceStatusView.InvoiceStatus = x.InvoiceStatus;
            }
        }
        public JabatanViewModel()
        {
            MainCollection = ResourcesBase.GetMainWindowViewModel().JabatanCollection;

            AddCommand = new CommandHandler {
                CanExecuteAction = x => true, ExecuteAction = AddCommandAction
            };
            EditCommand = new CommandHandler {
                CanExecuteAction = x => SelectedItem != null, ExecuteAction = EditCommandAction
            };
            DeleteCommand = new CommandHandler {
                CanExecuteAction = x => SelectedItem != null, ExecuteAction = DeleteCommandAction
            };
        }
Beispiel #29
0
        internal async Task Save(bool print = false)
        {
            var MainVM = ResourcesBase.GetMainWindowViewModel();

            try
            {
                this.UpdateDate = DateTime.Now;
                if (this.Id <= 0)
                {
                    this.Actived = true;
                    var result = await MainVM.PenjualanCollection.Add(this);

                    if (result != null)
                    {
                        ModernDialog.ShowMessage("Data Is Saved !", "Information", System.Windows.MessageBoxButton.OK);
                    }
                    else
                    {
                        throw new SystemException("Data Not Saved !");
                    }
                }
                else
                {
                    if (Id > 0 && Details != null && Details.Count > 0)
                    {
                        foreach (var dataItem in Details)
                        {
                            dataItem.PenjualanId = Id;
                        }
                    }

                    var result = await MainVM.PenjualanCollection.Update(Id, this);

                    if (result)
                    {
                        MainVM.PenjualanCollection.SourceView.Refresh();
                        ModernDialog.ShowMessage("Data Is Saved !", "Information", System.Windows.MessageBoxButton.OK);
                    }
                    else
                    {
                        throw new SystemException("Data Not Saved !");
                    }
                }
            }
            catch (Exception ex)
            {
                ModernDialog.ShowMessage(ex.Message, "Error", System.Windows.MessageBoxButton.OK);
            }
        }
Beispiel #30
0
        public PortCreateVM()
        {
            var vm = ResourcesBase.GetMainWindowViewModel();

            Collection     = vm.PortCollection;
            CityCollection = vm.CityCollection;
            PortTypes      = ResourcesBase.GetEnumCollection <ModelsShared.Models.PortType>();

            Save = new CommandHandler {
                CanExecuteAction = x => SaveValidation(), ExecuteAction = x => SaveAction()
            };
            Cancel = new CommandHandler {
                CanExecuteAction = x => true, ExecuteAction = c => CancelAction()
            };
        }
Beispiel #31
0
        private async void GetThumbs(ModelsShared.Models.Penjualan selectedItem)
        {
            var context = ResourcesBase.GetMainWindowViewModel().PenjualanCollection;
            var result  = await context.GetPhotoByPenjualanId(selectedItem.Id);

            if (result != null)
            {
                foreach (var item in result)
                {
                    Galeries.Add(item);
                }

                GaleriesView.Refresh();
            }
        }