What does "error code:4004" mean? - silverlight

I have this class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace BusinessApplication3.Web
{
public class Query2
{
public Int32? IDENTETE_BL { get; set; }
public String NO_BL { get; set; }
public DateTime? DATE_BL { get; set; }
public String FAC_AVOIR { get; set; }
public String REF_BL { get; set; }
public String CODE_CLIENT { get; set; }
public String NOM_CLIENT { get; set; }
public String ADRESSE { get; set; }
public String CODE_PAYS { get; set; }
public String VILLE { get; set; }
public String CODE_POSTAL { get; set; }
public String ZONE { get; set; }
public String TEL_FAX { get; set; }
public String CODE_ADL { get; set; }
public String NOM_ADL { get; set; }
public String ADRESSE_ADL { get; set; }
public String CODE_POSTAL_ADL { get; set; }
public String VILLE_ADL { get; set; }
public Decimal? MT_TTC_BL { get; set; }
public String CODE_PAYS_ADL { get; set; }
public String TEL_FAX_ADL { get; set; }
public Decimal? REM { get; set; }
public String CODE_REGLEMENT { get; set; }
public String NO_FACTURE { get; set; }
public DateTime? DATE_FACTURE { get; set; }
public String CODE_COMPTA { get; set; }
public String SITE { get; set; }
public String CODE_COMMERCIAL { get; set; }
public Int32? NBR_COLIS { get; set; }
public String NOM_TRANSPORTEUR { get; set; }
public String FACTURE_DIRECTE { get; set; }
public String MOIS_FACTURE { get; set; }
public String CLE_SITE_MOIS_FAC { get; set; }
public String CLE_SITE_FD_CC { get; set; }
public String CLE_SITE_FD { get; set; }
public String CLE_SITE_FD_CC_EDIT { get; set; }
public String ARCHIVAGE { get; set; }
public String NO_TVA_CL { get; set; }
public String numero { get; set; }
public String Bis { get; set; }
public String voie { get; set; }
public String P_identite { get; set; }
public String p_numero { get; set; }
public DateTime? p_du { get; set; }
public String p_par { get; set; }
public DateTime? nais_du { get; set; }
public String nais_ville { get; set; }
public String nais_dep { get; set; }
public String nais_pays { get; set; }
public String num_siren { get; set; }
public Int64? id_bon_ademe { get; set; }
public Decimal? poids_ademe_vhu { get; set; }
public String CODE_BROYEUR { get; set; }
public Int32 IDLIGNES_BL { get; set; }
public String CODE_CLIENT_LI { get; set; }
public String NO_BL_LI { get; set; }
public DateTime? DATE_BL_LI { get; set; }
public String FAC_AVOIR_LI { get; set; }
public String CODE_ARTICLE { get; set; }
public String NO_VEHICULE { get; set; }
public String DESIGNATION { get; set; }
public Decimal? QTE { get; set; }
public Decimal? PU_HT { get; set; }
public Decimal? REM_LI { get; set; }
public String CODE_TVA { get; set; }
public Single? TAUX_TVA { get; set; }
[Key]
public String NO_LIGNE { get; set; }
public String TYPE_ARTICLE { get; set; }
public String LIB_LIBRE { get; set; }
public String DESI_ARTICLE { get; set; }
public String CODE_GARANTIE { get; set; }
public String NO_FACTURE_LI { get; set; }
public String CODE_REGLEMENT_LI { get; set; }
public String SITE_LI { get; set; }
public String LIB_MODELE { get; set; }
public Decimal? PA_HT_TTC { get; set; }
public Decimal? PU_NET { get; set; }
public Decimal? PU_TTC { get; set; }
public Int64? code_id_article { get; set; }
public String site_stockage { get; set; }
public Byte? sans_trait_haut { get; set; }
public String nom_article_unique_demonter { get; set; }
public Int64? code_ademe_ligne { get; set; }
public Decimal? poids_ademe { get; set; }
public String type_article_ademe { get; set; }
public String consistance { get; set; }
public String conditionnement { get; set; }
public Int64? nombre_carcasse { get; set; }
public Int64? num_vehicule_entretien { get; set; }
public String num_immat_vehi_entretien { get; set; }
}
}
and this function in my domainservice
public IQueryable<Query2> Getligne_req()
{
return from t in ObjectContext.lignes_bl
from t0 in ObjectContext.entete_bl
where
t.NO_BL == t0.NO_BL
orderby
t.NO_BL,
t.NO_LIGNE
select new Query2()
{
IDENTETE_BL = t0.IDENTETE_BL,
NO_BL = t0.NO_BL,
DATE_BL = t0.DATE_BL,
FAC_AVOIR = t0.FAC_AVOIR,
REF_BL = t0.REF_BL,
CODE_CLIENT = t0.CODE_CLIENT,
NOM_CLIENT = t0.NOM_CLIENT,
ADRESSE = t0.ADRESSE,
CODE_PAYS = t0.CODE_PAYS,
VILLE = t0.VILLE,
CODE_POSTAL = t0.CODE_POSTAL,
ZONE = t0.ZONE,
TEL_FAX = t0.TEL_FAX,
CODE_ADL = t0.CODE_ADL,
NOM_ADL = t0.NOM_ADL,
ADRESSE_ADL = t0.ADRESSE_ADL,
CODE_POSTAL_ADL = t0.CODE_POSTAL_ADL,
VILLE_ADL = t0.VILLE_ADL,
MT_TTC_BL = t0.MT_TTC_BL,
CODE_PAYS_ADL = t0.CODE_PAYS_ADL,
TEL_FAX_ADL = t0.TEL_FAX_ADL,
REM = t0.REM,
CODE_REGLEMENT = t0.CODE_REGLEMENT,
NO_FACTURE = t0.NO_FACTURE,
DATE_FACTURE = t0.DATE_FACTURE,
CODE_COMPTA = t0.CODE_COMPTA,
SITE = t0.SITE,
CODE_COMMERCIAL = t0.CODE_COMMERCIAL,
NBR_COLIS = t0.NBR_COLIS,
NOM_TRANSPORTEUR = t0.NOM_TRANSPORTEUR,
FACTURE_DIRECTE = t0.FACTURE_DIRECTE,
MOIS_FACTURE = t0.MOIS_FACTURE,
CLE_SITE_MOIS_FAC = t0.CLE_SITE_MOIS_FAC,
CLE_SITE_FD_CC = t0.CLE_SITE_FD_CC,
CLE_SITE_FD = t0.CLE_SITE_FD,
CLE_SITE_FD_CC_EDIT = t0.CLE_SITE_FD_CC_EDIT,
ARCHIVAGE = t0.ARCHIVAGE,
NO_TVA_CL = t0.NO_TVA_CL,
numero = t0.numero,
Bis = t0.bis,
P_identite = t0.P_identite,
p_numero = t0.p_numero,
p_du = t0.p_du,
p_par = t0.p_par,
nais_du = t0.nais_du,
nais_ville = t0.nais_ville,
nais_dep = t0.nais_dep,
nais_pays = t0.nais_pays,
num_siren = t0.num_siren,
id_bon_ademe = t0.id_bon_ademe,
poids_ademe_vhu = t0.poids_ademe_vhu,
CODE_BROYEUR = t0.CODE_BROYEUR,
IDLIGNES_BL = t.IDLIGNES_BL,
CODE_CLIENT_LI = t.CODE_CLIENT,
NO_BL_LI = t.NO_BL,
DATE_BL_LI = t.DATE_BL,
FAC_AVOIR_LI = t.FAC_AVOIR,
CODE_ARTICLE = t.CODE_ARTICLE,
NO_VEHICULE = t.NO_VEHICULE,
DESIGNATION = t.DESIGNATION,
QTE = t.QTE,
PU_HT = t.PU_HT,
REM_LI = t.REM,
CODE_TVA = t.CODE_TVA,
TAUX_TVA = t.TAUX_TVA,
NO_LIGNE = t.NO_LIGNE,
TYPE_ARTICLE = t.TYPE_ARTICLE,
LIB_LIBRE = t.LIB_LIBRE,
DESI_ARTICLE = t.DESI_ARTICLE,
CODE_GARANTIE = t.CODE_GARANTIE,
NO_FACTURE_LI = t.NO_FACTURE,
CODE_REGLEMENT_LI = t.CODE_REGLEMENT,
SITE_LI = t.SITE,
LIB_MODELE = t.LIB_MODELE,
PA_HT_TTC = t.PA_HT_TTC,
PU_NET = t.PU_NET,
PU_TTC = t.PU_TTC,
code_id_article = t.code_id_article,
site_stockage = t.site_stockage,
sans_trait_haut = t.sans_trait_haut,
nom_article_unique_demonter = t.nom_article_unique_demonter,
code_ademe_ligne = t.code_ademe_ligne,
poids_ademe = t.poids_ademe,
type_article_ademe = t.type_article_ademe,
consistance = t.consistance,
conditionnement = t.conditionnement,
nombre_carcasse = t.nombre_carcasse,
num_vehicule_entretien = t.num_vehicule_entretien,
num_immat_vehi_entretien = t.num_immat_vehi_entretien
};
}
I get error code:4004. what does it mean?

This seems like a promising thread:
http://forums.silverlight.net/p/208030/496837.aspx
Sorry I can't help much beyond that. From there it appears to be an authentication/authorization issue with windows integrity.

Related

Npoi mapper file c#

I can read a file correctly, however, starting from column 63, the value is null, all columns before it are read normally, does anyone know what it could be? Is it a bug with lib?
This is my model :
namespace Biobe.Domain.Models.LayoutsExcel
{
public class LayoutSulamericaSaude
{
[Column(60)]
public string CodigoPaisOrigem { get; set; }
[Column(61)]
public string CodigoIdentificacao { get; set; }
[Column(62)]
public string IndicadorCPTCPT { get; set; }
[Column(63)]
public string IndicadorDeBloqueioDoBeneficiario { get; set; }
[Column(64)]
public string EmpresaTitularAgregado { get; set; }
[Column(65)]
public string MatriculaTitularAgregado { get; set; }
[Column(66)]
public string NumeroDeclaracaoNascidoVivo { get; set; }
[Column(67)]
public string NumeroTituloEleitor { get; set; }
[Column(68)]
public string NumeroRIC { get; set; }
[Column(69)]
public string IndicadorSeguradoContributario { get; set; }
[Column(70)]
public string QuantidadeMesesContribuicao { get; set; }
[Column(71)]
public string IndicadorCondicaoExEmpregado { get; set; }
[Column(72)]
public string IndicadorPermanenciaPlano { get; set; }
[Column(73)]
public string NomeCompletoDoBeneficiario { get; set; }
[Column(74)]
public string CodigoOperacao { get; set; }
}
}
This is map :
var t = ma.Take<LayoutSulamericaSaude>(1).ToList();

Error on update-database efcore asp.net core

namespace LoopSquad.Core.Entities.Addresses
{
public class Address
{
public int AddressId { get; set; }
public string NoName { get; set; }
public string AddressL1 { get; set; }
public string AddressL2 { get; set; }
public string Town { get; set; }
public string County { get; set; }
public string Postcode { get; set; }
[ForeignKey("Customer")]
public int CustomerId { get; set; }
public Customers.Customer Customer { get; set; }
public ICollection<Jobs.Job> Jobs { get; set; }
}
}
namespace LoopSquad.Core.Entities.Customers
{
public class Customer
{
[Key]
public int CustomerId { get; set; }
public string CompanyName { get; set; }
[ForeignKey("FKCustomerType")]
public int CustomerTypeId { get; set; }
public CustomerType CustomerType { get; set; }
public ICollection<Addresses.Address> Addresses { get; set; }
}
}
namespace LoopSquad.Core.Entities.Jobs
{
public class Job
{
[Key]
public int JobId { get; set; }
[ForeignKey("FKCustomer")]
public int CustomerId { get; set; }
public Customers.Customer Customer { get; set; }
[ForeignKey("FKAddress")]
public int AddressId { get; set; }
public Addresses.Address Address { get; set; }
public DateTime BookedDateTime { get; set; }
public DateTime CreatedDateTime { get; set; }
[ForeignKey("FKUser")]
public int UserId { get; set; }
public Users.ApplicationUser ApplicationUser { get; set; }
[ForeignKey("FRoomLayout")]
public int RoomLayoutId { get; set; }
public RoomLayout RoomLayout { get; set; }
[ForeignKey("FKJobType")]
public int JobTypeId { get; set; }
public JobType JobType { get; set; }
[ForeignKey("FKLoopType")]
public int loopTypeId { get; set; }
public LoopType LoopType { get; set; }
[ForeignKey("FKJobStatus")]
public int JobStatusId { get; set; }
public JobStatus JobStatus { get; set; }
}
}
I reproduce your problem and it is because you enable cascade delete by default which will result in cycles for your relationships.
Try to disable it using OnDelete(DeleteBehavior.Restrict) in dbcontext, for example
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public DbSet<Address> Addresses { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<Job> Jobs { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Job>().HasOne(p => p.Customer)
.WithMany()
.HasForeignKey(p => p.CustomerId)
.OnDelete(DeleteBehavior.Restrict);
}
}
Refer to https://learn.microsoft.com/en-us/ef/core/saving/cascade-delete

Cannot get my database-update to work

I have launched my website in beta-version. The next version should contain a shopping cart and a checkout with the credit card. On my way to making this shopping cart, I've discovered that my old Product-class with several different prices simply doesn't work. I need one price with one identity or a subclass with several prices mapped to the original class(which I will use) :
public class Product
{
[Key]
public int ProductID { get; set; }
[Required(ErrorMessage = "Please enter an product name")]
public string Name { get; set; }
[Required(ErrorMessage = "Please specify a category")]
public string Category { get; set; }
public string SubCategory { get; set; }
public string Description { get; set; }
public decimal Price16 { get; set; }
public decimal Price12 { get; set; }
public decimal Price8 { get; set; }
public decimal Price4 { get; set; }
public decimal PriceEach { get; set; }
public decimal PriceKg { get; set; }
public string ProductImageSmallUrl { get; set; }
public string ProductImageSmallAlternativeDescription { get; set; }
public string ProductImageSmallContentType { get; set; }
public string ProductImageLargeUrl { get; set; }
public string ProductImageLargeAlternativeDescription { get; set; }
public string ProductImageLargeContentType { get; set; }
public string ProductImageLargeSecondUrl { get; set; }
public string ProductImageLargeSecondAlternativeDescription { get;
set; }
public string ProductImageLargeSecondContentType { get; set; }
}
I have after, a lot of research constructed two classes:
public class Product
{
public Product(ICollection<Price> prices)
{
Prices = prices;
}
[Key]
public int ProductID { get; set; }
[Required(ErrorMessage = "Please enter an product name")]
public string Name { get; set; }
[Required(ErrorMessage = "Please specify a category")]
public string Category { get; set; }
public string SubCategory { get; set; }
public string Description { get; set; }
public string ProductImageSmallUrl { get; set; }
public string ProductImageSmallAlternativeDescription { get; set; }
public string ProductImageSmallContentType { get; set; }
public string ProductImageLargeUrl { get; set; }
public string ProductImageLargeAlternativeDescription { get; set; }
public string ProductImageLargeContentType { get; set; }
public string ProductImageLargeSecondUrl { get; set; }
public string ProductImageLargeSecondAlternativeDescription { get;
set; }
public string ProductImageLargeSecondContentType { get; set; }
public ICollection<Price> Prices { get; set; }
}
And a price class:
public class Price
{
[Key]
public int ID { get; set; }
public int CurrentProductID { get; set; }
public string Size { get; set; }
public decimal Value { get; set; }
public Product CurrentProduct { get; set; }
}
I have this DbContext:
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext(DbContextOptions<MokaMokkaDbContext>
options)
:base(options) {}
public DbSet<Product> Products { get; set; }
public DbSet<Price> Prices { get; set; }
protected override void OnModelCreating (ModelBuilder modelBuilder)
{
modelBuilder.Entity<Price>()
.HasOne(p => p.CurrentProduct)
.WithMany(b => b.Prices)
.HasForeignKey(p => p.CurrentProductID);
}
}
I am trying to write a seeding class:
public class SeedData
{
public static EnsurePopulated(IApplicationBuilder app)
{
MokaMokkaDbContext context = app.ApplicationServices
.GetRequiredService<MokaMokkaDbContext>();
context.Database.Migrate();
if(!context.Products.Any())
{
context.Products.AddRange(
new Product
{
Name = "Dobos cake",
Category = "Cake",
ProductImageSmallUrl = "Dobos.Torta.jpg",
ProductImageSmallContentType = "jpg",
Prices = new List<Price>()
});
}
}
But I get the following problem in over the red underline of the Product I am trying to create: "There is no argument given that corresponds to the required formal parameter "prices" of Product.Product(ICollection)".
I believe you need parameterless constructor in your Product class.

Including related data using Entity Framework

I have an existing database that I have used as a context for a project using Entity Framework in a multiple context project. The database contains several classes:
Market Message [Base Class]
MessageType300 [2nd level]
Meter [3rd level]
RegisterLevelInformation [4th level]
Using the code first from existing database tools it has created the following:
[Table("MarketMessage")]
public partial class MarketMessage
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public MarketMessage()
{
messageType300 = new HashSet<messageType300>();
messageType300S = new HashSet<messageType300S>();
messageType300W = new HashSet<messageType300W>();
messageType305 = new HashSet<messageType305>();
}
public int MarketMessageID { get; set; }
public DateTime CreatedOn { get; set; }
[Required]
[StringLength(4)]
public string messageType { get; set; }
[Required]
[StringLength(8)]
public string VersionNumber { get; set; }
public DateTime MarketTimestamp { get; set; }
[Required]
[StringLength(35)]
public string TxRefNbr { get; set; }
[Required]
[StringLength(3)]
public string Sender { get; set; }
[Required]
[StringLength(3)]
public string Recipient { get; set; }
[StringLength(10)]
public string alertFlag { get; set; }
[StringLength(50)]
public string fileName { get; set; }
public bool IsDeleted { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<messageType300> messageType300 { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<messageType300S> messageType300S { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<messageType300W> messageType300W { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<messageType305> messageType305 { get; set; }
}
public partial class messageType300
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public messageType300()
{
Meter = new HashSet<Meter>();
UsageFactor = new HashSet<UsageFactor>();
}
public int messageType300ID { get; set; }
public int MarketMessageID { get; set; }
[Required]
[StringLength(11)]
public string MPRN { get; set; }
[StringLength(35)]
public string MPBR { get; set; }
[Required]
[StringLength(35)]
public string NetworkReferenceNumber { get; set; }
[Required]
[StringLength(3)]
public string LoadProfileCode { get; set; }
[Required]
[StringLength(4)]
public string DUoSGroup { get; set; }
[Required]
[StringLength(2)]
public string MeterPointStatusCode { get; set; }
public DateTime ReadDate { get; set; }
public virtual MarketMessage MarketMessage { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Meter> Meter { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<UsageFactor> UsageFactor { get; set; }
}
[Table("Meter")]
public partial class Meter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Meter()
{
RegisterLevelInformation = new HashSet<RegisterLevelInformation>();
}
public int MeterID { get; set; }
[StringLength(15)]
public string MeterCategoryCode { get; set; }
[Required]
[StringLength(9)]
public string SerialNumber { get; set; }
[StringLength(3)]
public string MeterLocationCode { get; set; }
public int? MessageType300ID { get; set; }
public int? MessageType300SID { get; set; }
public int? MessageType300WID { get; set; }
public int? MessageType303RID { get; set; }
public int? MessageType305ID { get; set; }
public int? MessageType306ID { get; set; }
public int? MessageType306WID { get; set; }
public int? MessageType307ID { get; set; }
public int? MessageType307WID { get; set; }
public int? MessageType310ID { get; set; }
public int? MessageType310WID { get; set; }
public int? MessageType320ID { get; set; }
public int? MessageType320WID { get; set; }
public int? MessageType341ID { get; set; }
public int? MessageType342ID { get; set; }
public virtual messageType300 messageType300 { get; set; }
public virtual messageType300S messageType300S { get; set; }
public virtual messageType300W messageType300W { get; set; }
public virtual messageType305 messageType305 { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<RegisterLevelInformation> RegisterLevelInformation { get; set; }
}
[Table("RegisterLevelInformation")]
public partial class RegisterLevelInformation
{
public int RegisterLevelInformationID { get; set; }
[Required]
[StringLength(3)]
public string MeterRegisterSequence { get; set; }
[Required]
[StringLength(10)]
public string TimeslotCode { get; set; }
[Required]
[StringLength(3)]
public string UOM_Code { get; set; }
public decimal MeterMultiplier { get; set; }
public decimal ReadingValue { get; set; }
[Required]
[StringLength(2)]
public string ReadReasonCode { get; set; }
[Required]
[StringLength(2)]
public string ReadTypeCode { get; set; }
public DateTime? PreviousReadDate { get; set; }
public decimal Consumption { get; set; }
public decimal EstimatedConsumption { get; set; }
[StringLength(4)]
public string ReadStatusCode { get; set; }
[StringLength(2)]
public string RegisterTypeCode { get; set; }
[StringLength(1)]
public string PostDecimalDetails { get; set; }
[StringLength(2)]
public string PreDecimalDetails { get; set; }
public int? MeterID { get; set; }
public int? RemovedMeterRegisterID { get; set; }
public int? NewMeterRegisterID { get; set; }
public int? RetainedMeterRegisterID { get; set; }
public virtual Meter Meter { get; set; }
}
How can I call the marketmessage and the related children including messagetype300, meter, and register level information data?
In the original database I am able to join the table together using a SQL query as follows:
select
MarketTimestamp, TxRefNbr, Sender, Recipient, MPRN,
NetworkReferenceNumber, LoadProfileCode, DUoSGroup,
MeterPointStatusCode, ReadDate, SerialNumber,
MeterRegisterSequence, TimeslotCode, UOM_Code, MeterMultiplier,
ReadingValue, ReadReasonCode, ReadTypeCode, PreviousReadDate,
Consumption, EstimatedConsumption, ReadStatusCode, RegisterTypeCode
from
marketmessage as a
inner join
messagetype300 as b on a.MarketMessageID = b.MarketMessageID
inner join
Meter as c on b.messageType300ID = c.MessageType300ID
inner join
RegisterLevelInformation as d on c.MeterID = d.MeterID
where
DUoSGroup = 'T021'
and TimeslotCode = 'UNR'
order by
MarketTimestamp desc
I have attempted to join this in the following way but I am unable to access the properties of either the meters or the register level information from my view:
var test = db.MarketMessage.Where(m => m.messageType == "300S")
.Include(m => m.messageType300S.Select(mt => mt.Meter))
.ToList();
I am attempting the following:
<td>
#Html.DisplayFor(modelItem => item.Recipient)
</td>
<td>
#Html.DisplayFor(modelItem => item.alertFlag)
</td>
<td>
#Html.DisplayFor(modelItem => item.fileName)
</td>
<td>
#Html.DisplayFor(modelItem => item.IsDeleted)
</td>
<td>
#foreach (var m in item.messageType300S.Select(m => m.Meter).FirstOrDefault())
{
#Html.Display(m.SerialNumber)
}
</td>
Obviously I dont really want to be iterating the meters in this manner although this is not even displaying the serial number despite it being found when I am debugging so lost as to what is going on

Datagrid cell edit event

So I have a datagrid that I populate by a LINQ query:
public class dataservice
{
[OperationContract]
public List<LightOrder> GetOrder(string code)
{
// Add your operation implementation here
using (amazonproscoutEntities context = new amazonproscoutEntities())
{
return (from c in context.AmazonSKUs
where c.MerchantSKU.StartsWith(code)
select new LightOrder()
{
SKU = c.MerchantSKU,
productname = c.ItemName,
asin = c.ASIN,
//ourprice = c.OurPrice,
bbprice = c.Price,
quantity= c.TotalQty,
rank = c.Rank,
}
).Take<LightOrder>(500).ToList<LightOrder>();
}
}
// Add more operations here and mark them with [OperationContract]
}
public class LightOrder
{
public string SKU { get; set; }
public string productname { get; set; }
public string itemnumber { get; set; }
public string asin { get; set; }
//public Nullable<decimal> ourprice { get; set; }
public string bbprice { get; set; }
public string w1 { get; set; }
public string w2 { get; set; }
public string w3 { get; set; }
public string w4 { get; set; }
public int quantity { get; set; }
public string pendingorder { get; set; }
public string afner { get; set; }
public string order { get; set; }
public string total { get; set; }
public string profit { get; set; }
public string percent { get; set; }
public string rank { get; set; }
}
My question is if I change the cost cell and I change order, and I want it to tell me the total, how do I go about doing that with out losing my datagrid or writing to the db?
You can create temporary variables.
double tempCost;
double tempOrder;
double tempTotal;

Resources