public ProcessController(IProcessView view) { ICWObj = new ICWAccess(Helper.LoadConfigKeys("ConnectionString"));// + ";Integrated Security=SSPI; trusted_connection=Yes;"); _view = view; view.SetController(this); //pass the contoller instance to the view }
/// <summary> /// Adds the existing records classes. /// </summary> /// <param name="assemblyCode">The assembly code.</param> /// <param name="processView">The process view.</param> /// <param name="viewConfig">The view configuration.</param> /// <param name="process">The process.</param> /// <param name="assemblyGenerator">The assembly generator.</param> private static void AddExistingRecordsClasses(StringBuilder assemblyCode, IProcessView processView, DataCollectProcessViewConfigurator viewConfig, IProcessDefinition process, AssemblyGeneratorBase assemblyGenerator) { var dcConfig = (DataCollectViewConfig) processView.ViewConfiguration; var table = new TableDefinition { Name = process.Name }; assemblyCode.AppendFormat( @" [Serializable] public class {0} : BaseReferenceInfo<{0}> {{ {1} public static ReferenceFieldDefinition GetFieldDefinition() {{ ReferenceFieldDefinition fieldDefinition = null; {2} return fieldDefinition; }} }} ", GetExistingRecordsChildClassName(processView, viewConfig, process), AssemblyGeneratorBase.GetDisplaylistRefEditableChildProperties(table, dcConfig.ReferenceField), assemblyGenerator.GetReferenceDefinition(new TableDefinition {Name = process.Name}, dcConfig.ReferenceField, "fieldDefinition")); assemblyCode.AppendFormat( @" [Serializable] public class {0} : BaseReferenceInfoList<{0}, {1}> {{ public static void BeginGetList(int pageNumber, int pageSize, SortList sorting, string filter, System.Action<object, IDataPortalResult> callback) {{ DataPortal.BeginFetch<{0}>(new PagedCriteria {{ PageNumber = pageNumber, PageSize = pageSize, SortColumns = sorting, Filter = filter }}, (o, result) => callback(o, result)); }} public void Assign(IReverseCrossReferenceItem item) {{ IsReadOnly = false; Add(({1})item); IsReadOnly = true; }} public void Load(IEnumerable<IReverseCrossReferenceItem> items) {{ IsReadOnly = false; Clear(); AddRange(items.Cast<{1}>()); IsReadOnly = true; }} }} ", GetExistingRecordsListClassName(processView, viewConfig, process), GetExistingRecordsChildClassName(processView, viewConfig, process)); }
public Processor(IProcessView processView) { _processView = processView; _fullRespondBytes = new ArrayList(); processView.SetProcessor(this); _respondProcessor.CheckVersionEvent += _processView.CheckVersionEvent; _respondProcessor.GetAccXEvent += _processView.GetAccXEvent; _respondProcessor.GetAccYEvent += _processView.GetAccYEvent; _respondProcessor.GetAccZEvent += _processView.GetAccZEvent; _respondProcessor.GetGyrXEvent += _processView.GetGyrXEvent; _respondProcessor.GetGyrYEvent += _processView.GetGyrYEvent; _respondProcessor.GetGyrZEvent += _processView.GetGyrZEvent; _respondProcessor.GetAllMpuDataEvent += _processView.GetAllMpuDataEvent; _respondProcessor.GetBalanceKpEvent += _processView.GetBalanceKpEvent; _respondProcessor.GetBalanceKiEvent += _processView.GetBalanceKiEvent; _respondProcessor.GetVelocityKpEvent += _processView.GetVelocityKpEvent; _respondProcessor.GetVelocityKiEvent += _processView.GetVelocityKiEvent; _respondProcessor.GetAngleEvent += _processView.GetAngleEvent; }
public virtual void Init(IProcessView view, string processSystemName) { ProcessSystemName = processSystemName; ProcessView = view; }
/// <summary> /// Gets the name of the existing records child class. /// </summary> /// <param name="processView">The process view.</param> /// <param name="viewConfig">The view configuration.</param> /// <param name="process">The process.</param> /// <returns>System.String.</returns> private static string GetExistingRecordsChildClassName(IProcessView processView, DataCollectProcessViewConfigurator viewConfig, IProcessDefinition process) { return ProcessViewsCommon.GetDataCollectExsistingRecordsInfoClassName(process.Name, processView); }
/// <summary> /// Adds the existing records classes. /// </summary> /// <param name="assemblyCode">The assembly code.</param> /// <param name="processView">The process view.</param> /// <param name="viewConfig">The view configuration.</param> /// <param name="process">The process.</param> /// <param name="assemblyGenerator">The assembly generator.</param> private static void AddExistingRecordsClasses(StringBuilder assemblyCode, IProcessView processView, DataCollectProcessViewConfigurator viewConfig, IProcessDefinition process, AssemblyGeneratorBase assemblyGenerator) { var dcConfig = (DataCollectViewConfig)processView.ViewConfiguration; var table = new TableDefinition {Name = process.Name}; assemblyCode.AppendFormat( @" [Serializable] public class {0} : BaseReferenceInfo<{0}> {{ {1} public static {0} Get{0}(SafeDataReader reader) {{ return DataPortal.FetchChild<{0}>(reader); }} private void Child_Fetch(SafeDataReader reader) {{ var displayName = new System.Text.StringBuilder(); {2} }} public static Cebos.Veyron.SharedTypes.ReferenceFieldDefinition GetFieldDefinition() {{ Cebos.Veyron.SharedTypes.ReferenceFieldDefinition fieldDefinition = null; {3} return fieldDefinition; }} }} ", GetExistingRecordsChildClassName(processView, viewConfig, process), AssemblyGeneratorBase.GetDisplaylistRefEditableChildProperties(table, dcConfig.ReferenceField), ((ServerAssemblyGenerator)assemblyGenerator).GetReverseCrossRefChildPropertiesLoad(dcConfig.ReferenceField), assemblyGenerator.GetReferenceDefinition(table, dcConfig.ReferenceField, "fieldDefinition") ); }
/// <summary> /// Shows the process view. /// </summary> /// <param name="view">The view.</param> private void ShowProcessView(IProcessView view) { var vm = ProcessViewsFactory.FirstOrDefault(v => v.Metadata.ViewType == view.ViewType); if (vm == null) { ThePopupFactory.NotifyFailure("ViewModel for " + view.ViewType + " not found."); return; } var processViewModel = vm.CreateExport().Value; processViewModel.Init(view, _model.ProcessSystemName); WindowManager.ShowTaskWindow(processViewModel, false); }
/// <summary> /// The get apqp exsisting records info class name. /// </summary> /// <param name="processName">The process name.</param> /// <param name="view">The view.</param> /// <returns>The <see cref="string" />.</returns> public static string GetAPQPExsistingRecordsInfoClassName(string processName, IProcessView view) { return view != null ? string.Format(CultureInfo.InvariantCulture, "{0}APQPExistingRecordInfo{1}", processName, view.Guid.ToString("N")) : null; }
/// <summary> /// The get document exsisting records list class name. /// </summary> /// <param name="processName">The process name.</param> /// <param name="view">The view.</param> /// <returns>The <see cref="string" />.</returns> public static string GetDocumentExsistingRecordsListClassName(string processName, IProcessView view) { return view != null ? string.Format(CultureInfo.InvariantCulture, "{0}DocumentExistingRecordList{1}", processName, view.Guid.ToString("N")) : null; }
/// <summary> /// Adds the existing records classes. /// </summary> /// <param name="assemblyCode">The assembly code.</param> /// <param name="processView">The process view.</param> /// <param name="viewConfig">The view configuration.</param> /// <param name="process">The process.</param> /// <param name="assemblyGenerator">The assembly generator.</param> private void AddExistingRecordsClasses(StringBuilder assemblyCode, IProcessView processView, DataCollectProcessViewConfigurator viewConfig, IProcessDefinition process, AssemblyGeneratorBase assemblyGenerator) { assemblyCode.AppendFormat( @" [Serializable] public class {0} : BaseReferenceInfoList<{0}, {1}> {{ private void DataPortal_Fetch(PagedCriteria criteria) {{ var fieldDefinition = {1}.GetFieldDefinition(); var queryGenerator = new SearchQueryGenerator {{ PageSize = criteria.PageSize, PageNumber = criteria.PageNumber }}; Dynamic{2}.{2}List.AddTables(queryGenerator); queryGenerator.RefUpdateFields(fieldDefinition); var filterList = (new List<IFilterDescriptor>()); if (!string.IsNullOrWhiteSpace(criteria.Filter)) {{ // new JSON filter format filterList.Add(Cebos.Veyron.SharedTypes.FilterDescriptor.FromJSON(criteria.Filter)); }} if (filterList.Any()) {{ QueryGeneratorExtensions.AddFilters(filterList, queryGenerator.Filters, queryGenerator.RootTable, queryGenerator); }} if (criteria.SortColumns != null) {{ foreach(var col in criteria.SortColumns) {{ queryGenerator.SortOrders.Add(new Cebos.Veyron.SharedTypes.QueryGenerator.SortDescriptor(col.Direction, queryGenerator.FindColumn(col.ColumnName), col.ColumnName)); }} }} var cmdText = queryGenerator.RefGetQueryForList(fieldDefinition); RaiseListChangedEvents = false; IsReadOnly = false; using (var ctx = ConnectionManager<SqlConnection>.GetManager(ServerSettings.ConnectionString, false)) {{ using (var cmd = new SqlCommand(cmdText, ctx.Connection)) {{ using (var reader = new SafeDataReader(cmd.ExecuteReader())) {{ bool isFirstRow = true; while (reader.Read()) {{ var item = {1}.Get{1}(reader); Add(item); if (!isFirstRow) {{ continue; }} TotalRowCount = (int)reader.GetInt64(0); isFirstRow = false; }} }} }} }} PageNumber = criteria.PageNumber; IsReadOnly = true; RaiseListChangedEvents = true; }} }} ", GetExistingRecordsListClassName(processView, viewConfig, process), GetExistingRecordsChildClassName(processView, viewConfig, process), process.Name); }
public void Init(string processName, IProcessView processView, IEditableRoot model) { _processView = processView; _model = model; _listType = TheDynamicTypeManager.GetCustomType( processName, ProcessViewsCommon.GetDataCollectExsistingRecordsListClassName(processName, processView), false); if (_listType != null) { var itemType = _listType.BaseType.GetGenericArguments()[1]; ItemType = itemType; } else { ItemType = null; } List = null; Refresh(0); }