public EntityDataLinkReportDTO ToEntityDataLinkReportDTO(EntityDataLinkReport item, bool withDetails)
        {
            EntityDataLinkReportDTO result = new EntityDataLinkReportDTO();

            result.TableDrivedEntityID = item.EntityReport.TableDrivedEntityID;
            result.ID          = item.ID;
            result.DataLinkID  = item.DataLinkDefinitionID;
            result.ReportTitle = item.EntityReport.Title;
            bizEntityReport.ToEntityReportDTO(item.EntityReport, result as EntityReportDTO, withDetails);

            return(result);
        }
 public frmEntityDataLinkReport(int entityID, int entityViewReportID)
 {
     InitializeComponent();
     EntityID = entityID;
     //  SetSubReports();
     //    SetSubReportRelationships();
     SetDataLinksList();
     if (entityViewReportID != 0)
     {
         GetEntityDataLinkReport(entityViewReportID);
     }
     else
     {
         Message = new EntityDataLinkReportDTO();
         ShowMessage();
     }
 }
        public void UpdateEntityDataLinkReports(EntityDataLinkReportDTO message)
        {
            BizEntityReport bizEntityReport = new MyModelManager.BizEntityReport();

            using (var projectContext = new DataAccess.MyProjectEntities())
            {
                var dbEntityDataLinkReport = projectContext.EntityDataLinkReport.FirstOrDefault(x => x.ID == message.ID);
                if (dbEntityDataLinkReport == null)
                {
                    dbEntityDataLinkReport = new DataAccess.EntityDataLinkReport();
                    dbEntityDataLinkReport.EntityReport = bizEntityReport.ToNewEntityReport(message as EntityReportDTO, ReportType.DataLink);
                }
                else
                {
                    bizEntityReport.ToUpdateEntityReport(dbEntityDataLinkReport.EntityReport, message as EntityReportDTO);
                }

                dbEntityDataLinkReport.EntityReport.Title = message.ReportTitle;

                dbEntityDataLinkReport.DataLinkDefinitionID = message.DataLinkID;

                //while (dbEntityDataLinkReport.EntityDataLinkReportSubs1.Any())
                //    projectContext.EntityDataLinkReportSubs.Remove(dbEntityDataLinkReport.EntityDataLinkReportSubs1.First());
                //foreach (var sub in message.EntityDataLinkReportSubs)
                //{
                //    EntityDataLinkReportSubs rColumn = new EntityDataLinkReportSubs();
                //    rColumn.Title = sub.Title;
                //    rColumn.ChildEntityDataLinkReportID = sub.EntityDataLinkReportID;
                //    rColumn.OrderID = sub.OrderID;
                //    rColumn.RelationshipID = sub.RelationshipID;
                //    dbEntityDataLinkReport.EntityDataLinkReportSubs1.Add(rColumn);
                //}

                if (dbEntityDataLinkReport.ID == 0)
                {
                    projectContext.EntityDataLinkReport.Add(dbEntityDataLinkReport);
                }
                projectContext.SaveChanges();
            }
        }
 private void btnNew_Click(object sender, RoutedEventArgs e)
 {
     Message = new EntityDataLinkReportDTO();
     ShowMessage();
 }