Base solution for your next web application

Activities of "iamnish"

Answer

by changing it to Entitydto , am i loosing anything :?: ?

yes , I have corrected it thanks :D

Answer

Hi thanks I changed it to Entitydto and those fields are gone but still there is one extra field 'id' .And tenant id keep displaying zero

Answer

my salesdto and json response is mentioned below .though i have not defined those properties in dto but it is automatically added to the return value.

[AutoMapFrom(typeof(Salemast))] public class Salelistdto : FullAuditedEntityDto { [Required] public int TenantId { get; set; } [Required] public System.DateTime Invdt { get; set; } [Required] public System.DateTime Invduedt { get; set; } [Required] public string Currency { get; set; } [Required] public decimal Currate { get; set; } [Required] public string Custid { get; set; } public bool Export { get; set; } public string Comments { get; set; }

      [Required]
    public  string Invno { get; set; }
    public  int Sslno { get; set; }
    public  string Branchid { get; set; }
    public decimal Amount { get; set; }
    int termvalue;
    public  int Terms
    {
        get
        {
            return Convert.ToInt32(Invduedt.Subtract(Invdt).TotalDays);
        }
        set
        {
            termvalue = value;
        }
    }
    public Collection<Saledetailslistdto> Saledetails { get; set; }

}

json response from getsale

{ "success": true, "result": { "filter": null, "items": [ { "tenantId": 0, "invdt": "2015-02-02T00:00:00", "invduedt": "2015-03-03T00:00:00", "currency": "USD", "currate": 6.00, "custid": "MrX", "export": false, "comments": "okok", "invno": "10", "sslno": 0, "branchid": null, "amount": 2000.0000, "terms": 29, "saledetails": null, <span style="color:#FF0040">"isDeleted": false, "deleterUserId": null, "deletionTime": null, "lastModificationTime": null, "lastModifierUserId": null, "creationTime": "2016-03-03T23:33:26.2537063+08:00", "creatorUserId": null, "id": 0</span> },

Answer

I have followup questions

1 should i make separate repository and dtos for the all entities including the child entity?

2.I dont want to send extra info(tenantid , creationdate etc ) to the the client side, but they are automatically added by the platform.

3.why my tenantid is showing zero

Answer

thanks for a quick reply u r right i have the collection saledetails entity instead of saledetailsdto here is my dto

using System; using System.Collections.ObjectModel; using Abp.Application.Services.Dto; using Abp.AutoMapper; using nn.Saleapp.Dto; using System.ComponentModel.DataAnnotations;

namespace nn.Saleapp.Dto {

 [AutoMapFrom(typeof(Salemast))]
public class Salelistdto : FullAuditedEntityDto
{

  [Required]
    public  int TenantId { get; set; }

      [Required]
    public  System.DateTime Invdt { get; set; }

      [Required]
    public  System.DateTime Invduedt { get; set; }

      [Required]
    public  string Currency { get; set; }

      [Required]
    public  decimal Currate { get; set; }

      [Required]
    public  string Custid { get; set; }
    public  bool Export { get; set; }
    public  string Comments { get; set; }

      [Required]
    public  string Invno { get; set; }

   
    public  int Sslno { get; set; }

    public  string Branchid { get; set; }

    public decimal Amount { get; set; }

    public Collection&lt;Saledetails&gt; Saledetails { get; set; } // here i made the mistake
}
Answer

if I am changing the out put to json its giving following error

Server Error in '/' Application. Self referencing loop detected with type 'System.Data.Entity.DynamicProxies.Saledetails_77F91B59002A13BD27073425BCB8F0D7F115C48F2B66059C52B6900EA3B2CA32'. Path 'result.items[0].saledetails[0].salemast.saledetails'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Newtonsoft.Json.JsonSerializationException: Self referencing loop detected with type 'System.Data.Entity.DynamicProxies.Saledetails_77F91B59002A13BD27073425BCB8F0D7F115C48F2B66059C52B6900EA3B2CA32'. Path 'result.items[0].saledetails[0].salemast.saledetails'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[JsonSerializationException: Self referencing loop detected with type 'System.Data.Entity.DynamicProxies.Saledetails_77F91B59002A13BD27073425BCB8F0D7F115C48F2B66059C52B6900EA3B2CA32'. Path 'result.items[0].saledetails[0].salemast.saledetails'.] Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, Object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty) +649 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +654 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +578 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +492 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +471 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +492 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +471 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +654 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +578 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +492 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +471 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +654 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +578 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +492 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +471 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +492 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +471 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) +390 Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) +1929 Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType) +45 Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) +205 Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, Formatting formatting, JsonSerializerSettings settings) +82 Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) +47 Abp.Web.Mvc.Controllers.Results.AbpJsonResult.ExecuteResult(ControllerContext context) +531 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +116 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +529 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +106 System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +321 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +133 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40 System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +70 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +133 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44 System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +62 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +133 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +70 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9742689 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Showing 21 to 27 of 27 entries