private void InitializeOutload() { try { tarifMuatan.Items.Add("- Pilih Tipe Muatan -"); using (StreamReader reader = new StreamReader(MasterDataFileParkingIn)) { string json = reader.ReadToEnd(); dynamic outloads = JsonConvert.DeserializeObject(json); foreach (var outload in outloads["cargo"]) { int outloadFare = outload["fare"]; string outloadType = outload["name"]; string outloadTypeWithFare = outload["name"] + " - " + TKHelper.IDRWithCurrency(outloadFare.ToString()); tarifMuatan.Items.Add(outloadTypeWithFare); outloadDict.Add(outloadTypeWithFare, outloadFare); outloadTypeDict.Add(outloadTypeWithFare, outloadType); } tarifMuatan.SelectedIndex = 0; } } catch (Exception ex) { Console.WriteLine(ex.Message); notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.ERROR_MESSAGE_FAIL_TO_FETCH_OUTLOAD, ToolTipIcon.Error); } }
private void InitializeData() { int locationY = 20; if (PedestrianDetails.Count > 0) { int counter = 1; foreach (PedestrianDetail pedestrianDetail in PedestrianDetails) { Label labelPedestrianType = new Label(); labelPedestrianType.AutoSize = true; labelPedestrianType.BackColor = Color.WhiteSmoke; labelPedestrianType.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 0); labelPedestrianType.ForeColor = Color.Black; labelPedestrianType.Location = new Point(35, locationY); labelPedestrianType.Name = "labelPedestrianType" + counter; labelPedestrianType.Size = new Size(114, 16); labelPedestrianType.TabIndex = 54; labelPedestrianType.Text = pedestrianDetail.PedestrianType; Label labelPedestrianFareDetail = new Label(); labelPedestrianFareDetail.AutoSize = true; labelPedestrianFareDetail.BackColor = Color.WhiteSmoke; labelPedestrianFareDetail.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 0); labelPedestrianFareDetail.ForeColor = Color.Black; labelPedestrianFareDetail.Location = new Point(245, locationY); labelPedestrianFareDetail.Name = "labelPedestrianFareDetail" + counter; labelPedestrianFareDetail.Size = new Size(96, 16); labelPedestrianFareDetail.TabIndex = 55; labelPedestrianFareDetail.Text = String.Format("{0} x {1}", pedestrianDetail.NumberOfPeople, TKHelper.IDRWithCurrency(pedestrianDetail.PedestrianFare.ToString())); int totalFare = pedestrianDetail.NumberOfPeople * pedestrianDetail.PedestrianFare; Label labelPedestrianTotalFare = new Label(); labelPedestrianTotalFare.AutoSize = true; labelPedestrianTotalFare.BackColor = Color.WhiteSmoke; labelPedestrianTotalFare.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 0); labelPedestrianTotalFare.ForeColor = Color.Black; labelPedestrianTotalFare.Location = new Point(452, locationY); labelPedestrianTotalFare.Name = "labelPedestrianTotalFare" + counter; labelPedestrianTotalFare.Size = new Size(77, 16); labelPedestrianTotalFare.TabIndex = 56; labelPedestrianTotalFare.Text = TKHelper.IDRWithCurrency(totalFare.ToString()); panelPedestrianDetail.Controls.Add(labelPedestrianType); panelPedestrianDetail.Controls.Add(labelPedestrianFareDetail); panelPedestrianDetail.Controls.Add(labelPedestrianTotalFare); locationY += 30; counter++; } } }
private void InitData() { nonCash.Checked = true; datetimeIn.Text = TKHelper.GetCurrentDatetime(); try { string masterDataFile = TKHelper.GetApplicationExecutableDirectoryName() + Constant.PATH_FILE_MASTER_DATA_PARKING_IN; using (StreamReader reader = new StreamReader(masterDataFile)) { string json = reader.ReadToEnd(); dynamic pedestrianData = JsonConvert.DeserializeObject(json); foreach (var data in pedestrianData["pedestrian"]) { string pedestrianName = data["name"]; int pedestrianFare = data["fare"]; PedestrianTypes.Add(pedestrianName, pedestrianFare); } foreach (string data in pedestrianData["notes"]) { FreePassTypes.Add(data); } string defaultText = "- Pilih Tipe Muatan -"; tarifMuatan.Items.Add(defaultText); tarifMuatan.Items.Add("Tidak Ada Muatan"); tarifMuatan.SelectedIndex = 0; foreach (var data in pedestrianData["cargo"]) { string cargoName = data["name"]; int cargoFare = data["fare"]; string CargoNameWithFare = String.Format("{0} - {1}", cargoName, TKHelper.IDRWithCurrency(cargoFare.ToString())); Cargos.Add(CargoNameWithFare, cargoFare); CargoTypes.Add(CargoNameWithFare, cargoName); tarifMuatan.Items.Add(CargoNameWithFare); } } } catch (Exception ex) { Console.WriteLine(ex.Message); notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.ERROR_MESSAGE_FAIL_TO_FETCH_PEDESTRIAN_DATA, ToolTipIcon.Error); } }