private void Loadxml(MyWorkerClass obj) { try { Logininfo.Username = textBox1.Text; var to = textBox1.Text.Trim(); var url = "http://localhost/comido/cgi_bin/is_staff.php?username="******"status"); var i = 0; var parentNode = nodeList[0].ParentNode; var xmlNode = parentNode?.InnerText.Trim(); if (xmlNode != null) { obj.Access = xmlNode; } backgroundWorker1.ReportProgress(i, obj); i++; Thread.Sleep(10); } catch (Exception exec) { bunifuTransition1.HideSync(homeButton1); var interneterror = new InternetError(); interneterror.ShowDialog(); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { const string url = "http://localhost/comido/cgi_bin/fetch_cafeteria_details.php"; var requ = WebRequest.Create(url); requ.Timeout = 80000; var responses = requ.GetResponse(); var stream = responses.GetResponseStream(); var xmlDoc = XDocument.Load(stream); var response = from status in xmlDoc.Descendants("status") where status.Element("Name")?.Value == comboBox1.SelectedItem.ToString() select new { Points = status.Element("CafID")?.Value }; foreach (var status in response) { //timer1.Interval = 10; timer1.Start(); _cafid = status.Points; bunifuCustomLabel2.Text = comboBox1.Text + @" Selected"; panel2.Top = 40; panel2.Left = Screen.PrimaryScreen.Bounds.Width - 250; var m = (panel2.Size.Width - bunifuCustomLabel2.Size.Width) / 2; bunifuCustomLabel2.Location = new Point(m, bunifuCustomLabel2.Location.Y); bunifuTransition1.ShowSync(panel2); } } catch (Exception ce) { var interneterror = new InternetError(); interneterror.ShowDialog(); } }
private void FetchCafeteriaName(MyWorkerClass obj) { try { const string url = "http://localhost/comido/cgi_bin/fetch_cafeteria_details.php"; var request = (HttpWebRequest)WebRequest.Create(url); request.Timeout = 80000; request.ContentType = "application/xml"; var response = (HttpWebResponse)request.GetResponse(); var datastream = response.GetResponseStream(); var reader = XmlReader.Create(datastream ?? throw new InvalidOperationException()); var doc = new XmlDocument(); doc.Load(reader); var nodeList = doc.SelectNodes("response/status"); if (nodeList != null) { obj.Cafetype = nodeList; } const int i = 0; backgroundWorker1.ReportProgress(i, obj); } catch (Exception ce) { var interneterror = new InternetError(); interneterror.ShowDialog(); // to start new instance of application System.Diagnostics.Process.Start(Application.ExecutablePath); //to turn off current app Close(); } }
private void Loadtransaction(MyWorkerClass obj) { try { var attendant = FirstPage.Logininfo.Username; var price = textBox1.Text.Trim(); var cafid = CafSelect.CafeteriaInfo.CafId; const string matric = "null"; var datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); const string type = "cash"; const string pin = "null"; var url = "http://localhost/comido/cgi_bin/insert_transaction.php?matric=" + matric + "&pin=" + pin + "&attendant=" + attendant + "&amount=" + price + "&datetime=" + datetime + "&type=" + type + "&CafID=" + cafid + ""; var requ = WebRequest.Create(url); requ.Timeout = 80000; var response = requ.GetResponse(); var stream = response.GetResponseStream(); var compSpecs = new XmlDocument(); compSpecs.Load(stream ?? throw new InvalidOperationException()); var nodeList = compSpecs.SelectNodes("response"); var i = 0; if (nodeList != null) { var parentNode = nodeList[0].FirstChild; var xmlNode = parentNode?.InnerText.Trim(); if (xmlNode != null) { obj.Access = xmlNode; } } backgroundWorker1.ReportProgress(i, obj); i++; Thread.Sleep(10); } catch (Exception exec) { bunifuTransition1.HideSync(transactionSuccessful1); var interneterror = new InternetError(); interneterror.ShowDialog(); } }