示例#1
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;
            }
            }
        }
示例#2
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;
         }
     }
 }
示例#3
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();
     }
 }
示例#4
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);
     }
 }
示例#5
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);
             * }*/
        }