protected async void Register_Click(object sender, EventArgs e)
        {
            FirebaseResponse respo = await client.GetAsync("contrequest");

            CountRequest get = respo.ResultAs <CountRequest>();
            string       cn  = (Convert.ToInt32(get.contr) + 1).ToString();

            if (FileUpload1.HasFile)
            {
                string filepath = Path.Combine(Server.MapPath("~/requestimg"), FileUpload1.FileName);
                FileUpload1.SaveAs(filepath);
                var stream = File.Open(filepath, FileMode.Open);
                var task   = new FirebaseStorage("irecycle-b0312.appspot.com").Child(FileUpload1.FileName).PutAsync(stream);
                task.Progress.ProgressChanged += (s, c) => Console.WriteLine($"Progress:{c.Percentage} %");
                var dowenloadurl = await task;

                var bader = new Bader
                {
                    EstablishName  = name.Text,
                    Phone          = phon.Text,
                    Address        = addr.Text,
                    RecycleType    = RadioButtonList1.SelectedItem.Value,
                    Weight         = weight.Text,
                    Type           = type.SelectedItem.Value,
                    CompanyName    = "",
                    CompanyPhone   = "",
                    CompanyAddress = "",
                    TruckName      = "",
                    TruckPhone     = "",
                    TruckRequest   = "",
                    Username       = Label1.Text,
                    Date           = DateTime.Now.ToString("yyyy-MM-dd"),
                    RequestTime    = "",
                    SupmitTime     = "",
                    Imageurl       = dowenloadurl,
                    RequestType    = "قيد المراجعة",
                    Accept         = ""
                };

                SetResponse response = await client.SetAsync("Requests/" + cn, bader);

                Bader result = response.ResultAs <Bader>();

                var obj = new CountRequest
                {
                    contr = cn,
                };
                SetResponse response1 = await client.SetAsync("contrequest", obj);

                // divexms.Visible = true;
                RadioButtonList1.ClearSelection();
                type.ClearSelection();
                weight.Text = "";
                MessageBox.Show(GetLocalResourceObject("LabelResource18").ToString());
                Response.Redirect("CustomerDefault.aspx", false);
            }
        }
Exemple #2
0
        protected async void ListData()
        {
            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
                {
                    FirebaseResponse response = await client.GetAsync("Requests/" + i);

                    Bader result = response.ResultAs <Bader>();
                    if (result.TruckRequest == "notruck")
                    {
                        DataRow row = dt.NewRow();
                        row["اسم المؤسسة"]        = result.EstablishName;
                        row["الهاتف"]             = result.Phone;
                        row["الموقع"]             = result.Address;
                        row["النوع"]              = result.RecycleType;
                        row["شركة إعادة التدوير"] = result.CompanyName;
                        row["موقع الشركة"]        = result.CompanyAddress;
                        row["الهاتف الشركة"]      = result.CompanyPhone;
                        row["التاريخ"]            = result.Date;
                        row["الحالة"]             = result.RequestType;
                        row["الكمية"]             = result.Weight;
                        row["نوع"] = result.Type;

                        dt.Rows.Add(row);
                        gridViwe1.DataSource = dt;
                        gridViwe1.DataBind();
                    }
                }
                catch
                {
                }
            }
        }
        protected async void ListData(string username)
        {
            int i = 0;
            FirebaseResponse respo = await client.GetAsync("contrequest");

            CountRequest obj = respo.ResultAs <CountRequest>();
            int          cnt = Convert.ToInt32(obj.contr);

            while (true)
            {
                if (i == cnt)
                {
                    break;
                }
                i++;
                try
                {
                    FirebaseResponse response = await client.GetAsync("Requests/" + i);

                    Bader result = response.ResultAs <Bader>();
                    if (result.Username == username)
                    {
                        DataRow row = dt.NewRow();
                        row["اسم المؤسسة"] = result.CompanyName;
                        row["الهاتف"]      = result.CompanyPhone;
                        row["(kg)الكمية"]  = result.Weight;
                        row["النوع"]       = result.RecycleType;
                        row["التاريخ"]     = result.Date;
                        row["الحالة"]      = result.RequestType;

                        dt.Rows.Add(row);
                        GridView1.DataSource = dt;
                        GridView1.DataBind();
                    }
                }
                catch
                {
                }
            }
        }
        protected async void ListData()
        {
            int i = 0;
            FirebaseResponse respo = await client.GetAsync("contrequest");

            CountRequest obj = respo.ResultAs <CountRequest>();
            int          cnt = Convert.ToInt32(obj.contr);

            while (true)
            {
                if (i == cnt)
                {
                    break;
                }
                i++;
                try
                {
                    FirebaseResponse response = await client.GetAsync("Requests/" + i);

                    Bader   result = response.ResultAs <Bader>();
                    DataRow row    = dt.NewRow();
                    row["المؤسسة"]            = result.EstablishName;
                    row["المخلفات"]           = result.RecycleType;
                    row["شركة إعادة التدوير"] = result.CompanyName;
                    row["وقت استلام الطلب"]   = result.RequestTime;
                    row["وقت اتمام الطلب"]    = result.SupmitTime;
                    row["شاحنات"]             = result.TruckName;
                    row["التاريخ"]            = result.Date;
                    row["الحالة"]             = result.RequestType;


                    dt.Rows.Add(row);
                    GridView2.DataSource = dt;
                    GridView2.DataBind();
                }
                catch
                {
                }
            }
        }
Exemple #5
0
        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
                {
                }
            }
        }
Exemple #6
0
        protected async void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "accept")
            {
                int         rowIndex = Convert.ToInt32(e.CommandArgument);
                GridViewRow row      = gridViwe1.Rows[rowIndex];
                string      date     = row.Cells[11].Text;
                string      name     = row.Cells[10].Text;
                string      retype   = row.Cells[9].Text;
                string      weight   = row.Cells[6].Text;
                string      type     = row.Cells[5].Text;

                int i = 0;
                FirebaseResponse respo = await client.GetAsync("contrequest");

                CountRequest obj = respo.ResultAs <CountRequest>();
                int          cnt = Convert.ToInt32(obj.contr);
                while (true)
                {
                    if (i == cnt)
                    {
                        break;
                    }
                    i++;
                    try
                    {
                        FirebaseResponse response = await client.GetAsync("Requests/" + i);

                        Bader  result = response.ResultAs <Bader>();
                        string add    = result.Address;
                        string dates  = result.Date;
                        string cname  = result.CompanyName;
                        string cphone = result.CompanyPhone;
                        string caddr  = result.CompanyAddress;
                        string ename  = result.EstablishName;
                        string truckr = result.TruckRequest;
                        string ph     = result.Phone;
                        string rt     = result.RecycleType;
                        string reqt   = result.RequestType;
                        string tname  = result.TruckName;
                        string tpho   = result.TruckPhone;
                        string types  = result.Type;
                        string user   = result.Username;
                        string weigh  = result.Weight;
                        string rdate  = result.RequestTime;
                        string sdate  = result.SupmitTime;
                        string url    = result.Imageurl;
                        string accept = result.Accept;
                        if (name == ename && date == dates && type == types && retype == rt && weight == weigh)
                        {
                            var bader = new Bader
                            {
                                EstablishName  = name,
                                Phone          = ph,
                                Address        = add,
                                RecycleType    = retype,
                                Weight         = weight,
                                Type           = type,
                                CompanyName    = cname,
                                CompanyPhone   = cphone,
                                CompanyAddress = caddr,
                                TruckName      = name1.Text,
                                TruckPhone     = phon1.Text,
                                TruckRequest   = "notruck",
                                Username       = user,
                                Date           = date,
                                RequestTime    = rdate,
                                SupmitTime     = sdate,
                                Imageurl       = url,
                                Accept         = accept,
                                RequestType    = "قيد الاستلام"
                            };

                            FirebaseResponse response2 = await client.UpdateAsync("Requests/" + i, bader);

                            Bader result2 = response2.ResultAs <Bader>();
                            Response.Redirect("TruckDefault.aspx", false);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            if (e.CommandName == "ok")
            {
                int         rowIndex = Convert.ToInt32(e.CommandArgument);
                GridViewRow row      = gridViwe1.Rows[rowIndex];
                string      date     = row.Cells[11].Text;
                string      name     = row.Cells[10].Text;
                string      retype   = row.Cells[9].Text;
                string      weight   = row.Cells[6].Text;
                string      type     = row.Cells[5].Text;

                int i = 0;
                FirebaseResponse respo = await client.GetAsync("contrequest");

                CountRequest obj = respo.ResultAs <CountRequest>();
                int          cnt = Convert.ToInt32(obj.contr);
                while (true)
                {
                    if (i == cnt)
                    {
                        break;
                    }
                    i++;
                    try
                    {
                        FirebaseResponse response = await client.GetAsync("Requests/" + i);

                        Bader  result   = response.ResultAs <Bader>();
                        string add      = result.Address;
                        string dates    = result.Date;
                        string cname    = result.CompanyName;
                        string cphone   = result.CompanyPhone;
                        string caddr    = result.CompanyAddress;
                        string ename    = result.EstablishName;
                        string truckr   = "truck";
                        string ph       = result.Phone;
                        string rt       = result.RecycleType;
                        string reqt     = result.RequestType;
                        string reqttime = result.RequestTime;
                        string suptime  = result.SupmitTime;
                        string tname    = result.TruckName;
                        string tpho     = result.TruckPhone;
                        string types    = result.Type;
                        string user     = result.Username;
                        string weigh    = result.Weight;
                        string url      = result.Imageurl;
                        string accept   = result.Accept;
                        if (name == ename && date == dates && type == types && retype == rt && weight == weigh)
                        {
                            var bader = new Bader
                            {
                                EstablishName  = name,
                                Phone          = ph,
                                Address        = add,
                                RecycleType    = retype,
                                Weight         = weight,
                                Type           = type,
                                CompanyName    = cname,
                                CompanyPhone   = cphone,
                                CompanyAddress = caddr,
                                TruckName      = tname,
                                TruckPhone     = tpho,
                                TruckRequest   = truckr,
                                RequestTime    = reqttime,
                                SupmitTime     = suptime,
                                Username       = user,
                                Date           = date,
                                Imageurl       = url,
                                Accept         = accept,
                                RequestType    = "تم الاستلام"
                            };

                            FirebaseResponse response2 = await client.UpdateAsync("Requests/" + i, bader);

                            Bader result2 = response2.ResultAs <Bader>();
                            Response.Redirect("TruckDefault.aspx", false);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            if (e.CommandName == "ignor")
            {
                int         rowIndex = Convert.ToInt32(e.CommandArgument);
                GridViewRow row      = gridViwe1.Rows[rowIndex];
                if (row.RowType == DataControlRowType.DataRow)
                {
                    var ok  = ((Button)row.FindControl("ok"));
                    var acc = ((Button)row.FindControl("accept"));
                    if (ok != null && acc != null)
                    {
                        ((Button)ok).Visible  = false;
                        ((Button)acc).Visible = false;
                    }
                }
            }
        }
Exemple #7
0
        protected async void Button1_Click(object sender, EventArgs e)
        {
            int i = 0;
            FirebaseResponse respo = await client.GetAsync("contrequest");

            CountRequest obj = respo.ResultAs <CountRequest>();
            int          cnt = Convert.ToInt32(obj.contr);

            while (true)
            {
                if (i == cnt)
                {
                    break;
                }
                i++;
                try
                {
                    FirebaseResponse response = await client.GetAsync("Requests/" + i);

                    Bader  result = response.ResultAs <Bader>();
                    string add    = result.Address;
                    string dates  = result.Date;
                    string cname  = result.CompanyName;
                    string cphone = result.CompanyPhone;
                    string caddr  = result.CompanyAddress;
                    string ename  = result.EstablishName;
                    string truckr = result.TruckRequest;
                    string ph     = result.Phone;
                    string rt     = result.RecycleType;
                    string reqt   = result.RequestType;
                    string tname  = result.TruckName;
                    string tpho   = result.TruckPhone;
                    string types  = result.Type;
                    string user   = result.Username;
                    string weigh  = result.Weight;
                    string rdate  = result.RequestTime;
                    string sdate  = result.SupmitTime;
                    string url    = result.Imageurl;
                    string accept = result.Accept;
                    if (user1.Text == user && user3.Text == rt && user2.Text == cname && user4.Text == weigh && user5.Text == dates)
                    {
                        var bader = new Bader
                        {
                            EstablishName  = ename,
                            Phone          = ph,
                            Address        = add,
                            RecycleType    = rt,
                            Weight         = weigh,
                            Type           = types,
                            CompanyName    = cname,
                            CompanyPhone   = cphone,
                            CompanyAddress = caddr,
                            TruckName      = tname,
                            TruckPhone     = tpho,
                            TruckRequest   = truckr,
                            Username       = user,
                            Date           = dates,
                            RequestTime    = rdate,
                            Imageurl       = url,
                            Accept         = accept,
                            SupmitTime     = sdate,
                            RatePoint      = Rating1.CurrentRating.ToString(),
                            Comment        = TextArea1.Value,
                            RequestType    = reqt
                        };
                        FirebaseResponse response2 = await client.UpdateAsync("Requests/" + i, bader);

                        Bader result2 = response2.ResultAs <Bader>();
                        ClientScript.RegisterStartupScript(typeof(Page), "closePage", "self.close();", true);
                    }
                }
                catch
                {
                }
            }
        }