Example #1
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;
         }
     }
 }