示例#1
0
        private void DeleteProductManagmentButton_Click(object sender, EventArgs e)
        {
            var selectedRows = ProductManagmentGridView.SelectedRows;

            try
            {
                using (WarehouseServiceClient client = new WarehouseServiceClient("HTTP"))
                {
                    foreach (var elem in selectedRows)
                    {
                        client.DeleteItem(Convert.ToInt32(((DataGridViewRow)elem).Cells[0].Value));
                    }
                }
                if (statusFilterProductId != 0)
                {
                    ProductManagmentIntoGridView(true, 0, 0, statusFilterProductId);
                }
                else
                {
                    ProductManagmentIntoGridView(true, 0, 0, 0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         using (var client = new WarehouseServiceClient(ServiceParametor.Parametor))
         {
             User user = client.Login(textBox1.Text, textBox2.Text);
             if (user != null)
             {
                 client.UpdateUserLoginDate(user.Id.Value);
                 this.Hide();
                 var formx = new MainForm(user);
                 formx.Closed += (s, args) => this.Close();
                 formx.Show();
             }
             else
             {
                 MessageBox.Show("Invalid User name or password");
             }
         }
     }
     catch (System.ServiceModel.FaultException exception) {
         MessageBox.Show($"Connection error\n\n{exception.Message}");
     }
 }
示例#3
0
 private void roleAddButton_Click(object sender, EventArgs e)
 {
     if (RoleNameTextBox.Text != "")
     {
         try
         {
             using (WarehouseServiceClient wwsClient = new WarehouseServiceClient("HTTP"))
             {
                 wwsClient.CreateOrUpdateRole(new Role()
                 {
                     Name = RoleNameTextBox.Text
                 });
             }
         }
         catch
         {
         }
         mainForm.Enabled = true;
         mainForm.RoleDataGridRefresh();
         Close();
     }
     else
     {
         MessageBox.Show("Wrong role name.");
     }
 }
示例#4
0
 public MainWh()
 {
     client = new WarehouseGUIServiceClient(new System.ServiceModel.InstanceContext(this));
     clientW = new WarehouseServiceClient();
     InitializeComponent();
     client.RegisterGUI();
 }
示例#5
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            LoadAllStaticInfo();
            switch (loginUser.RoleGroupId)
            {
            case 1: {
                try
                {
                    using (var client = new WarehouseServiceClient(ServiceParametor.Parametor))
                    {
                        foreach (User user in client.SelectActiveUsers())
                        {
                            ApplicationData.Users.Add(user.Id.Value, user);
                        }

                        dataGridView1.DataSource = ApplicationData.Users.Values.ToList();
                    }
                    dataGridView1.Columns[2].Visible = false;
                    dataGridView1.Columns[0].Visible = false;
                }
                catch (Exception exeption) {
                    Console.WriteLine(exeption.Message);
                }
                break;
            }

            default:
            {
                tabControl1.TabPages.Remove(UserTab);
                tabControl1.TabPages.Remove(RoleTab);
                tabControl1.TabPages.Remove(RoleMapTab);
                break;
            }
            }
        }
 public void ProductCategoryRefresh()
 {
     using (WarehouseServiceClient wwsClient = new WarehouseServiceClient(ServiceParametor.Parametor))
     {
         IList <ProductCategory> prodCatList = wwsClient.GetAllProductCategories().ToList();
         productCategoryDataGridView.DataSource = prodCatList.ToList();
     }
 }
示例#7
0
        public WarehouseGUI()
        {
            InitializeComponent();

            proxyShop = new ShopServiceClient(new InstanceContext(this));
            proxyShop.SetClientBaseAddress();
            proxyWH = new WarehouseServiceClient();
        }
示例#8
0
 public void RoleGroupDataGridRefresh()
 {
     using (WarehouseServiceClient wwsClient = new WarehouseServiceClient(ServiceParametor.Parametor))
     {
         IList <RoleGroup> roleGroupList = wwsClient.GetRoleGroups().ToList();
         roleGroupDataGridView.DataSource = roleGroupList.ToList();
     }
 }
示例#9
0
 public Server()
 {
     _warehouseQueue           = new MessageQueue("FormatName:DIRECT=OS:" + _machineName + "\\Private$\\" + _queueName);
     _warehouseQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(BookOrder) });
     _warehouseQueue.MessageReadPropertyFilter.SetAll();
     _proxy = new WarehouseServiceClient(new InstanceContext(new MyServiceCallback()));
     //_proxy.Subscribe();
 }
示例#10
0
 public BucketController(BucketRepository bucketRepository
                         , OrderService orderService
                         , WarehouseServiceClient warehouseServiceClient
                         , IMapper mapper)
 {
     _bucketRepository       = bucketRepository;
     _mapper                 = mapper;
     _orderService           = orderService;
     _warehouseServiceClient = warehouseServiceClient;
 }
示例#11
0
 public void ProductManagmentIntoGridView(bool reload, int id, int userId, int productId)
 {
     if (reload)
     {
         using (WarehouseServiceClient client = new WarehouseServiceClient("HTTP"))
         {
             prodManagList = client.GetItem(id, userId, productId);
             if (prodManagList == null)
             {
                 //prodManagList = new List<WWS.ProductManagment>();
             }
             productListForProdManag = ApplicationData.Products.Select(p => p.Value).ToList();
             var pMJOinP = prodManagList.Join(
                 productListForProdManag,
                 p => p.ProductId,
                 m => m.Id,
                 (p, m) => new
             {
                 Id         = p.Id.Value,
                 Product    = m.Name,
                 Quantity   = p.Quantity,
                 ActionDate = p.ActionDate,
                 Action     = p.Action,
                 userId     = p.UserId,
                 Reason     = p.Reason,
                 Price      = p.Price,
                 supplierId = p.SupplierId,
                 brand      = p.Brand,
             }
                 );
             var userList        = client.SelectActiveUsers();
             var pMJoinPJoinUser = pMJOinP.Join(
                 userList,
                 p => p.userId,
                 u => u.Id,
                 (p, u) => new
             {
                 Id         = p.Id,
                 Product    = p.Product,
                 Quantity   = p.Quantity,
                 ActionDate = p.ActionDate,
                 Action     = p.Action,
                 User       = u.Username,
                 Reason     = p.Reason,
                 Price      = p.Price,
                 supplierId = p.supplierId,
                 brand      = p.brand,
             }
                 );
             ProductManagmentGridView.DataSource         = pMJoinPJoinUser.ToList();
             ProductManagmentGridView.Columns[0].Visible = false;
         }
     }
 }
示例#12
0
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            MyServiceCallback callback        = new MyServiceCallback(this);
            InstanceContext   instanceContext = new InstanceContext(callback);

            _proxy = new WarehouseServiceClient(instanceContext);
            _proxy.Subscribe();
            _requests = _proxy.GetOpenRequests();

            RequestsList.ItemsSource = _requests.DefaultView;
        }
示例#13
0
 public void ReloadUserGrid(bool reload = false)
 {
     if (reload)
     {
         using (var client = new WarehouseServiceClient(ServiceParametor.Parametor))
         {
             foreach (User user in client.SelectActiveUsers())
             {
                 ApplicationData.Users.Add(user.Id.Value, user);
             }
         }
         dataGridView1.DataSource = ApplicationData.Users.Values.ToList();
         dataGridView1.Refresh();
     }
 }
示例#14
0
 public OrderService(OrderContext orderContext
                     , UserContext userContext
                     , BucketRepository bucketRepository
                     , PriceServiceClient pricingClient
                     , WarehouseServiceClient warehouseServiceClient
                     , RabbitMQMessageSender mqSender
                     , MetricReporter metricReporter
                     , IDistributedCache distributedCache)
 {
     _orderContext           = orderContext;
     _userContext            = userContext;
     _pricingClient          = pricingClient;
     _warehouseServiceClient = warehouseServiceClient;
     _bucketRepository       = bucketRepository;
     _mqSender         = mqSender;
     _metricReporter   = metricReporter;
     _distributedCache = distributedCache;
 }
示例#15
0
 private void UserProdManagTabComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (WarehouseServiceClient client = new WarehouseServiceClient("HTTP"))
     {
         var userList     = client.SelectActiveUsers();
         var selectedUser = UserProdManagTabComboBox.SelectedItem.ToString();
         int userId       = -1;
         foreach (var elem in userList)
         {
             if (selectedUser == elem.Username)
             {
                 userId = Convert.ToInt32(elem.Id);
                 break;
             }
         }
         ProductManagmentIntoGridView(true, 0, userId, 0);
     }
 }
示例#16
0
        private void ProductManagementTab_Enter(object sender, EventArgs e)
        {
            //  try
            // {
            //add elems in ProductCategory ComboBox
            if (CategoryProdMagTabComboBox.Items.Count == 0)
            {
                foreach (var elem in WarehouseClient.Constants.ApplicationData.ProductCategory)
                {
                    CategoryProdMagTabComboBox.Items.Add(elem.Value.Name);
                }
            }



            //add elems in Product ComboBox
            if (ProductProdManagTabComboBox.Items.Count == 0)
            {
                foreach (var elem in WarehouseClient.Constants.ApplicationData.Products)
                {
                    ProductProdManagTabComboBox.Items.Add(elem.Value.Name);
                }
            }


            //  UserManager user = new UserManager();
            //userList = user.SelectActiveUser();
            using (WarehouseServiceClient client = new WarehouseServiceClient("HTTP"))
            {
                var userList = client.SelectActiveUsers();
                foreach (var elem in userList)
                {
                    UserProdManagTabComboBox.Items.Add(elem.Username);
                }
                ProductManagmentIntoGridView(true, 0, 0, 0);
            }

            // }

            /*catch(Exception ex)
             * {
             *  MessageBox.Show(ex.Message);
             * }*/
        }
示例#17
0
 public SellForm(StoreServiceClient sp)
 {
     storeProxy     = sp;
     warehouseProxy = new WarehouseServiceClient();
     InitializeComponent();
 }
示例#18
0
 public WarehouseClientForm()
 {
     InitializeComponent();
     proxy = new WarehouseServiceClient(new InstanceContext(this));
 }
示例#19
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
        }
示例#20
0
 public PriceService(WarehouseServiceClient warehouseServiceClient)
 {
     _warehouseServiceClient = warehouseServiceClient;
 }