public EntityDataViewReportDTO ToEntityDataViewReportDTO(EntityDataViewReport item, bool withDetails)
        {
            EntityDataViewReportDTO result = new EntityDataViewReportDTO();

            bizEntitySearchableReport.ToEntitySearchableReportDTO(item.EntitySearchableReport, result, withDetails);
            result.DataMenuSettingID = item.DataMenuSettingID;
            //         result.SearchRepositoryID = item.EntitySearchableReport.SearchRepositoryID ?? 0;
            return(result);
        }
 public frmEntityDataViewReport(int entityID, int entityViewReportID)
 {
     InitializeComponent();
     EntityID = entityID;
     //  SetSubReports();
     //    SetSubReportRelationships();
     SetEntityPreDefinedSearchList();
     SetDataMenuSetting();
     if (entityViewReportID != 0)
     {
         GetEntityDataViewReport(entityViewReportID);
     }
     else
     {
         Message = new EntityDataViewReportDTO();
         ShowMessage();
     }
 }
        public void UpdateEntityDataViewReports(EntityDataViewReportDTO message)
        {
            BizEntityReport bizEntityReport = new MyModelManager.BizEntityReport();

            using (var projectContext = new DataAccess.MyProjectEntities())
            {
                var dbEntitySpecifiedReport = projectContext.EntityDataViewReport.FirstOrDefault(x => x.ID == message.ID);
                if (dbEntitySpecifiedReport == null)
                {
                    message.ReportType           = ReportType.SearchableReport;
                    message.SearchableReportType = SearchableReportType.DataView;
                    dbEntitySpecifiedReport      = new EntityDataViewReport();
                    dbEntitySpecifiedReport.EntitySearchableReport = bizEntitySearchableReport.ToNewEntitySearchableReport(message);
                }
                else
                {
                    bizEntitySearchableReport.ToUpdateEntitySearchableReport(dbEntitySpecifiedReport.EntitySearchableReport, message);
                }

                dbEntitySpecifiedReport.DataMenuSettingID = message.DataMenuSettingID;
                //    dbEntitySpecifiedReport.EntitySearchableReport.SearchRepositoryID = message.SearchRepositoryID;
                //while (dbEntityDataViewReport.EntityDataViewReportSubs1.Any())
                //    projectContext.EntityDataViewReportSubs.Remove(dbEntityDataViewReport.EntityDataViewReportSubs1.First());
                //foreach (var sub in message.EntityDataViewReportSubs)
                //{
                //    EntityDataViewReportSubs rColumn = new EntityDataViewReportSubs();
                //    rColumn.Title = sub.Title;
                //    rColumn.ChildEntityDataViewReportID = sub.EntityDataViewReportID;
                //    rColumn.OrderID = sub.OrderID;
                //    rColumn.RelationshipID = sub.RelationshipID;
                //    dbEntityDataViewReport.EntityDataViewReportSubs1.Add(rColumn);
                //}

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