/// <summary>
		/// Initializes a new instance of the <see cref="QueryConverter"/> class.
		/// </summary>
		/// <param name="services">The services.</param>
		/// <param name="typeProvider">The type provider.</param>
		/// <param name="translator">The translator.</param>
		/// <param name="nodeFactory">The node factory.</param>
		internal QueryConverter(IDataServices services, TypeSystemProvider typeProvider, Translator translator, NodeFactory nodeFactory)
		{
			if(services == null)
			{
				throw Error.ArgumentNull("services");
			}
			if(nodeFactory == null)
			{
				throw Error.ArgumentNull("sql");
			}
			if(translator == null)
			{
				throw Error.ArgumentNull("translator");
			}
			if(typeProvider == null)
			{
				throw Error.ArgumentNull("typeProvider");
			}
			_services = services;
			_translator = translator;
			_nodeFactory = nodeFactory;
			_typeProvider = typeProvider;
			_parameterExpressionToSqlExpression = new Dictionary<ParameterExpression, SqlExpression>();
			_parameterExpressionToExpression = new Dictionary<ParameterExpression, Expression>();
			_parameterExpressionToSqlNode = new Dictionary<ParameterExpression, SqlNode>();
			_sqlNodeToGroupInfo = new Dictionary<SqlNode, GroupInfo>();
			_allowDeferred = true;
		}
Beispiel #2
0
        // When data services are available and initialized,
        // the API calls the method you passed to Create() above:
        private void OnDataServicesCreated(IDataServices dataServices)
        {
            this.realtime = dataServices.Realtime;

            // Using realtime object, you can now start sending requests and/or
            // subscribing to realtime. See below for other code samples.
        }
 internal ObjectReaderBase(ObjectReaderSession <TDataReader> session,
                           NamedColumn[] namedColumns,
                           object[] globals,
                           object[] arguments,
                           int nLocals
                           )
     : base()
 {
     this.Session    = session;
     this.services   = session.Provider.Services;
     this.DataReader = session.DataReader;
     this.Globals    = globals;
     this.Arguments  = arguments;
     if (nLocals > 0)
     {
         this.Locals = new object[nLocals];
     }
     if (this.Session.IsBuffered)
     {
         this.Buffer();
     }
     this.Ordinals = this.GetColumnOrdinals(namedColumns);
 }
Beispiel #4
0
 /// <summary>
 ///     Control the invoce control view model.
 /// </summary>
 /// <param name="dataServices">Data Services</param>
 /// <param name="container">Unity container</param>
 /// <param name="service">Service</param>
 /// <param name="manager">Region Manager</param>
 /// <param name="requestService">Request service</param>
 /// <param name="eventManager">Event manager</param>
 public InvoiceControlViewModel(IDataServices dataServices,
                                IConfigurationService configurationService,
                                IUnityContainer container,
                                IDialogService service,
                                IRegionManager manager,
                                IInteractionRequestController requestService,
                                IEventManager eventManager) : base(
         dataServices, requestService, service, eventManager, configurationService)
 {
     _regionManager  = manager;
     IsBusy          = false;
     _container      = container;
     OpenItemCommand = new DelegateCommand <object>(OpenCurrentItem);
     InitViewModel();
     ItemName             = "Facturas";
     ShowClientCommand    = new DelegateCommand <object>(OnShowClient);
     _invoiceDataServices = DataServices.GetInvoiceDataServices();
     ViewModelUri         = new Uri("karve://invoice/viewmodel?id=" + UniqueId);
     MailboxName          = ViewModelUri.ToString();
     EventManager.RegisterObserverSubsystem(InvoiceModule.InvoiceSubSystem, this);
     RegisterMailBox(ViewModelUri.ToString());
     StartAndNotify();
 }
Beispiel #5
0
 internal QueryConverter(IDataServices services, TypeSystemProvider typeProvider, Translator translator, SqlFactory sql) {
     if (services == null) {
         throw Error.ArgumentNull("services");
     }
     if (sql == null) {
         throw Error.ArgumentNull("sql");
     }
     if (translator == null) {
         throw Error.ArgumentNull("translator");
     }
     if (typeProvider == null) {
         throw Error.ArgumentNull("typeProvider");
     }
     this.services = services;
     this.translator = translator;
     this.sql = sql;
     this.typeProvider = typeProvider;
     this.map = new Dictionary<ParameterExpression, SqlExpression>();
     this.exprMap = new Dictionary<ParameterExpression, Expression>();
     this.dupMap = new Dictionary<ParameterExpression, SqlNode>();
     this.gmap = new Dictionary<SqlNode, GroupInfo>();
     this.allowDeferred = true;
 }
Beispiel #6
0
        protected HeaderedLineViewModelBase(IDataServices dataServices,
                                            IDialogService dialogServices,
                                            IEventManager manager,
                                            IRegionManager regionManager,
                                            IIdentifier identifier,
                                            IConfigurationService configurationService,
                                            IInteractionRequestController controller) : base(dataServices, controller, dialogServices, manager, configurationService)
        {
            RegionManager       = regionManager;
            IdentifierGenerator = identifier;
            AssistDataService   = DataServices.GetAssistDataServices();
            LineVisible         = true;
            FooterVisible       = true;

            /* This instruct the toolbar to skip its is own handlers. Avoiding complexity.
             * It will be just the view to save itself with composite command and to alert it subsystem.
             *  This with the SetRegistrationPayLoad set properly it will permit to save itself.
             *  Each view will save itself, like in this scenario:
             *  https://prismlibrary.github.io/docs/wpf/Advanced-MVVM.html
             * It is better that all headered window will use a composite command.
             */
            CompositeCommandOnly = true;
        }
Beispiel #7
0
        //public new DbConnection Connection
        //{
        //    get
        //    {
        //        CheckDispose();
        //        CheckInitialized();
        //        var conn = conManager.Connection;
        //        if (conn is Connection)
        //            return ((Connection)conn).Source;
        //        return conn;
        //    }
        //}
        #endregion

        void IProvider.Initialize(IDataServices dataServices, object connection)
        {
            if (dataServices == null)
            {
                throw SqlClient.Error.ArgumentNull("dataServices");
            }

            DbConnection conn;
            string       constr;

            if (connection is string)
            {
                conn   = new OracleConnection((string)connection);
                constr = (string)connection;
            }
            //else if (connection is Connection)
            //{
            //    conn = (Connection)connection;
            //    constr = ((Connection)connection).ConnectionString;
            //}
            else
            {
                conn   = (OracleConnection)connection;
                constr = conn.ConnectionString;
            }

            dbName = dataServices.Model.DatabaseName;

            object obj;
            var    builder = new DbConnectionStringBuilder {
                ConnectionString = constr
            };

            passowrd = !builder.TryGetValue("password", out obj) ? dbName : obj.ToString();

            Initialize(dataServices, conn);
        }
 public ProvidersControlViewModel(IConfigurationService configurationService,
                                  IUnityContainer container,
                                  IDataServices services,
                                  IRegionManager regionManager,
                                  IDialogService service,
                                  IEventManager eventManager) : base(configurationService, eventManager, services, null, service, regionManager)
 {
     _container                 = container;
     _regionManager             = regionManager;
     _extendedSupplierDataTable = new DataTable();
     _uniqueIdentifier          = _uniqueIdentifier % Int64.MaxValue;
     _mailBoxName               = PROVIDER_SUMMARY_VM;
     _supplierTaskEvent        += OnNotifyIncrementalList <SupplierSummaryDto>;
     _supplierDataServices      = DataServices.GetSupplierDataServices();
     _gridSorter                = new GridSorter <SupplierSummaryDto>(service, _supplierDataServices, DefaultPageSize);
     _gridSorter.OnInitPage    += _gridSorter_OnInitPage;
     _gridSorter.OnNewPage     += _gridSorter_OnNewPage;
     DefaultPageSize            = 100;
     ViewModelUri               = new Uri("karve://booking/viewmodel?id=" + Guid.ToString());
     SortCommand                = new DelegateCommand <object>(OnSortCommand);
     OpenItemCommand            = new DelegateCommand <object>(OpenCurrentItem);
     InitViewModel();
     ActiveSubSystem();
 }
Beispiel #9
0
        void IProvider.Initialize(IDataServices dataServices, object connection)
        {
            //Debug.Assert(connection is SQLiteConnection);
            if (dataServices == null)
            {
                throw SqlClient.Error.ArgumentNull("dataServices");
            }

            var connection2 = connection as SQLiteConnection;

            if (connection2 == null)
            {
                var fileOrConnectionString = connection as string;
                if (fileOrConnectionString == null)
                {
                    throw SqlClient.Error.InvalidConnectionArgument("connection");
                }
                string connectionString = GetConnectionString(fileOrConnectionString);
                connection2 = new SQLiteConnection(connectionString);
            }
            services = dataServices;
            dbName   = GetDatabaseName(connection2.ConnectionString);
            Initialize(dataServices, connection2);
        }
        /// <summary>
        /// Commision agent info view model.
        /// </summary>
        /// <param name="configurationService"></param>
        /// <param name="eventManager"></param>
        /// <param name="services"></param>
        /// <param name="dialogService"></param>
        /// <param name="regionManager"></param>
        /// <param name="controller"></param>
        public CommissionAgentInfoViewModel(IConfigurationService configurationService,
                                            IEventManager eventManager,
                                            IDataServices services,
                                            IDialogService dialogService,
                                            IRegionManager regionManager, IInteractionRequestController controller
                                            ) : base(eventManager,
                                                     configurationService,
                                                     services,
                                                     dialogService,

                                                     regionManager,
                                                     controller)
        {
            _queries    = new Dictionary <string, string>();
            _visibility = Visibility.Collapsed;
            _commissionAgentDataServices = DataServices.GetCommissionAgentDataServices();
            _regionManager         = regionManager;
            _onBranchesPrimaryKey += CommissionAgentInfoViewModel__onBranchesPrimaryKey;
            _onContactsPrimaryKey += CommissionAgentInfoViewModel__onContactsPrimaryKey;
            _onVisitPrimaryKey    += CommissionAgentInfoViewModel__onVisitPrimaryKey;
            IsVisible              = Visibility.Collapsed;
            AssistQueryDictionary  = new Dictionary <string, string>();
            PrimaryKeyValue        = string.Empty;
            ConfigurationService   = configurationService;
            InitEvents();
            InitCommands();
            ViewModelUri = new Uri("karve://broker/viewmodel?id=" + Guid.ToString());
            _mapper      = MapperField.GetMapper();
            EventManager.RegisterObserverSubsystem(MasterModuleConstants.CommissionAgentSystemName, this);
            // update the assist.
            UpdateAssist(ref _leftSideDualDfSearchBoxes);
            UpdateChangeCommand(ref _leftSideDualDfSearchBoxes);
            // register itself in the broacast.
            EventManager.RegisterObserver(this);
            _countTime = 0;
        }
 public InvoiceController(IDataServices dataService)
 {
     DataService = dataService;
 }
Beispiel #12
0
 public ProviderDataLayer(IDataServices dataServices)
 {
     _dataServices  = dataServices;
     Initialization = InitializeAsync();
 }
Beispiel #13
0
 /// FIXME: see if the payload can be TAP.
 /// <summary>
 /// Abstract method to override for executing the payload
 /// </summary>
 /// <param name="services">DataServices</param>
 /// <param name="manager">Event manager</param>
 /// <param name="payLoad">Payload to be filed.</param>
 public abstract void ExecutePayload(IDataServices services, IEventManager manager, ref DataPayLoad payLoad);
 public DataProviderViewModel(IDataServices dataServices)
 {
 }
Beispiel #15
0
 public BusinessUnitController(IDataServices dataServices)
 {
     _dataServices = dataServices;
 }
 public LayoutController(IDataServices dataService)
 {
     DataService = dataService;
 }
Beispiel #17
0
 /// <summary>
 ///  Constructor for the helper view.
 /// </summary>
 /// <param name="dataService">DataService for retrieving the helper dataservice.</param>
 /// <param name="regionManager">Region manager used by the factory for the navigation.</param>
 /// <param name="dialogService">DialogService used by the factory for pointing out the errors.</param>
 public HelperNavigatorFactory(IDataServices dataService, IRegionManager regionManager, IDialogService dialogService)
 {
     _dataService   = dataService;
     _regionManager = regionManager;
     _dialogService = dialogService;
 }
Beispiel #18
0
		[ResourceExposure(ResourceScope.Machine)] // connection parameter may refer to filenames.
		void IProvider.Initialize(IDataServices dataServices, object connection)
		{
			if(dataServices == null)
			{
				throw Error.ArgumentNull("dataServices");
			}
			_services = dataServices;

			DbConnection con;
			DbTransaction tx = null;

			string fileOrServerOrConnectionString = connection as string;
			if(fileOrServerOrConnectionString != null)
			{
				string connectionString = this.GetConnectionString(fileOrServerOrConnectionString);
				_dbName = this.GetDatabaseName(connectionString);
				if(_dbName.EndsWith(".sdf", StringComparison.OrdinalIgnoreCase))
				{
					_mode = SqlServerProviderMode.SqlCE;
				}
				if(_mode == SqlServerProviderMode.SqlCE)
				{
					DbProviderFactory factory = SqlProvider.GetProvider(SqlCeProviderInvariantName);
					if(factory == null)
					{
						throw Error.ProviderNotInstalled(_dbName, SqlCeProviderInvariantName);
					}
					con = factory.CreateConnection();
				}
				else
				{
					con = new SqlConnection();
				}
				con.ConnectionString = connectionString;
			}
			else
			{
				// We only support SqlTransaction and SqlCeTransaction
				tx = connection as SqlTransaction;
				if(tx == null)
				{
					// See if it's a SqlCeTransaction
					if(connection.GetType().FullName == SqlCeTransactionTypeName)
					{
						tx = connection as DbTransaction;
					}
				}
				if(tx != null)
				{
					connection = tx.Connection;
				}
				con = connection as DbConnection;
				if(con == null)
				{
					throw Error.InvalidConnectionArgument("connection");
				}
				if(con.GetType().FullName == SqlCeConnectionTypeName)
				{
					_mode = SqlServerProviderMode.SqlCE;
				}
				_dbName = this.GetDatabaseName(con.ConnectionString);
			}

			// initialize to the default command timeout
			using(DbCommand c = con.CreateCommand())
			{
				_commandTimeout = c.CommandTimeout;
			}

			int maxUsersPerConnection = 1;
			if(con.ConnectionString.IndexOf("MultipleActiveResultSets", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				DbConnectionStringBuilder builder = new DbConnectionStringBuilder();
				builder.ConnectionString = con.ConnectionString;
				if(string.Compare((string)builder["MultipleActiveResultSets"], "true", StringComparison.OrdinalIgnoreCase) == 0)
				{
					maxUsersPerConnection = 10;
				}
			}

			// If fileOrServerOrConnectionString != null, that means we just created the connection instance and we have to tell
			// the SqlConnectionManager that it should dispose the connection when the context is disposed. Otherwise the user owns
			// the connection and should dispose of it themselves.
			_conManager = new ConnectionManager(this, con, maxUsersPerConnection, fileOrServerOrConnectionString != null /*disposeConnection*/);
			if(tx != null)
			{
				_conManager.Transaction = tx;
			}

#if DEBUG
			SqlNode.Formatter = new SqlFormatter();
#endif


			Type readerType;
			if(_mode == SqlServerProviderMode.SqlCE)
			{
				readerType = con.GetType().Module.GetType(SqlCeDataReaderTypeName);
			}
			else if(con is SqlConnection)
			{
				readerType = typeof(SqlDataReader);
			}
			else
			{
				readerType = typeof(DbDataReader);
			}
			_readerCompiler = new ObjectReaderCompiler(readerType, _services);
		}
Beispiel #19
0
		// Not implementing finalizer here because there are no unmanaged resources
		// to release. See http://msdnwiki.microsoft.com/en-us/mtpswiki/12afb1ea-3a17-4a3f-a1f0-fcdb853e2359.aspx

		// The bulk of the clean-up code is implemented in Dispose(bool)
		protected virtual void Dispose(bool disposing)
		{
			// Implemented but empty so that derived contexts can implement
			// a finalizer that potentially cleans up unmanaged resources.
			if(disposing)
			{
				_services = null;
				if(_conManager != null)
				{
					_conManager.DisposeConnection();
				}
				_conManager = null;
				_typeProvider = null;
				_sqlFactory = null;
				_translator = null;
				_readerCompiler = null;
				_log = null;
			}
		}
		internal ObjectReaderCompiler(Type dataReaderType, IDataServices services)
		{
			this.dataReaderType = dataReaderType;
			this.services = services;

			this.miDRisDBNull = dataReaderType.GetMethod("IsDBNull", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			this.miBRisDBNull = typeof(DbDataReader).GetMethod("IsDBNull", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

			Type orbType = typeof(ObjectMaterializer<>).MakeGenericType(this.dataReaderType);
			this.ordinalsField = orbType.GetField("Ordinals", BindingFlags.Instance | BindingFlags.Public);
			this.globalsField = orbType.GetField("Globals", BindingFlags.Instance | BindingFlags.Public);
			this.argsField = orbType.GetField("Arguments", BindingFlags.Instance | BindingFlags.Public);
			this.readerField = orbType.GetField("DataReader", BindingFlags.Instance | BindingFlags.Public);
			this.bufferReaderField = orbType.GetField("BufferReader", BindingFlags.Instance | BindingFlags.Public);

			System.Diagnostics.Debug.Assert(
				this.miDRisDBNull != null &&
				this.miBRisDBNull != null &&
				this.readerField != null &&
				this.bufferReaderField != null &&
				this.ordinalsField != null &&
				this.globalsField != null &&
				this.argsField != null
			);
		}
 public ClientController(IDataServices dataService)
 {
     DataService = dataService;
 }
 public ObjectStateManager(DataContext context)
 {
     _context = context;
       _dataServices = CommonDataServicesWrapper.CreateDataServiceServicesWrapper(context);
 }
Beispiel #23
0
 public FlowsController(IDataServices dataServices)
 {
     _dataServices = dataServices;
 }
Beispiel #24
0
 internal Translator(IDataServices services, SqlFactory sqlFactory, TypeSystemProvider typeProvider)
 {
     this.services     = services;
     this.sql          = sqlFactory;
     this.typeProvider = typeProvider;
 }
 /// <summary>
 /// Generate a new navigator. A KarveNavigator is an helper for navigating from a view to another view
 /// allowing the communication with the toolbar. It allows a creation of data.
 /// </summary>
 /// <param name="dataServices">DataService. It has been used in this case for creating a new view with a new item</param>
 /// <param name="regionManager">RegionManager. It has been used in this case for navigating to the tabregion.</param>
 /// <param name="eventManager">EventManager. It has been used for sending messaging to the navigated subsystem with a new item.</param>
 /// <param name="dialogService">DialogService. It has been used for spotting an error.</param>
 /// <returns></returns>
 public static IKarveNavigator GetKarveNavigator(IDataServices dataServices, IRegionManager regionManager, IEventManager eventManager, IDialogService dialogService)
 {
     return(new KarveNavigator(dataServices, regionManager, eventManager, dialogService));
 }
 /// <summary>
 ///  VisitType view model
 /// </summary>
 /// <param name="dataServices">Tipo de visita</param>
 /// <param name="region">Region</param>
 /// <param name="manager">Manager</param>
 public VisitTypeViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService) : base(String.Empty, dataServices, region, manager, dialogService)
 {
     GridIdentifier = KarveCommon.Generic.GridIdentifiers.VisitType;
 }
Beispiel #27
0
 public AirportBusinessService(IDataServices dataServices)
 {
     DataServices = dataServices;
 }
 /// <summary>
 /// CreditCardView Model.
 /// </summary>
 /// <param name="dataServices">DataServices</param>
 /// <param name="region"> RegionManager to support further navigation</param>
 /// <param name="manager">Event Manager for the communiction between view modules.</param>
 public CreditCardViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService) : base(String.Empty, dataServices, region, manager, dialogService)
 {
     GridIdentifier = KarveCommon.Generic.GridIdentifiers.HelperCreditCard;
 }
Beispiel #29
0
 public SupplierCurrencyViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService) : base(string.Empty, dataServices, region, manager, dialogService)
 {
 }
Beispiel #30
0
        void IProvider.Initialize(IDataServices dataServices, object connection)
        {
            DbConnection connection2;
            Type         type;

            if (dataServices == null)
            {
                throw Error.ArgumentNull("dataServices");
            }
            services = dataServices;
            DbTransaction transaction = null;
            string        fileOrServerOrConnectionString = connection as string;

            if (fileOrServerOrConnectionString != null)
            {
                string connectionString = GetConnectionString(fileOrServerOrConnectionString);
                dbName = GetDatabaseName(connectionString);
                if (dbName.EndsWith(".sdf", StringComparison.OrdinalIgnoreCase))
                {
                    Mode = ProviderMode.SqlCE;
                }
                if (Mode == ProviderMode.SqlCE)
                {
                    DbProviderFactory provider = GetProvider("System.Data.SqlServerCe.3.5");
                    if (provider == null)
                    {
                        throw Error.ProviderNotInstalled(dbName, "System.Data.SqlServerCe.3.5");
                    }
                    connection2 = provider.CreateConnection();
                }
                else
                {
                    connection2 = new SqlConnection();
                }
                connection2.ConnectionString = connectionString;
            }
            else
            {
                transaction = connection as SqlTransaction;
                if ((transaction == null) &&
                    (connection.GetType().FullName == "System.Data.SqlServerCe.SqlCeTransaction"))
                {
                    transaction = connection as DbTransaction;
                }
                if (transaction != null)
                {
                    connection = transaction.Connection;
                }
                connection2 = connection as DbConnection;
                if (connection2 == null)
                {
                    throw Error.InvalidConnectionArgument("connection");
                }
                if (connection2.GetType().FullName == "System.Data.SqlServerCe.SqlCeConnection")
                {
                    Mode = ProviderMode.SqlCE;
                }
                dbName = GetDatabaseName(connection2.ConnectionString);
            }
            using (DbCommand command = connection2.CreateCommand())
            {
                CommandTimeout = command.CommandTimeout;
            }
            int maxUsers = 1;

            if (connection2.ConnectionString.Contains("MultipleActiveResultSets"))
            {
                DbConnectionStringBuilder builder = new DbConnectionStringBuilder();
                builder.ConnectionString = connection2.ConnectionString;
                if (
                    string.Compare((string)builder["MultipleActiveResultSets"], "true",
                                   StringComparison.OrdinalIgnoreCase) == 0)
                {
                    maxUsers = 10;
                }
            }
            conManager = new SqlConnectionManager(this, connection2, maxUsers);
            if (transaction != null)
            {
                conManager.Transaction = transaction;
            }
            if (Mode == ProviderMode.SqlCE)
            {
                type = connection2.GetType().Module.GetType("System.Data.SqlServerCe.SqlCeDataReader");
            }
            else if (connection2 is SqlConnection)
            {
                type = typeof(SqlDataReader);
            }
            else
            {
                type = typeof(DbDataReader);
            }
            readerCompiler = new ObjectReaderCompiler(type, services);
            //InvokeIProviderMethod("Initialize", new[] { SourceService(conManager.Connection), connection });
        }
Beispiel #31
0
 public DataBaseObjectDataProvider(IDataServices dataServices)
 {
     _dataServices = dataServices;
 }
Beispiel #32
0
        /// <summary>
        /// InvoiceInfoViewModel.
        /// </summary>
        /// <param name="dataServices">DataServices</param>
        /// <param name="dialogServices"></param>
        /// <param name="manager"></param>
        /// <param name="container"></param>
        /// <param name="regionManager"></param>
        /// <param name="controller"></param>

        public InvoiceInfoViewModel(IDataServices dataServices,
                                    IDialogService dialogServices,
                                    IEventManager manager,
                                    IConfigurationService configurationService,
                                    IRegionManager regionManager,
                                    IInteractionRequestController controller) : base(dataServices,
                                                                                     controller,
                                                                                     dialogServices,
                                                                                     manager, configurationService)
        {
            _dataServices       = dataServices;
            _regionManager      = regionManager;
            _invoiceDataService = _dataServices.GetInvoiceDataServices();
            LineVisible         = true;
            CollectionView      = new ObservableCollection <InvoiceSummaryViewObject>();
            AssistMapper        = _dataServices.GetAssistDataServices().Mapper;
            ItemChangedCommand  = new Prism.Commands.DelegateCommand <IDictionary <string, object> >(OnChangedCommand);
            NavigateCommand     = new DelegateCommand <object>(OnNavigate);
            AssistCommand       = new DelegateCommand <object>(OnAssistCommand);
            AddNewClientCommand = new DelegateCommand <object>(OnAddNewClientCommand);
            OpenContractCommand = new DelegateCommand <object>(OnOpenContract);
            OpenVehiclesCommand = new DelegateCommand <object>(OnOpenVehicles);

            AssistExecuted += OnAssistExecuted;
            CompanyName     = String.Empty;
            AddressName     = String.Empty;
            List <string> colList;
            var           genericInovice = new InvoiceSummaryViewObject();

            colList = genericInovice.GetType().GetProperties().Select(value => value.Name).ToList();

            GridColumns = new List <string>()
            {
                "AgreementCode", "VehicleCode", "Opciones", "Description", "Quantity", "Price", "Discount", "Subtotal",
                "Unity", "Iva"
            };

            /*
             * This is a cell grid presentation item
             */
            var presenter = new ObservableCollection <CellPresenterItem>()
            {
                new NavigationAwareItem()
                {
                    DataTemplateName = "NavigateInvoiceItem", MappingName = "AgreementCode", RegionName = RegionNames.LineRegion
                },
                new NavigationAwareItem()
                {
                    DataTemplateName = "NavigateVehicleItem", MappingName = "VehicleCode", RegionName = RegionNames.LineRegion
                }
            };

            CellGridPresentation = presenter;
            EventManager.RegisterObserverSubsystem(InvoiceModule.InvoiceSubSystem, this);
            var gid = Guid.NewGuid();

            GridIdentifier  = GridIdentifiers.InvoiceLineGrids;
            ViewModelUri    = new Uri("karve://invoice/viewmodel?id=" + gid.ToString());
            MailBoxHandler += IncomingMailBox;
            SubSystem       = DataSubSystem.InvoiceSubsystem;
            RegisterMailBox(ViewModelUri.ToString());
        }
 internal Translator(IDataServices services, SqlFactory sqlFactory, TypeSystemProvider typeProvider) {
     this.services = services;
     this.sql = sqlFactory;
     this.typeProvider = typeProvider;
 }
Beispiel #34
0
 public PgsqlQueryConverter(IDataServices services, ITypeSystemProvider typeProvider, Translator translator, SqlFactory sql)
     : base(services, typeProvider, translator, sql)
 {
 }
 private ConcreteDomainFactory(IDataServices services) : base(services)
 {
     _services = services;
 }
Beispiel #36
0
 /// <summary>
 /// Save a data command for the configuration manager.
 /// </summary>
 /// <param name="dataServices"></param>
 /// <param name="careKeeperService"></param>
 /// <param name="eventManager"></param>
 /// <param name="configurationService"></param>
 public SaveDataCommand(IDataServices dataServices, ICareKeeperService careKeeperService, IEventManager eventManager, IConfigurationService configurationService) :
     this(dataServices, careKeeperService, configurationService)
 {
     _eventManager = eventManager;
     InitHandlers();
 }
 protected override AbstractDomainWrapperFactory CreateAbstractFactory(IDataServices services)
 {
     return(new ConcreteDomainFactory(services));
 }
Beispiel #38
0
 public override void ExecutePayload(IDataServices services, IEventManager manager, ref DataPayLoad payLoad)
 {
     _companyDataServices          = services.GetCompanyDataServices();
     ToolbarInitializationNotifier = NotifyTaskCompletion.Create <DataPayLoad>(HandleSaveOrUpdate(payLoad), ExecutedPayloadHandler);
 }
        /// <summary>
        /// KarveToolBarViewModel is a view model to modle the toolbar behaviour.
        /// </summary>
        /// <param name="dataServices">Service for fetching datas</param>
        /// <param name="eventManager">Service for communicate with other view models</param>
        /// <param name="careKeeper">Service for caring command and storing/undoing command</param>
        /// <param name="regionManager">Service for region handling</param>
        /// <param name="dialogService">Service for spotting the dialog</param>
        /// <param name="configurationService">Service for the configuraration parameters</param>
        public KarveToolBarViewModel(IDataServices dataServices,
                                     IEventManager eventManager,
                                     ICareKeeperService careKeeper,
                                     IRegionManager regionManager,
                                     IDialogService dialogService,
                                     IConfigurationService configurationService) : base(dataServices, null, dialogService, configurationService)
        {
            this._dictionary           = SubsystemFactory.GetSubsytem();
            this._dataServices         = dataServices;
            this._dialogService        = dialogService;
            this._configurationService = configurationService;
            this._eventManager         = eventManager;
            this._eventManager.RegisterObserverToolBar(this);
            this._careKeeper           = careKeeper;
            this.SaveCommand           = new DelegateCommand(DoSaveCommand);
            this.NewCommand            = new DelegateCommand(DoNewCommand);
            this.DeleteCommand         = new DelegateCommand <object>(DoDeleteCommand);
            this._dataServices         = dataServices;
            this._configurationService = configurationService;
            this._eventManager         = eventManager;
            this._eventManager.RegisterObserverToolBar(this);
            this.CurrentSaveImagePath = currentSaveImage;
            _regionManager            = regionManager;
            _states              = ToolbarStates.None;
            _noActiveValue       = string.Empty;
            this.IsSaveEnabled   = false;
            this.IsDeleteEnabled = false;
            this.IsNewEnabled    = false;
            ConfirmationRequest  = new InteractionRequest <IConfirmation>();
            Confirmation request = new Confirmation
            {
                Title   = "Confirmacion",
                Content = confirmDelete
            };

            ViewModelUri        = new Uri("karve://toolbar/viewmodel?id=" + UniqueId);
            ConfirmationCommand = new DelegateCommand(() =>
            {
                // string noActiveValue = configurationService.GetPrimaryKeyValue();
                request.Content = confirmDelete;
                ConfirmationRequest.Raise(request);
                if (request.Confirmed)
                {
                    string value   = string.Empty;
                    var singleView = _regionManager.Regions[RegionNames.TabRegion].ActiveViews.FirstOrDefault();
                    if (singleView != null)
                    {
                        var headerProp = singleView.GetType().GetProperty("Header");
                        if (headerProp != null)
                        {
                            if (headerProp.GetValue(singleView) is string header)
                            {
                                value = header.Split('.')[0];
                            }
                        }
                    }

                    DeleteCommand.Execute(value);
                }
            });
            SaveValueCommand = new DelegateCommand(() =>
            {
                request.Content = confirmSave;

                ConfirmationRequest.Raise(request);
                if (request.Confirmed)
                {
                    SaveCommand.Execute();
                }
                else
                {
                    this.CurrentSaveImagePath = KarveToolBarViewModel.currentSaveImage;
                }
            });

            AddValidationChain();
            _uniqueId = ObserverName + Guid.NewGuid();
        }
Beispiel #40
0
 public TestController(IDataServices dataServices)
 {
     _dataServices = dataServices;
 }
 public PaymentFormViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService) : base(string.Empty, dataServices, region, manager, dialogService)
 {
     GridIdentifier = KarveCommon.Generic.GridIdentifiers.PaymentFormGrid;
 }