public void ProductCategoryRefresh()
 {
     using (WarehouseServiceClient wwsClient = new WarehouseServiceClient(ServiceParametor.Parametor))
     {
         IList <ProductCategory> prodCatList = wwsClient.GetAllProductCategories().ToList();
         productCategoryDataGridView.DataSource = prodCatList.ToList();
     }
 }
示例#2
0
        private static void LoadAllStaticInfo()
        {
            #region Load Role Groups
            try
            {
                using (WarehouseServiceClient wwsClient = new WarehouseServiceClient("HTTP"))
                {
                    var allRoleGroups = wwsClient.GetRoleGroups();

                    Constants.ApplicationData.RoleGroups = new Dictionary <int, RoleGroup>();

                    foreach (var roleGroup in allRoleGroups)
                    {
                        Constants.ApplicationData.RoleGroups.Add(roleGroup.Id, roleGroup);
                    }
                }
            }
            catch
            {
            }

            #endregion

            #region Load Roles
            try
            {
                using (WarehouseServiceClient wwsClient = new WarehouseServiceClient("HTTP"))
                {
                    var allRoles = wwsClient.GetRoles();

                    Constants.ApplicationData.Roles = new Dictionary <int, Role>();

                    foreach (var role in allRoles)
                    {
                        Constants.ApplicationData.Roles.Add(role.Id, role);
                    }
                }
            }
            catch
            {
            }

            #endregion

            #region Load Product Categories

            try
            {
                using (WarehouseServiceClient wwsClient = new WarehouseServiceClient("HTTP"))
                {
                    var allCats = wwsClient.GetAllProductCategories();

                    Constants.ApplicationData.ProductCategory = new Dictionary <int, ProductCategory>();

                    foreach (var product in allCats)
                    {
                        Constants.ApplicationData.ProductCategory.Add(product.Id.Value, product);
                    }
                }
            }
            catch
            {
            }



            #endregion

            #region Load Product

            try
            {
                WWS.WarehouseServiceClient productManager = new WWS.WarehouseServiceClient(ServiceParametor.Parametor);

                var allProduct = productManager.GetActiveProduct();

                Constants.ApplicationData.Products = new Dictionary <int, WWS.Product>();

                foreach (var item in allProduct)
                {
                    Constants.ApplicationData.Products.Add(item.Id.Value, item);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            #endregion

            #region Load Munit
            try
            {
                WWS.WarehouseServiceClient munitManager = new WWS.WarehouseServiceClient(ServiceParametor.Parametor);

                var allMunit = munitManager.GetActiveMunit();

                Constants.ApplicationData.Munits = new Dictionary <int, WWS.Munit>();

                foreach (var item in allMunit)
                {
                    Constants.ApplicationData.Munits.Add(item.Id.Value, item);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            #endregion
        }