Пример #1
0
        private async void LoadData()
        {
            var planes = await context.GetPlanes();

            var ports = await context.GetPorts();

            foreach (var item in ports)
            {
                Ports.Add(item);
            }
            Destinations.Refresh();
            Origins.Refresh();

            foreach (var item in planes)
            {
                Planes.Add(item);
            }

            PlanesView.Refresh();
            this.PortFrom = SettingConfiguration.GetIntValue("PortId");

            var portTo = ports.Where(O => O.Id != SettingConfiguration.GetIntValue("PortId")).FirstOrDefault();

            if (portTo != null)
            {
                this.PortTo = portTo.Id;
            }
        }
Пример #2
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;
            }
        }
Пример #3
0
        private async void LoadDataCities()
        {
            var scheduleBussines = new ScheduleBussines();
            var result           = await scheduleBussines.GetCities();

            var fromid = SettingConfiguration.GetIntValue("CityId");

            if (result != null)
            {
                foreach (var item in result.Where(O => O.Id != fromid).ToList())
                {
                    Cities.Add(item);
                }
            }

            if (Cities.Where(O => O.Id != fromid).Count() == 1)
            {
                var city = Cities.FirstOrDefault();
                this.ToId = city.Id;
            }
        }
Пример #4
0
        private async void SetNew()
        {
            Shiper   = new customer();
            Reciever = new customer();
            this.Id  = await CodeGenerate.GetNewPTINumber();

            this.ActiveStatus = ActivedStatus.OK;
            this.CreatedDate  = DateTime.Now;
            this.Etc          = 0;
            this.Note         = string.Empty;
            this.PayType      = PayType.Chash;
            this.RecieverId   = 0;
            this.ShiperID     = 0;
            Shiper            = new customer();
            Reciever          = new customer();
            this.FromId       = SettingConfiguration.GetIntValue("CityId");
            Collies.Clear();
            SourceView.Refresh();

            SumBerat = 0;
            SumBiaya = 0;
            SumColly = 0;
        }