I am trying to build a one-page application with asp.net MVC4(razor syntax) and databasefirst approach. You can see a simple mock-up of my application as below.
-OPPORTUNITY<br />
--OPPORTUNITY DETAIL(1)<br />
---Seleted Solution-1<br />
---Seleted Solution-2<br />
---Seleted Solution-3<br />
--OPPORTUNITY DETAIL(2)<br />
---Seleted Solution-1<br />
---Seleted Solution-2<br />
--OPPORTUNITY DETAIL(3)<br />
---Seleted Solution-1<br />
---Seleted Solution-2<br />
---Seleted Solution-3<br />
I have lots of Solutions in a table and there are lot of paramaters. What is the bestway to show all information in an one page. I am trying to use create a new viewmodel. But i am not sure about its performance since it is getting all data from tables.
Here are the my model class..
OPPORNUTIES CLASS
namespace CRM_V1.Models
{
using System;
using System.Collections.Generic;
public partial class CRM_OPPORTUNITIES
{
public CRM_OPPORTUNITIES()
{
this.CRM_OP_ATTACHMENTS = new HashSet<CRM_OP_ATTACHMENTS>();
this.CRM_OPP_DETAILS = new HashSet<CRM_OPP_DETAILS>();
}
public decimal ID { get; set; }
public Nullable<decimal> COMPANYID { get; set; }
public Nullable<decimal> SEGMENTID { get; set; }
public Nullable<decimal> SEGMENTDETAILID { get; set; }
public Nullable<decimal> CUSTOMERID { get; set; }
public Nullable<decimal> PROJECTID { get; set; }
public Nullable<decimal> STATUSID { get; set; }
public Nullable<System.DateTime> CRDATE { get; set; }
public Nullable<decimal> CRUSER { get; set; }
public string CODE { get; set; }
public Nullable<System.DateTime> MDDATE { get; set; }
public Nullable<decimal> MDUSER { get; set; }
public Nullable<decimal> IS_VALID { get; set; }
public Nullable<decimal> OWNERID { get; set; }
public Nullable<decimal> PRJCTGRPID { get; set; }
public Nullable<decimal> ORDERSUMMARY { get; set; }
public string NOTES { get; set; }
public virtual CRM_COMPANIES CRM_COMPANIES { get; set; }
public virtual CRM_CUSTOMERS CRM_CUSTOMERS { get; set; }
public virtual ICollection<CRM_OP_ATTACHMENTS> CRM_OP_ATTACHMENTS { get; set; }
public virtual CRM_OP_STATUS CRM_OP_STATUS { get; set; }
public virtual ICollection<CRM_OPP_DETAILS> CRM_OPP_DETAILS { get; set; }
public virtual CRM_SEGMENTS CRM_SEGMENTS { get; set; }
public virtual CRM_SEGMENT_DETAILS CRM_SEGMENT_DETAILS { get; set; }
public virtual CRM_PROJECTS CRM_PROJECTS { get; set; }
public virtual CRM_PRJCT_GROUPS CRM_PRJCT_GROUPS { get; set; }
}
}
DETAIL CLASS
namespace CRM_V1.Models
{
using System;
using System.Collections.Generic;
public partial class CRM_OPP_DETAILS
{
public CRM_OPP_DETAILS()
{
this.CRM_OPP_DETAILS1 = new HashSet<CRM_OPP_DETAILS>();
this.CRM_REVENUE_PLAN = new HashSet<CRM_REVENUE_PLAN>();
this.CRM_SOLUTION_DISTRIBUTION = new HashSet<CRM_SOLUTION_DISTRIBUTION>();
}
public decimal ID { get; set; }
public string CODE { get; set; }
public Nullable<decimal> OPPID { get; set; }
public Nullable<decimal> ORDERAMOUNT { get; set; }
public Nullable<System.DateTime> ORDERDATE { get; set; }
public string ORDERCURRENCY { get; set; }
public Nullable<decimal> REVENUEAMOUNT { get; set; }
public Nullable<System.DateTime> REVENUEDATE { get; set; }
public Nullable<decimal> REVENUECURRENCY { get; set; }
public Nullable<short> MARGINRATE { get; set; }
public Nullable<System.DateTime> TARGETDATE { get; set; }
public Nullable<short> POSSIBILITY { get; set; }
public Nullable<decimal> STATUSID { get; set; }
public string NOTES { get; set; }
public Nullable<System.DateTime> CRDATE { get; set; }
public Nullable<decimal> CRUSER { get; set; }
public Nullable<System.DateTime> MDDATE { get; set; }
public Nullable<decimal> MDUSER { get; set; }
public Nullable<decimal> IS_VALID { get; set; }
public Nullable<decimal> TYPEID { get; set; }
public Nullable<decimal> OWNERID { get; set; }
public Nullable<decimal> AFFLDETAILID { get; set; }
public Nullable<decimal> REVENUEDOLLAR { get; set; }
public Nullable<decimal> ORDERDOLLAR { get; set; }
public Nullable<decimal> ISHAVEREVPLAN { get; set; }
public Nullable<decimal> SOLPLANDONE { get; set; }
public Nullable<decimal> SOLUTIONID { get; set; }
public string PAFDCANO { get; set; }
public Nullable<decimal> DCAKOD { get; set; }
public virtual CRM_OP_DETAIL_STATUS CRM_OP_DETAIL_STATUS { get; set; }
public virtual CRM_OPP_DETAIL_TYPE CRM_OPP_DETAIL_TYPE { get; set; }
public virtual CRM_OPPORTUNITIES CRM_OPPORTUNITIES { get; set; }
public virtual ICollection<CRM_OPP_DETAILS> CRM_OPP_DETAILS1 { get; set; }
public virtual CRM_OPP_DETAILS CRM_OPP_DETAILS2 { get; set; }
public virtual ICollection<CRM_REVENUE_PLAN> CRM_REVENUE_PLAN { get; set; }
public virtual ICollection<CRM_SOLUTION_DISTRIBUTION> CRM_SOLUTION_DISTRIBUTION { get; set; }
}
}
SOLUTION DISTRUBUTION CLASS
namespace CRM_V1.Models
{
using System;
using System.Collections.Generic;
public partial class CRM_SOLUTION_DISTRIBUTION
{
public CRM_SOLUTION_DISTRIBUTION()
{
this.CRM_SOLUTION_VENDOR = new HashSet<CRM_SOLUTION_VENDOR>();
}
public decimal ID { get; set; }
public Nullable<decimal> OPPDETAILID { get; set; }
public Nullable<decimal> SOLUTIONID { get; set; }
public Nullable<decimal> CRUSER { get; set; }
public Nullable<System.DateTime> CRDATE { get; set; }
public Nullable<decimal> MDUSER { get; set; }
public Nullable<System.DateTime> MDDATE { get; set; }
public Nullable<decimal> AMOUNT { get; set; }
public Nullable<decimal> IS_VALID { get; set; }
public string CURRENCY { get; set; }
public Nullable<decimal> AMOUNTDOLLAR { get; set; }
public Nullable<decimal> MARGIN { get; set; }
public Nullable<decimal> MARGINRATE { get; set; }
public Nullable<decimal> DISTMARGIN { get; set; }
public Nullable<decimal> VENDORID { get; set; }
public Nullable<System.DateTime> VENDORDATE { get; set; }
public virtual CRM_OPP_DETAILS CRM_OPP_DETAILS { get; set; }
public virtual CRM_SOLUTIONS CRM_SOLUTIONS { get; set; }
public virtual CRM_VENDORS CRM_VENDORS { get; set; }
public virtual ICollection<CRM_SOLUTION_VENDOR> CRM_SOLUTION_VENDOR { get;
I started with create a MODELVIEW to show an OPPORTUNITY and related DETAILS at first but i failed ?
Here is my modelview class :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CRM_V1.Models;
namespace CRM_V1.ViewModels
{
public class OppViewModel
{
public List<CRM_OPPORTUNITIES> OppList { get; set; }
public List<CRM_OPP_DETAILS> OppDetailList { get; set; }
}
}
My Controller Action
public ActionResult addingDetailNew(decimal id = 0)
{
CRM_OPPORTUNITIES crm_opportunities = db.CRM_OPPORTUNITIES.Find(id);
var viewModel2 = new OppViewModel
{
viewModel2 = db.CRM_OPPORTUNITIES.ToList()
};
if (crm_opportunities == null)
{
return HttpNotFound();
}
return View(viewModel2);
}
And finally my view.
@model CRM_V1.ViewModels.OppViewModel
@{
ViewBag.Title = "addingDetailNew";
}
<h2>addingDetailNew</h2>
@Html.DisplayFor(model => model.NOTES)
But i could not get the NOTES field. And my second question how can i get the joined field like model.CUSTOMERS.NAME . ?
Regards