public Login() { InitializeComponent(); InitData(); about = new About(); this.restApi = new RESTAPI(); }
public PassKadeIn(Login home) { InitializeComponent(); this.home = home; this.restApi = new RESTAPI(); this.database = new DBConnect(); Initialize(); }
public LostTicket(Login home) { InitializeComponent(); this.home = home; this.webcamImage = webcam; this.camera = new Webcam(this); this.bni = new BNI(); this.database = new DBConnect(); restApi = new RESTAPI(); ipAddressServer = Properties.Settings.Default.IPAddressServer; InitData(); }
public Pedestrian(Login home) { InitializeComponent(); this.home = home; this.restApi = new RESTAPI(); this.database = new DBConnect(); this.bni = new BNI(); this.mifareCard = new MifareCard(this); this.mifareCard.RunMain(); InitData(); InitializePedestrianType(); }
private void Initialize() { this.webcamImage = webcam; this.camera = new Webcam(this); this.restApi = new RESTAPI(); this.parkingIn = new ParkingIn(); autoComplete = new AutoCompleteStringCollection(); this.ip_address_server = Properties.Settings.Default.IPAddressServer; StartLiveCamera(); this.MifareCard = new MifareCard(this); this.MifareCard.RunMain(); InitDataVehicleType(); }
public void Initialize() { InitializeVehicleType(); CameraHelper.StartIpCamera(liveCamera); this.webcamImage = webcam; if (Properties.Settings.Default.WebcamEnabled) { this.camera = new Webcam(this); } nonCash.Checked = true; this.restApi = new RESTAPI(); this.database = new DBConnect(); this.bni = new BNI(); this.mifareCard = new MifareCard(this); this.mifareCard.RunMain(); }
private void Initialize() { this.webcamImage = webcam; if (Properties.Settings.Default.WebcamEnabled) { this.camera = new Webcam(this); } this.restApi = new RESTAPI(); this.database = new DBConnect(); this.parkingIn = new ParkingIn(); autoComplete = new AutoCompleteStringCollection(); nonCash.Checked = true; ip_address_server = Properties.Settings.Default.IPAddressServer; StartLiveCamera(); this.bni = new BNI(); this.mifareCard = new MifareCard(this); this.mifareCard.RunMain(); // initialize vehicle type options try { comboBox1.Items.Add("- Pilih Tipe Kendaraan -"); string masterDataFile = TKHelper.GetApplicationExecutableDirectoryName() + Constant.PATH_FILE_MASTER_DATA_PARKING_OUT; using (StreamReader reader = new StreamReader(masterDataFile)) { string json = reader.ReadToEnd(); dynamic vehicleTypes = JsonConvert.DeserializeObject(json); foreach (var types in vehicleTypes["VehicleTypes"]) { comboBox1.Items.Add(types); } comboBox1.SelectedIndex = 0; } } catch (Exception ex) { Console.WriteLine(ex.Message); notifyIcon.ShowBalloonTip(Constant.NOTIFICATION_TRAY_TIMEOUT, "Error", Constant.ERROR_MESSAGE_FAIL_TO_FETCH_VEHICLE_TYPE_DATA, ToolTipIcon.Error); } }
static void Main(string[] args) { ODBC oDBC = new ODBC(); oDBC.ConnectionString = "DSN=GeoSCADA;Uid=Administrator;Pwd=Administrator@123"; oDBC.Connect(); while (oDBC.IsConnected) { //Extract data from ODBC var Query = " Select \"FileId\", FILEOFFSET, \"RecordTime\", SEVERITY, ID, SOURCE, MESSAGE, ALARMSTATEDESC " + "From CDBEVENTJOURNAL " + "Where " + "(\"CDBEVENTJOURNAL\".\"RecordTime\" BETWEEN { OPC 'S - 10S' } AND { OPC 'S' } )"; Console.WriteLine(Query); var data = oDBC.DataReaderMapToList <CDBEVENTJOURNAL>(oDBC.ReturnTable(Query)); if (data.Count > 0) { Console.WriteLine(data.Count + " Alarms are found"); //Send Data to REST API server RESTAPI rESTAPI = new RESTAPI(); rESTAPI.BaseUrl = ""; rESTAPI.UploadUrl = ""; rESTAPI.UserName = ""; rESTAPI.Password = ""; foreach (CDBEVENTJOURNAL item in data) { rESTAPI.UploadData(JsonConvert.SerializeObject(item)); } } else { Console.WriteLine("No Alarms to be transmitted"); } Thread.Sleep(10000); } }
private void SendDataToServer(int totalFare, string base64Image, string paymentMethod, string bankCode = "") { JObject param = new JObject(); param["uid"] = textBox1.Text.ToString(); param["vehicle"] = comboBox1.Text.ToString(); param["waktu_keluar"] = this.helper.ConvertDatetimeToDefaultFormat(textBox4.Text.ToString()); param["username"] = Properties.Settings.Default.Username; param["plate_number"] = textBox2.Text.ToString(); param["total_fare"] = totalFare; param["ipv4"] = this.helper.GetLocalIPAddress(); param["payment_method"] = paymentMethod; param["bank_code"] = bankCode; param["image"] = base64Image; var sent_param = JsonConvert.SerializeObject(param); RESTAPI save = new RESTAPI(); string ip_address_server = "http://" + Properties.Settings.Default.IPAddressServer; DataResponse response = save.API_Post(ip_address_server, Properties.Resources.SaveDataParkingAPIURL, sent_param); if (response != null) { switch (response.Status) { case 206: MessageBox.Show("Transaksi Berhasil.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Clear(true); break; default: MessageBox.Show(response.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } else { MessageBox.Show("Error found when receiving server response.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public IActionResult Post(JObject payload) { try { string fullname = payload.SelectToken(@"fullname").Value <String>(); string email = payload.SelectToken(@"email").Value <String>(); string mobile = payload.SelectToken(@"mobile").Value <String>(); string birthdate = payload.SelectToken(@"birthdate").Value <String>(); string gender = payload.SelectToken(@"gender").Value <String>(); RESTAPI rest = new RESTAPI(fullname, email, mobile, birthdate, gender); if (rest.GetErrors().Count() > 0) { return(BadRequest(new { message = "Errors Found. Please see error list.", errors = rest.GetErrors().ToArray(), status = 400 })); } else { return(Ok(new { message = "Data saved to MySQL Database", status = 200 })); } } catch (Exception ex) { return(BadRequest(new { message = "Missing one or more parameters", status = 400, exception = ex.Message })); } }
public CustomerREST(RESTAPI.EpicorConnectionInfo conInfo) { epicorRestApi = new RESTAPI(conInfo); }
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e) { if (comboBox1.SelectedIndex != 0) { if (textBox1.Text != "" && textBox1.Text != "UID Card") { if (comboBox1.SelectedIndex != 0) { // send data API var APIUrl = Properties.Resources.RequestUIDFareAPIURL; JObject param = new JObject(); param["uid"] = textBox1.Text; param["vehicle"] = comboBox1.Text; var sent_param = JsonConvert.SerializeObject(param); RESTAPI api = new RESTAPI(); string ip_address_server = "http://" + Properties.Settings.Default.IPAddressServer; DataResponse response = api.API_Post(ip_address_server, APIUrl, sent_param); if (response != null) { switch (response.Status) { case 206: //MessageBox.Show(response.Message, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); foreach (JObject data in response.Data) { // Duration Data Process string duration = data["lama_parkir"].ToString(); string[] temp = duration.Split(':'); txtHour.Text = temp[0]; txtMinute.Text = temp[1]; txtSecond.Text = temp[2]; // Total Fare Process txtGrandTotal.Text = data["tarif_parkir"].ToString(); // Datetime Parking In string datetime_in = data["waktu_masuk"].ToString(); string[] temp_dt_in = datetime_in.Split(' '); textBox3.Text = this.helper.ConvertDatetime(temp_dt_in[0], temp_dt_in[1]); // Datetime Out string datetime_out = data["waktu_keluar"].ToString(); string[] temp_dt_out = datetime_out.Split(' '); textBox4.Text = this.helper.ConvertDatetime(temp_dt_out[0], temp_dt_out[1]); // Load Picture of face and plate number string URL_pict_face = "http://" + Properties.Settings.Default.IPAddressServer + Properties.Resources.repo + "/" + data["gambar_face"].ToString(); PictFace.Load(URL_pict_face); PictFace.BackgroundImageLayout = ImageLayout.Stretch; PictFace.SizeMode = PictureBoxSizeMode.StretchImage; string URL_pict_vehicle = "http://" + Properties.Settings.Default.IPAddressServer + Properties.Resources.repo + "/" + data["gambar_plate"].ToString(); PictVehicle.Load(URL_pict_vehicle); PictVehicle.BackgroundImageLayout = ImageLayout.Stretch; PictVehicle.SizeMode = PictureBoxSizeMode.StretchImage; // Total Fare Process string total_fare = data["tarif_parkir"].ToString(); txtGrandTotal.Text = this.helper.IDR(total_fare); } break; default: MessageBox.Show(response.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Clear(); break; } } else { MessageBox.Show("Error : Can't establish connection to server.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Silahkan Tap Kartunya Terlebih Dahulu.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.ResetComboBox(); return; } } }
private void btnLogin_Click(object sender, EventArgs e) { string username = textBox1.Text.ToString(); string password = textBox2.Text.ToString(); if (username == "" || username == "Username") { MessageBox.Show("Username Harus Diisi.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (password == "" || password == "Password") { MessageBox.Show("Password Harus Diisi.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(this.setting.IPAddressServer)) { MessageBox.Show("Invalid IP Address Server.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(this.setting.IPAddressLiveCamera)) { MessageBox.Show("Invalid IP Address Live Camera.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // validate TID & Settlement MID for further transaction if (string.IsNullOrEmpty(this.tmid.TID)) { MessageBox.Show("Invalid 'TID' value.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(this.tmid.MID)) { MessageBox.Show("Invalid 'Settlement MID' value.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } using (Loading loading = new Loading(SignIn)) { loading.ShowDialog(this); // check local database connection DBConnect database = new DBConnect(); if (!database.CheckMySQLConnection()) { MessageBox.Show("Error : Can't Establish Connection to Local Database.\nPlease setup properly.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // check reader connection BNI bni = new BNI(); if (!bni.CheckReaderConn()) { MessageBox.Show("Error : Contactless Reader not available.\nPlease plug it and then try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // remember me feature if (checkBox1.Checked) { Properties.Settings.Default.Username = username; Properties.Settings.Default.Password = password; Properties.Settings.Default.RememberMe = "yes"; } else { Properties.Settings.Default.Username = username; Properties.Settings.Default.Password = ""; Properties.Settings.Default.RememberMe = "no"; } Properties.Settings.Default.Save(); string ip_address_server = "http://" + this.setting.IPAddressServer; // pull some data from server e.g. Vehicle Types string APIPullData = Properties.Resources.RequestVehicleTypeAPIURL; RESTAPI pull = new RESTAPI(); DataResponse receivedData = pull.API_Get(ip_address_server, APIPullData); if (receivedData != null) { switch (receivedData.Status) { case 206: JArray receivedVehicleTypes = receivedData.Data; JObject vehicleTypes = new JObject(); vehicleTypes.Add(new JProperty("VehicleTypes", receivedVehicleTypes)); // write into a file called 'master-data.json' try { string savedDir = tk.GetApplicationExecutableDirectoryName() + "\\src\\master-data.json"; string json = JsonConvert.SerializeObject(vehicleTypes); System.IO.File.WriteAllText(@savedDir, json); //MessageBox.Show("Pull Master Data is Success.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Console.WriteLine(ex.Message); MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; default: MessageBox.Show(receivedData.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } else { MessageBox.Show("Error : Can't establish connection to server.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } // send data API var APIUrl = Properties.Resources.LoginAPIURL; JObject param = new JObject(); param["username"] = username; param["password"] = password; var sent_param = JsonConvert.SerializeObject(param); RESTAPI api = new RESTAPI(); DataResponse response = api.API_Post(ip_address_server, APIUrl, sent_param); if (response != null) { switch (response.Status) { case 201: //MessageBox.Show(response.Message, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); try { this.cashier = new Cashier(this); this.cashier.Show(); Hide(); } catch (Exception ex) { MessageBox.Show("Error : Can't Connect to Webcam.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } break; default: MessageBox.Show(response.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } else { MessageBox.Show("Error : Can't establish connection to server.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }