コード例 #1
0
        public void MoveAxis(TelescopeAxes telescopeAxis, double rate)
        {
            traceLogger.LogMessage("MoveAxis", "TelescopeAxis - " + telescopeAxis.ToString() + "Rate - " + rate.ToString());
            //Some checks on given values for API conformity
            if (telescopeAxis == TelescopeAxes.axisTertiary)
            {
                throw new ASCOM.InvalidValueException("TelescopeAxes", telescopeAxis.ToString(), "No ternary axis on ST-4");
            }
            IRate axisRate = this.AxisRates(telescopeAxis)[1];

            if (Math.Abs(rate) > axisRate.Maximum || Math.Abs(rate) < axisRate.Minimum)
            {
                throw new ASCOM.InvalidValueException("AxisRate", rate.ToString(), axisRate.Minimum + ".." + axisRate.Maximum);
            }

            Orientation    orientation            = rate > 0 ? Orientation.PLUS : Orientation.MINUS;
            Axis           axis                   = telescopeAxis == TelescopeAxes.axisPrimary ? Axis.RA : Axis.DEC;
            AxisController axisPositionController = axisControllers[(int)axis];

            if (rate == 0)
            {
                axisPositionController.Stop();
            }
            else
            {
                axisPositionController.Move(orientation);
            }
        }
コード例 #2
0
        public UserAccount CreateUserAccount(string name, IRate rate, PayServiceManager serviceManager)
        {
            var user = new UserAccount(name, rate, this, serviceManager);

            UsersAccounts.Add(user);
            return(user);
        }
コード例 #3
0
 // local helper method for getting rate order
 static IEnumerable <IRate> GetRateOrder(IRate rate)
 {
     if (rate.OrderAfterRate is not null)
     {
         yield return(rate.OrderAfterRate);
     }
 }
コード例 #4
0
        private IRate[] GetAxisRateArrayFromService(TelescopeAxes axis)
        {
            AxisRates rates;

            if (axis == TelescopeAxes.axisPrimary)
            {
                rates = (AxisRates)_svc.MockPrimaryAxisRates;
            }
            else if (axis == TelescopeAxes.axisSecondary)
            {
                rates = (AxisRates)_svc.MockSecondaryAxisRates;
            }
            else
            {
                rates = (AxisRates)_svc.MockTertiaryAxisRates;
            }

            IRate[] rateArr = new IRate[rates.Count];
            int     i       = 0;

            foreach (IRate rate in rates)
            {
                rateArr[i++] = rate;
            }

            return(rateArr);
        }
コード例 #5
0
        //TODO: Update this to error when at park
        /// <summary>
        /// Move the telescope in one axis at the given rate.
        /// </summary>
        /// <param name="axis">The physical axis about which movement is desired</param>
        /// <param name="rate">The rate of motion (deg/sec) about the specified axis</param>
        public void MoveAxis(TelescopeAxes axis, double rate)
        {
            tl.LogMessage("MoveAxis", "TelescopeAxis - " + axis.ToString() + "Rate - " + rate.ToString());
            //Some checks on given values for API conformity
            if (axis == TelescopeAxes.axisTertiary)
            {
                throw new ASCOM.InvalidValueException("TelescopeAxes", axis.ToString(), "No ternary axis on ST-4");
            }
            IRate axisRate = this.AxisRates(axis)[1];

            if (Math.Abs(rate) > axisRate.Maximum || Math.Abs(rate) < axisRate.Minimum)
            {
                throw new ASCOM.InvalidValueException("AxisRate", rate.ToString(), axisRate.Minimum + ".." + axisRate.Maximum);
            }

            var orientation    = rate < 0 ? Orientation.Minus : Orientation.Plus;
            var axisController = axis == TelescopeAxes.axisPrimary ? raAxisController : decAxisController;

            if (rate == 0)
            {
                axisController.StopSlew();
            }
            else
            {
                axisController.StartSlew(orientation);
            }
        }
コード例 #6
0
 public ClientContract(string clientName, TelephoneNumber number, IClientTerminal terminal, IRate rate)
 {
     ClientName = clientName;
     TelephoneNumber = number;
     Terminal = terminal;
     Rate = rate;
 }
コード例 #7
0
ファイル: GradientHandler.cs プロジェクト: Prodject/Gamesense
 public GradientHandler(string deviceType, List <int> customZoneKeys, string mode, Gradient gradient, IRate rate = null)
 {
     DeviceType     = deviceType;
     CustomZoneKeys = customZoneKeys;
     Mode           = mode;
     Color          = new GradientWrapper(gradient);
     Rate           = rate;
 }
コード例 #8
0
 public StaticColorHandler(string deviceType, string zone, string mode, RGB color, IRate rate = null)
 {
     DeviceType = deviceType;
     Zone       = zone;
     Mode       = mode;
     Color      = color;
     Rate       = rate;
 }
コード例 #9
0
ファイル: GradientHandler.cs プロジェクト: Prodject/Gamesense
 public GradientHandler(string deviceType, string zone, string mode, Gradient gradient, IRate rate = null)
 {
     DeviceType = deviceType;
     Zone       = zone;
     Mode       = mode;
     Color      = new GradientWrapper(gradient);
     Rate       = rate;
 }
コード例 #10
0
 public RangeColorHandler(string deviceType, List <int> customZoneKeys, string mode, ColorRange crange, IRate rate = null)
 {
     DeviceType     = deviceType;
     CustomZoneKeys = customZoneKeys;
     Mode           = mode;
     Color          = crange;
     Rate           = rate;
 }
コード例 #11
0
 public RangeColorHandler(string deviceType, string zone, string mode, ColorRange crange, IRate rate = null)
 {
     DeviceType = deviceType;
     Zone       = zone;
     Mode       = mode;
     Color      = crange;
     Rate       = rate;
 }
コード例 #12
0
ファイル: Session.cs プロジェクト: GeorgeManiya/EpamTraining
        public Session(ClientContract source, ClientContract target, IRate rate)
        {
            Events = new List<ConnectionEvent>();

            Source = source;
            Target = target;
            Rate = rate;
        }
コード例 #13
0
ファイル: BankModel.cs プロジェクト: semacool/BankSystem
        public void AddAccount(uint IdClient, IRate Rate, DateTime DateEnd, double Money)
        {
            CheckClient(Rate.TypeClient, IdClient);
            Account account = Factory.newAccount(AccountId++, IdClient, Rate, DateEnd, Money);

            account.ChangeMoney += NoteTrasfer;
            DataBase.Accounts.Add(account);
        }
コード例 #14
0
 public StaticColorHandler(string deviceType, List <int> customZoneKeys, string mode, RGB color, IRate rate = null)
 {
     DeviceType     = deviceType;
     CustomZoneKeys = customZoneKeys;
     Mode           = mode;
     Color          = color;
     Rate           = rate;
 }
コード例 #15
0
 public CallInfo(Call call, IRate rate, bool isOutComingCall)
 {
     IsOutComingCall = isOutComingCall;
     StartTime       = call.StartTime;
     EndTime         = call.EndTime;
     Duration        = call.Duration;
     SenderNumber    = call.SenderNumber;
     RecieverNumber  = call.RecieverNumber;
     Rate            = rate;
     Price           = 0;
 }
コード例 #16
0
 public UserAccount(string name, IRate currentRate, AtsManager manager, PayServiceManager serviceManager)
 {
     Name             = name;
     CurrentRate      = currentRate;
     Terminals        = new List <Terminal>();
     RegistrationTime = DateTime.Now;
     ChangeRateTime   = RegistrationTime;
     FreeMinutes      = currentRate.FreeMinutes;
     ServiceManager   = serviceManager;
     Manager          = manager;
     Balance          = 1;
 }
コード例 #17
0
 public void ChangeRate(IRate rate)
 {
     if (IsOneMonthExpired())
     {
         CurrentRate    = rate;
         ChangeRateTime = DateTime.Now;
         Console.WriteLine("Rate has been changed succesfully");
     }
     else
     {
         Console.WriteLine("You can change rate only 1 time in month");
     }
 }
コード例 #18
0
ファイル: User.cs プロジェクト: AleksandarPaunov/ForumDomain
        public void RateTheme(ITheme them, byte score)
        {
            IRate rate = Factory.CreateRating(them, this, score);

            if (RatingsForThemes.TryAdd(them, rate))
            {
                Console.WriteLine($"Your rating {score} for {them.Name} is succesfully added");
                them.UserRatings.Add(this, rate);
            }
            else
            {
                Console.WriteLine($"You have already rated this theme- {them.Name}");
            }
        }
コード例 #19
0
        public IAxisRates AxisRates(TelescopeAxes axis)
        {
            IAxisRates retval;

            Exception            xcp         = null;
            ActivityMessageTypes messageType = ActivityMessageTypes.Capabilities;

            string axisName = GetNameFromAxis(axis);
            string msg      = String.Format("Calling AxisRates( {0} )", axisName);

            try
            {
                CheckDevice();

                if (Service.CanMoveAxis(axis))
                {
                    retval = Service.AxisRates(axis);
                }
                else
                {
                    IRate[] rateArr = new IRate[0];
                    retval = new ScopeAxisRates(rateArr);
                }

                msg += Done;
            }
            catch (Exception ex)
            {
                xcp  = ex;
                msg += Failed;

                // Return an empty IAxisRates collection

                IRate[] rateArr = new IRate[0];
                retval = new ScopeAxisRates(rateArr);
            }
            finally
            {
                LogActivityLine(messageType, msg);

                if (xcp != null)
                {
                    LogActivityLine(messageType, "AxisRates( {0} ) Exception: {1}", axisName, xcp.Message);
                }
            }

            return(retval);
        }
コード例 #20
0
ファイル: Rates.cs プロジェクト: int77/AAAOV_ASCOMDeviceHub
        // Constructor - Internal prevents public creation
        // of instances. Returned by Telescope.AxisRates.

        internal AxisRates(TelescopeAxes axis)
        {
            IRate[] iRates = new IRate[0];

            this._axis = axis;

            // This collection must hold zero or more Rate objects describing the
            // rates of motion ranges for the Telescope.MoveAxis() method
            // that are supported by your driver. It is OK to leave this
            // array empty, indicating that MoveAxis() is not supported.
            //
            // Note that we are constructing a rate array for the axis passed
            // to the constructor. Thus we switch() below, and each case should
            // initialize the array for the rate for the selected axis.

            switch (axis)
            {
            case TelescopeAxes.axisPrimary:
                iRates = TelescopeManager.Instance.Capabilities.PrimaryAxisRates;

                break;

            case TelescopeAxes.axisSecondary:
                iRates = TelescopeManager.Instance.Capabilities.SecondaryAxisRates;

                break;

            case TelescopeAxes.axisTertiary:
                iRates = TelescopeManager.Instance.Capabilities.TertiaryAxisRates;

                break;
            }

            _rates = new Rate[iRates.Length];
            int ndx = 0;

            foreach (IRate iRate in iRates)
            {
                _rates[ndx++] = new Rate(iRate.Minimum, iRate.Maximum);
            }
        }
コード例 #21
0
        public Rate GetById(object id)
        {
            IRate rateToReturn = null;

            try
            {
                foreach (var rate in _fakeRates)
                {
                    if (rate.Id == (int)id)
                    {
                        rateToReturn = rate;
                    }
                }

                return((Rate)rateToReturn);
            }
            catch (Exception ex)
            {
                throw new RateInFakeRepositoryNotExistException(ex.Message);
            }
        }
コード例 #22
0
        public ClientContract AddClient(string name, ushort code, IRate rate)
        {
            // get free telephone number
            var freeNumber = GetFreeTelephoneNumber(code);
            if (!freeNumber.HasValue)
                throw new ArgumentException("There is no free telephone number in this code");

            // get free terminal
            var freeTerminal = Terminals.FirstOrDefault(t => BillingSystem.Contracts.All(c => c.Terminal != t));
            if (freeTerminal == null)
                freeTerminal = AddNewTerminal();

            // connect terminal with first free port
            ConnectTerminalToFreePort(freeTerminal);

            var newClientContract = new ClientContract(name, freeNumber.Value, freeTerminal, rate);
            BillingSystem.Contracts.Add(newClientContract);

            BillingSystem.RateHistory.Add(new ClientRateHistory(newClientContract, BillingSystem.CurrentTime, rate));

            return newClientContract;
        }
コード例 #23
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            RateViewHolder viewHolder = holder as RateViewHolder;
            IRate          rate       = this._allRates != null ? this._allRates[position] : null;

            if (rate != null && viewHolder != null)
            {
                int flagID = this._activity.Resources.GetIdentifier("flag_" + rate.CurrencyCode.ToLower(), "drawable", this._activity.PackageName);

                if (flagID == 0)
                {
                    viewHolder.ForexFlagImageView.Visibility = ViewStates.Gone;
                }
                else
                {
                    viewHolder.ForexFlagImageView.Visibility = ViewStates.Visible;
                    viewHolder.ForexFlagImageView.SetImageDrawable(this._activity.Resources.GetDrawable(flagID));
                }

                viewHolder.ForexCodeTextView.Text = rate.CurrencyCode;
                viewHolder.BuyRateTextView.Text   = rate.BuysNotes.ToString("C");
                viewHolder.SellRateTextView.Text  = rate.SellsNotes.ToString("C");
            }
        }
コード例 #24
0
ファイル: LoanController.cs プロジェクト: Falki94/Banqsoft
 public LoanController(ICalculation calculation, IRate rate)
 {
     _calculation = calculation;
     _rate        = rate;
 }
コード例 #25
0
 public RateController(IRate iRate)
 {
     Rate = iRate;
 }
コード例 #26
0
 public RateController(IRate tmpRater)
 {
     Rater = tmpRater;
 }
コード例 #27
0
        public void CanJogScope()
        {
            TelescopeParameters parms = new TelescopeParameters
            {
                AlignmentMode = AlignmentModes.algGermanPolar
            };
            DevHubTelescopeStatus status = DevHubTelescopeStatus.GetEmptyStatus();
            TelescopeCapabilities caps   = TelescopeCapabilities.GetFullCapabilities();

            _vm.Status       = null;
            _vm.Parameters   = parms;
            _vm.Capabilities = caps;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No device status

            _vm.Status     = status;
            _vm.Parameters = null;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No device parameters

            _vm.Parameters   = parms;
            _vm.Capabilities = null;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No capabilities

            _vm.Capabilities = caps;

            // Test variable jogs with MoveAxis and PulseGuide

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // Not connected

            _vm.Status.Connected = true;

            // Test variable jogs with MoveAxis and PulseGuide

            _vm.IsVariableJog = true;
            _vm.Capabilities.CanMovePrimaryAxis = false;
            _vm.Capabilities.CanPulseGuide      = false;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // Can't MoveAxis or PulseGuide

            _vm.Capabilities.CanMovePrimaryAxis   = true;
            _vm.Capabilities.CanMoveSecondaryAxis = false;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // Can't MoveAxis or PulseGuide

            _vm.Capabilities.CanMoveSecondaryAxis = true;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No Axis Rates Defined

            object[] rates = new IRate[] { new AxisRate(0.0, 5.0) };
            _vm.Capabilities.PrimaryAxisRates = (IRate[])rates;
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No Secondary axis rates defined

            _vm.Capabilities.SecondaryAxisRates = (IRate[])rates;
            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Not Tracking, but MoveAxis is OK ???

            _vm.Status.Tracking = true;

            _prVm.Invoke("UpdateCanStartMove");               // Ready to do variable slews (Move Axis or PulseGuide)
            Assert.IsTrue(_vm.CanStartMoveTelescope);

            // Now test fixed RA/Dec jogs

            _vm.IsVariableJog = false;

            _vm.Capabilities = TelescopeCapabilities.GetFullCapabilities();

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Ready to do fixed RA/Dec slews (sync or async)

            _vm.Capabilities.CanSlewAsync = false;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Ready to do fixed sync RA/Dec slews

            _vm.Capabilities.CanSlew      = false;
            _vm.Capabilities.CanSlewAltAz = false;
            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);                // Can't do fixed sync or async RA/Dec or Alt/Az slews

            // Finally test jogging via alt-az slews.

            _vm.Parameters.EquatorialSystem = EquatorialCoordinateType.equTopocentric;
            _vm.Status.Tracking             = false;

            _vm.Capabilities.CanSlewAltAz = true;
            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Can slew either sync or async Alt-Az.

            _vm.Capabilities.CanSlewAltAzAsync = false;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Can slew sync Alt-Az.

            _vm.Capabilities.CanSlewAltAz = false;
            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // Can't slew either sync or async Alt-Az.
        }
コード例 #28
0
 protected BaseViewModelRate(IRate <TValue> rate)
 {
     this.rate  = rate;
     this.value = this.rate.ValueDefault;
 }
コード例 #29
0
 public SubscriberNumber(IRate rate, int numbers)
 {
     Rate    = rate;
     Number  = numbers;
     CallLog = new List <ICallLog>();
 }
コード例 #30
0
        public void Test_RatesAndMoveAxis()
        {
            // Unsimulated movement causing no M commands, but testing IRates
            device.Connected = true;
            Assert.IsTrue(device.Connected);

            IAxisRates ra_rates  = device.AxisRates(TelescopeAxes.axisPrimary);
            IAxisRates dec_rates = device.AxisRates(TelescopeAxes.axisSecondary);

            Assert.AreEqual(4, ra_rates.Count);
            Assert.AreEqual(5.0 / 3600.0, ra_rates[1].Minimum); // 1-based
            Assert.AreEqual(5.0 / 60.0, ra_rates[2].Minimum);
            Assert.AreEqual(20.0 / 60.0, ra_rates[3].Minimum);
            Assert.AreEqual(5.0, ra_rates[4].Minimum);

            Assert.AreEqual(4, dec_rates.Count);
            Assert.AreEqual(5.0 / 3600.0, dec_rates[1].Minimum);
            Assert.AreEqual(5.0 / 60.0, dec_rates[2].Minimum);
            Assert.AreEqual(20.0 / 60.0, dec_rates[3].Minimum);
            Assert.AreEqual(5.0, dec_rates[4].Minimum);

            device.MoveAxis(TelescopeAxes.axisPrimary, 0.0);
            device.MoveAxis(TelescopeAxes.axisSecondary, 0.0);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.MoveAxis(TelescopeAxes.axisTertiary, 0.0));
            Assert.IsTrue(device.Tracking);

            Assert.IsTrue(ra_rates.Count == dec_rates.Count);
            string[] rates = new string[] { "SLEW_GUIDE", "SLEW_CENTER", "SLEW_FIND", "SLEW_MAX" };

            for (int i = 1; i < ra_rates.Count + 1; i++)
            {
                IRate ra_rate = ra_rates[i];
                Assert.IsTrue(ra_rate.Minimum == ra_rate.Maximum);
                Assert.IsTrue(0 < ra_rate.Minimum);

                IRate dec_rate = dec_rates[i];
                Assert.IsTrue(dec_rate.Minimum == dec_rate.Maximum);
                Assert.IsTrue(0 < dec_rate.Minimum);

                Assert.IsTrue(device.Tracking);
                Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true));
                Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, ra_rate.Minimum + 1 / 3600.0));
                Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, dec_rate.Minimum + 1 / 3600.0));

                device.MoveAxis(TelescopeAxes.axisPrimary, ra_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                for (int j = 1; j < ra_rates.Count + 1; j++)
                {
                    if (i != j)
                    {
                        Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, ra_rates[((i - 1 + 1) % ra_rates.Count) + 1].Minimum));
                        Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, ra_rates[((i - 1 + 1) % ra_rates.Count) + 1].Minimum));
                    }
                }
                device.MoveAxis(TelescopeAxes.axisSecondary, dec_rate.Minimum);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                for (int j = 1; j < ra_rates.Count + 1; j++)
                {
                    if (i != j)
                    {
                        Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, ra_rates[((i - 1 + 1) % ra_rates.Count) + 1].Minimum));
                        Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, ra_rates[((i - 1 + 1) % ra_rates.Count) + 1].Minimum));
                    }
                }
                Assert.IsTrue(device.Slewing);
                Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true));

                device.AbortSlew();
                Assert.IsTrue(device.Tracking);

                device.MoveAxis(TelescopeAxes.axisPrimary, -ra_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                device.MoveAxis(TelescopeAxes.axisSecondary, -dec_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true));

                device.AbortSlew();
                Assert.IsTrue(device.Tracking);
                Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true));

                device.MoveAxis(TelescopeAxes.axisPrimary, +ra_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                device.MoveAxis(TelescopeAxes.axisSecondary, -dec_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true));

                device.AbortSlew();
                Assert.IsTrue(device.Tracking);
                Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true));

                device.MoveAxis(TelescopeAxes.axisPrimary, -ra_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                device.MoveAxis(TelescopeAxes.axisSecondary, +dec_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true));

                device.AbortSlew();
                Assert.IsTrue(device.Tracking);
                Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true));

                device.MoveAxis(TelescopeAxes.axisPrimary, +ra_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                device.MoveAxis(TelescopeAxes.axisSecondary, +dec_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true));

                device.MoveAxis(TelescopeAxes.axisPrimary, 0);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                device.MoveAxis(TelescopeAxes.axisSecondary, 0);

                Assert.IsTrue(device.Tracking);
                Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true));

                device.MoveAxis(TelescopeAxes.axisPrimary, +ra_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                device.MoveAxis(TelescopeAxes.axisSecondary, +dec_rate.Minimum);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true));

                device.MoveAxis(TelescopeAxes.axisSecondary, 0);
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
                device.MoveAxis(TelescopeAxes.axisPrimary, 0);

                Assert.IsTrue(device.Tracking);
                Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true));
            }

            // One single rate for both axes
            device.MoveAxis(TelescopeAxes.axisPrimary, ra_rates[1].Minimum);
            Assert.IsTrue(device.Slewing);
            Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, dec_rates[2].Minimum));
            Assert.IsTrue(device.Slewing);
            device.AbortSlew();
            Assert.IsTrue(device.Tracking);
        }
コード例 #31
0
 public ValueCalculator(IRate rate, IDiscount discount)
 {
     this.rate     = rate;
     this.discount = discount;
 }
コード例 #32
0
        public void ChangeClientRate(ClientContract client, IRate newRate)
        {
            var currentDate = BillingSystem.CurrentTime;
            var lastHistoryDate = BillingSystem.RateHistory.LastOrDefault(h => h.Client == client).Date;
            if (new DateTime(lastHistoryDate.Year, lastHistoryDate.Month + 1, lastHistoryDate.Day) > currentDate)
                throw new ArgumentException("You cannot change rate before on month has gone");

            client.Rate = newRate;
            BillingSystem.CalculateClientMonthlyTax(client);
            var rateHistory = new ClientRateHistory(client, currentDate, newRate);
            BillingSystem.RateHistory.Add(rateHistory);
        }
コード例 #33
0
 public async Task InsertRateAsync(IRate newRate)
 {
     await this._databaseConnection.UpdateAsync(newRate);
 }
コード例 #34
0
ファイル: Rate.cs プロジェクト: barkerest/atera_api_v3
 private bool Equals(IRate other)
 {
     return(RateID == other.RateID && Amount.Equals(other.Amount) && Description == other.Description && SKU == other.SKU && Category == other.Category && Archived == other.Archived);
 }
コード例 #35
0
        static void Main(string[] args)
        {
            try
            {
                var fileLog = ConfigurationManager.AppSettings["FileLog"];
                var log     = new ProgramLog(fileLog);
            }
            catch (DirectoryNotFoundException)
            {
                var exception =
                    new ConfigurationDirectoryNotFoundException(ConfigurationManager.AppSettings["FileLog"]);
                Console.WriteLine(exception.Message);
                throw exception;
            }

            IAdress vasinAdress = ContactAddressInformation.CreateNewAdress("Belarus", "Grodno", "Kleckova",
                                                                            new Tuple <int, char, char>(12, '/', 'A'), 3);

            IList <int> vasinListNumbers = new List <int>();

            vasinListNumbers.Add(654321);
            vasinListNumbers.Add(543210);

            IList <string> vasinListEmails = new List <string>();

            vasinListEmails.Add("*****@*****.**");
            vasinListEmails.Add("*****@*****.**");

            IContactInforamtion vasinaContactInforamtion =
                ContactAddressInformation.CreateNewContacts(vasinListNumbers, vasinListEmails);

            IFullName vasyasFullName = PersonalIdentification.CreateNewFullName("Vasya", "Pupkin", "Ivanavich");

            IPassportIdentification passportIdentification = PersonalIdentification.CreateNewPassportIdentification(
                vasyasFullName,
                "REPUBLIC OF BELARUS", new DateTime(1997, 10, 28), true, "3456797K000PB9", "REPUBLIC OF BELARUS");
            IPassportData passportData = PersonalIdentification.CreateNewPassportData(passportIdentification,
                                                                                      "KH248248",
                                                                                      "MINISTRY OF INTERNAL AFFAIRS", new DateTime(2015, 10, 28), new DateTime(2025, 10, 28));

            IInformationOfAnIndividual informationOfVasya =
                InformationProvided.CreateNewInformationOfAnIndividual(vasinAdress, vasinaContactInforamtion,
                                                                       passportData);

            Console.WriteLine(informationOfVasya.ToString());

            //
            IBillingCompany billingCompany       = CompanyManagement.CreateNewCompany("Company");
            IAdress         billingCompanyAdress = ContactAddressInformation.CreateNewAdress("Belarus", "Grodno", "Kleckova",
                                                                                             new Tuple <int, char, char>(10, '/', '2'), 3);

            CompanyManagement.ChangeAdress(billingCompany, billingCompanyAdress);

            IList <int> companyListNumbers = new List <int>();

            vasinListNumbers.Add(123456);
            vasinListNumbers.Add(234567);

            IList <string> companyListEmails = new List <string>();

            vasinListEmails.Add("*****@*****.**");
            vasinListEmails.Add("*****@*****.**");

            IContactInforamtion companyContactInforamtion =
                ContactAddressInformation.CreateNewContacts(companyListNumbers, companyListEmails);

            CompanyManagement.ChangeContactInforamtion(billingCompany, companyContactInforamtion);
            CompanyManagement.ChangeAboutLegalEntity(billingCompany, "Some company");
            StationManagment.CreateNewStation(billingCompany, CodecType.G711);

            try
            {
                StationManagment.AddPortRange(billingCompany.Stations[0], 2030, 2110);
            }
            catch (PortArgumentOutOfRangeException e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine(StationManagment.OutputAllPorts(billingCompany.Stations[0]));


            IClient client = ContractManagement.CreateNewClient(informationOfVasya);

            IRate rate = ContractManagement.CreateNewRate("Tarif", 0.5);

            ISubscriberNumber subscriberNumber1 = ContractManagement.CreateNewSubscriberNumber(rate, 505050);
            ISubscriberNumber subscriberNumber2 = ContractManagement.CreateNewSubscriberNumber(rate, 525252);

            ContractManagement.MakeNewTerminalContract(billingCompany, client, subscriberNumber1);
            ContractManagement.MakeNewTerminalContract(billingCompany, client, subscriberNumber2);

            TerminalManagement.ConnectTerminal(billingCompany.Stations[0], client.Contracts[0].Terminal, 2030);
            Thread.Sleep(200);
            TerminalManagement.ConnectTerminal(billingCompany.Stations[0], client.Contracts[1].Terminal, 2100);
            Thread.Sleep(200);

            TerminalManagement.CallToSubscriber(billingCompany.Stations[0], client.Contracts[0].Terminal,
                                                client.Contracts[1].Terminal);
            Thread.Sleep(200);
            TerminalManagement.AnswerTheCall(billingCompany.Stations[0], client.Contracts[0].Terminal,
                                             client.Contracts[1].Terminal);
            Thread.Sleep(1200);
            TerminalManagement.CompleteCall(billingCompany.Stations[0], client.Contracts[0].Terminal,
                                            client.Contracts[1].Terminal);
            Thread.Sleep(200);

            TerminalManagement.DisconnectTerminal(billingCompany.Stations[0], client.Contracts[0].Terminal);
            Thread.Sleep(200);
            TerminalManagement.DisconnectTerminal(billingCompany.Stations[0], client.Contracts[1].Terminal);


            try
            {
                Console.WriteLine(CallManagement.ViewCallLog(client.Contracts[0].Terminal.SubscriberNumber, 30));
            }
            catch (CallLogArgumentException e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #36
0
 public ClientRateHistory(ClientContract client, DateTime date, IRate rate)
 {
     Client = client;
     Date = date;
     Rate = rate;
 }
コード例 #37
0
 public RateCommand(IRate defaultRate)
     : base("/rate")
 {
     this.defaultRate = defaultRate;
 }