protected async void Updat_Details(object sender, EventArgs e) { 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 respon = await client.GetAsync("user/" + i); Data result1 = respon.ResultAs <Data>(); string user1 = result1.Username; try { if (Label1.Text == user1) { var data = new Data { EstablishName = name1.Text, Email = emails1.Text, Phone = phon1.Text, Address = addr1.Text, Username = Label1.Text, Date = date.Text, Password = this.Encrypt(pass.Text.Trim()), Retypepassword = this.Encrypt(repass.Text.Trim()), RegisterType = rtype.Text }; FirebaseResponse response = await client.UpdateAsync("user/" + i, data); Data result = response.ResultAs <Data>(); name1.Visible = false; name.Visible = true; phon.Visible = true; phon1.Visible = false; addr.Visible = true; addr1.Visible = false; emails.Visible = true; emails1.Visible = false; types.Visible = true; bu1.Visible = true; bu2.Visible = false; GetData(Label1.Text); } } catch { } } }
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 truck = new Data { TruckName = TruckName.Text, CarType = carname.Text, Phone = phone.Text, Address = address.Text, Username = username.Text, Password = this.Encrypt(pass.Text.Trim()), Retypepassword = this.Encrypt(repass.Text.Trim()), RegisterType = "Truck", Date = date.Text, RegisterState = "قيد المراجعة" }; SetResponse response = await client.SetAsync("user/" + cn, truck); Data result = response.ResultAs <Data>(); var obj = new Counter_class { cnt = cn, }; SetResponse response1 = await client.SetAsync("counter", obj); string smtpAddress = "smtp.live.com"; int portNumber = 587; bool enableSSL = true; string emailFrom = "*****@*****.**"; string emailPassword = "******"; string emailTo = "*****@*****.**"; string subject = "Truck Information"; string body = "الإسم الثلاثي:" + TruckName.Text + "\n نوع الشاحنه: " + carname.Text + "\n الهاتف:" + phone.Text + "\n الموقع:" + address.Text + "اسم المستخدم\n:" + username.Text + "\n كلمة المرور:" + Encrypt(pass.Text.Trim()) + "\n تأكيد كلمة المرور:" + Encrypt(repass.Text.Trim()); using (MailMessage Forget = new MailMessage()) { Forget.From = new MailAddress(emailFrom); Forget.To.Add(emailTo); Forget.Subject = subject; Forget.Body = body; Forget.IsBodyHtml = false; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFrom, emailPassword); smtp.EnableSsl = enableSSL; smtp.Send(Forget); Response.Redirect("Dialog3.aspx"); } } // Response.Redirect("Dialog3.aspx"); }
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 ListRegister() { 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++; try { FirebaseResponse response = await client.GetAsync("user/" + i); Data result = response.ResultAs <Data>(); DataRow rows = dt1.NewRow(); if (result.RegisterType == "Company") { rows["تاريخ"] = result.Date; rows["اسم"] = result.CompanyName; rows["نوع"] = result.CarType; rows["الهاتف"] = result.Phone; rows["البريد"] = result.Email; rows["الموقع"] = result.Address; rows["الحالة"] = result.RegisterState; dt1.Rows.Add(rows); GridView1.DataSource = dt1; GridView1.DataBind(); } if (result.RegisterType == "Truck") { rows["تاريخ"] = result.Date; rows["اسم"] = result.TruckName; rows["نوع"] = result.CarType; rows["الهاتف"] = result.Phone; rows["البريد"] = result.Email; rows["الموقع"] = result.Address; rows["الحالة"] = result.RegisterState; dt1.Rows.Add(rows); GridView1.DataSource = dt1; GridView1.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; Label2.Text = result.TruckName; try { if (Label1.Text == user1) { name.Text = result.TruckName; addr.Text = result.Address; phon.Text = result.Phone; emails.Text = result.CarType; name1.Text = result.TruckName; addr1.Text = result.Address; phon1.Text = result.Phone; emails1.Text = result.CarType; date.Text = result.Date; user.Text = result.Username; pass.Text = this.Decrypt(result.Password); repass.Text = this.Decrypt(result.Retypepassword); state.Text = result.RegisterState; rtype.Text = result.RegisterType; } } 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 { } } }
protected async void ListTruck() { int i = 0; FirebaseResponse respos = await client.GetAsync("contrequest"); CountRequest obj = respos.ResultAs <CountRequest>(); int cnt = Convert.ToInt32(obj.contr); while (true) { if (i == cnt) { break; } i++; try { int t = 0; FirebaseResponse respo = await client.GetAsync("counter"); Counter_class get = respo.ResultAs <Counter_class>(); int tcnt = Convert.ToInt32(get.cnt); while (true) { if (t == tcnt) { break; } t++; FirebaseResponse tresponse = await client.GetAsync("user/" + t); Data tresult = tresponse.ResultAs <Data>(); string user1 = tresult.Username; if (Label1.Text == user1) { FirebaseResponse response = await client.GetAsync("Requests/" + i); Bader result = response.ResultAs <Bader>(); string user = tresult.TruckName; if (user == name.Text && result.TruckRequest == "truck") { DataRow row1 = dt1.NewRow(); row1["اسم المؤسسة"] = result.EstablishName; row1["الهاتف"] = result.Phone; row1["الموقع"] = result.Address; row1["النوع"] = result.RecycleType; row1["شركة إعادة التدوير"] = result.CompanyName; row1["موقع الشركة"] = result.CompanyAddress; row1["الهاتف الشركة"] = result.CompanyPhone; row1["التاريخ"] = result.Date; row1["الحالة"] = result.RequestType; row1["الكمية"] = result.Weight; row1["نوع"] = result.Type; dt1.Rows.Add(row1); GridView1.DataSource = dt1; GridView1.DataBind(); } } } } catch { } } }
protected async void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ok") { int rowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridView1.Rows[rowIndex]; string country = row.Cells[6].Text; string email = row.Cells[3].Text; 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++; try { FirebaseResponse response = await client.GetAsync("user/" + i); Data result = response.ResultAs <Data>(); string cname = result.CompanyName; string tname = result.TruckName; string add = result.Address; string em = result.Email; string user = result.Username; string date = result.Date; string ph = result.Phone; string retyp = result.Recycletype; string pass = this.Decrypt(result.Password.Trim()); string rg = result.RegisterType; string rgs = result.RegisterState; string car = result.CarType; if (country == result.CompanyName) { var data = new Data { CompanyName = country, Email = email, Phone = ph, Address = add, Username = user, Date = date, Password = this.Encrypt(pass.Trim()), Retypepassword = this.Encrypt(pass.Trim()), Recycletype = retyp, RegisterState = "تم الإتفاق", RegisterType = rg }; FirebaseResponse response1 = await client.UpdateAsync("user/" + i, data); Data result1 = response1.ResultAs <Data>(); Response.Redirect("AdminDefault.aspx", false); } if (country == result.TruckName) { var data = new Data { TruckName = tname, CarType = car, Phone = ph, Address = add, Username = user, Date = date, Password = this.Encrypt(pass.Trim()), Retypepassword = this.Encrypt(pass.Trim()), RegisterState = "تم الإتفاق", RegisterType = rg }; FirebaseResponse response2 = await client.UpdateAsync("user/" + i, data); Data result2 = response2.ResultAs <Data>(); Response.Redirect("AdminDefault.aspx", false); } } catch { } } } }
protected async void Register_Click(object sender, EventArgs e) { string message = ""; foreach (ListItem item in type.Items) { if (item.Selected) { message += item.Value + " "; } } FirebaseResponse respo = await client.GetAsync("counter"); Counter_class get = respo.ResultAs <Counter_class>(); string cn = (Convert.ToInt32(get.cnt) + 1).ToString(); var data = new Data { CompanyName = companyName.Text, Email = email.Text, Phone = phone.Text, Address = address.Text, Username = username.Text, Password = this.Encrypt(pass.Text.Trim()), Retypepassword = this.Encrypt(repass.Text.Trim()), Recycletype = message, RegisterType = "Company", Date = date.Text, RegisterState = "قيد المراجعة" }; SetResponse response = await client.SetAsync("user/" + cn, data); Data result = response.ResultAs <Data>(); var obj = new Counter_class { cnt = cn, }; SetResponse response1 = await client.SetAsync("counter", obj); string smtpAddress = "smtp.live.com"; int portNumber = 587; bool enableSSL = true; string emailFrom = "*****@*****.**"; string emailPassword = "******"; string emailTo = "*****@*****.**"; string subject = "Company Information"; string body = "إسم الشركه:" + companyName.Text + "\n البريد الإلكتروني: " + email.Text + "\n الهاتف:" + phone.Text + "\n الموقع:" + address.Text + "\n شركة متخصصه ب:" + type.SelectedItem.Text + "اسم المستخدم:" + username.Text + "\n كلمة المرور:" + Encrypt(pass.Text.Trim()) + "\n تأكيد كلمة المرور:" + Encrypt(repass.Text.Trim()); using (MailMessage Forget = new MailMessage()) { Forget.From = new MailAddress(emailFrom); Forget.To.Add(emailTo); Forget.Subject = subject; Forget.Body = body; Forget.IsBodyHtml = false; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFrom, emailPassword); smtp.EnableSsl = enableSSL; smtp.Send(Forget); Response.Redirect("Dialog.aspx"); } } //Response.Redirect("Dialog.aspx"); }
protected async void Register_Click(object sender, EventArgs e) { if (pass.Text == "" || username.Text == "") { message.Visible = true; message.Text = GetLocalResourceObject("errormessage").ToString(); } else { 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++; try { FirebaseResponse response = await client.GetAsync("user/" + i); Data da = response.ResultAs <Data>(); string user = da.Username; string type = da.RegisterType; string state = da.RegisterState; string password = Decrypt(da.Password.Trim()); if (username.Text == user && pass.Text == password) { if (type == "Admin") { Response.Redirect("AdminDefault.aspx", false); } if (type == "Estaplished") { Session["FirstName"] = username.Text; Response.Redirect("CustomerDefault.aspx", false); } if (type == "Company") { if (state == "قيد المراجعة") { message.Visible = true; message.Text = "ليس لديك صلاحية بالدخول"; } else { Session["FirstName"] = username.Text; Response.Redirect("CompanyDefault.aspx", false); } } if (type == "Truck") { if (state == "قيد المراجعة") { message.Visible = true; message.Text = "ليس لديك صلاحية بالدخول"; } else { Session["FirstName"] = username.Text; Response.Redirect("TruckDefault.aspx", false); } } } else { message.Visible = true; message.Text = "اسم المستخدم أو كلمة المرور خاطئة الرجاء التحقق"; } } catch { } } } }
protected async void Forget_Click(object sender, EventArgs e) { if (fname.Text == "") { Label2.Visible = true; Label2.Text = GetLocalResourceObject("errormessage1").ToString(); divfor.Visible = true; divexm.Visible = false; } else { Label2.Visible = false; 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++; try { FirebaseResponse response = await client.GetAsync("user/" + i); Data da = response.ResultAs <Data>(); string user = da.Username; string email = da.Email; string password = Decrypt(da.Password.Trim()); if (fname.Text == user) { string smtpAddress = "smtp.live.com"; int portNumber = 587; bool enableSSL = true; string emailFrom = "*****@*****.**"; string emailPassword = "******"; string emailTo = email; string subject = "Forget Password"; string body = "your password is:" + password; using (MailMessage Forget = new MailMessage()) { Forget.From = new MailAddress(emailFrom); Forget.To.Add(emailTo); Forget.Subject = subject; Forget.Body = body; Forget.IsBodyHtml = false; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFrom, emailPassword); smtp.EnableSsl = enableSSL; smtp.Send(Forget); //MessageBox.Show(GetLocalResourceObject("msg1").ToString() + " \n " + GetLocalResourceObject("msg2").ToString()); Response.Write("<script>alert('" + GetLocalResourceObject("msg1").ToString() + " \n " + GetLocalResourceObject("msg2").ToString() + "')</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script>alert('" + GetLocalResourceObject("msg1").ToString() + " \n " + GetLocalResourceObject("msg2").ToString() + "')</script>", true); divfor.Visible = false; divexm.Visible = true; } } //divfor.Visible = false; //divexm.Visible = true; } } catch { } } } }