Esempio n. 1
0
        public int testCon()
        {
            var response = Task.Run(() => client.GetAsync("test"));

            try
            {
                if (response.Result.ResultAs <int>() == 1)
                {
                    this.connection = true;
                    return(1);
                }
                else
                {
                    this.connection = false;
                }
            }
            catch
            {
                this.connection = false;
                return(0);
            }
            return(0);
        }
Esempio n. 2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            FirebaseResponse rsp = await client.GetAsync("Counter/node");

            Counter get = rsp.ResultAs <Counter>();

            var Data = new Data
            {
                firmaID        = (Convert.ToInt32(get.cntr) + 1).ToString(),
                firmaAdi       = textBox2.Text,
                latitude       = textBox3.Text,
                longitude      = textBox1.Text,
                kampanyaIcerik = textBox4.Text,
                kategori       = comboBox2.Text,
                kampanyaSuresi = textBox5.Text,
            };

            if (Data.firmaAdi == "" || Data.latitude == "" || Data.longitude == "" || Data.kampanyaIcerik == "" || Data.kampanyaSuresi == "" || Data.kategori == "")
            {
                MessageBox.Show("Lütfen Tüm Alanları Eksiksiz Doldurun.");
            }
            else
            {
                SetResponse response = await client.SetAsync("reklam/" + Data.firmaID, Data);

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

                MessageBox.Show("Veri başarıyla eklendi.");
                var obj = new Counter
                {
                    cntr = Data.firmaID
                };

                SetResponse response1 = await client.SetAsync("Counter/node", obj);
            }
        }
Esempio n. 3
0
        public async Task <T> Get <T>(string path)
        {
            FirebaseResponse response = await _firebaseClient.GetAsync(path);

            return(response.ResultAs <T>());
        }
Esempio n. 4
0
        public async void getkhachthue()
        {
            try
            {
                FirebaseResponse res = await client.GetAsync("khachthue/" + CMND_ + "/KHACHTHUE/");

                Data thongtinkhachthue = res.ResultAs <Data>();
                if (thongtinkhachthue != null)
                {
                    TENKH.Text      = thongtinkhachthue.TEN_KHACH;
                    dienthoai.Text  = thongtinkhachthue.SDT;
                    dantoc.Text     = thongtinkhachthue.DANTOC;
                    tongiao.Text    = thongtinkhachthue.TONGIAO;
                    nghenghiep.Text = thongtinkhachthue.NGHENGHIEP;
                    mail.Text       = thongtinkhachthue.EMAIL;
                    bienso.Text     = thongtinkhachthue.BIENSOXE;
                    Chuyenmon.Text  = thongtinkhachthue.TRINHDOCHUYENMON;
                    ngaysinh.Date   = Convert.ToDateTime(thongtinkhachthue.NGAY_SINH);
                    ngaycap.Date    = Convert.ToDateTime(thongtinkhachthue.NGAY_CAP);
                    Congty.Text     = thongtinkhachthue.CongTy;

                    PlaceJobLabelNavigatePage.Text        = (thongtinkhachthue.NOILAMVIEC == "") ? _customerInforPlaceholder_JobSite : thongtinkhachthue.NOILAMVIEC;
                    SiteCurentLabelNavigatePage.Text      = (thongtinkhachthue.DIACHIHIENNAY == "") ? _customerInforPlaceholder_CurentSite : thongtinkhachthue.DIACHIHIENNAY;
                    AddressResidentLabelNavigatePage.Text = (thongtinkhachthue.NOITHUONGTHU == "") ? _customerInforPlaceholder_Resident : thongtinkhachthue.NOITHUONGTHU;
                    HometownLabelNavigatePage.Text        = (thongtinkhachthue.QUE_QUAN == "") ? _customerInforPlaceholder_Hometown : thongtinkhachthue.QUE_QUAN;

                    //check hiện thị
                    for (int i = 0; i < gioitinh_.Items.Count; i++)
                    {
                        try
                        {
                            if (thongtinkhachthue.GIOI_TINH == gioitinh_.Items[i].ToString())
                            {
                                gioitinh_.SelectedIndex = i;
                            }
                        }
                        catch { gioitinh_.SelectedIndex = 0; }
                    }

                    for (int i = 0; i < hocvan_.Items.Count; i++)
                    {
                        try
                        {
                            if (thongtinkhachthue.TRINHDOHOCVAN == hocvan_.Items[i].ToString())
                            {
                                hocvan_.SelectedIndex = i;
                            }
                        }
                        catch { hocvan_.SelectedIndex = 0; }
                    }
                    for (int i = 0; i < loaixe_.Items.Count; i++)
                    {
                        try
                        {
                            if (thongtinkhachthue.LOAIXE == loaixe_.Items[i].ToString())
                            {
                                loaixe_.SelectedIndex = i;
                            }
                        }
                        catch { loaixe_.SelectedIndex = 0; }
                    }
                }
            }
            catch
            {
                //if (!Application.Current.Properties.ContainsKey(KeyCustomerViewEnumeration.DefaultAddress))
                //{
                //    _ = Navigation.PushAsync(new SettingPageUI());
                //}
                this.gioitinh_.SelectedIndex = 0;
                this.loaixe_.SelectedIndex   = 0;
                this.hocvan_.SelectedIndex   = 0;
                return;
            }
        }
        protected override async Task onMessage(string mid = null, string author_id = null, string message = null, FB_Message message_object = null, string thread_id = null, ThreadType?thread_type = null, long ts = 0, JToken metadata = null, JToken msg = null)
        {
            //authorId: Nguoi Gui
            //threaId: Nguoi Nhan
            try
            {
                if (thread_type == ThreadType.ROOM || thread_type == ThreadType.GROUP)
                {
                    return;
                }
                IFirebaseClient client = FirebaseHelper.SetFirebaseClientForChat();
                //Check Remove blockall
                if (message.ToLower() == "removestopall")
                {
                    await client.DeleteAsync("ListBlockUser/" + thread_id);

                    return;
                }

                if (author_id == GetUserUid())
                {
                    await client.SetAsync("ListBlockUser/" + GetUserUid(), new MessageFirsebase
                    {
                        Id       = GetUserUid(),
                        BlockAll = true
                    });

                    return;
                }

                //Check ListBlockUser
                FirebaseResponse firebaseResponse = await client.GetAsync("ListBlockUser");

                Dictionary <string, MessageFirsebase> listBlockUser = JsonConvert.DeserializeObject <Dictionary <string, MessageFirsebase> >(firebaseResponse.Body);
                var isBlockedAll = listBlockUser != null && listBlockUser.Values.Any(x => x.BlockAll == true && x.Id == thread_id);
                if (isBlockedAll)
                {
                    return;
                }


                var firebaseGet = await client.GetAsync("ListUser/" + author_id);

                if (firebaseGet == null)
                {
                    if (!await CheckUserInListSimsimi(client, thread_id))
                    {
                        await Add5MinuteUser(client, author_id, author_id, thread_id, message, false);
                    }
                }
                else
                {
                    //Thơi gian hien tai < Thoi gian Block
                    var response = firebaseGet.ResultAs <MessageFirsebase>();
                    if (DateTime.UtcNow < response?.BlockUntil)
                    {
                        if (message.ToLower() == "stopall")
                        {
                            await client.SetAsync("ListBlockUser/" + thread_id, new MessageFirsebase
                            {
                                Id       = thread_id,
                                BlockAll = true
                            });

                            return;
                        }
                        else if (message.ToLower() == "stophour")
                        {
                            await client.SetAsync("ListUser/" + thread_id, new MessageFirsebase
                            {
                                BlockUntil = DateTime.UtcNow.AddHours(1)
                            });

                            return;
                        }
                        else if (message.ToLower() == "trolyao")
                        {
                            await client.SetAsync("ListSimsimiUser/" + thread_id, new MessageFirsebase
                            {
                                Id = thread_id
                            });
                            await send(new FB_Message { text = "Chào bạn. Mình là Trợ lý ảo của Quang.\nNhững tin nhắn này được trả lời tự động. Mục đích vui là chính :D" }, author_id, ThreadType.USER);
                        }
                        if (await CheckUserInListSimsimi(client, thread_id))
                        {
                            string answer = await SimsimiHelper.SendSimsimi(message);

                            string text = "Trợ lý ảo:\n" + answer;
                            await send(new FB_Message { text = text }, author_id, ThreadType.USER);
                        }
                    }
                    else
                    {
                        if (message.ToLower() == "stopall")
                        {
                            await client.SetAsync("ListBlockUser/" + thread_id, new MessageFirsebase
                            {
                                Id       = thread_id,
                                BlockAll = true
                            });

                            return;
                        }
                        else if (message.ToLower() == "stophour")
                        {
                            await client.SetAsync("ListUser/" + thread_id, new MessageFirsebase
                            {
                                Id         = thread_id,
                                BlockUntil = DateTime.UtcNow.AddHours(1)
                            });

                            return;
                        }
                        else if (message.ToLower() == "trolyao")
                        {
                            await client.SetAsync("ListSimsimiUser/" + thread_id, new MessageFirsebase
                            {
                                Id = thread_id
                            });
                            await send(new FB_Message { text = "Chào bạn. Mình là Trợ lý ảo của Quang.\nNhững tin nhắn này được trả lời tự động. Mục đích vui là chính :D" }, author_id, ThreadType.USER);
                        }


                        //Co the send message o day
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine(string.Format($"{DateTime.Now}: Got new 1 message from author_id = {author_id}: {message}. Thread_type = {thread_type.ToString()} \nthread_id={thread_id}"));
                        if (author_id != GetUserUid())
                        {
                            Console.ForegroundColor = ConsoleColor.Blue;
                            if (await CheckUserInListSimsimi(client, thread_id))
                            {
                                string answer = await SimsimiHelper.SendSimsimi(message);

                                string text = "Trợ lý ảo:\n" + answer;
                                await send(new FB_Message { text = text }, author_id, ThreadType.USER);
                            }
                            else
                            {
                                string text = "Đây là trợ lý ảo của Quang.\nHiện tại Quang không đang online nên không thể trả lời bạn ngay được.\nTrong khi chờ đợi, các bạn có thể gõ tin nhắn \"trolyao\" để trao đổi với trợ lý ảo";

                                await send(new FB_Message { text = text }, author_id, ThreadType.USER);
                            }



                            #region Ít dùng
                            //using (FileStream stream = File.OpenRead(@"the girl with katana.jpg"))
                            //{
                            //    await sendLocalFiles(
                            //        file_paths: new Dictionary<string, Stream>() { { @"the girl with katana.jpg", stream } },
                            //        message: null,
                            //        thread_id: author_id,
                            //        thread_type: ThreadType.USER);
                            //}
                            //await send(new FB_Message { text = "Đáp lại tin nhắn----" }, author_id, ThreadType.USER);
                            //await send(new FB_Message { text = await Covid19Helper.GetDetail() }, author_id, ThreadType.USER);

                            #endregion
                        }

                        ///////////////////
                        if (!await CheckUserInListSimsimi(client, thread_id))
                        {
                            await Add5MinuteUser(client, author_id, author_id, thread_id, message, false);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"{DateTime.Now}: Có lỗi xảy ra. Exception = {e.Message}");
            }
        }
        private async void PopulateMessageView()
        {
            //Populate message list
            string msgCountPath = "DemoApp/Messages/" + pathToPairedId + "/msgCount";

            response = await client.GetAsync(msgCountPath);

            if (response.ResultAs <string>() != null)
            {
                int messageCount = response.ResultAs <int>();
                sMessageCount = response.ResultAs <int>();
                for (int i = 0; i < messageCount; i++)
                {
                    string path      = "DemoApp/Messages/" + pathToPairedId + "/messages/" + i.ToString() + "/";
                    var    msgBundle = new
                    {
                        msg = await client.GetAsync(path + "msg"),
                        id  = await client.GetAsync(path + "id"),
                        img = await client.GetAsync(path + "img")
                    };

                    if (!msgBundle.msg.ResultAs <string>().Equals(""))
                    {
                        mdp          = new MessageDisplay();
                        mdp.Message  = msgBundle.msg.ResultAs <string>();
                        mdp.ID       = msgBundle.id.ResultAs <string>();
                        mdp.AutoSize = true;
                        if (msgBundle.id.ResultAs <string>().Equals(Properties.Settings.Default.Email))
                        {
                            mdp.Margin = new Padding(250, 20, 0, 0);
                        }
                        else
                        {
                            mdp.Margin = new Padding(30, 20, 0, 0);
                        }
                        fpMsgs.Controls.Add(mdp);
                    }
                    else
                    {
                        mdp = new MessageDisplay();
                        mdp.PictureProfile = msgBundle.img.ResultAs <string>();
                        mdp.ID             = msgBundle.id.ResultAs <string>();
                        mdp.AutoSize       = true;

                        if (msgBundle.id.ResultAs <string>().Equals(Properties.Settings.Default.Email))
                        {
                            mdp.Margin = new Padding(250, 20, 0, 0);
                        }
                        else
                        {
                            mdp.Margin = new Padding(30, 20, 0, 0);
                        }
                        fpMsgs.Controls.Add(mdp);
                    }
                }
                //
                //Stream event listener
                ESRMsgs = await client.OnAsync("DemoApp/Messages/" + pathToPairedId + "/messages/complete", changed : async(sender, args, context) => {
                    System.Console.WriteLine(args.Data);
                    //sMessageCount++;
                    //response = await client.GetAsync("DemoApp/Messages/" + pathToPairedId + "/messages/" + messageCount.ToString());

                    Invoke(new MethodInvoker(async delegate
                    {
                        if (response.ResultAs <string>() != null)
                        {
                            string path   = "DemoApp/Messages/" + pathToPairedId + "/messages/" + (sMessageCount).ToString() + "/";
                            var msgBundle = new
                            {
                                msg = await client.GetAsync(path + "msg"),
                                id  = await client.GetAsync(path + "id"),
                                img = await client.GetAsync(path + "img")
                            };

                            if (!msgBundle.msg.ResultAs <string>().Equals(""))
                            {
                                mdp          = new MessageDisplay();
                                mdp.Message  = msgBundle.msg.ResultAs <string>();
                                mdp.ID       = msgBundle.id.ResultAs <string>();
                                mdp.AutoSize = true;
                                if (msgBundle.id.ResultAs <string>().Equals(Properties.Settings.Default.Email))
                                {
                                    mdp.Margin = new Padding(250, 20, 0, 0);
                                }
                                else
                                {
                                    mdp.Margin = new Padding(30, 20, 0, 0);
                                }
                                fpMsgs.Controls.Add(mdp);
                                sMessageCount++;
                            }
                            else
                            {
                                mdp = new MessageDisplay();
                                mdp.PictureProfile = msgBundle.img.ResultAs <string>();
                                mdp.ID             = msgBundle.id.ResultAs <string>();
                                mdp.AutoSize       = true;

                                if (msgBundle.id.ResultAs <string>().Equals(Properties.Settings.Default.Email))
                                {
                                    mdp.Margin = new Padding(250, 20, 0, 0);
                                }
                                else
                                {
                                    mdp.Margin = new Padding(30, 20, 0, 0);
                                }
                                fpMsgs.Controls.Add(mdp);
                                sMessageCount++;
                            }
                        }
                    }));
                });
            }
            else
            {
                MessageBox.Show("Has no message");
            }
        }
Esempio n. 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
                {
                }
            }
        }
Esempio n. 8
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                PurchaseOrderId n = new PurchaseOrderId();
                client = new FireSharp.FirebaseClient(config);
                DateTime sysdt;
                sysdt = DateTime.Now;
                string Date = sysdt.ToString("dd/MM/yyyy");
                DateT.Text = Date;
                string Time1 = sysdt.ToString("hh:mm tt");
                TimeT.Text = Time1;
                // AutoSuggestion for Popup Name
                FirebaseResponse response = await client.GetAsync("Master/Spinner/Supplier/count/");

                int count;
                try
                {
                    count = response.ResultAs <int>();
                }
                catch (Exception)
                { count = 0; }
                List <String> nameLt = new List <String>();
                for (int i = 1; i <= count; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Master/Spinner/Supplier/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt.Add(nameNw);
                }
                int cnt = nameLt.Count;
                Autoitems = new string[cnt];
                Autoitems = nameLt.ToArray();
                FirebaseResponse response2 = await client.GetAsync("Spinner/StripSize/count/");

                int           count2  = response2.ResultAs <int>();
                List <String> nameLt2 = new List <String>();
                for (int i = 1; i <= count2; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Spinner/StripSize/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt2.Add(nameNw);
                }
                int cnt2 = nameLt2.Count;
                productList1 = new string[cnt2];
                productList1 = nameLt2.ToArray();

                FirebaseResponse response3 = await client.GetAsync("Sales/SalesOrder/Spinner/Verified/count/");

                int           count3  = response3.ResultAs <int>();
                List <String> nameLt3 = new List <String>();
                for (int i = 1; i <= count3; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Sales/SalesOrder/Spinner/Verified/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt3.Add(nameNw);
                }
                int cnt3 = nameLt3.Count;
                sID = new string[cnt3];
                sID = nameLt3.ToArray();

                FirebaseResponse response4 = await client.GetAsync("Purchase/PurchaseOrder/Spinner/pending/count/");

                int count4 = response4.ResultAs <int>();
                for (int i = 1; i <= count4; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Purchase/PurchaseOrder/Spinner/pending/" + i);

                    string nameNw = response1.ResultAs <string>();
                    pOrderId1.Add(nameNw);
                }
                pOrderID.ItemsSource = pOrderId1;
                if (nameLt3.Count == cnt3)
                {
                    progress1.Visibility = Visibility.Collapsed;
                    pr.Visibility        = Visibility.Visible;
                }
            }
            catch (Exception)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
Esempio n. 9
0
        private async void RegisterButton(object sender, RoutedEventArgs e)
        {
            registruotisButton.IsEnabled = false;
            // tikrinama ar langeliai atitinka reikalavimus
            PasswordValidation_1(sender, e);
            PasswordValidation_2(sender, e);
            NameValidation(sender, e);
            SurnameValidation(sender, e);
            EmailValidation(sender, e);
            // paimamos langelių reikšmės
            vardas      = vardoTextBox.Text;
            pavarde     = pavardesTextBox.Text;
            epastas     = ePastoTextBox.Text;
            slaptazodis = slaptazodzioTextBox_1.Password;

            Loading();
            // tikriname ar neegzistuoja paskyra su šiuo email
            string email    = String.Join("", Encoding.ASCII.GetBytes(ValidEmail(ePastoTextBox.Text)));
            var    response = await client.GetAsync("Paskyros/" + email);

            Vartotojas vartotojas = response.ResultAs <Vartotojas>();

            // ieškome ar egzistuoja tokia paskyra duomenų bazėje
            // jei neegzistuoja

            if (ePastoTextBox.Text != "")
            {
                if (vartotojas == null)
                {
                    // tikrinama ar nėra klaidų susijusių su langeliais
                    if (!slaptazodzioError_1.IsVisible & !slaptazodzioError_2.IsVisible & !vardoError.IsVisible & !pavardesError.IsVisible & !ePastoError.IsVisible)
                    {
                        slaptazodis = Security.HashingPassword(slaptazodis);

                        Random rand = new Random();
                        randomCode = (rand.Next(10000, 99999)).ToString();
                        try
                        {
                            string      messageBody    = "Jūsu patvirtinimo kodas yra: " + randomCode;
                            string      messageSubject = "Registracijos patvirtinimo kodas";
                            MailMessage message        = SiustiLaiska.CreateMessage(epastas, projektoEpastas, messageBody, messageSubject);
                            SiustiLaiska.SendMessage(projektoEpastas, projektoSlaptazodis, message);
                            var EmailCode = new EmailPatikrinimas();
                            EmailCode.generalEventText.Content    = "Išsiunteme jums kodą į El. paštą!";
                            EmailCode.generalEventText.Foreground = Brushes.Green;
                            EmailCode.generalEventText.Visibility = Visibility.Visible;
                            EmailCode.randomCode = randomCode;
                            EmailCode.Show();
                            Close();
                        }
                        catch
                        {
                            Unloading();
                            ePastoError.Visibility       = Visibility.Visible;
                            ePastoError.Content          = "Toks paštas neegzistuoja!";
                            registruotisButton.IsEnabled = true;
                        }
                    }
                    else
                    {
                        Unloading();
                        registruotisButton.IsEnabled = true;
                    }
                }
                else
                {
                    Unloading();
                    ePastoError.Content          = "Toks paštas užimtas";
                    ePastoError.Visibility       = Visibility.Visible;
                    registruotisButton.IsEnabled = true;
                }
            }
            else
            {
                Unloading();
                registruotisButton.IsEnabled = true;
                ePastoError.Visibility       = Visibility.Visible;
                ePastoError.Content          = "Prašome užpildyti langelį!";
            }
        }
Esempio n. 10
0
        private async void Button_Click_2(object sender, RoutedEventArgs e)
        {
            if (pOrderID.Text.Length > 0 && pSupplier.Text.Length > 0 && DateT.Text.Length > 0 && TimeT.Text.Length > 0 && endList.Items.Count > 0 && endList2.Items.Count > 0)
            {
                try
                {
                    client = new FireSharp.FirebaseClient(config);
                    pOrderFinal a = new pOrderFinal();
                    a.purchaseNumber = pOrderID.Text;
                    a.supplierName   = pSupplier.Text;
                    a.date           = DateT.Text;
                    a.time           = TimeT.Text;
                    FirebaseResponse response2 = await client.GetAsync("Purchase/PurchaseOrder/count/");

                    int c;
                    try
                    {
                        c = response2.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        c = 0;
                    }
                    c++;
                    FirebaseResponse firebaseResponse1 = await client.GetAsync("Purchase/PurchaseOrder/Spinner/pending/count/");

                    int cnt;
                    try
                    {
                        cnt = firebaseResponse1.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        cnt = 0;
                    }
                    List <string> list2 = new List <string>();
                    for (int i = 1; i <= cnt; i++)
                    {
                        FirebaseResponse firebase = await client.GetAsync("Purchase/PurchaseOrder/Spinner/pending/");

                        string abv = firebase.ResultAs <string>();
                        list2.Add(abv);
                    }
                    int booll = 0;
                    foreach (string y in list2)
                    {
                        if (y == a.purchaseNumber)
                        {
                            booll++;
                            break;
                        }
                    }
                    if (booll == 0)
                    {
                        cnt++;
                        FirebaseResponse firebaseResponse3 = await client.SetAsync("Purchase/PurchaseOrder/Spinner/pending/count/", cnt);

                        FirebaseResponse firebaseResponse = await client.SetAsync("Purchase/PurchaseOrder/Spinner/pending/" + cnt, a.purchaseNumber);

                        FirebaseResponse response3 = await client.SetAsync("Purchase/PurchaseOrder/count/", c);

                        FirebaseResponse ab = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/", a);

                        foreach (Sales1 tempP in endList2.Items)
                        {
                            client = new FireSharp.FirebaseClient(config);
                            FirebaseResponse response = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/salesLayout/" + tempP.SNo + "/", tempP);

                            FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/salesLayout/count/", tempP.SNo);
                        }
                        foreach (Product1 temp in endList.Items)
                        {
                            client = new FireSharp.FirebaseClient(config);
                            FirebaseResponse response = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/itemLayout/" + temp.SNo + "/", temp);

                            FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseOrder/" + a.purchaseNumber + "/itemLayout/count/", temp.SNo);
                        }

                        MessageDialog md = new MessageDialog("SalesOrder Successfully Added!");
                        await md.ShowAsync();
                    }
                    else if (booll > 0)
                    {
                        MessageDialog md = new MessageDialog("SalesOrder Already Raised");
                        await md.ShowAsync();
                    }
                }

                catch (Exception)
                {
                    MessageDialog error = new MessageDialog("Failed to connect to database!");
                    this.Frame.Navigate(typeof(BlankPage6));
                }
            }
            else
            {
                MessageDialog md = new MessageDialog("Check the inputs!");
                await md.ShowAsync();
            }
        }
Esempio n. 11
0
 public async Task <FirebaseResponse> GetAllNews()
 {
     return(await client.GetAsync("news/"));
 }
Esempio n. 12
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                SalesOrderID n = new SalesOrderID();
                client = new FireSharp.FirebaseClient(config);
                DateTime sysdt;
                sysdt = DateTime.Now;
                string Date = sysdt.ToString("dd/MM/yyyy");
                DateT.Text = Date;
                string Time1 = sysdt.ToString("hh:mm tt");
                TimeT.Text = Time1;
                // AutoSuggestion for Popup Name
                FirebaseResponse response = await client.GetAsync("Spinner/Product/count");

                int count;
                try
                {
                    count = response.ResultAs <int>();
                }
                catch (Exception)
                {
                    count = 0;
                }
                List <String> nameLt = new List <String>();
                for (int i = 1; i <= count; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Spinner/Product/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt.Add(nameNw);
                }
                int cnt = nameLt.Count;
                Autoitems   = new string[cnt];
                Autoitems   = nameLt.ToArray();
                orderT.Text = n.saleID;
                // AutoSuggestion for Client Name
                response = await client.GetAsync("Master/Spinner/Client/count");

                count = response.ResultAs <int>();
                List <String> cnameLt = new List <String>();
                for (int i = 1; i <= count; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Master/Spinner/Client/" + i);

                    string nameNw = response1.ResultAs <string>();
                    cnameLt.Add(nameNw);
                }
                cnt       = cnameLt.Count;
                cNameitem = new string[cnt];
                cNameitem = cnameLt.ToArray();
                cNameT.IsHitTestVisible = true;
                if (cnameLt.Count == count)
                {
                    progress1.Visibility = Visibility.Collapsed;
                    so.Visibility        = Visibility.Visible;
                }
            }

            catch (FireSharp.Exceptions.FirebaseException)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
Esempio n. 13
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
                {
                }
            }
        }
Esempio n. 14
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if ((cNameT.Text.Length > 0) && (cMailT.Text.Length > 0) && (cMailT.Text.Length > 0) && (cNoT.Text.Length > 0) && (cAddT.Text.Length > 0) && (DateT.Text.Length > 0) && (TimeT.Text.Length > 0) && (MyList.Items.Count > 0) == true)
            {
                try
                {
                    SOrder temp = new SOrder();
                    temp.ClientAddress       = cAddT.Text;
                    temp.ClientContactNumber = cNoT.Text;
                    temp.ClientMailID        = cMailT.Text;
                    temp.ClientName          = cNameT.Text;
                    temp.Date         = DateT.Text;
                    temp.Time         = TimeT.Text;
                    temp.SalesOrderID = orderT.Text;
                    temp.status       = "Pending";
                    String loc = "Sales/SalesOrder/" + temp.SalesOrderID + "/";
                    client = new FireSharp.FirebaseClient(config);
                    var settr = await client.SetAsync(loc, temp);

                    loc = "Sales/SalesOrder/" + temp.SalesOrderID + "/Layout/";
                    int len = loc.Length;
                    client = new FireSharp.FirebaseClient(config);
                    int i = 1;
                    foreach (Product1 tempP in MyList.Items)
                    {
                        Product temp1 = new Product();
                        temp1.pName     = tempP.pName;
                        temp1.pQuantity = tempP.pQuantity;
                        loc             = loc + i + "/";
                        var settr1 = await client.SetAsync(loc, temp1);

                        loc = loc.Remove(len);
                        i++;
                    }
                    loc = loc + "count/";
                    var sett = await client.SetAsync(loc, i - 1);

                    loc  = loc.Remove(len);
                    loc  = "Sales/SalesOrder/count";
                    sett = await client.SetAsync(loc, temp.getCount());

                    // Get Pending Count
                    IFirebaseClient  client1  = new FireSharp.FirebaseClient(config);
                    FirebaseResponse response = await client.GetAsync("Sales/SalesOrder/Spinner/Pending/count/");

                    int pCount, flag1 = 0;
                    try
                    {
                        pCount = response.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        pCount = 0;
                    }
                    for (i = 1; i <= pCount; i++)
                    {
                        response = await client.GetAsync("Sales/SalesOrder/Spinner/Pending/" + i + "/");

                        string SOID = response.ResultAs <string>();
                        if (SOID == orderT.Text)
                        {
                            flag1 = 1;
                            break;
                        }
                    }
                    if (flag1 != 1)
                    {
                        pCount = pCount + 1;
                    }
                    loc  = "Sales/SalesOrder/Spinner/Pending/" + pCount + "/";
                    sett = await client.SetAsync(loc, temp.SalesOrderID);

                    loc  = "Sales/SalesOrder/Spinner/Pending/count/";
                    sett = await client.SetAsync(loc, pCount);

                    loc = "Sales/SalesOrder/count";
                    MessageDialog md = new MessageDialog("SalesOrder Successfully Updated!");
                    await md.ShowAsync();
                }
                catch (FireSharp.Exceptions.FirebaseException)
                {
                    MessageDialog error = new MessageDialog("Failed to connect to database!");
                    this.Frame.Navigate(typeof(BlankPage6));
                }
            }
            else
            {
                MessageDialog md = new MessageDialog("Check the inputs!");
                await md.ShowAsync();
            }
        }
Esempio n. 15
0
        private async void updateMaster(string cName)
        {
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response5 = await client.GetAsync("Manufacturing/RouteCard/" + cName + "/employeeLayout/count");

            int count5;

            try
            {
                count5 = response5.ResultAs <int>();
            }
            catch (Exception)
            {
                count5 = 0;
            }
            List <String> nameLt5 = new List <String>();

            for (int i = 1; i <= count5; i++)
            {
                FirebaseResponse response1 = await client.GetAsync("Manufacturing/RouteCard/" + cName + "/employeeLayout/" + i);

                employeeList1 list1 = new employeeList1();
                list1 = response1.ResultAs <employeeList1>();
                string nameNw = list1.Name;
                nameLt5.Add(nameNw);
            }
            int cnt5 = nameLt5.Count;

            empList = new string[cnt5];
            empList = nameLt5.ToArray();



            FirebaseResponse response6 = await client.GetAsync("Manufacturing/RouteCard/" + cName + "/machineLayout/count");

            int count6;

            try
            {
                count6 = response6.ResultAs <int>();
            }
            catch (Exception)
            {
                count6 = 0;
            }
            List <String> nameLt6 = new List <String>();

            for (int i = 1; i <= count6; i++)
            {
                FirebaseResponse response1 = await client.GetAsync("Manufacturing/RouteCard/" + cName + "/machineLayout/" + i);

                employeeList1 list1 = new employeeList1();
                list1 = response1.ResultAs <employeeList1>();
                string nameNw = list1.Name;
                nameLt6.Add(nameNw);
            }
            int cnt6 = nameLt6.Count;

            machineList = new string[cnt6];
            machineList = nameLt6.ToArray();
        }
Esempio n. 16
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(config);
                WorkOrderNo n = new WorkOrderNo();
                DateTime    sysdt;
                sysdt = DateTime.Now;
                string Date = sysdt.ToString("dd/MM/yyyy");
                fDate.Text = Date;
                string Time1 = sysdt.ToString("hh:mm tt");
                fTime.Text = Time1;
                // AutoSuggestion for Popup Name
                FirebaseResponse response = await client.GetAsync("Manufacturing/Spinner/pending/count/");

                int count;
                try
                {
                    count = response.ResultAs <int>();
                }
                catch (Exception)
                {
                    count = 0;
                }
                List <String> nameLt = new List <String>();
                for (int i = 1; i <= count; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Manufacturing/Spinner/pending/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt.Add(nameNw);
                }
                int cnt = nameLt.Count;
                Autoitems = new string[cnt];
                Autoitems = nameLt.ToArray();

                FirebaseResponse response5 = await client.GetAsync("Spinner/Employee/count/");

                int count5;
                try
                {
                    count5 = response5.ResultAs <int>();
                }
                catch (Exception)
                {
                    count5 = 0;
                }
                List <String> nameLt5 = new List <String>();
                for (int i = 1; i <= count5; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Spinner/Employee/" + i);

                    string nameNw = response1.ResultAs <string>();
                    nameLt5.Add(nameNw);
                }
                int cnt5 = nameLt5.Count;
                empList = new string[cnt5];
                empList = nameLt5.ToArray();
                if (nameLt5.Count == count5)
                {
                    progress1.Visibility = Visibility.Collapsed;
                    qc.Visibility        = Visibility.Visible;
                }
            }
            catch (Exception)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
Esempio n. 17
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(config);
                FirebaseResponse response = await client.GetAsync("Dispatch/Spinner/count/");

                int c;
                try
                {
                    c = response.ResultAs <int>();
                }
                catch (Exception)
                {
                    c = 0;
                }
                for (int i = 1; i <= c; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Dispatch/Spinner/" + i + "/");

                    string           a         = response1.ResultAs <string>();
                    FirebaseResponse response3 = await client.GetAsync("Dispatch/" + a + "/count/");

                    int v;
                    try
                    {
                        v = response3.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        v = 0;
                    }
                    for (int j = 1; j <= v; j++)
                    {
                        FirebaseResponse response2 = await client.GetAsync("Dispatch/" + a + "/" + j + "/");

                        dispatch dispatch2 = new dispatch();
                        dispatch2 = response2.ResultAs <dispatch>();
                        productOut productOut = new productOut();
                        productOut.sno     = MyList.Items.Count + 1;
                        productOut.salesid = dispatch2.salesordernumber;
                        FirebaseResponse response4 = await client.GetAsync("Sales/SalesOrder/" + productOut.salesid + "/ClientName/");

                        productOut.clientname  = response4.ResultAs <string>();
                        productOut.productname = dispatch2.productname;
                        productOut.quantity    = dispatch2.pquantity;
                        productOut.vehicleno   = dispatch2.vehicleno;
                        productOut.date        = dispatch2.date;
                        productOut.time        = dispatch2.time;
                        MyList.Items.Add(productOut);
                    }
                    if (MyList.Items.Count > 0)
                    {
                        progress1.Visibility = Visibility.Collapsed;
                        pout.Visibility      = Visibility.Visible;
                    }
                }
            }
            catch (Exception)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
Esempio n. 18
0
        //Funtii de introducere in lista de elemente pentru fiecare tabel
        public async void listaProduse()
        {
            this.lista.Clear();
            FirebaseResponse idResponse = await client.GetAsync("Counter/ProdCNT");

            Counter get = idResponse.ResultAs <Counter>();

            nrProduse = get.nr;

            for (int i = 1; i <= get.nr; i++)
            {
                FirebaseResponse prodResp = await client.GetAsync("Produse/" + i.ToString());

                Data dt = prodResp.ResultAs <Data>();
                if (dt != null)
                {
                    this.lista.Add(dt);
                }
            }
            l1 = true;
        }
Esempio n. 19
0
        private async void Button_Click_2(object sender, RoutedEventArgs e)
        {
            if (pOrderID.Text.Length > 0 && pSupplier.Text.Length > 0 && DateT.Text.Length > 0 && TimeT.Text.Length > 0 && endList.Items.Count > 0 && endList2.Items.Count > 0)
            {
                try
                {
                    client = new FireSharp.FirebaseClient(config);
                    pOrderFinal a = new pOrderFinal();
                    a.purchaseNumber = pOrderID.Text;
                    a.supplierName   = pSupplier.Text;
                    a.date           = DateT.Text;
                    a.time           = TimeT.Text;
                    a.coilNo         = coilNo.Text;
                    FirebaseResponse response2 = await client.GetAsync("Purchase/PurchaseRegister/count/");

                    int c;
                    try
                    {
                        c = response2.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        c = 0;
                    }
                    c++;
                    FirebaseResponse response3 = await client.SetAsync("Purchase/PurchaseRegister/count/", c);

                    FirebaseResponse ab = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/", a);

                    foreach (Sales1 tempP in endList2.Items)
                    {
                        client = new FireSharp.FirebaseClient(config);
                        FirebaseResponse response = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/salesLayout/" + tempP.SNo + "/", tempP);

                        FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/salesLayout/" + tempP.SNo + "/count/", tempP.SNo);
                    }
                    foreach (Product1 temp in endList.Items)
                    {
                        client = new FireSharp.FirebaseClient(config);
                        FirebaseResponse response = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/itemLayout/" + temp.SNo + "/", temp);

                        FirebaseResponse response1 = await client.SetAsync("Purchase/PurchaseRegister/" + a.purchaseNumber + "/itemLayout/count/", temp.SNo);
                    }
                    FirebaseResponse response4 = await client.GetAsync("Master/Spinner/CoilNo/count/");

                    int abs;
                    try
                    {
                        abs = response4.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        abs = 0;
                    }
                    FirebaseResponse firebaseResponse3 = await client.SetAsync("Master/Spinner/CoilNO/" + ab + "/", coilNo.Text);

                    FirebaseResponse response5 = await client.GetAsync("Purchase/PurchaseRegister/Spinner/finished/count/");

                    int ac;
                    try
                    {
                        ac = response5.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        ac = 0;
                    }
                    ac++;
                    FirebaseResponse response6 = await client.SetAsync("Purchase/PurchaseRegister/Spinner/finished/count/", ac);

                    FirebaseResponse firebaseResponse4 = await client.SetAsync("Purchase/PurchaseRegister/Spinner/finished" + ac + "/", a.purchaseNumber);

                    MessageDialog md = new MessageDialog("Purchase Register Successfully Added!");
                    await md.ShowAsync();
                }
                catch (Exception)
                {
                    MessageDialog error = new MessageDialog("Failed to connect to database!");
                    this.Frame.Navigate(typeof(BlankPage6));
                }
            }
            else
            {
                MessageDialog md = new MessageDialog("Check the inputs!");
                await md.ShowAsync();
            }
        }
Esempio n. 20
0
        public async Task <List <LoadDTO> > ExportFromFBToDG()
        {
            List <LoadDTO> result = new List <LoadDTO>();


            var response = await client.GetAsync("TeachersLoad/");

            var list = response.ResultAs <List <LoadDTO> >();

            if (list != null)
            {
                foreach (var item in list)
                {
                    result.Add(new LoadDTO
                    {
                        Id             = item.Id,
                        Teacher        = item.Teacher,
                        Subject        = item.Subject,
                        Group          = item.Group,
                        TotalHours     = item.TotalHours,
                        Weeks          = item.Weeks,
                        HoursPerWeek   = item.HoursPerWeek,
                        DaysOfPractice = item.DaysOfPractice
                    });
                }
            }
            List <TeachersOpp> TeachResult = new List <TeachersOpp>();

            response = await client.GetAsync("TeachersWeekLoad/");

            var Teachlist = response.ResultAs <List <TeachersOpp> >();

            if (Teachlist != null)
            {
                foreach (var item in Teachlist)
                {
                    TeachResult.Add(new TeachersOpp
                    {
                        Teacher   = item.Teacher,
                        Monday    = item.Monday,
                        Tuesday   = item.Tuesday,
                        Wednesday = item.Wednesday,
                        Thursday  = item.Thursday,
                        Friday    = item.Friday
                    });
                }
            }
            List <CabinetList> CabResult = new List <CabinetList>();

            response = await client.GetAsync("Cabinets/");

            var CabList = response.ResultAs <List <CabinetList> >();

            if (CabList != null)
            {
                foreach (var item in CabList)
                {
                    CabResult.Add(new CabinetList
                    {
                        TeacherName = item.TeacherName,
                        Cabinet     = item.Cabinet,
                    });
                }
            }
            AlgoLogic.BData          = result;
            AlgoLogic.TeachersUpload = TeachResult;
            AlgoLogic.CabLoad        = CabResult;
            return(result);
        }
        private async void btnEnter_Click(object sender, EventArgs e)
        {
            var signUpDetails = new
            {
                email      = tbUserEmail.Text,
                password   = tbPassword.Text,
                name       = tbUserName.Text,
                picProfile = "noPic"
            };
            string email;

            if (txtUserName.Visible)
            {
                if (!tbUserEmail.Text.Equals("") && !tbPassword.Text.Equals("") && !tbUserName.Text.Equals(""))
                {
                    try
                    {
                        email    = tbUserEmail.Text.Replace('.', '_');
                        response = await client.GetAsync("DemoApp/MessageInfo/ID/" + email + "/email");

                        if (tbUserEmail.Text.Equals(response.ResultAs <string>()))
                        {
                            MessageBox.Show("User already exist!");
                        }
                        else
                        {
                            await client.SetAsync("DemoApp/MessageInfo/ID/" + email, signUpDetails);

                            await client.SetAsync("DemoApp/MessageInfo/Accounts/" + email + "/Contacts/pairedCount", 0);

                            Properties.Settings.Default.Email = tbUserEmail.Text;
                            Properties.Settings.Default.Name  = tbUserName.Text;
                            Properties.Settings.Default.Save();
                            response = await client.GetAsync("DemoApp/Search/UserCount");

                            int count = response.ResultAs <int>() + 1;
                            await client.SetAsync("DemoApp/Search/UserCount", count);

                            await client.SetAsync("DemoApp/Search/Users/" + count.ToString(), tbUserEmail.Text);

                            await client.SetAsync("DemoApp/MessageInfo/Accounts/" + email + "/Contacts/pairedCount", 0);

                            tbUserEmail.Clear();
                            tbPassword.Clear();
                            tbUserName.Clear();
                            this.Hide();
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Error has accured");
                    }
                }
                else
                {
                    MessageBox.Show("Input fields cannot be empty");
                }
            }
            else if (!txtUserName.Visible)
            {
                if (!tbUserEmail.Text.Equals("") && !tbPassword.Text.Equals(""))
                {
                    try
                    {
                        email    = tbUserEmail.Text.Replace('.', '_');
                        response = await client.GetAsync("DemoApp/MessageInfo/ID/" + email + "/email");

                        if (tbUserEmail.Text.Equals(response.ResultAs <string>()))
                        {
                            response = await client.GetAsync("DemoApp/MessageInfo/ID/" + email + "/password");

                            if (tbPassword.Text.Equals(response.ResultAs <string>()))
                            {
                                response = await client.GetAsync("DemoApp/MessageInfo/ID/" + email + "/name");

                                Properties.Settings.Default.Email = tbUserEmail.Text;
                                Properties.Settings.Default.Name  = response.ResultAs <string>();
                                Properties.Settings.Default.Save();
                                tbUserEmail.Clear();
                                tbPassword.Clear();
                                this.Hide();
                            }
                            else
                            {
                                MessageBox.Show("Access denied");
                            }
                        }
                        else
                        {
                            MessageBox.Show("User does not exist!");
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Error has accured");
                    }
                }
                else
                {
                    MessageBox.Show("Input fields cannot be empty");
                }
            }
        }
Esempio n. 22
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(config);
                FirebaseResponse response = await client.GetAsync("Purchase/PurchaseRegister/Spinner/finished/count");

                int c;
                try
                {
                    c = response.ResultAs <int>();
                }
                catch
                {
                    c = 0;
                }
                productIn     result     = new productIn();
                List <string> numberList = new List <string>();
                for (int i = 1; i <= c; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Purchase/PurchaseRegister/Spinner/finished/" + i + "/");

                    string ab = response1.ResultAs <string>();

                    pOrderFinal abc = new pOrderFinal();

                    FirebaseResponse response15 = await client.GetAsync("Purchase/PurchaseRegister/" + ab + "/");

                    abc               = response15.ResultAs <pOrderFinal>();
                    result.sno        = MyList.Items.Count + 1;
                    result.purchaseid = ab;
                    result.supplier   = abc.supplierName;
                    result.date       = abc.date;
                    result.time       = abc.time;
                    result.coilno     = abc.coilNo;
                    FirebaseResponse response2 = await client.GetAsync("Purchase/PurchaseRegister/" + ab + "/itemLayout/count/");

                    int count;
                    try
                    {
                        count = response2.ResultAs <int>();
                    }
                    catch
                    {
                        count = 0;
                    }

                    for (int i1 = 1; i1 <= count; i1++)
                    {
                        FirebaseResponse response3 = await client.GetAsync("Purchase/PurchaseRegister/" + ab + "/itemLayout/" + i1 + "/");

                        Product1 product1 = new Product1();
                        product1 = response3.ResultAs <Product1>();
                        productIn productIn = new productIn();
                        productIn.sno        = result.sno;
                        productIn.purchaseid = result.purchaseid;
                        productIn.supplier   = result.supplier;
                        productIn.date       = result.date;
                        productIn.time       = result.time;
                        productIn.coilno     = result.coilno;
                        productIn.stripsize  = product1.pName;
                        productIn.quantity   = product1.pQuantity;

                        MyList.Items.Add(productIn);
                    }
                    if (MyList.Items.Count > 0)
                    {
                        progress1.Visibility = Visibility.Collapsed;
                        pin.Visibility       = Visibility.Visible;
                    }
                }
            }
            catch (Exception)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
Esempio n. 23
0
        async void GetAllTasksForAccept()
        {
            _client = new FireSharp.FirebaseClient(config);
            int              i           = 0;
            bool             s           = true;
            FirebaseResponse getResponse = null;
            List <Tasks>     tasks       = new List <Tasks>();

            try
            {
                while (s)
                {
                    try
                    {
                        getResponse = await _client.GetAsync("Tasks/" + i);

                        Tasks result = getResponse.ResultAs <Tasks>();
                        if (result == null)
                        {
                            break;
                        }
                        if (result.status == "Resolved")
                        {
                            tasks.Add(result);
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                        s = false;
                    }
                    i++;
                }
            }
            catch (Exception e)
            {
            }

            wrapPanel1.Children.Clear();

            foreach (var OneTask in tasks)
            {
                Border myBorder1 = new Border();
                myBorder1.Background      = Brushes.White;
                myBorder1.BorderBrush     = Brushes.Black;
                myBorder1.BorderThickness = new Thickness(1);
                myBorder1.Margin          = new Thickness(0, 0, 10, 10);

                Label Name = new Label();
                Name.Content = OneTask.name;

                var bc = new BrushConverter();
                Name.Background = (Brush)bc.ConvertFrom("#FF70B8E8");
                Name.Foreground = new SolidColorBrush(Colors.White);

                Label Owner = new Label();
                Owner.Content    = OneTask.requester;
                Owner.Margin     = new Thickness(0, 1, 0, 0);
                Owner.Background = (Brush)bc.ConvertFrom("#FF70B8E8");
                Owner.Foreground = new SolidColorBrush(Colors.White);

                Label Status = new Label();
                Status.Content    = OneTask.status;
                Status.Foreground = new SolidColorBrush(Colors.Black);

                StackPanel st = new StackPanel();
                st.Orientation = Orientation.Vertical;

                st.Children.Add(Name);
                st.Children.Add(Owner);
                st.Children.Add(Status);

                //AcceptTask
                Button AcceptTask = new Button();
                AcceptTask.FontWeight  = FontWeights.UltraBold;
                AcceptTask.Background  = (Brush)bc.ConvertFrom("#FF70B8E8");
                AcceptTask.Foreground  = new SolidColorBrush(Colors.White);
                AcceptTask.BorderBrush = new SolidColorBrush(Colors.White);
                AcceptTask.Tag         = OneTask.id + " " + OneTask.requester;
                AcceptTask.Click      += new RoutedEventHandler(AcceptTask_Click);
                AcceptTask.Content     = "Підтвердити";
                //AcceptTask

                //CanceledTask
                Button CanceledTask = new Button();
                CanceledTask.FontWeight  = FontWeights.UltraBold;
                CanceledTask.Background  = (Brush)bc.ConvertFrom("#FF70B8E8");
                CanceledTask.Foreground  = new SolidColorBrush(Colors.White);
                CanceledTask.BorderBrush = new SolidColorBrush(Colors.White);
                CanceledTask.Content     = "Скасувати";
                //CanceledTask


                st.Children.Add(AcceptTask);
                st.Children.Add(CanceledTask);

                myBorder1.Child = st;
                wrapPanel1.Children.Add(myBorder1);
            }
        }
Esempio n. 24
0
        async void GetAllClosedTasks(string requester)
        {
            _client = new FireSharp.FirebaseClient(config);

            FirebaseResponse getResponse          = null;
            int            i                      = 0;
            List <oneTask> AllResolvedUserTasksID = new List <oneTask>();
            List <Tasks>   AllResolvedUserTasks   = new List <Tasks>();

            try
            {
                while (true)
                {
                    getResponse = await _client.GetAsync("Users/" + requester + "/closedTasks/" + i);

                    if (getResponse.Body == "null")
                    {
                        break;
                    }
                    var result = getResponse.ResultAs <oneTask>();
                    AllResolvedUserTasksID.Add(result);
                    i++;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                foreach (var taskID in AllResolvedUserTasksID)
                {
                    getResponse = await _client.GetAsync("Tasks/" + taskID.id);

                    var result = getResponse.ResultAs <Tasks>();
                    AllResolvedUserTasks.Add(result);
                }
            }
            catch (Exception e)
            {
            }

            wrapPanel1.Children.Clear();

            foreach (var OneTask in AllResolvedUserTasks)
            {
                Border myBorder1 = new Border();
                myBorder1.Background      = Brushes.White;
                myBorder1.BorderBrush     = Brushes.Black;
                myBorder1.BorderThickness = new Thickness(1);
                myBorder1.Margin          = new Thickness(0, 0, 10, 10);

                Label Name = new Label();
                Name.Content = OneTask.name;

                var bc = new BrushConverter();
                Name.Background = (Brush)bc.ConvertFrom("#FF70B8E8");
                Name.Foreground = new SolidColorBrush(Colors.White);

                Label Owner = new Label();
                Owner.Content    = OneTask.owner;
                Owner.Margin     = new Thickness(0, 1, 0, 0);
                Owner.Background = (Brush)bc.ConvertFrom("#FF70B8E8");
                Owner.Foreground = new SolidColorBrush(Colors.White);

                Label Status = new Label();
                Status.Content    = OneTask.status;
                Status.Foreground = new SolidColorBrush(Colors.Black);

                StackPanel st = new StackPanel();
                st.Orientation = Orientation.Vertical;

                st.Children.Add(Name);
                st.Children.Add(Owner);
                st.Children.Add(Status);

                myBorder1.Child = st;
                myBorder1.Tag   = OneTask.id;
                wrapPanel1.Children.Add(myBorder1);
            }
        }
Esempio n. 25
0
        private async void Recive()
        {
            try
            {
                FirebaseResponse response = await client.GetAsync(@"Actions/action");

                if (response.StatusCode == System.Net.HttpStatusCode.NotFound && response.StatusCode == System.Net.HttpStatusCode.BadRequest)
                {
                    RemoteRecive.Interval = 1000;
                }
                else if (respold != response.Body)
                {
                    respold = response.Body;

                    if (response.Body.Contains("up"))
                    {
                        GoUp();
                    }
                    else if (response.Body.Contains("down"))
                    {
                        GoDown();
                    }
                    else if (response.Body.Contains("left"))
                    {
                        GoLeft();
                    }
                    else if (response.Body.Contains("right"))
                    {
                        GoRight();
                    }
                    else if (response.Body.Contains("enter"))
                    {
                        if (controllerControlling == "keyboard")
                        {
                            if (curentLetter == "OK")
                            {
                                Search(textBox1.Text);
                                youTubeSearch.BringToFront();
                                youTubeSearch.Visible = true;
                                controllerControlling = "youtubeSearchSelection";
                                virtualKeyboard.SendToBack();
                                virtualKeyboard.Visible = false;
                            }
                            else
                            {
                                textBox1.Text += curentLetter;
                            }
                        }
                        else if (controllerControlling == "youtubeSearchSelection")
                        {
                            videoSearchResultsOnDisplay[curentVideoSearchLine][curentVideoSearchRow].Play();
                            controllerControlling = "playingVideo";
                        }
                        else if (controllerControlling == "playingVideo")
                        {
                            PauseAndCloseAdd();
                        }
                    }
                    else if (response.Body.Contains("back"))
                    {
                        if (controllerControlling == "playingVideo")
                        {
                            webBrowser.SendToBack();
                            webBrowser.Visible = false;
                            browser.LoadHtml("");
                            controllerControlling = "youtubeSearchSelection";
                        }
                        else if (controllerControlling == "youtubeSearchSelection")
                        {
                            youTubeSearch.SendToBack();
                            youTubeSearch.Visible = false;
                            browser.LoadHtml("");
                            controllerControlling = "keyboard";
                            virtualKeyboard.BringToFront();
                            virtualKeyboard.Visible = true;
                        }
                    }
                }

                label1.Text = response.Body;
            }
            catch
            {
                RemoteRecive.Interval = 1000;
            }

            RemoteRecive.Start();
        }
        private async void LoginButton(object sender, RoutedEventArgs e)
        {
            Loading();
            prisijungtiButton.IsEnabled = false;
            string key = String.Join("", Encoding.ASCII.GetBytes(ePastoTextBox.Text));
            // nuskaitom paskyra is duomenu bazes
            var response = await client.GetAsync("Paskyros/" + key);

            Vartotojas paskyra = response.ResultAs <Vartotojas>();

            // jei paskyra neegzistuoja
            if (paskyra == null)
            {
                Unloading();
                generalEventText.Content    = "Tokia paskyra neegzistuoja";
                generalEventText.Foreground = Brushes.Red;
                generalEventText.Visibility = Visibility.Visible;
                prisijungtiButton.IsEnabled = true;
                counter++;
            }
            else
            {
                //Tikrina ar paskyra neturi buti istrinta
                if (paskyra.ToDelete == true && DateTime.Now > paskyra.Istrynimo_Data)
                {
                    client.Delete("Paskyros/" + key);
                    Unloading();
                    generalEventText.Content    = "Tokia paskyra neegzistuoja";
                    generalEventText.Foreground = Brushes.Red;
                    generalEventText.Visibility = Visibility.Visible;
                    prisijungtiButton.IsEnabled = true;
                    counter++;
                }
                else
                {
                    // jei tinka slaptažodis
                    if (Security.PasswordMatch(slaptazodzioTextBox.Password, paskyra.Slaptazodis))
                    {
                        // prisijungus prie paskyros kuri neturi apsaugos
                        if (paskyra.ShortSecurityCode == 0 | paskyra.LongSecurityCode == 0)
                        {
                            var securityForm = new ApsaugosKodas();
                            securityForm.paskyra = paskyra;
                            securityForm.key     = key;
                            securityForm.Show();
                            Close();
                        }
                        else
                        {
                            var apzvalga = new Apzvalga(paskyra, key);
                            generalEventText.Visibility = Visibility.Hidden;
                            prisijungtiButton.IsEnabled = true;
                            apzvalga.Show();
                            Close();
                        }
                    }
                    else
                    {
                        Unloading();
                        generalEventText.Content    = "Neteisingas slaptažodis";
                        generalEventText.Foreground = Brushes.Red;
                        generalEventText.Visibility = Visibility.Visible;
                        prisijungtiButton.IsEnabled = true;
                        counter++;
                    }
                }
            }

            if (counter >= 5)
            {
                var captcha = new Captcha();
                captcha.prisijungimas         = this;
                ePastoTextBox.IsReadOnly      = true;
                slaptazodzioTextBox.IsEnabled = false;
                prisijungtiButton.IsEnabled   = false;
                captcha.Show();
            }
        }
Esempio n. 27
0
        async void GetResolvedTasks(string requester)
        {
            _client = new FireSharp.FirebaseClient(config);

            FirebaseResponse getResponse = null;

            List <Tasks> AllResolvedUserTasks = new List <Tasks>();

            try
            {
                getResponse = await _client.GetAsync("Users/" + requester + "/userTasks");

                var result = getResponse.ResultAs <currentTask>();

                if (result.first != "")
                {
                    getResponse = await _client.GetAsync("Tasks/" + result.first);

                    var firstTask = getResponse.ResultAs <Tasks>();
                    if (firstTask.status == "Resolved")
                    {
                        AllResolvedUserTasks.Add(firstTask);
                    }
                }
                if (result.second != "")
                {
                    getResponse = await _client.GetAsync("Tasks/" + result.second);

                    var secondTask = getResponse.ResultAs <Tasks>();
                    if (secondTask.status == "Resolved")
                    {
                        AllResolvedUserTasks.Add(secondTask);
                    }
                }
                if (result.third != "")
                {
                    getResponse = await _client.GetAsync("Tasks/" + result.third);

                    var thirdTask = getResponse.ResultAs <Tasks>();
                    if (thirdTask.status == "Resolved")
                    {
                        AllResolvedUserTasks.Add(thirdTask);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            wrapPanel1.Children.Clear();

            foreach (var OneTask in AllResolvedUserTasks)
            {
                Border myBorder1 = new Border();
                myBorder1.Background      = Brushes.White;
                myBorder1.BorderBrush     = Brushes.Black;
                myBorder1.BorderThickness = new Thickness(1);
                myBorder1.Margin          = new Thickness(0, 0, 10, 10);

                Label Name = new Label();
                Name.Content = OneTask.name;

                var bc = new BrushConverter();
                Name.Background = (Brush)bc.ConvertFrom("#FF70B8E8");
                Name.Foreground = new SolidColorBrush(Colors.White);

                Label Owner = new Label();
                Owner.Content    = OneTask.owner;
                Owner.Margin     = new Thickness(0, 1, 0, 0);
                Owner.Background = (Brush)bc.ConvertFrom("#FF70B8E8");
                Owner.Foreground = new SolidColorBrush(Colors.White);

                Label Status = new Label();
                Status.Content    = OneTask.status;
                Status.Foreground = new SolidColorBrush(Colors.Black);

                StackPanel st = new StackPanel();
                st.Orientation = Orientation.Vertical;

                st.Children.Add(Name);
                st.Children.Add(Owner);
                st.Children.Add(Status);


                AccessText mess = new AccessText();
                mess.Text         = "Waiting for access";
                mess.TextWrapping = TextWrapping.Wrap;
                mess.Height       = double.NaN;
                mess.Foreground   = new SolidColorBrush(Colors.ForestGreen);

                st.Children.Add(mess);

                myBorder1.Child = st;
                myBorder1.Tag   = OneTask.id;
                wrapPanel1.Children.Add(myBorder1);
            }
        }
Esempio n. 28
0
        private async void updateDetails(string cName)
        {
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response5 = await client.GetAsync("Sales/SalesOrder/" + fSales.Text + "/Layout/count/");

            int count5;

            try
            {
                count5 = response5.ResultAs <int>();
            }
            catch (Exception)
            {
                count5 = 0;
            }
            List <String> nameLt5 = new List <String>();

            for (int i = 1; i <= count5; i++)
            {
                FirebaseResponse response1 = await client.GetAsync("Sales/SalesOrder/" + fSales.Text + "/Layout/" + i);

                Product list1 = new Product();
                list1 = response1.ResultAs <Product>();
                string nameNw = list1.pName;
                if (nameNw == cName)
                {
                    fEQuantity.Text = list1.pQuantity.ToString();
                }
            }
            FirebaseResponse response = await client.GetAsync("DispatchQC/Spinner/Verified/count/");

            int n;

            try
            {
                n = response.ResultAs <int>();
            }
            catch (Exception)
            {
                n = 0;
            }
            int finished = 0;

            for (int i = 1; i <= n; i++)
            {
                FirebaseResponse response1 = await client.GetAsync("DispatchQC/Spinner/Verified/" + i + "/");

                string           a         = response1.ResultAs <string>();
                FirebaseResponse response2 = await client.GetAsync("DispatchQC/" + a + "/");

                dispatchQC dispatch = new dispatchQC();
                dispatch = response2.ResultAs <dispatchQC>();
                string ab = fSales.Text;
                if (dispatch.salesordernumber == ab && dispatch.productname == cName)
                {
                    finished = finished + dispatch.pquantity;
                }
            }
            fPQuantity.Text = finished.ToString();
            if (fPQuantity.Text == fEQuantity.Text)
            {
                fStatus.Text = "Fully Completed";
            }
            else if (finished < Int32.Parse(fEQuantity.Text))
            {
                fStatus.Text = "Partially Completed";
            }
        }
Esempio n. 29
0
        async void GetAllTasks(string status)
        {
            //status;
            _client = new FireSharp.FirebaseClient(config);
            int              i           = 0;
            bool             s           = true;
            FirebaseResponse getResponse = null;
            List <Tasks>     tasks       = new List <Tasks>();

            try
            {
                while (s)
                {
                    try
                    {
                        getResponse = await _client.GetAsync("Tasks/" + i);

                        Tasks result = getResponse.ResultAs <Tasks>();
                        if (result == null)
                        {
                            break;
                        }
                        tasks.Add(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                        s = false;
                    }
                    i++;
                }
            }
            catch (Exception e)
            {
            }

            wrapPanel1.Children.Clear();

            foreach (var OneTask in tasks)
            {
                Border myBorder1 = new Border();
                // Zadniy fon colir
                myBorder1.Background  = Brushes.White;
                myBorder1.BorderBrush = Brushes.Black;
                //розмір рамки
                myBorder1.BorderThickness = new Thickness(1);
                //Відступи знизу, справа
                myBorder1.Margin = new Thickness(0, 0, 10, 10);

                Label Name = new Label();
                Name.Content = OneTask.name;
                //Name.FontFamily

                var bc = new BrushConverter();
                Name.Background = (Brush)bc.ConvertFrom("#FF70B8E8");
                Name.Foreground = new SolidColorBrush(Colors.White);

                //Name.Foreground = new SolidColorBrush(Colors.);

                Label Owner = new Label();
                Owner.Content = OneTask.owner;
                //var bc = new BrushConverter();
                Owner.Margin     = new Thickness(0, 1, 0, 0);
                Owner.Background = (Brush)bc.ConvertFrom("#FF70B8E8");
                Owner.Foreground = new SolidColorBrush(Colors.White);

                Label Status = new Label();
                Status.Content    = OneTask.status;
                Status.Foreground = new SolidColorBrush(Colors.Black);

                //Дозволяє додавати лейбли один під одним
                StackPanel st = new StackPanel();
                st.Orientation = Orientation.Vertical;

                if (OneTask.status == status)
                {
                    // TODO :  id, Name, Opys, ToyHtoVykonye, status
                    st.Children.Add(Name);
                    st.Children.Add(Owner);
                    st.Children.Add(Status);

                    //TakeTaskButton
                    Button TakeTaskButton = new Button();
                    TakeTaskButton.FontWeight  = FontWeights.UltraBold;
                    TakeTaskButton.Background  = (Brush)bc.ConvertFrom("#FF70B8E8");
                    TakeTaskButton.Foreground  = new SolidColorBrush(Colors.White);
                    TakeTaskButton.BorderBrush = new SolidColorBrush(Colors.White);
                    TakeTaskButton.Content     = "Добавити до завдань";
                    TakeTaskButton.Click      += new RoutedEventHandler(btnTest_Click);
                    //TakeTaskButton

                    st.Children.Add(TakeTaskButton);

                    myBorder1.Child = st;
                    myBorder1.Tag   = OneTask.id;
                }

                wrapPanel1.Children.Add(myBorder1);
            }
        }
Esempio n. 30
0
        public async void getthongtincuoi(string CMND, int vitrivuaxoa)
        {
            var action = await DisplayAlert("Thông báo", "Bạn có chắc xóa thông tin này chứ?", "Đồng Ý", "Hủy");

            if (action)
            {
                if (employees.Count == 1) //Nếu chỉ còn 1 phần tử  thì xóa ngay
                {
                    FirebaseResponse xoahet = await client.DeleteAsync("khachthue/" + CMND + "/KHACHTHUEGIADINH/" + vitrivuaxoa + "/");

                    getgiadinh(CMND_);
                }
                else // Ngược lại
                {
                    //Tiến hành lấy vị trí cuối
                    var  mangvitricuoi = new List <listgiadinh>();
                    int  i             = 0;
                    bool check         = true;
                    while (check)
                    {
                        i++;
                        try
                        {
                            FirebaseResponse tk = await client.GetAsync("khachthue/" + CMND + "/KHACHTHUEGIADINH/" + i + "/");

                            if (tk.Body == "null")
                            {
                                //Tiến hành duyệt mảng đến null thì vào đây làm bước tiếp theo
                                int cuoi             = i - 1;
                                FirebaseResponse tk1 = await client.GetAsync("khachthue/" + CMND + "/KHACHTHUEGIADINH/" + cuoi + "/");

                                KHACH_THUE_GIA_DINH GD = tk1.ResultAs <KHACH_THUE_GIA_DINH>();
                                mangvitricuoi.Add(
                                    new listgiadinh(
                                        GD.ID,
                                        GD.HOTEN,
                                        GD.NGAYSINH,
                                        GD.GIOITINH,
                                        GD.QUANHE,
                                        GD.NGHENGHIEP,
                                        GD.DIACHICHOOHIENNAY
                                        )
                                    );                   // Lưu thông tin cuối mảng vào 1 mảng
                                //Tiến hành hành động xóa
                                if (vitrivuaxoa == cuoi) //Nếu vị trí vừa chọn là cuối thì tiến hành xóa ngay
                                {
                                    FirebaseResponse xoahet = await client.DeleteAsync("khachthue/" + CMND + "/KHACHTHUEGIADINH/" + vitrivuaxoa + "/");
                                }
                                else //Nếu vị trí vừa chọn là ngẫu nhiên thì tiến hành xóa vị trí hiện tại và xóa vị trí cuối
                                {
                                    FirebaseResponse xoa = await client.DeleteAsync("khachthue/" + CMND + "/KHACHTHUEGIADINH/" + vitrivuaxoa + "/");

                                    FirebaseResponse xoacuoi = await client.DeleteAsync("khachthue/" + CMND + "/KHACHTHUEGIADINH/" + cuoi + "/");

                                    //Gán giá trị lưu ở mảng trên vào vị trí vừa xóa
                                    foreach (var item in mangvitricuoi)
                                    {
                                        var data = new KHACH_THUE_GIA_DINH
                                        {
                                            ID                = vitrivuaxoa,
                                            HOTEN             = item.hoten,
                                            GIOITINH          = item.gioitinh,
                                            NGAYSINH          = item.ngaysinh,
                                            DIACHICHOOHIENNAY = item.choo,
                                            NGHENGHIEP        = item.nghenghiep,
                                            QUANHE            = item.quanhe
                                        };
                                        SetResponse response = await client.SetAsync("khachthue/" + CMND_ + "/KHACHTHUEGIADINH/" + vitrivuaxoa + "/", data);
                                    }
                                }
                                //Cuối cũng tiến hành clear mảng ==> gét thông tin về ==> thoát While
                                employees.Clear();
                                getgiadinh(CMND_);
                                check = false;
                            }
                        }
                        catch { }
                    }
                }
            }
            else
            {
                getgiadinh(CMND_);
            }
        }