async Task LoadOrders(string value)
        {
            LoadingManager.OnLoading();
            Status _statusvalue = (Status)Enum.Parse(typeof(Status), value);

            var orderData = await orderDataStore.GetOrdersOfUserWithSpecificStatus(App.LogUser.UserId, _statusvalue, App.TokenDto.Token);


            KeyValues.Clear();

            KeyValues.Add("orderAdded", orderData);

            UserOrders.Clear();

            foreach (var item in orderData)
            {
                item.StoreOrder = await StoreDataStore.GetItemAsync(item.StoreId.ToString());

                var presenter = new OrderPresenter(item);

                UserOrders.Add(presenter);
            }

            LoadingManager.OffLoading();
        }
Ejemplo n.º 2
0
        // keyPath (path to key), dive (recursively go through SubKeys)
        public RegLookupParse(string keyPath, bool dive = true)
        {
            RegistryKey localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);

            localKey = localKey.OpenSubKey(keyPath, false);

            // Check for empty (non-exsistent) key
            if (localKey == null)
            {
                Error = true;
                return;
            }

            // Process any Sub Keys
            foreach (string subKeyName in localKey.GetSubKeyNames())
            {
                string subKeyPath = keyPath + @"\" + subKeyName;

                // Check if it's needed to go through the subkeys
                if (dive)
                {
                    SubKeys.Add(new SubKey
                    {
                        KeyPath   = subKeyPath,
                        SubKeyObj = new RegLookupParse(subKeyPath)
                    });
                }
                else
                {
                    SubKeys.Add(new SubKey
                    {
                        KeyPath = subKeyPath
                    });
                }
            }

            // Process any Values
            foreach (string valueName in localKey.GetValueNames())
            {
                string valueForName = localKey.GetValue(valueName).ToString();
                KeyValues.Add(new KeyValue {
                    Name = valueName, Value = valueForName
                });
            }
        }
Ejemplo n.º 3
0
        private void GetKeyValuesFromDatabase()
        {
            string conStr = Manager.ConnectionString;

            using (SqlConnection con = new SqlConnection(conStr))
            {
                using (SqlCommand com = new SqlCommand(_sqlScript, con))
                {
                    con.Open();

                    using (SqlDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            KeyValues.Add(new KeyValuePair <string, string>(reader[0].ToString(), reader[1].ToString()));
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public void getMedicineStatisticByDrug()
 {
     try
     {
         KeyValues.Clear();
         string medicineId = null;
         if (MedicineSelected != null)
         {
             medicineId = ChartM.GetMedicineId(MedicineSelected);
         }
         foreach (var item in ChartM.GetStatistic(DateStart, DateFinish, medicineId))
         {
             KeyValues.Add(new KeyValuePair <string, int>(item.Key, item.Value));
         }
     }
     catch (Exception e)
     {
         (App.Current as App).navigation.MainWindows.comments.Text = e.Message.ToString();
     }
 }
Ejemplo n.º 5
0
        public void SetKeyValue(string key, string value)
        {
            bool IsMatch(PointOfSaleKeyValue posKv) => string.Equals(posKv.Key, key, StringComparison.OrdinalIgnoreCase);

            var cnt = KeyValues.Count(IsMatch);

            if (cnt > 1)
            {
                foreach (var kv in KeyValues.Where(IsMatch).ToArray())
                {
                    KeyValues.Remove(kv);
                }
            }
            else if (cnt == 1)
            {
                KeyValues.First(IsMatch).SetValue(value);
            }
            else
            {
                KeyValues.Add(new PointOfSaleKeyValue(key, value));
            }
        }
Ejemplo n.º 6
0
 public Bucket Add(KeyValue keyValue) =>
 new Bucket(KeyValues.Add(keyValue));
Ejemplo n.º 7
0
 /// <summary>
 /// 添加键和值
 /// </summary>
 public int Add(String key, String value)
 {
     return(KeyValues.Add(key, value));
 }
        async Task LoadUserOrderWithStatus(string value)
        {
            LoadingManager.OnLoading();
            Status _statusvalue = (Status)Enum.Parse(typeof(Status), value);

            var orderData = await orderDataStore.GetOrdersOfUserWithSpecificStatus(App.LogUser.UserId, _statusvalue, App.TokenDto.Token);

            if (!KeyValues.ContainsKey("orderAdded"))
            {
                KeyValues.Add("orderAdded", orderData);
            }


            switch (_statusvalue)
            {
            case Status.Completed:
            {
                List <Order> tempData = new List <Order>();

                var data = await orderDataStore.GetOrdersOfUserWithSpecificStatusDifferent(KeyValues["orderAdded"], _statusvalue, App.LogUser.UserId);

                if (data != null)
                {
                    foreach (var item in KeyValues["orderAdded"])
                    {
                        if (!tempData.Any(o => o.OrderId == item.OrderId))
                        {
                            tempData.Add(item);
                        }
                    }

                    foreach (var item in data)
                    {
                        if (!tempData.Any(s => s.StoreId == item.StoreId))
                        {
                            tempData.Add(item);
                        }
                    }

                    KeyValues.Clear();
                    KeyValues.Add("orderAdded", tempData);


                    foreach (var item in KeyValues["orderAdded"])
                    {
                        if (!UserOrders.Any(s => s.OrderId == item.OrderId))
                        {
                            //Task.Run(async() =>
                            //{
                            //    item.StoreOrder = await StoreDataStore.GetItemAsync(item.StoreId.ToString());

                            //}).Wait();

                            item.StoreOrder = await StoreDataStore.GetItemAsync(item.StoreId.ToString());

                            var presenter = new OrderPresenter(item);

                            UserOrders.Add(presenter);
                        }
                    }
                }



                break;
            }

            case Status.NotSubmited:
            {
                List <Order> tempData = new List <Order>();

                var data = await orderDataStore.GetOrdersOfUserWithSpecificStatusDifferent(KeyValues["orderAdded"], _statusvalue, App.LogUser.UserId);

                if (data != null)
                {
                    foreach (var item in KeyValues["orderAdded"])
                    {
                        if (!tempData.Any(o => o.OrderId == item.OrderId))
                        {
                            tempData.Add(item);
                        }
                    }

                    foreach (var item in data)
                    {
                        if (!tempData.Any(s => s.StoreId == item.StoreId))
                        {
                            tempData.Add(item);
                        }
                    }

                    KeyValues.Clear();
                    KeyValues.Add("orderAdded", tempData);


                    foreach (var item in KeyValues["orderAdded"])
                    {
                        if (!UserOrders.Any(s => s.OrderId == item.OrderId))
                        {
                            item.StoreOrder = await StoreDataStore.GetItemAsync(item.StoreId.ToString());

                            var presenter = new OrderPresenter(item);

                            UserOrders.Add(presenter);
                        }
                    }
                }

                break;

                //UserOrders.Clear();

                //foreach (var item in orderData)
                //{

                //    item.StoreOrder = await StoreDataStore.GetItemAsync(item.StoreId.ToString());
                //    var presenter = new OrderPresenter(item);

                //    UserOrders.Add(presenter);
                //}
            }

            case Status.Submited:
            {
                List <Order> tempData = new List <Order>();

                var data = await orderDataStore.GetOrdersOfUserWithSpecificStatusDifferent(KeyValues["orderAdded"], _statusvalue, App.LogUser.UserId);

                if (data != null)
                {
                    foreach (var item in KeyValues["orderAdded"])
                    {
                        if (!tempData.Any(o => o.OrderId == item.OrderId))
                        {
                            tempData.Add(item);
                        }
                    }

                    foreach (var item in data)
                    {
                        if (!tempData.Any(s => s.StoreId == item.StoreId))
                        {
                            tempData.Add(item);
                        }
                    }

                    KeyValues.Clear();
                    KeyValues.Add("orderAdded", tempData);


                    foreach (var item in KeyValues["orderAdded"])
                    {
                        if (!UserOrders.Any(s => s.OrderId == item.OrderId))
                        {
                            item.StoreOrder = await StoreDataStore.GetItemAsync(item.StoreId.ToString());

                            var presenter = new OrderPresenter(item);

                            UserOrders.Add(presenter);
                        }
                    }
                }


                //UserOrders.Clear();

                //foreach (var item in orderData)
                //{

                //    item.StoreOrder = await StoreDataStore.GetItemAsync(item.StoreId.ToString());
                //    var presenter = new OrderPresenter(item);

                //    UserOrders.Add(presenter);
                //}

                break;
            }

            default:
                break;
            }

            LoadingManager.OffLoading();
        }