protected async void Register_Click(object sender, EventArgs e) { FirebaseResponse respo = await client.GetAsync("counter"); Counter_class get = respo.ResultAs <Counter_class>(); string cn = (Convert.ToInt32(get.cnt) + 1).ToString(); var estaplish = new Data { EstablishName = estaplishName.Text, Email = email.Text, Phone = phone.Text, Address = address.Text, Username = username.Text, Date = date.Text, Password = this.Encrypt(pass.Text.Trim()), Retypepassword = this.Encrypt(repass.Text.Trim()), RegisterType = "Estaplished" }; SetResponse response = await client.SetAsync("user/" + cn, estaplish); Data result = response.ResultAs <Data>(); var obj = new Counter_class { cnt = cn, }; SetResponse response1 = await client.SetAsync("counter", obj); FirebaseResponse pcnts = await client.GetAsync("Pointcont"); Pointcont pcount = pcnts.ResultAs <Pointcont>(); string pcnt = (Convert.ToInt32(pcount.pcnt) + 1).ToString(); int a = 0; var points = new Point { ورق = a, ألمونيوم = a, بلاستك = a, حديد = a, زجاج = a, كرتون = a, إطارات = a, أخرى = a, Username = username.Text }; SetResponse respons = await client.SetAsync("Point/" + pcnt, points); Point point = response.ResultAs <Point>(); var pobj = new Pointcont { pcnt = pcnt, }; SetResponse presp = await client.SetAsync("Pointcont", pobj); Response.Redirect("Dialog2.aspx"); }
protected async void ListPoints() { int i = 0; FirebaseResponse respo = await client.GetAsync("Pointcont"); Pointcont get = respo.ResultAs <Pointcont>(); int cnt = Convert.ToInt32(get.pcnt); while (true) { if (i == cnt) { break; } i++; try { Double p = 0.050; Double c = 0.060; FirebaseResponse response = await client.GetAsync("Point/" + i); Point result = response.ResultAs <Point>(); Double total = (result.ورق * p) + (result.إطارات) + (result.ألمونيوم) + (result.زجاج) + (result.حديد) + (result.كرتون * c) + (result.بلاستك * p) + (result.أخرى); DataRow rows = dt2.NewRow(); rows["ورق"] = result.ورق; rows["اسم"] = result.Username; rows["إطارات"] = result.إطارات; rows["ألمونيوم"] = result.ألمونيوم; rows["زجاج"] = result.زجاج; rows["حديد"] = result.حديد; rows["كرتون"] = result.كرتون; rows["بلاستيك"] = result.بلاستك; rows["أخرى"] = result.أخرى; rows["قيمة"] = total; dt2.Rows.Add(rows); GridView3.DataSource = dt2; GridView3.DataBind(); } catch { } } }
protected async void GetData(string username) { int i = 0; FirebaseResponse respo = await client.GetAsync("counter"); Counter_class get = respo.ResultAs <Counter_class>(); int cnt = Convert.ToInt32(get.cnt); while (true) { if (i == cnt) { break; } i++; FirebaseResponse response = await client.GetAsync("user/" + i); Data result = response.ResultAs <Data>(); string user1 = result.Username; try { if (Label1.Text == user1) { int s = 0; FirebaseResponse prespo = await client.GetAsync("Pointcont"); Pointcont pget = prespo.ResultAs <Pointcont>(); int pcnt = Convert.ToInt32(pget.pcnt); while (true) { if (s == pcnt) { break; } s++; try { FirebaseResponse presp = await client.GetAsync("Point/" + s); Point point1 = presp.ResultAs <Point>(); int paper = point1.ورق; int glass = point1.زجاج; int cartoon = point1.كرتون; int others = point1.أخرى; int palstic = point1.بلاستك; int toors = point1.إطارات; int alum = point1.ألمونيوم; int me = point1.حديد; int all = paper + glass + cartoon + others + palstic + toors + alum + me; name.Text = result.EstablishName; addr.Text = result.Address; phon.Text = result.Phone; emails.Text = result.Email; types.Text = all.ToString(); name1.Text = result.EstablishName; addr1.Text = result.Address; phon1.Text = result.Phone; emails1.Text = result.Email; date.Text = result.Date; user.Text = result.Username; pass.Text = this.Decrypt(result.Password); repass.Text = this.Decrypt(result.Retypepassword); rtype.Text = result.RegisterType; } catch { } } } } catch { } } }