internal string GetString(MeasureType type) { switch (type) { case MeasureType.SongName: return(this.HistoryJson[0]["track"]["name"].ToString()); case MeasureType.Artists: return(this.HistoryJson[0]["track"]["artists"][0]["name"].ToString()); case MeasureType.Album: return(this.HistoryJson[0]["track"]["album"]["name"].ToString()); case MeasureType.Lyric: return(""); case MeasureType.IsLyricTranslated: return(""); case MeasureType.TranslatedLyric: return(""); } return(null); }
//Constructor public RectangleObject() { this._rect = new RectangleF(0, 0, 1, 1); this._color = Color.FromArgb(255, 255, 0, 255); this._positionType = MeasureType.pixels; this._sizeType = MeasureType.pixels; }
public RectangleObject(RectangleF rect, Color color) { this._rect = rect; this._color = color; this._positionType = MeasureType.pixels; this._sizeType = MeasureType.pixels; }
/// <summary> /// 鼠标双击,结束本次量测,进行下一次量测,并在其中关闭定时器 /// </summary> public override void OnDblClick() { //base.OnDblClick(); //this.m_GeoMeasure = null; //this.m_Element.Geometry = new PolygonClass(); //this.m_hookHelper.ActiveView.Refresh(); //this.m_FormDis.WriteLabelText(this.m_GeoMeasure); //this.m_FormDis.m_timer.Stop(); if (this.m_GeoMeasure == null) { return; } //结果显示窗口 if (this.m_FormDis == null) { MeasureType type = MeasureType.Area; this.m_FormDis = new FormDis(type, this); this.m_FormDis.TopMost = true; //窗口显示位置 this.m_FormDis.Location = new System.Drawing.Point(130, 150); this.m_FormDis.Show(); } this.m_GeoMeasure = m_pNewPolygonFeed.Stop(); this.m_FormDis.WriteLabelText(this.m_GeoMeasure); this.m_GeoMeasure = null; }
public bool AssignJob(MeasureType typeToInstall) { _target = FindBestBuilding(typeToInstall); if (_target == null) { UIController.instance.AddNews(name, " wants to install a " + typeToInstall.ToString() + ", but there is no room left."); return(false); } if (GameController.instance.money < RainproofMeasures.GetCost(typeToInstall)) { UIController.instance.AddNews(name, " tried to buy a " + typeToInstall.ToString() + ", but there is currently not enough money."); return(false); } _measureToInstall = typeToInstall; _path = AStar.FindPath(_lastReachedWaypoint, _target); _target.GetComponent <RainproofMeasures>().PlanMeasure(_measureToInstall); Vector2 screenSize = new Vector2(Screen.width, Screen.height); Vector2 canvasLocation = Camera.main.WorldToViewportPoint(new Vector2(_target.transform.position.x * screenSize.x, _target.transform.position.y * screenSize.y)); UIController.instance.AddMoneyDecreaseFeedback(canvasLocation, RainproofMeasures.GetCost(typeToInstall)); UIController.instance.AddNews(name, " bought a " + typeToInstall.ToString() + " and is now going to install it."); CreateMeasureIcon(); ApplyEasterEgg(); return(true); }
public async Task ThrowsEntityAlreadyExistsException_IfMeasureTypeExists() { // Arrange contextOptions = new DbContextOptionsBuilder <SmartDormitoryContext>() .UseInMemoryDatabase(databaseName: "ThrowsEntityAlreadyExistsException_IfMeasureTypeExists") .Options; var existingId = Guid.NewGuid().ToString(); var existingMeasureUnit = "Some existing measure unit"; var existingSuitableSensorType = "Some existing sensor type"; var softDeletedMeasureType = new MeasureType { Id = existingId, MeasureUnit = existingMeasureUnit, SuitableSensorType = existingSuitableSensorType, IsDeleted = false }; using (var arrangeContext = new SmartDormitoryContext(contextOptions)) { await arrangeContext.MeasureTypes.AddAsync(softDeletedMeasureType); await arrangeContext.SaveChangesAsync(); } // Act && Asert using (var assertContext = new SmartDormitoryContext(contextOptions)) { var sut = new MeasureTypeService(assertContext); await Assert.ThrowsExceptionAsync <EntityAlreadyExistsException>( () => sut.Create(existingMeasureUnit, existingSuitableSensorType), "\nMeasure type is already present in the database."); } }
// this is for initial "parent" type, // sent down inheritenace chain, overidden though? internal virtual void Reload(Rainmeter.API api, ref double maxValue) { string type = api.ReadString("Type", ""); switch (type.ToLowerInvariant()) { case "rank": Type = MeasureType.Rank; break; case "won": Type = MeasureType.Won; break; case "lost": Type = MeasureType.Lost; break; case "wontoday": Type = MeasureType.WonToday; break; case "losttoday": Type = MeasureType.LostToday; break; case "highestrank": Type = MeasureType.HighestRank; break; default: API.Log(API.LogType.Error, "Type=" + type + " is not valid"); break; } }
/// <summary> /// Добавить /// </summary> /// <param name="event">событие</param> public void Add(TraceEvent @event) { TimeSpan?ts = null; if (@event != null) { if (MeasureType == MeasureType.Count) { ts = null; } else if (MeasureType == MeasureType.BeginTime) { ts = @event.BeginTime; } else if (MeasureType == MeasureType.EndTime) { ts = @event.EndTime; } else if (MeasureType == MeasureType.Duration) { ts = @event.Duration; } else if (MeasureType == MeasureType.ExcludedTime) { ts = @event.ExcludedTime; } else { throw new NotSupportedException(MeasureType.ToString()); } } _ts.Add(ts); }
internal virtual void Reload(API api, ref double maxValue) { ItemIndex = api.ReadInt("FeedIndex", -1); Format = api.ReadString("Format", DEFAULT_TIMESTAMP_FORMAT); var type = api.ReadString("Type", "").ToLowerInvariant(); switch (type) { case "title": Type = MeasureType.TITLE; break; case "url": Type = MeasureType.URL; break; case "": case null: Type = MeasureType.NONE; break; default: Log(API.LogType.Error, "Type=" + type + " not valid"); break; } }
public Product(int id, string name, int amount, MeasureType measure) { Id = id; Name = name; Amount = amount; Measure = measure; }
internal double ReturnValue(MeasureType type) { switch (type) { case MeasureType.Duration: return(MediaMonkey.Duration()); case MeasureType.FileID: return(MediaMonkey.FileID()); case MeasureType.Position: return(MediaMonkey.Position()); case MeasureType.Progress: return(MediaMonkey.Progress()); case MeasureType.Rating: int mmRating = MediaMonkey.Rating(); double Stars = MediaMonkeyRatingToStars(mmRating); if (Stars == -2.0) { API.Log(API.LogType.Error, "MediaMonkey.dll: Invalid was returned for Rating =" + mmRating); return(0.0); } else { return(Stars); } case MeasureType.Repeat: return(MediaMonkey.IsRepeat() ? 1.0 : 0.0); case MeasureType.Shuffle: return(MediaMonkey.IsShuffle() ? 1.0 : 0.0); case MeasureType.State: if (MediaMonkey.IsPlaying()) { return(MediaMonkey.IsPaused() ? 2.0 : 1.0); } else { return((double)0.0); } case MeasureType.Status: return(MediaMonkey.IsRunning() ? 1.0 : 0.0); case MeasureType.Volume: return(MediaMonkey.Volume()); case MeasureType.Year: return(MediaMonkey.Year()); default: break; } return(0.0); }
/// <summary> /// Creates and shows the history form. /// </summary> /// <param name="type"></param> public HistoryForm(MeasureType type) { InitializeComponent(); lineSerie = new LineSeries() { Title = type.Equals(MeasureType.Proximity) ? PROXIMITY_HISTORY_TITLE : TEMPERATURE_HISTORY_TITLE, Color = type.Equals(MeasureType.Proximity) ? OxyColors.Blue : OxyColors.DarkOrange, StrokeThickness = 2 }; graphModel = new PlotModel { Title = type.Equals(MeasureType.Proximity) ? PROXIMITY_HISTORY_TITLE : TEMPERATURE_HISTORY_TITLE }; graphModel.Series.Add(lineSerie); measureType = type; startPicker.Format = DateTimePickerFormat.Custom; startPicker.CustomFormat = DATE_FORMAT; endPicker.Format = DateTimePickerFormat.Custom; endPicker.CustomFormat = DATE_FORMAT; plotView1.Model = graphModel; endPicker.Value = DateTime.Now; }
public void Reload(MeasureType type, int updateRate) { Monitor.ChangeUpdateRate(_observerKey, updateRate); switch (type) { case MeasureType.CpuTemp: GetLatestValue = () => Monitor.CpuTemp; break; case MeasureType.GpuTemp: GetLatestValue = () => Monitor.GpuTemp; break; case MeasureType.CpuFan: GetLatestValue = () => Monitor.CpuFan; break; case MeasureType.GpuFan: GetLatestValue = () => Monitor.GpuFan; break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public void PlanMeasure(MeasureType type) { if (!_plannedMeasures.Contains(type)) { _plannedMeasures.Add(type); } }
public static void AddCostValue(MeasureType type, int cost) { if (!_costValues.ContainsKey(type)) { _costValues.Add(type, cost); } }
public async Task ReturnTrue_WhenMeasureTypeExists() { // Arrange contextOptions = new DbContextOptionsBuilder <SmartDormitoryContext>() .UseInMemoryDatabase(databaseName: "ReturnTrue_WhenMeasureTypeExists") .Options; var existingId = Guid.NewGuid().ToString(); var existingMeasureUnit = "ExistingMeasureUnit"; var existingSensorType = "ExistingSensorType"; var existingMeasureType = new MeasureType { Id = existingId, MeasureUnit = existingMeasureUnit, SuitableSensorType = existingSensorType, IsDeleted = false }; using (var arrangeContext = new SmartDormitoryContext(contextOptions)) { await arrangeContext.MeasureTypes.AddAsync(existingMeasureType); await arrangeContext.SaveChangesAsync(); } // Act && Asert using (var assertContext = new SmartDormitoryContext(contextOptions)) { var sut = new MeasureTypeService(assertContext); var result = await sut.Exists(existingId); Assert.IsTrue(result); } }
public override IQuery GetHsql(Object data) { StringBuilder sql = new StringBuilder("select a from MeasureType a where "); MeasureType measuretype = (MeasureType)data; if (measuretype != null) { Parms = new List <Object[]>(); if (measuretype.MeasureTypeID != 0) { sql.Append(" a.MeasureTypeID = :id and "); Parms.Add(new Object[] { "id", measuretype.MeasureTypeID }); } if (!String.IsNullOrEmpty(measuretype.Name)) { sql.Append(" a.Name = :nom and "); Parms.Add(new Object[] { "nom", measuretype.Name }); } } sql = new StringBuilder(sql.ToString()); sql.Append(" 1=1 order by a.measureTypeID asc "); IQuery query = Factory.Session.CreateQuery(sql.ToString()); SetParameters(query); return(query); }
public Search(IAnalyticsMember member, MeasureType measure, DimensionType dimension, bool hasOtherSuggestions = false, string originalQuery = null) { Name = member.Name; UniqueName = member.UniqueName; Type = MemberMeta.GetMemberType(member); Format = AnalyticsCache.FormatFromType(measure); HasOtherSuggestions = hasOtherSuggestions; OriginalQuery = originalQuery; try { var customSearch = new GoogleCache(); GoogleResults = customSearch.Search(member.Name).Select(x => new GoogleResult(x)); } catch(Exception ex) { // Not paying for google search so this can throw a Not Authorized } var analyticsCache = new AnalyticsCache(); ValueByWeek = analyticsCache.GetMesaureByDimension(member, dimension, measure).Cast<IMeasureByTimeDimension>(); var dataWarehouseCache = new DataWarehouseCache(); TopProjects = dataWarehouseCache.GetTopProjects(member.Name, this.EndDate); switch (Type) { case MemberType.County: Extent = dataWarehouseCache.GetCountyExtent(member.Name); break; } }
public string PerformMeasure(MeasureType type, double[] data) { double value; switch (type) { case MeasureType.DC: value = ArrayCalculation.Average(data); break; case MeasureType.RMS: value = ArrayCalculation.RMS(data); break; case MeasureType.PeakAmp: case MeasureType.PeakFreq: double dt = 1.0 / _oscilloscopeGlobalInfo.SampleRate; double peakFreq, peakAmp; Spectrum.PeakSpectrumAnalysis(data, dt, out peakFreq, out peakAmp); value = (type == MeasureType.PeakFreq) ? peakFreq : peakAmp; break; default: return(Constants.NotAvailable); break; } return(Utility.GetShowValue(value)); }
public string PerformMeasure(MeasureType type, double[] data) { string value; switch (type) { case MeasureType.DC: value = ArrayCalculation.Average(data).ToString(); break; case MeasureType.RMS: value = ArrayCalculation.RMS(data).ToString(); break; case MeasureType.PeakAmp: case MeasureType.PeakFreq: double dt = 1.0 / _oscilloscopeGlobalInfo.SampleRate; double peakFreq, peakAmp; PeakSpectrum.PeakSpectrumAnalysis(data, dt, out peakFreq, out peakAmp); value = (type == MeasureType.PeakFreq) ? peakFreq.ToString() : peakAmp.ToString(); break; default: value = ""; break; } return(value); }
public CurriculumData(MeasureType type, int min_lesson_length = 100, bool signal_smoothing = true) { this.min_lesson_length = min_lesson_length; this.signal_smoothing = signal_smoothing; parameters = new Dictionary <string, float[]>(); SetMeasure(type); }
internal double GetValue(MeasureType type) { //Rainmeter.API.Log(API.LogType.Debug, "GetValue(): type=" + type); switch (type) { case MeasureType.Rank: return(summary.Rank); case MeasureType.Won: return(summary.Won); case MeasureType.Lost: return(summary.Lost); case MeasureType.WonToday: return(summary.WonToday); case MeasureType.LostToday: return(summary.LostToday); case MeasureType.HighestRank: return(summary.HighestRank); default: return(0.0); } }
public static bool IsNameTabAvailable(MeasureType tab) { ReadOnlyCollection <IWebElement> mainTabs = Driver.Instance.FindElements(By.ClassName(classNameToFind: "methodOption")); IWebElement selectedTab = mainTabs.FirstOrDefault(t => t.Text.ToUpper().Contains(tab.ToString().ToUpper())); return(selectedTab != null); }
/// <summary> /// Измеряемая величина трассировки /// </summary> /// <param name="type">тип аггрегата</param> /// <param name="measureType">тип измерямой величины</param> public TraceEventMeasure( AggregateType type , MeasureType measureType) { _ts = new TimeSpanAggregate(Type); MeasureType = measureType; }
public static TabCommands GotoNameTab(MeasureType tab) { Driver.PleaseWait(); var navCommand = new TabCommands(); try { //IWebElement measureDiv = wait.Until(ExpectedConditions.ElementExists(By.ClassName(classNameToFind: "methodOption"))); ReadOnlyCollection <IWebElement> mainTabs = LocalWait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.ClassName(classNameToFind: "methodOption"))); //ReadOnlyCollection <IWebElement> mainTabs = Driver.Instance.FindElements(By.ClassName(classNameToFind: "methodOption")); string tabName = GetMeasureTypeDictionary()[tab]; IWebElement selectedTab = mainTabs.FirstOrDefault(t => t.Text.ToUpper() == tabName.ToUpper()); if (selectedTab != null) { navCommand.SelectedTabText = selectedTab.Text; if (!selectedTab.GetAttribute(attributeName: "class").Contains(value: "active")) { selectedTab.Click(); Driver.PleaseWait(); } } } catch { } return(navCommand); }
internal void Reload(Rainmeter.API rm, ref double maxValue) { string type = rm.ReadString("Type", ""); switch (type.ToLowerInvariant()) { case "major": Type = MeasureType.Major; break; case "minor": Type = MeasureType.Minor; break; case "number": Type = MeasureType.Number; break; case "string": Type = MeasureType.String; break; default: API.Log(API.LogType.Error, "SystemVersion.dll: Type=" + type + " not valid"); break; } }
public MeasureType AddMeasureType(string type) { if (type == null) { throw new ArgumentNullException("Type cannot be null"); } if (type.Length < 1 || type.Length > 20) { throw new ArgumentException("Type must be between 1 and 20 symbols"); } var sensorType = this.context.MeasureTypes .FirstOrDefault(st => st.Type == type); if (sensorType != null) { throw new ArgumentException("Sensor type already exists!"); } sensorType = new MeasureType { Type = type }; this.context.MeasureTypes.Add(sensorType); this.context.SaveChanges(); return(sensorType); }
internal virtual void Reload(Rainmeter.API api, ref double maxValue) { string type = api.ReadString("Type", "current"); switch (type.ToLowerInvariant()) { case "current": Type = MeasureType.current; break; case "lastx": Type = MeasureType.lastX; break; case "min": Type = MeasureType.min; break; case "max": Type = MeasureType.max; break; default: api.Log(API.LogType.Error, "ZWIFT_RM_API.dll: Type=" + type + " not valid"); break; } }
// テキスト追加処理を実行し、処理時間を測定する private TimeSpan measure(MeasureType measureType, bool doEvents, int MaxLoop) { textBox1.Text = ""; Stopwatch sw = new Stopwatch(); sw.Start(); for (int i = 0; i < MaxLoop; i++) { String s = i + ":" + testText + "\r\n"; switch (measureType) { case MeasureType.Text: textBox1.Text = textBox1.Text + s; break; case MeasureType.Selection: textBox1.SelectionStart = textBox1.Text.Length; textBox1.SelectionLength = 0; textBox1.SelectedText = s; break; case MeasureType.AppendText: textBox1.AppendText(s); break; } if (doEvents) { System.Windows.Forms.Application.DoEvents(); } } sw.Stop(); return sw.Elapsed; }
public async Task Create(string measureUnit, string sensorType) { var type = await GetMeasureType(measureUnit, sensorType); if (type != null) { if (type.IsDeleted) { type.IsDeleted = false; await this.Context.SaveChangesAsync(); } else { throw new EntityAlreadyExistsException("\nMeasure type is already present in the database."); } } else { type = new MeasureType() { CreatedOn = DateTime.Now, MeasureUnit = measureUnit, SuitableSensorType = sensorType }; await this.Context.MeasureTypes.AddAsync(type); await this.Context.SaveChangesAsync(); } }
internal virtual void Reload(Rainmeter.API api, ref double maxValue) { string type = api.ReadString("Type", ""); switch (type.ToLowerInvariant()) { case "name": this.Type = MeasureType.SongName; break; case "artists": this.Type = MeasureType.Artists; break; case "album": this.Type = MeasureType.Album; break; case "lyric": this.Type = MeasureType.Lyric; break; case "islyrictranslated": this.Type = MeasureType.IsLyricTranslated; break; case "translatedlyric": this.Type = MeasureType.TranslatedLyric; break; default: api.Log(API.LogType.Error, "ParentChild.dll: Type=" + type + " not valid"); break; } }
public double Update() { if (_updateCount < 0 || _updateCount >= UpdateRate) { API.Log(API.LogType.Debug, "Measure.Update()"); result = string.Empty; if (MeasureType.Equals(Constants.MeasureType.PullRequest, StringComparison.OrdinalIgnoreCase)) { result = GetPRCount(); } else if (MeasureType.Equals(Constants.MeasureType.Build, StringComparison.OrdinalIgnoreCase)) { result = GetBuildStatus(); } else if (MeasureType.Equals(Constants.MeasureType.Release, StringComparison.OrdinalIgnoreCase)) { result = GetReleaseStatus(); } else if (MeasureType.Equals(Constants.MeasureType.UserId, StringComparison.OrdinalIgnoreCase)) { result = GetUserId(); } else { result = string.Empty; } _updateCount = 0; } else if (!MeasureType.Equals(Constants.MeasureType.UserId, StringComparison.OrdinalIgnoreCase)) { _updateCount++; } return(0.0); }
public QuantityEditorViewModel(decimal startingQuantity, decimal maximumQuantity, MeasureType measure, string name) { this.maximumQuantity = maximumQuantity; this.measure = measure; this.Name = name; this.Quantity = startingQuantity.ToString(); this.Add = new RelayCommand(this.HandleAdd); }
public IList<MeasureType> Select(MeasureType data) { IList<MeasureType> datos = new List<MeasureType>(); datos = GetHsql(data).List<MeasureType>(); if (!Factory.IsTransactional) Factory.Commit(); return datos; }
public void AddColumn(float width, MeasureType measureType) { if (__usingDefaultColumn) { __usingDefaultColumn = false; __columns.Clear(); } GridViewColumn newColumn = new GridViewColumn(){ Width = width, MeasureType = measureType }; __columns.Add(newColumn); this.RecalculateColumns(); }
public void AddRow(float height, MeasureType measureType) { if (__usingDefaultRow) { __usingDefaultRow = false; __rows.Clear(); } GridViewRow newRow = new GridViewRow(){ Height = height, MeasureType = measureType }; __rows.Add(newRow); this.RecalculateRows(); }
public ITool m_Tool; //��������axMapControl��IToolʵ�� #endregion Fields #region Constructors /// <summary> /// ��ʼ������ /// </summary> /// <param name="type">��������</param> /// <param name="ipTool">��������axMapControl��IToolʵ��</param> public FormDis(MeasureType type,ITool ipTool) { InitializeComponent(); this.m_MeasureType = type; this.m_Tool = ipTool; this.TopMost = true; this.WriteLabelText(null); if (this.m_Tool.GetType() == typeof(ToolMeasureLength)) { (this.m_Tool as ToolMeasureLength).MyInit(); } if (this.m_Tool.GetType() == typeof(ToolMeasureArea)) { (this.m_Tool as ToolMeasureArea).MyInit(); } }
public IList<MeasureType> GetMeasureType(MeasureType data) { return Factory.DaoMeasureType().Select(data); }
public static bool IsPointType(MeasureType type) { return _pointTypes.Contains(type); }
public void MoveUIElement(UIElement elem, Point newLocation, MeasureType type) { if (elem == null) return; Canvas.SetRight(elem, Double.NaN); Canvas.SetBottom(elem, Double.NaN); if (type == MeasureType.Relative) { newLocation.X += Canvas.GetLeft(elem); newLocation.Y += Canvas.GetTop(elem); } Canvas.SetLeft(elem, newLocation.X); Canvas.SetTop(elem, newLocation.Y); if (this.SelectedElement == elem) { this.m_origSelectedRect.X = newLocation.X; this.m_origSelectedRect.Y = newLocation.Y; PositionHandles(this.m_origSelectedRect, SizingHandles.BottomCentre); } if (OnChildElementMoved != null) OnChildElementMoved(elem, newLocation); }
public MeasureType SelectById(MeasureType data) { return (MeasureType)base.SelectById(data); }
public Boolean Update(MeasureType data) { return base.Update(data); }
public void DeleteMeasureType(MeasureType data) { Factory.DaoMeasureType().Delete(data); }
// this is for initial "parent" type, // sent down inheritenace chain, overidden though? internal virtual void Reload(Rainmeter.API api, ref double maxValue) { string type = api.ReadString("Type", ""); switch(type.ToLowerInvariant()) { case "rank": Type = MeasureType.Rank; break; case "won": Type = MeasureType.Won; break; case "lost": Type = MeasureType.Lost; break; case "wontoday": Type = MeasureType.WonToday; break; case "losttoday": Type = MeasureType.LostToday; break; case "highestrank": Type = MeasureType.HighestRank; break; default: API.Log(API.LogType.Error, "Type=" + type + " is not valid"); break; } }
private void initROI(ROI roi) { if (roi == null) return; mRoi = roi; mROICoord = mRoi.getModelData(); switch (mRoi.ROIMeasureType) { case MeasureType.None: if (mRoi is ROICircularArc) mROIType = ROI.ROI_TYPE_CIRCLEARC; else mROIType = ROI.ROI_TYPE_LINE; break; case MeasureType.Point: mROIType = ROI.ROI_TYPE_POINT; break; case MeasureType.Line: mROIType = ROI.ROI_TYPE_LINE; break; case MeasureType.FitLine: mROIType = ROI.ROI_TYPE_LINE; break; case MeasureType.Circle: mROIType = ROI.ROI_TYPE_CIRCLE; break; } ROIMeasureType = mRoi.ROIMeasureType; }
public MeasureUnit(DateTime NewTime, MeasureType NewType, Double NewValue) { this.Time = NewTime; this.Type = NewType; this.Value = NewValue; }
internal void Reload(Rainmeter.API rm, ref double maxValue) { string type = rm.ReadString("Type", ""); switch (type.ToLowerInvariant()) { case "major": Type = MeasureType.Major; break; case "minor": Type = MeasureType.Minor; break; case "number": Type = MeasureType.Number; break; case "string": Type = MeasureType.String; break; default: API.Log(API.LogType.Error, "SystemVersion.dll: Type=" + type + " not valid"); break; } }
public void AddOrUpdate(string name, string oldName, decimal? buyingPrice, decimal? sellingPrice, MeasureType? measure, decimal? quantity, ICollection<Barcode> barcodes, ICollection<ExpirationDate> expirationDates) { if (oldName != name && this.productsRepository.All().Where(x => !x.IsDeleted).Any(x => x.Name == name)) { throw new ArgumentException($"A product with name {name} already exists"); } this.missingProductsService.RemoveMissingProducts(barcodes.Select(x => x.Value)); var product = this.productsRepository.All().FirstOrDefault(x => x.Name == oldName); if (product == null) { product = new Product(); this.productsRepository.Add(product); } var stockPrice = this.CalculateStockPrice(product, sellingPrice ?? product.SellingPrice, quantity ?? 0); this.MapProperties(product, name, buyingPrice, sellingPrice, measure, quantity, barcodes, expirationDates); if (quantity.GetValueOrDefault() != 0) { this.reportsService.AddShipment(product, quantity.GetValueOrDefault()); } this.reportsService.AddStockPrice(stockPrice); this.productsRepository.SaveChanges(); }
public MeasureType SaveMeasureType(MeasureType data) { return Factory.DaoMeasureType().Save(data); }
internal double GetValue(MeasureType type) { //Rainmeter.API.Log(API.LogType.Debug, "GetValue(): type=" + type); switch(type) { case MeasureType.Rank: return summary.Rank; case MeasureType.Won: return summary.Won; case MeasureType.Lost: return summary.Lost; case MeasureType.WonToday: return summary.WonToday; case MeasureType.LostToday: return summary.LostToday; case MeasureType.HighestRank: return summary.HighestRank; default: return 0.0; } }
public void UpdateMeasureType(MeasureType data) { Factory.DaoMeasureType().Update(data); }
internal double GetValue(MeasureType type) { switch (type) { case MeasureType.A: return ValueA; case MeasureType.B: return ValueB; case MeasureType.C: return ValueC; } return 0.0; }
public MeasureType Save(MeasureType data) { return (MeasureType)base.Save(data); }
internal virtual void Reload(Rainmeter.API api, ref double maxValue) { string type = api.ReadString("Type", ""); switch (type.ToLowerInvariant()) { case "a": Type = MeasureType.A; break; case "b": Type = MeasureType.B; break; case "c": Type = MeasureType.C; break; default: API.Log(API.LogType.Error, "ParentChild.dll: Type=" + type + " not valid"); break; } }
public Boolean Delete(MeasureType data) { return base.Delete(data); }
public static bool IsResultType(MeasureType type) { return _resultTypes.Contains(type); }
public MeasureType SaveMeasureType(MeasureType data) { try { SetService(); return SerClient.SaveMeasureType(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public void ResizeUIElement(UIElement elem, Size newSize, MeasureType type) { if (elem == null) return; FrameworkElement fe = (FrameworkElement)elem; if (type == MeasureType.Relative) { newSize.Width += fe.Width; newSize.Height += fe.Height; } fe.Width = newSize.Width; fe.Height = newSize.Height; if (fe.RenderTransform is ScaleTransform) { ScaleTransform st = (ScaleTransform)fe.RenderTransform; st.CenterX = newSize.Width / 2; st.CenterY = newSize.Height / 2; } if (this.SelectedElement == elem) { this.m_origSelectedRect.Width = newSize.Width; this.m_origSelectedRect.Height = newSize.Height; PositionHandles(this.m_origSelectedRect, SizingHandles.BottomCentre); } double x = Canvas.GetLeft(elem); double y = Canvas.GetTop(elem); if (OnChildElementResized != null) OnChildElementResized(elem, new Rect(x, y, newSize.Width, newSize.Height)); }
private void MapProperties(Product product, string name, decimal? buyingPrice, decimal? sellingPrice, MeasureType? measure, decimal? quantity, ICollection<Barcode> barcodes, ICollection<ExpirationDate> expirationDates) { product.Name = ProductNameFixer.Fix(name); product.BuyingPrice = buyingPrice ?? product.BuyingPrice; product.SellingPrice = sellingPrice ?? product.SellingPrice; product.Measure = measure ?? product.Measure; product.Quantity += quantity ?? 0; foreach (var barcode in product.Barcodes.Where(barcode => barcodes.All(x => x.Value != barcode.Value)).ToList()) { this.barcodesRepository.Delete(barcode); } foreach (var barcode in barcodes.Where(barcode => !this.barcodesRepository.All().Any(x => x.Value == barcode.Value))) { product.Barcodes.Add(barcode); } foreach (var expirationDate in expirationDates.Where(expirationDate => product.ExpirationDates.All(x => x.Date != expirationDate.Date || x.Batch != expirationDate.Batch))) { product.ExpirationDates.Add(expirationDate); } }
public void DeleteMeasureType(MeasureType data) { try { SetService(); SerClient.DeleteMeasureType(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }