如何解决LINQ中的CS1941错误,C#

huangapple go评论94阅读模式
英文:

How do I resolve CS1941 Error in LINQ, C#

问题

  1. 我尝试了这个查询,但是它给我返回了CS1941错误
  2. 错误图片:
  3. ![错误图片][1]
  4. ReportList = from hb in (new XPQuery<HallBanquet>(das.UOW))
  5. join hbi in (new XPQuery<HallBanquetItem>(das.UOW)) on hb.DocId equals hbi.HallBanquet
  6. join cus in (new XPQuery<Customer>(das.UOW)) on hb.Customer equals cus.MastId
  7. select new
  8. {
  9. hb.DocId,
  10. hb.Site,
  11. hb.DocNo,
  12. hb.RefNo,
  13. hb.DocDt,
  14. hb.Customer,
  15. hb.NoOfPax,
  16. hb.PartyDate,
  17. hb.FromTime,
  18. hb.ToTime,
  19. hb.MainMenu,
  20. hb.OfferPackage,
  21. hb.Currency,
  22. hb.CurRate,
  23. hb.LPONo,
  24. hb.LPODate,
  25. hb.ExpectedDeliveryDt,
  26. hb.RoundOff,
  27. hb.SubTotal,
  28. hb.NetAmount,
  29. hb.Remarks,
  30. hbi.SeqNo,
  31. hbi.HallBanquet,
  32. hbi.ItemType,
  33. hbi.Code,
  34. Desc = hbi.Description,
  35. hbi.Item,
  36. hbi.Pkg,
  37. hbi.Unit,
  38. hbi.Qty,
  39. hbi.Price,
  40. hbi.Cost,
  41. hbi.DiscountPer,
  42. hbi.DiscountAmt,
  43. hbi.Amount,
  44. hbi.TotalAmt,
  45. hbi.IsInclussiveTax,
  46. hbi.TaxCd,
  47. hbi.TaxPer,
  48. hbi.TaxAmt,
  49. hbi.GlCode,
  50. cus.Description
  51. };
  52. 错误出现在第二行的`join`语句。
  53. [1]: https://i.stack.imgur.com/2cyEV.png
  54. 1. HallBanquet 类:
  55. ```csharp
  56. public class HallBanquet : Epimonos.BizObjects.Core.XPDocumentObject
  57. {
  58. // 类的定义,请保留原始代码
  59. }
  60. ```
  61. 2. HallBanquetItem 类(子表):
  62. ```csharp
  63. public class HallBanquetItem : XPDocumentDet
  64. {
  65. // 类的定义,请保留原始代码
  66. }
  67. ```
  68. 3. Customer 表:
  69. ```csharp
  70. public class Customer : Epimonos.BizObjects.Core.XPMasterObject
  71. {
  72. // 类的定义,请保留原始代码
  73. }
  74. ```
英文:

I am trying this query but it gives me CS1941 Error.

Image of error:
如何解决LINQ中的CS1941错误,C#

  1. ReportList = from hb in (new XPQuery&lt;HallBanquet&gt;(das.UOW))
  2. join hbi in (new XPQuery&lt;HallBanquetItem&gt;(das.UOW)) on hb.DocId equals hbi.HallBanquet
  3. join cus in (new XPQuery&lt;Customer&gt;(das.UOW)) on hb.Customer equals cus.MastId
  4. select new
  5. {
  6. hb.DocId,
  7. hb.Site,
  8. hb.DocNo,
  9. hb.RefNo,
  10. hb.DocDt,
  11. hb.Customer,
  12. hb.NoOfPax,
  13. hb.PartyDate,
  14. hb.FromTime,
  15. hb.ToTime,
  16. hb.MainMenu,
  17. hb.OfferPackage,
  18. hb.Currency,
  19. hb.CurRate,
  20. hb.LPONo,
  21. hb.LPODate,
  22. hb.ExpectedDeliveryDt,
  23. hb.RoundOff,
  24. hb.SubTotal,
  25. hb.NetAmount,
  26. hb.Remarks,
  27. hbi.SeqNo,
  28. hbi.HallBanquet,
  29. hbi.ItemType,
  30. hbi.Code,
  31. Desc = hbi.Description,
  32. hbi.Item,
  33. hbi.Pkg,
  34. hbi.Unit,
  35. hbi.Qty,
  36. hbi.Price,
  37. hbi.Cost,
  38. hbi.DiscountPer,
  39. hbi.DiscountAmt,
  40. hbi.Amount,
  41. hbi.TotalAmt,
  42. hbi.IsInclussiveTax,
  43. hbi.TaxCd,
  44. hbi.TaxPer,
  45. hbi.TaxAmt,
  46. hbi.GlCode,
  47. cus.Description
  48. };

The error is thrown on the second line at join

  1. HallBanquet Class :

    public class HallBanquet : Epimonos.BizObjects.Core.XPDocumentObject
    {
    public HallBanquet(Session session) : base(session)
    {
    // This constructor is used when an object is loaded from a persistent storage.
    // Do not place any code here.
    }
    public override void AfterConstruction()
    {
    base.AfterConstruction();
    // Place here your initialization code.
    }
    public override void Initialize(RstUser LoginUser, RstSite LoginSite)
    {

    1. }
    2. public override void AfterDisplay(RstUser LoginUser, RstSite LoginSite)
    3. {
    4. UpdateTotals();
    5. }
    6. private Customer _Customer;
    7. [RValidate(&quot;Customer&quot;, true, 0)]
    8. public Customer Customer
    9. {
    10. get { return _Customer; }
    11. set {
    12. SetPropertyValue&lt;Customer&gt;(nameof(Customer), ref _Customer, value);
    13. if (!IsLoading &amp;&amp; !IsSaving)
    14. {
    15. this.Branch = null;
    16. this.Contact = null;
    17. //this.Currency = GetCompanyCurrency(this.Site.Company);
    18. this.Currency = Site?.Company?.CompanyCurrencies.FirstOrDefault(e =&gt; e.Currency == this.Customer?.Currency);
    19. }
    20. }
    21. }
    22. private CustomerBranch _Branch;
    23. [RValidate(&quot;Branch&quot;, false, 0)]
    24. public CustomerBranch Branch
    25. {
    26. get { return _Branch; }
    27. set
    28. {
    29. SetPropertyValue&lt;CustomerBranch&gt;(nameof(Branch), ref _Branch, value);
    30. if (!IsLoading &amp;&amp; !IsSaving)
    31. {
    32. this.Contact = null;
    33. }
    34. }
    35. }
    36. private CustomerContact _Contact;
    37. [RValidate(&quot;Contact&quot;,false,0)]
    38. public CustomerContact Contact
    39. {
    40. get { return _Contact; }
    41. set { SetPropertyValue&lt;CustomerContact&gt;(nameof(Contact), ref _Contact, value); }
    42. }
    43. private string _ContactTel;
    44. public string ContactTel
    45. {
    46. get { return _ContactTel; }
    47. set { SetPropertyValue&lt;string&gt;(nameof(ContactTel), ref _ContactTel, value); }
    48. }
    49. private decimal _NoOfPax;
    50. [RValidate(&quot;NoOfPax&quot;, true, 0)]
    51. public decimal NoOfPax
    52. {
    53. get { return _NoOfPax; }
    54. set { SetPropertyValue&lt;decimal&gt;(nameof(NoOfPax), ref _NoOfPax, value); }
    55. }
    56. private DateTime _PartyDate = DateTime.Today;
    57. public DateTime PartyDate
    58. {
    59. get { return _PartyDate; }
    60. set { SetPropertyValue&lt;DateTime&gt;(nameof(PartyDate), ref _PartyDate, value); }
    61. }
    62. private DateTime _FromTime = DateTime.Parse(&quot;12:00&quot;);
    63. public DateTime FromTime
    64. {
    65. get { return _FromTime; }
    66. set { SetPropertyValue&lt;DateTime&gt;(nameof(FromTime), ref _FromTime, value); }
    67. }
    68. private DateTime _ToTime=DateTime.Parse(&quot;12:00&quot;);
    69. public DateTime ToTime
    70. {
    71. get { return _ToTime; }
    72. set { SetPropertyValue&lt;DateTime&gt;(nameof(ToTime), ref _ToTime, value); }
    73. }
    74. private FoodPkg _MainMenu;
    75. [RValidate(&quot;MainMenu&quot;, true, 0)]
    76. public FoodPkg MainMenu
    77. {
    78. get { return _MainMenu; }
    79. set { SetPropertyValue&lt;FoodPkg&gt;(nameof(MainMenu), ref _MainMenu, value); }
    80. }
    81. private string _OfferPackage;
    82. [Size(50)]
    83. public string OfferPackage
    84. {
    85. get { return _OfferPackage; }
    86. set { SetPropertyValue&lt;string&gt;(nameof(OfferPackage), ref _OfferPackage, value); }
    87. }
    88. private RstCompanyCurrency _Currency;
    89. [RValidate(&quot;Currency&quot;, true, 0 )]
    90. public RstCompanyCurrency Currency
    91. {
    92. get { return _Currency; }
    93. set { SetPropertyValue&lt;RstCompanyCurrency&gt;(nameof(Currency), ref _Currency, value);
    94. if (!IsLoading &amp;&amp; !IsSaving)
    95. {
    96. this.CurRate = value == null ? 0 : value.CurRate;
    97. }
    98. }
    99. }
    100. private Double _CurRate;
    101. [CustomValidation(typeof(VcCommon), &quot;ValidateCurrencyRate&quot;)]
    102. public Double CurRate
    103. {
    104. get { return _CurRate; }
    105. set { SetPropertyValue&lt;Double&gt;(nameof(CurRate), ref _CurRate, value); }
    106. }
    107. private string _LPONo;
    108. [Size(50)]
    109. [RValidate(&quot;LPO No&quot;, false ,50 )]
    110. public string LPONo
    111. {
    112. get { return _LPONo; }
    113. set { SetPropertyValue&lt;string&gt;(nameof(LPONo), ref _LPONo, value); }
    114. }
    115. private DateTime _LPODate = DateTime.Today;
    116. public DateTime LPODate
    117. {
    118. get { return _LPODate; }
    119. set { SetPropertyValue&lt;DateTime&gt;(nameof(LPODate), ref _LPODate, value); }
    120. }
    121. private DateTime _ExpectedDeliveryDt;
    122. public DateTime ExpectedDeliveryDt
    123. {
    124. get { return _ExpectedDeliveryDt; }
    125. set { SetPropertyValue&lt;DateTime&gt;(nameof(ExpectedDeliveryDt), ref _ExpectedDeliveryDt, value); }
    126. }
    127. private Decimal _CustomerBalance;
    128. [NonPersistent]
    129. public Decimal CustomerBalance
    130. {
    131. get { return _CustomerBalance; }
    132. set { SetPropertyValue&lt;Decimal&gt;(nameof(CustomerBalance), ref _CustomerBalance, value); }
    133. }
    134. private Decimal _RoundOff;
    135. [CustomValidation(typeof(VcCommon), &quot;ValidateRoundOff&quot;)]
    136. public Decimal RoundOff
    137. {
    138. get { return _RoundOff; }
    139. set { SetPropertyValue&lt;Decimal&gt;(nameof(RoundOff), ref _RoundOff, value);
    140. UpdateTotals();
    141. }
    142. }
    143. private Decimal _SubTotal;
    144. public Decimal SubTotal
    145. {
    146. get { return _SubTotal; }
    147. set { SetPropertyValue&lt;Decimal&gt;(nameof(SubTotal), ref _SubTotal, value); }
    148. }
    149. private Decimal _NetAmount;
    150. public Decimal NetAmount
    151. {
    152. get { return _NetAmount; }
    153. set { SetPropertyValue&lt;Decimal&gt;(nameof(NetAmount), ref _NetAmount, value); }
    154. }
    155. private string _Remarks;
    156. [Size(SizeAttribute.Unlimited)]
    157. public string Remarks
    158. {
    159. get { return _Remarks; }
    160. set { SetPropertyValue&lt;string&gt;(nameof(Remarks), ref _Remarks, value); }
    161. }
    162. [DevExpress.Xpo.Association(&quot;HallBanquet-Item&quot;), Aggregated()]
    163. public XPCollection&lt;HallBanquetItem&gt; HallBanquetItems
    164. {
    165. get
    166. {
    167. XPCollection&lt;HallBanquetItem&gt; col = GetCollection&lt;HallBanquetItem&gt;(nameof(HallBanquetItems));
    168. if (col.Sorting.Count == 0)
    169. {
    170. col.Sorting.Add(new DevExpress.Xpo.SortProperty(&quot;SeqNo&quot;, SortingDirection.Ascending));
    171. }
    172. return col;
    173. }
    174. }
    175. public void UpdateTotals()
    176. {
    177. if (IsLoading || IsSaving) return;
    178. Decimal netAmt = 0;
    179. Decimal taxAmt = 0;
    180. foreach (var item in this.HallBanquetItems)
    181. {
    182. if (!item.IsDeleting)
    183. {
    184. netAmt += item.TotalAmt;
    185. }
    186. }
    187. _NetAmount = CommonFx.Round((netAmt + this.RoundOff), this.Currency?.Currency);
    188. _SubTotal = CommonFx.Round((netAmt-taxAmt), this.Currency?.Currency);
    189. }
    190. }
  2. HallBanquetItem Class (Child Table)

    public class HallBanquetItem : XPDocumentDet
    {
    public HallBanquetItem(Session session) : base(session)
    {
    // This constructor is used when an object is loaded from a persistent storage.
    // Do not place any code here.
    }

    1. public override void AfterConstruction()
    2. {
    3. base.AfterConstruction();
    4. // Place here your initialization code.
    5. }
    6. private HallBanquet _HallBanquet;
    7. [Association(&quot;HallBanquet-Item&quot;)]
    8. public HallBanquet HallBanquet
    9. {
    10. get { return _HallBanquet; }
    11. set { SetPropertyValue&lt;HallBanquet&gt;(nameof(HallBanquet), ref _HallBanquet, value); }
    12. }
    13. private RstConstants _ItemType;
    14. public RstConstants ItemType
    15. {
    16. get { return _ItemType; }
    17. set { SetPropertyValue&lt;RstConstants&gt;(nameof(ItemType), ref _ItemType, value);
    18. ItmTypeDs = value?.Description;
    19. }
    20. }
    21. private string ItmTypeDs { get; set; }
    22. private string _Code;
    23. [Size(50)]
    24. //[RValidate(&quot;Code&quot;, true, 50)]
    25. public string Code
    26. {
    27. get { return _Code; }
    28. set { SetPropertyValue&lt;string&gt;(nameof(Code), ref _Code, value); }
    29. }
    30. private string _Description;
    31. [Size(200)]
    32. //[RValidate(&quot;Description&quot;, true, 200)]
    33. public string Description
    34. {
    35. get { return _Description; }
    36. set { SetPropertyValue&lt;string&gt;(nameof(Description), ref _Description, value); }
    37. }
    38. private Guid _Item;
    39. public Guid Item
    40. {
    41. get { return _Item; }
    42. set { SetPropertyValue&lt;Guid&gt;(nameof(Item), ref _Item, value);
    43. }
    44. }
    45. private float _Pkg = 1;
    46. public float Pkg
    47. {
    48. get { return _Pkg; }
    49. set
    50. {
    51. SetPropertyValue&lt;float&gt;(nameof(Pkg), ref _Pkg, value);
    52. }
    53. }
    54. private string _Unit;
    55. [Size(50)]
    56. //[RValidate(&quot;Unit&quot;, true,50 )]
    57. public string Unit
    58. {
    59. get { return _Unit; }
    60. set { SetPropertyValue&lt;string&gt;(nameof(Unit), ref _Unit, value); }
    61. }
    62. private Decimal _Qty = 1;
    63. public Decimal Qty
    64. {
    65. get { return _Qty; }
    66. set
    67. {
    68. SetPropertyValue&lt;Decimal&gt;(nameof(Qty), ref _Qty, value);
    69. SetTaxAndSalesAmount();
    70. }
    71. }
    72. private Decimal _Price;
    73. public Decimal Price
    74. {
    75. get { return _Price; }
    76. set
    77. {
    78. SetPropertyValue&lt;Decimal&gt;(nameof(Price), ref _Price, value);
    79. SetTaxAndSalesAmount();
    80. }
    81. }
    82. private float _Cost;
    83. public float Cost
    84. {
    85. get { return _Cost; }
    86. set { SetPropertyValue&lt;float&gt;(nameof(Cost), ref _Cost, value); }
    87. }
    88. private Decimal _DiscountPer;
    89. public Decimal DiscountPer
    90. {
    91. get { return _DiscountPer; }
    92. set
    93. {
    94. SetPropertyValue&lt;Decimal&gt;(nameof(DiscountPer), ref _DiscountPer, value);
    95. this.DiscountAmt = Math.Round(((Price * Qty) * value) / 100, 3, MidpointRounding.AwayFromZero);
    96. }
    97. }
    98. private Decimal _DiscountAmt;
    99. public Decimal DiscountAmt
    100. {
    101. get { return _DiscountAmt; }
    102. set
    103. {
    104. SetPropertyValue&lt;Decimal&gt;(nameof(DiscountAmt), ref _DiscountAmt, value);
    105. SetTaxAndSalesAmount();
    106. }
    107. }
    108. private Decimal _Amount;
    109. public Decimal Amount
    110. {
    111. get { return _Amount; }
    112. set { SetPropertyValue&lt;Decimal&gt;(nameof(Amount), ref _Amount, value); }
    113. }
    114. private Decimal _TotalAmt;
    115. public Decimal TotalAmt
    116. {
    117. get { return _TotalAmt; }
    118. set { SetPropertyValue&lt;Decimal&gt;(nameof(TotalAmt), ref _TotalAmt, value); }
    119. }
    120. private Boolean _IsInclussiveTax;
    121. public Boolean IsInclussiveTax
    122. {
    123. get { return _IsInclussiveTax; }
    124. set { SetPropertyValue&lt;Boolean&gt;(nameof(IsInclussiveTax), ref _IsInclussiveTax, value); }
    125. }
    126. private Tax _TaxCd;
    127. public Tax TaxCd
    128. {
    129. get { return _TaxCd; }
    130. set
    131. {
    132. SetPropertyValue&lt;Tax&gt;(nameof(TaxCd), ref _TaxCd, value);
    133. this.TaxPer = value == null ? 0 : value.TaxValue;
    134. }
    135. }
    136. private Decimal _TaxPer;
    137. public Decimal TaxPer
    138. {
    139. get { return _TaxPer; }
    140. set
    141. {
    142. SetPropertyValue&lt;Decimal&gt;(nameof(TaxPer), ref _TaxPer, value);
    143. SetTaxAndSalesAmount();
    144. }
    145. }
    146. private Decimal _TaxAmt;
    147. public Decimal TaxAmt
    148. {
    149. get { return _TaxAmt; }
    150. set { SetPropertyValue&lt;Decimal&gt;(nameof(TaxAmt), ref _TaxAmt, value); }
    151. }
    152. private Account _GlCode;
    153. public Account GlCode
    154. {
    155. get { return _GlCode; }
    156. set { SetPropertyValue&lt;Account&gt;(nameof(GlCode), ref _GlCode, value); }
    157. }
    158. private void SetTaxAndSalesAmount()
    159. {
    160. if (!IsLoading &amp;&amp; !IsSaving)
    161. {
    162. this.TaxAmt = Math.Round(CommonFx.GetTaxAmount(this.IsInclussiveTax, this.TaxPer, ((this.Price * this.Qty) - this.DiscountAmt)), 3);
    163. this.Amount = Math.Round(CommonFx.GetTaxableAmount(this.IsInclussiveTax, this.TaxPer, ((this.Price * this.Qty) - this.DiscountAmt)), 3);
    164. this.TotalAmt = Math.Round(CommonFx.GetAmountWithTax(this.IsInclussiveTax, this.TaxPer, ((this.Price * this.Qty) - this.DiscountAmt)), 3);
    165. }
    166. }
    167. }
  3. Customer Tabe

    public class Customer : Epimonos.BizObjects.Core.XPMasterObject
    {

    1. public Customer(Session session) : base(session)
    2. {
    3. // This constructor is used when an object is loaded from a persistent storage.
    4. // Do not place any code here.
    5. }
    6. public override void AfterConstruction()
    7. {
    8. base.AfterConstruction();
    9. // Place here your initialization code.
    10. }
    11. public override void Initialize(RstUser LoginUser, RstSite LoginSite)
    12. {
    13. _VATRegion = VATRegion.Domestic;
    14. }
    15. public override void AfterDisplay(RstUser LoginUser, RstSite LoginSite)
    16. {
    17. ///Value assigned after display
    18. }
    19. #region Properties
    20. private string _ShortDs;
    21. [Size(10)]
    22. [RValidate(&quot;Short Description&quot;,true ,10 )]
    23. public string ShortDs
    24. {
    25. get { return _ShortDs; }
    26. set { SetPropertyValue&lt;string&gt;(nameof(ShortDs), ref _ShortDs, value); }
    27. }
    28. private CustomerGroup _Parent;
    29. public CustomerGroup Parent
    30. {
    31. get { return _Parent; }
    32. set { SetPropertyValue&lt;CustomerGroup&gt;(nameof(Parent), ref _Parent, value); }
    33. }
    34. private RstCurrency _Currency;
    35. public RstCurrency Currency
    36. {
    37. get { return _Currency; }
    38. set { SetPropertyValue&lt;RstCurrency&gt;(nameof(Currency), ref _Currency, value); }
    39. }
    40. private string _IDNumber;
    41. [Size(50)]
    42. [RValidate(&quot;ID. Number&quot;,false , 50)]
    43. public string IDNumber
    44. {
    45. get { return _IDNumber; }
    46. set { SetPropertyValue&lt;string&gt;(nameof(IDNumber), ref _IDNumber, value); }
    47. }
    48. private string _CustomerType;
    49. [Size(30)]
    50. [RValidate(&quot;CustomerType&quot;,false, 30)]
    51. public string CustomerType
    52. {
    53. get { return _CustomerType; }
    54. set { SetPropertyValue&lt;string&gt;(nameof(CustomerType), ref _CustomerType, value); }
    55. }
    56. [NonPersistent]
    57. private RstBaseType _BaseType;
    58. public RstBaseType BaseType
    59. {
    60. get { return _BaseType; }
    61. set { SetPropertyValue&lt;RstBaseType&gt;(nameof(BaseType), ref _BaseType, value); }
    62. }
    63. private VATRegion _VATRegion;
    64. public VATRegion VATRegion
    65. {
    66. get { return _VATRegion; }
    67. set { SetPropertyValue&lt;VATRegion&gt;(nameof(VATRegion), ref _VATRegion, value); }
    68. }
    69. private string _VATNumber;
    70. [Size(50)]
    71. [RValidate(&quot;VAT Number&quot;,false , 50)]
    72. public string VATNumber
    73. {
    74. get { return _VATNumber; }
    75. set { SetPropertyValue&lt;string&gt;(nameof(VATNumber), ref _VATNumber, value); }
    76. }
    77. private DateTime _VATStartDt;
    78. public DateTime VATStartDt
    79. {
    80. get { return _VATStartDt; }
    81. set { SetPropertyValue&lt;DateTime&gt;(nameof(VATStartDt), ref _VATStartDt, value); }
    82. }
    83. private DateTime _ContractExpiry = DateTime.Today;
    84. public DateTime ContractExpiry
    85. {
    86. get { return _ContractExpiry; }
    87. set { SetPropertyValue&lt;DateTime &gt;(nameof(ContractExpiry), ref _ContractExpiry, value); }
    88. }
    89. private bool _ShowPriceInDN;
    90. public bool ShowPrice
    91. {
    92. get { return _ShowPriceInDN; }
    93. set { SetPropertyValue&lt;bool&gt;(nameof(ShowPrice), ref _ShowPriceInDN, value); }
    94. }
    95. /// &lt;summary&gt;
    96. /// Mannual blocking of Customer from Transaction
    97. /// &lt;/summary&gt; _BlockCustomer
    98. private bool _BlockCustomer;
    99. public bool BlockCustomer
    100. {
    101. get { return _BlockCustomer; }
    102. set { SetPropertyValue&lt;bool&gt;(nameof(BlockCustomer), ref _BlockCustomer, value);
    103. if (!IsLoading &amp;&amp; !IsSaving &amp;&amp; !BlockCustomer) _BlockedReason = &quot;&quot;;
    104. }
    105. }
    106. private string _BlockedReason;
    107. [Size(100)]
    108. [RValidate(&quot;Blocked Reason&quot;,false ,100 )]
    109. public string BlockedReason
    110. {
    111. get { return _BlockedReason; }
    112. set { SetPropertyValue&lt;string&gt;(nameof(BlockedReason), ref _BlockedReason, value); }
    113. }
    114. private string _PaymentTerms;
    115. [Size(30)]
    116. [RValidate(&quot;Payment Terms&quot;,false , 30)]
    117. public string PaymentTerms
    118. {
    119. get { return _PaymentTerms; }
    120. set { SetPropertyValue&lt;string&gt;(nameof(PaymentTerms), ref _PaymentTerms, value); }
    121. }
    122. private string _DeliveryTerms;
    123. [Size(30)]
    124. [RValidate(&quot;DeliveryTerms&quot;,false , 30)]
    125. public string DeliveryTerms
    126. {
    127. get { return _DeliveryTerms; }
    128. set { SetPropertyValue&lt;string&gt;(nameof(DeliveryTerms), ref _DeliveryTerms, value); }
    129. }
    130. private Account _CustomerLedger;
    131. public Account CustomerLedger
    132. {
    133. get { return _CustomerLedger; }
    134. set { SetPropertyValue&lt;Account&gt;(nameof(CustomerLedger), ref _CustomerLedger, value); }
    135. }
    136. private Account _AdvanceLedger;
    137. public Account AdvanceLedger
    138. {
    139. get { return _AdvanceLedger; }
    140. set { SetPropertyValue&lt;Account&gt;(nameof(AdvanceLedger), ref _AdvanceLedger, value); }
    141. }
    142. private Boolean _IsSubCustomer;
    143. public Boolean IsSubCustomer
    144. {
    145. get { return _IsSubCustomer; }
    146. set
    147. {
    148. SetPropertyValue&lt;Boolean&gt;(nameof(IsSubCustomer), ref _IsSubCustomer, value);
    149. if (!IsLoading &amp;&amp; !IsSaving &amp;&amp; !IsSubCustomer) _ParentCustomer = null;
    150. }
    151. }
    152. private Customer _ParentCustomer;
    153. public Customer ParentCustomer
    154. {
    155. get { return _ParentCustomer; }
    156. set { SetPropertyValue&lt;Customer&gt;(nameof(ParentCustomer), ref _ParentCustomer, value); }
    157. }
    158. private bool _IsCreditLimitCheck;
    159. public bool IsCreditLimitCheck
    160. {
    161. get { return _IsCreditLimitCheck; }
    162. set
    163. {
    164. SetPropertyValue&lt;bool&gt;(nameof(IsCreditLimitCheck), ref _IsCreditLimitCheck, value);
    165. if (!IsCreditLimitCheck)
    166. {
    167. _CreditPeriod = 0;
    168. _CreditLimit = 0;
    169. }
    170. }
    171. }
    172. private int _CreditPeriod;
    173. public int CreditPeriod
    174. {
    175. get { return _CreditPeriod; }
    176. set { SetPropertyValue&lt;int&gt;(nameof(CreditPeriod), ref _CreditPeriod, value); }
    177. }
    178. private Decimal _CreditLimit;
    179. public Decimal CreditLimit
    180. {
    181. get { return _CreditLimit; }
    182. set { SetPropertyValue&lt;Decimal&gt;(nameof(CreditLimit), ref _CreditLimit, value); }
    183. }
    184. private SalesMan _SalesMan;
    185. public SalesMan SalesMan
    186. {
    187. get { return _SalesMan; }
    188. set { SetPropertyValue&lt;SalesMan&gt;(nameof(SalesMan), ref _SalesMan, value); }
    189. }
    190. #endregion
    191. #region Associations
    192. [Association(&quot;Customer-CustomerBranch&quot;)]
    193. public XPCollection&lt;CustomerBranch&gt; CustomerBranches
    194. {
    195. get
    196. {
    197. XPCollection&lt;CustomerBranch&gt; col = GetCollection&lt;CustomerBranch&gt;(nameof(CustomerBranches));
    198. if (col.Sorting.Count == 0)
    199. {
    200. col.Sorting.Add(new DevExpress.Xpo.SortProperty(&quot;SeqNo&quot;, SortingDirection.Ascending));
    201. }
    202. return col;
    203. }
    204. }
    205. private XPCollection&lt;CustomerBranch&gt; _ActiveBranches;
    206. public XPCollection&lt;CustomerBranch&gt; ActiveBranches
    207. {
    208. get
    209. {
    210. return _ActiveBranches;
    211. }
    212. }
    213. [Association(&quot;Customer-CustomerContact&quot;)]
    214. public XPCollection&lt;CustomerContact&gt; CustomerContacts
    215. {
    216. get
    217. {
    218. XPCollection&lt;CustomerContact&gt; col = GetCollection&lt;CustomerContact&gt;(nameof(CustomerContacts));
    219. if (col.Sorting.Count == 0)
    220. {
    221. col.Sorting.Add(new DevExpress.Xpo.SortProperty(&quot;SeqNo&quot;, SortingDirection.Ascending));
    222. }
    223. return col;
    224. }
    225. }
    226. public XPCollection&lt;CustomerContact&gt; ActiveCustContacts(Guid? BranchID)
    227. {
    228. if (BranchID != null)
    229. {
    230. return new XPCollection&lt;CustomerContact&gt;(this.Session, CriteriaOperator.Parse($&quot;Customer = &#39;{this.MastId}&#39;AND Active AND CustomerBranch.RowId=&#39;{BranchID}&#39; &quot;),
    231. new SortProperty(&quot;SeqNo&quot;, SortingDirection.Ascending));
    232. }
    233. else
    234. {
    235. return new XPCollection&lt;CustomerContact&gt;(this.Session, CriteriaOperator.Parse($&quot;Customer = &#39;{this.MastId}&#39;AND Active&quot;),
    236. new SortProperty(&quot;SeqNo&quot;, SortingDirection.Ascending));
    237. }
    238. }
    239. #endregion
    240. }

答案1

得分: 1

在第2行,你可能应该写hb.DocId equals hbi.HallBanquetId或者hb.DocId equals hbi.DocId,而不是hb.DocId equals hbi.HallBanquet(这取决于你的外键从项目指向宴会的命名方式)。

英文:

Probably, in the 2nd line you should write hb.DocId equals hbi.HallBanquetId or hb.DocId equals hbi.DocId instead of hb.DocId equals hbi.HallBanquet (It depends on how your foreign key pointing from item to banquet is named).

huangapple
  • 本文由 发表于 2023年2月8日 16:24:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75382997.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定