Beispiel #1
0
        /// <summary>
        /// Loads the by customer and order group id.
        /// </summary>
        /// <param name="CustomerId">The customer id.</param>
        /// <param name="OrderGroupId">The order group id.</param>
        /// <returns></returns>
        public static PurchaseOrder LoadByCustomerAndOrderGroupId(Guid CustomerId, int OrderGroupId)
        {
            Guid        searchGuid = Guid.NewGuid();
            DataCommand cmd        = OrderDataHelper.CreateTranDataCommand();

            cmd.CommandText = String.Format("ecf_Search_{0}_CustomerAndOrderGroupId", OrderContext.Current.PurchaseOrderMetaClass.Name);
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", OrderConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("SearchSetId", searchGuid, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("CustomerId", CustomerId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("OrderGroupId", OrderGroupId, DataParameterType.Int));

            // Might be good idea to signal if there are results at all
            DataService.Run(cmd);

            // Load results and return them back
            MetaStorageCollectionBase <PurchaseOrder> orders = LoadSearchResults(searchGuid);

            if (orders.Count > 0)
            {
                return(orders[0]);
            }

            return(null);
        }
Beispiel #2
0
        /// <summary>
        /// Returns 0 if no patches were installed.
        /// </summary>
        /// <param name="major"></param>
        /// <param name="minor"></param>
        /// <param name="patch"></param>
        /// <param name="installDate"></param>
        /// <returns></returns>
        public static int GetOrderSystemVersion(out int major, out int minor, out int patch, out DateTime installDate)
        {
            int retval = 0;

            major       = 0;
            minor       = 0;
            patch       = 0;
            installDate = DateTime.MinValue;

            DataCommand command = OrderDataHelper.CreateConfigDataCommand();

            command.CommandText = "GetOrderSchemaVersionNumber";
            DataResult result = DataService.LoadDataSet(command);

            if (result.DataSet != null)
            {
                if (result.DataSet.Tables.Count > 0 && result.DataSet.Tables[0].Rows.Count > 0)
                {
                    DataRow row = result.DataSet.Tables[0].Rows[0];
                    major       = (int)row["Major"];
                    minor       = (int)row["Minor"];
                    patch       = (int)row["Patch"];
                    installDate = (DateTime)row["InstallDate"];
                }
            }

            return(retval);
        }
Beispiel #3
0
        /// <summary>
        /// Loads cat by name and customer id.
        /// </summary>
        /// <param name="CustomerId">The customer id.</param>
        /// <param name="Name">The name.</param>
        /// <returns></returns>
        public static Cart LoadByCustomerAndName(Guid CustomerId, string Name)
        {
            Guid        searchGuid = Guid.NewGuid();
            DataCommand cmd        = OrderDataHelper.CreateTranDataCommand();

            cmd.CommandText = String.Format("ecf_Search_{0}_CustomerAndName", OrderContext.Current.ShoppingCartMetaClass.Name);
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", OrderConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("SearchSetId", searchGuid, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("CustomerId", CustomerId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("Name", Name, DataParameterType.NVarChar));
            cmd.Parameters[2].Size = 64;

            // Might be good idea to signal if there are results at all
            DataService.Run(cmd);

            // Load results and return them back
            MetaStorageCollectionBase <Cart> carts = LoadSearchResults(searchGuid);

            if (carts.Count > 0)
            {
                return(carts[0]);
            }

            return(null);
        }
Beispiel #4
0
        /// <summary>
        /// Loads the search results.
        /// </summary>
        /// <param name="SearchGuid">The search GUID.</param>
        /// <returns></returns>
        private static MetaStorageCollectionBase <PurchaseOrder> LoadSearchResults(Guid SearchGuid)
        {
            DataCommand cmd = OrderDataHelper.CreateTranDataCommand();

            cmd.CommandText = String.Format("ecf_Search_{0}", OrderContext.Current.PurchaseOrderMetaClass.Name);
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("SearchSetId", SearchGuid, DataParameterType.UniqueIdentifier));

            // Might be good idea to signal if there are results at all
            DataResult result = DataService.LoadDataSet(cmd);

            MetaStorageCollectionBase <PurchaseOrder> orders = new MetaStorageCollectionBase <PurchaseOrder>();

            PopulateCollection <PurchaseOrder>(OrderContext.Current.PurchaseOrderClassInfo, orders, result.DataSet);
            return(orders);
        }
Beispiel #5
0
        /// <summary>
        /// Loads the Payment Plan by customer.
        /// </summary>
        /// <param name="CustomerId">The customer id.</param>
        /// <returns></returns>
        public static MetaStorageCollectionBase <PaymentPlan> LoadByCustomer(Guid CustomerId)
        {
            Guid        searchGuid = Guid.NewGuid();
            DataCommand cmd        = OrderDataHelper.CreateTranDataCommand();

            cmd.CommandText = String.Format("ecf_Search_{0}_Customer", OrderContext.Current.PaymentPlanMetaClass.Name);
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", OrderConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("SearchSetId", searchGuid, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("CustomerId", CustomerId, DataParameterType.UniqueIdentifier));

            // Might be good idea to signal if there are results at all
            DataService.Run(cmd);

            // Load results and return them back
            return(LoadSearchResults(searchGuid));
        }