Пример #1
0
        private async void updateInfo(string Name)
        {
            IFirebaseConfig config1 = new FirebaseConfig
            {
                AuthSecret = "Fld3TLREfZ47bmggol008nKkHzDAMphTdhlqi09d",
                BasePath   = "https://weldonetechnocrats.firebaseio.com/"
            };
            var client1 = new FireSharp.FirebaseClient(config1);

            Name = wOrderID.Text;

            FirebaseResponse response1 = await client1.GetAsync("Manufacturing/RouteCard/" + Name + "/");

            routeCard var = response1.ResultAs <routeCard>();

            updateMaster(Name);

            try
            {
                FirebaseResponse response = await client1.GetAsync("Manufacturing/RouteCard/" + Name + "/processLayout/1/Name/");

                string a = response.ResultAs <string>();
                fProduct.Text = a;
                fBatch.Text   = var.batchNo;
                updateProcess(a);
            }
            catch (Exception)
            {
                updateInfo(Name);
            }
        }
Пример #2
0
        private async void updateClientInfo(string Name)
        {
            IFirebaseConfig config1 = new FirebaseConfig
            {
                AuthSecret = "Fld3TLREfZ47bmggol008nKkHzDAMphTdhlqi09d",
                BasePath   = "https://weldonetechnocrats.firebaseio.com/"
            };
            var client1 = new FireSharp.FirebaseClient(config1);

            Name = cNameT.Text;
            FirebaseResponse response1 = await client1.GetAsync("Master/Client/" + Name);

            Client var = response1.ResultAs <Client>();

            try
            {
                cAddT.Text  = var.Address;
                cNoT.Text   = var.ContactNo;
                cMailT.Text = var.MailId;
            }
            catch (Exception)
            {
                updateClientInfo(Name);
            }
        }
Пример #3
0
        public string Get(string User)
        {
            List <History>   histories = new List <History>();
            var              client    = new FireSharp.FirebaseClient(config);
            FirebaseResponse responce  = client.Get("firetest");

            Historydictionary = responce.ResultAs <Dictionary <string, History> >();

            if (Historydictionary != null)
            {
                foreach (var item in Historydictionary)
                {
                    if (item.Value.User == User)
                    {
                        History history = new History();
                        history.Id     = item.Key;
                        history.Date   = item.Value.Date;
                        history.User   = item.Value.User;
                        history.Screen = item.Value.Screen;

                        Histories.Insert(0, history);
                    }
                }
            }
            return(JsonConvert.SerializeObject(Histories));
        }
    public db_connection()
    {
        IFirebaseConfig config = new FirebaseConfig
        {
            AuthSecret = FirebaseSecret,
            BasePath   = BasePath
        };

        _client = new FireSharp.FirebaseClient(config); //Uses JsonNet default
    }
    public static FireSharp.FirebaseClient getFirebaseClientRef()
    {
        IFirebaseConfig config = new FirebaseConfig
        {
            AuthSecret = FirebaseSecret,
            BasePath   = BasePath
        };

        _client = new FireSharp.FirebaseClient(config); //Uses JsonNet default

        return(_client);
    }
Пример #6
0
        private async void rSOrderT_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox temp = (ComboBox)sender;

            rSOrderT.Text = temp.SelectedItem.ToString();
            string          sel    = (string)temp.SelectedItem;
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "Fld3TLREfZ47bmggol008nKkHzDAMphTdhlqi09d",
                BasePath   = "https://weldonetechnocrats.firebaseio.com/"
            };
            IFirebaseClient  client   = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetAsync("Sales/SalesOrder/" + sel + "/");

            selected    = response.ResultAs <SOrder>();
            cNameT.Text = selected.ClientName;
            cMailT.Text = selected.ClientMailID;
            cNoT.Text   = selected.ClientContactNumber;
            cAddT.Text  = selected.ClientAddress;
            DateT.Text  = selected.Date;
            TimeT.Text  = selected.Time;
            updateEndLayout();
        }
Пример #7
0
        public async void updateEndLayout()
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "Fld3TLREfZ47bmggol008nKkHzDAMphTdhlqi09d",
                BasePath   = "https://weldonetechnocrats.firebaseio.com/"
            };
            IFirebaseClient  client   = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetAsync("Sales/SalesOrder/" + selected.SalesOrderID + "/Layout/count/");

            try
            {
                count = response.ResultAs <int>();
            }
            catch (Exception)
            {
                count = 0;;
            }
            if (count > 0)
            {
                layouts = new Layout[count];
                for (int i = 1; i <= count; i++)
                {
                    string          str     = "Sales/SalesOrder/" + selected.SalesOrderID + "/Layout/" + i + "/";
                    IFirebaseConfig config1 = new FirebaseConfig
                    {
                        AuthSecret = "Fld3TLREfZ47bmggol008nKkHzDAMphTdhlqi09d",
                        BasePath   = "https://weldonetechnocrats.firebaseio.com/"
                    };
                    IFirebaseClient client1 = new FireSharp.FirebaseClient(config);
                    response = await client1.GetAsync(str);

                    layouts[i - 1] = response.ResultAs <Layout>();
                }
                updateEndList();
            }
        }
Пример #8
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            // Declaring Firebase
            try
            {
                IFirebaseConfig config = new FirebaseConfig
                {
                    AuthSecret = "Fld3TLREfZ47bmggol008nKkHzDAMphTdhlqi09d",
                    BasePath   = "https://weldonetechnocrats.firebaseio.com/"
                };
                IFirebaseClient  client = new FireSharp.FirebaseClient(config);
                int              i      = 1;
                FirebaseResponse response;
                while (true)
                {
                    response = await client.GetAsync("Sales/SalesOrder/Spinner/Pending/" + i + "/");

                    string str = response.ResultAs <string>();
                    if (str != null)
                    {
                        pSOrder.Add(str);
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
                rSOrderT.ItemsSource = pSOrder;
                // AutoSuggestion for Popup Name
                response = await client.GetAsync("Spinner/Product/count");

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

                    string nameNw = response.ResultAs <string>();
                    nameLt.Add(nameNw);
                }
                int cnt = nameLt.Count;
                Autoitems = new string[cnt];
                Autoitems = nameLt.ToArray();
                if (nameLt.Count == count1)
                {
                    progress1.Visibility = Visibility.Collapsed;
                    sr.Visibility        = Visibility.Visible;
                }
            }
            catch (Exception)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
Пример #9
0
        private async void Submit_Click(object sender, RoutedEventArgs e)
        {
            // Send without Layout
            if (cAddT.Text.Length > 0 && cNoT.Text.Length > 0 && cMailT.Text.Length > 0 && cNameT.Text.Length > 0 && DateT.Text.Length > 0 && TimeT.Text.Length > 0 && rSOrderT.Text.Length > 0 && MyList.Items.Count > 0)
            {
                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 = rSOrderT.Text;
                    temp.status       = "Verified";
                    String          loc    = "Sales/SalesOrder/" + temp.SalesOrderID + "/";
                    IFirebaseConfig config = new FirebaseConfig
                    {
                        AuthSecret = "Fld3TLREfZ47bmggol008nKkHzDAMphTdhlqi09d",
                        BasePath   = "https://weldonetechnocrats.firebaseio.com/"
                    };
                    IFirebaseClient client = new FireSharp.FirebaseClient(config);
                    var             settr  = await client.SetAsync(loc, temp);

                    //Send Layout Now
                    loc = "Sales/SalesOrder/" + temp.SalesOrderID + "/Layout/";
                    int len = loc.Length;
                    client = new FireSharp.FirebaseClient(config);
                    int i = 1;
                    foreach (Layout temp1 in MyList.Items)
                    {
                        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 Verified Count
                    IFirebaseClient  client1  = new FireSharp.FirebaseClient(config);
                    FirebaseResponse response = await client.GetAsync("Sales/SalesOrder/Spinner/Pending/count/");

                    int pCount;
                    int vCount;
                    FirebaseResponse response1 = await client.GetAsync("Sales/SalesOrder/Spinner/Verified/count");

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

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

                    loc  = "Sales/SalesOrder/Spinner/Verified/" + vCount + "/";
                    sett = await client.SetAsync(loc, rSOrderT.Text);

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

                    loc = "Sales/SalesOrder/count";
                    // Pending Count Deletion
                    //response = await client.GetAsync("Sales/SalesOrder/Spinner/Pending/count/");
                    //pCount = response.ResultAs<int>();
                    response = await client.DeleteAsync("Sales/SalesOrder/Spinner/Pending/" + pCount);

                    //loc = "Sales/SalesOrder/Spinner/Pending/count/";
                    //sett = await client.SetAsync(loc, pCount - 1);
                    MessageDialog md = new MessageDialog("Sales Order Successfully Reviewed!");
                    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();
            }
        }
Пример #10
0
        static void Main(string[] args)
        {
            Task.Run(async() =>
            {
                try
                {
                    //        var config = {
                    //    apiKey: "AIzaSyAf3zX8rG4hGfjLQK4Er61bTW7cQjTptgE",
                    //    authDomain: "barontest-152eb.firebaseapp.com",
                    //    databaseURL: "https://barontest-152eb.firebaseio.com",
                    //    projectId: "barontest-152eb",
                    //    storageBucket: "barontest-152eb.appspot.com",
                    //    messagingSenderId: "592512603881"
                    //};

                    var apiKey = "AIzaSyAf3zX8rG4hGfjLQK4Er61bTW7cQjTptgE"; // your app secret
                    var firebaseAuthProvider = new FirebaseAuthProvider(new FirebaseConfig(apiKey));
                    var auth = await firebaseAuthProvider.SignInAnonymouslyAsync();

                    var firebaseClient = new FirebaseClient(
                        "https://barontest-152eb.firebaseio.com/",
                        new FirebaseOptions
                    {
                        AuthTokenAsyncFactory = () => Task.FromResult(auth.FirebaseToken.ToString())
                    });

                    var users           = firebaseClient.Child("users_list");
                    var usersCollection = await users
                                          .OrderByKey()
                                          .LimitToFirst(1)
                                          .OnceAsync <UserNode>();
                    var user = usersCollection.ToList().First();


                    var conversations = firebaseClient.Child("conversations");

                    var conversationsHistory = new Dictionary <string, ConverstionNode>();

                    var conversationsList = await conversations
                                            .OrderByKey()
                                            .OnceAsync <ConverstionNode>();

                    foreach (var conversation in conversationsList)
                    {
                        Console.WriteLine($"{conversation.Key} is {conversation.Object.ToString()}");
                        conversationsHistory.Add(conversation.Key, conversation.Object);
                    }


                    // add new item to list of data and let the client generate new key for you (done offline)
                    var newNode = await conversations.PostAsync(new ConverstionNode
                    {
                        date     = DateTime.Now.ToString("dd/MM/yyyy HH:mm"),
                        username = user.Object.name,
                        text     = $"hello to the first userP {user.Object.name} [{DateTime.Now.Ticks}]"
                    });

                    var obs = conversations.AsObservable <ConverstionNode>();
                    obs.Where(c => !conversationsHistory.ContainsKey(c.Key))
                    .Subscribe(f => Console.WriteLine($"after insert: {f.Key}: {f.Object.ToString()}"));

                    //// add new item directly to the specified location (this will overwrite whatever data already exists at that location)
                    //await firebase
                    //  .Child("dinosaurs")
                    //  .Child("t-rex")
                    //  .PutAsync(new Dinosaur());

                    //// delete given child node
                    //await firebase
                    //  .Child("dinosaurs")
                    //  .Child("t-rex")
                    //  .DeleteAsync();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }).Wait();

            Console.ReadLine();
        }
Пример #11
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();
            }
        }
Пример #12
0
 private void ClienteAlerta_Load(object sender, EventArgs e)
 {
     client = new FireSharp.FirebaseClient(config);
 }
Пример #13
0
 public void attendanceLoaded(Object sender, EventArgs args)
 {
     client = new FireSharp.FirebaseClient(config);
 }
Пример #14
0
 public void Delete(string id)
 {
     var client = new FireSharp.FirebaseClient(config);
     FirebaseResponse responce = client.Delete("firetest/" + id);
 }
Пример #15
0
 public void Post([FromBody] History history)
 {
     var          client   = new FireSharp.FirebaseClient(config);
     PushResponse responce = client.Push("firetest/", history);
 }