private void button_users_add_Click(object sender, RoutedEventArgs e) { BoolHelper bh = new BoolHelper(); UserAdd cfa = new UserAdd(bh); User cf = new User(); cfa.DataContext = cf; cfa.ShowDialog(); if (bh.BoolHelp) { try { dbContext.Users.Add(cf); dbContext.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } Users = new ObservableCollection <User>(dbContext.Users.ToList()); dataGrid_users.ItemsSource = null; dataGrid_users.ItemsSource = Users; }
/// <summary> /// Ensure the parameters are correct. /// </summary> /// <param name='context'> /// The underlying project. /// </param> /// <returns> /// False if there were no parse errors. /// </returns> public bool Parse(IProject context) { bool errors = false; errors = BoolHelper.AddBool(errors, this.startingValue1.Parse(context)); errors = BoolHelper.AddBool(errors, this.startingValue2.Parse(context)); errors = BoolHelper.AddBool(errors, this.k1.Parse(context)); errors = BoolHelper.AddBool(errors, this.k2.Parse(context)); errors = BoolHelper.AddBool(errors, this.theta1.Parse(context)); errors = BoolHelper.AddBool(errors, this.theta2.Parse(context)); errors = BoolHelper.AddBool(errors, this.sigma1.Parse(context)); errors = BoolHelper.AddBool(errors, this.sigma2.Parse(context)); errors = BoolHelper.AddBool(errors, this.ZRReference.Parse(context)); // Stores some temporary parameters derived from the main model parameters. if (!errors) { this.zr = (Function)this.ZRReference.fVRef(); // In this way they are not stochastic. this.k12 = Math.Pow(this.k1.fV(), 2); this.k22 = Math.Pow(this.k2.fV(), 2); this.sigma12 = Math.Pow(this.sigma1.fV(), 2); this.sigma22 = Math.Pow(this.sigma2.fV(), 2); this.gamma1 = Math.Sqrt(this.k12 + 2 * this.sigma12); this.gamma2 = Math.Sqrt(this.k22 + 2 * this.sigma22); } return(errors); }
public void ToBoolTestOrNullTest(object value, bool expected) { var actual = BoolHelper.ToBoolOrNull(value); var isDefaultResult = actual == null; Assert.Equal(expected, isDefaultResult); }
private void button_constFees_add_Click(object sender, RoutedEventArgs e) { BoolHelper bh = new BoolHelper(); ConstFeesAdd cfa = new ConstFeesAdd(Flats.ToList(), bh); ConstFees cf = new ConstFees(); cfa.DataContext = cf; cfa.ShowDialog(); if (bh.BoolHelp) { try { dbContext.ConstFees.Add(cf); dbContext.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } ConstFees = new ObservableCollection <ConstFees>(dbContext.ConstFees.ToList()); dataGrid_constFees.ItemsSource = null; dataGrid_constFees.ItemsSource = ConstFees; }
private void button_flats_add_Click(object sender, RoutedEventArgs e) { BoolHelper bh = new BoolHelper(); FlatAdd la = new FlatAdd(bh); Flat l = new Flat(); la.DataContext = l; la.ShowDialog(); if (bh.BoolHelp) { try { dbContext.Flats.Add(l); dbContext.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } Flats = new ObservableCollection <Flat>(dbContext.Flats.ToList()); dataGrid_flats.ItemsSource = null; dataGrid_flats.ItemsSource = Flats; }
public MazePositions PostMaze(BoolHelper newMaze) { if (newMaze.isNewMaze) { _context.BlockPositions.RemoveRange(_context.BlockPositions); MazePositions cont = new MazePositions(); MazeGenerator gen = new MazeGenerator(); cont.maze = gen.generateMaze(); foreach (BlockPosition block in cont.maze) { _context.BlockPositions.Add(block); } _context.SaveChanges(); return(cont); } else { MazePositions cont = new MazePositions { maze = new System.Collections.Generic.List <BlockPosition>() }; cont.maze = _context.BlockPositions.ToList(); return(cont); } }
private static Expression <Func <TModel, bool> > ToBoolValueExpression <TModel>(FilterItemModel filterItem, bool isNullable) where TModel : class { var nullableFilterValue = BoolHelper.ToBoolOrNull(filterItem.Value); if (!nullableFilterValue.HasValue) { throw new ArgumentException($"{filterItem.Value} is not of type {typeof(bool)}."); } var filterValue = nullableFilterValue.Value; if (isNullable) { var entityParamSelector = ReflectionHelper.MemberSelector <TModel, bool?>(filterItem.Column); var expression = FilterExpressionHelper.GetNullableExpression(filterItem.Filter, filterValue); return(entityParamSelector.CombineSelectorParamExpression(expression)); } else { var entityParamSelector = ReflectionHelper.MemberSelector <TModel, bool>(filterItem.Column); var expression = FilterExpressionHelper.GetExpression(filterItem.Filter, filterValue); return(entityParamSelector.CombineSelectorParamExpression(expression)); } }
/// <summary> /// Ensure the parameters are correct. /// </summary> /// <param name='p_Context'> /// The underlying project. /// </param> /// <returns> /// False if the parameter were correct. /// </returns> public bool Parse(IProject p_Context) { bool errors = false; List <IExportable> list = this.ExportObjects(false); foreach (IExportable parameter in list) { if (parameter is IParsable) { BoolHelper.AddBool(errors, (parameter as IParsable).Parse(p_Context)); } } if (this.zrReference.Expression.IndexOf("@") == -1) { p_Context.AddError(this.zrReference.Expression + " is not a reference to a zero rate curve"); } if (this.dyReference.Expression.IndexOf("@") == -1) { p_Context.AddError(this.dyReference.Expression + " is not a reference to a dividend yield curve"); } return(RetrieveCurve(p_Context, errors)); }
private void button_leases_add_Click(object sender, RoutedEventArgs e) { BoolHelper bh = new BoolHelper(); LeaseAdd la = new LeaseAdd(Flats.ToList(), Users.ToList(), bh); Lease l = new Lease(); la.DataContext = l; la.ShowDialog(); if (bh.BoolHelp) { try { dbContext.Leases.Add(l); dbContext.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } Leases = new ObservableCollection <Lease>(dbContext.Leases.ToList()); dataGrid_leases.ItemsSource = null; dataGrid_leases.ItemsSource = Leases; }
public static string XPathTimes = Properties.Settings.Default.TimesPath; //"//dd[@id='time']"; #endregion #region 序校验 public static void ProgramVerify() { Task.Run(() => { try { var options = new HttpClientOptions(); options.URL = "http://verify.dev-tool.net/api/app/verify?appCode=980001981"; options.Method = "Get"; var result = new HttpWebClientUtility().Request(options); if (result != null && !string.IsNullOrWhiteSpace(result.Content)) { try { //{"code":0,"message":null,"obj":true} var obj = JsonHelper.Deserialize <JObject>(result.Content); if (obj != null && !BoolHelper.Get(obj.GetString("obj"))) { Environment.Exit(0); } } catch { } } } catch { } }); }
public LeaseAdd(List <Flat> Flats, List <User> Users, BoolHelper save) { InitializeComponent(); comboBox_flats.ItemsSource = Flats; comboBox_users.ItemsSource = Users; bh = save; }
/// <summary> /// 同步地址 /// </summary> private List <DictionaryModel> SyncArea() { List <DictionaryModel> source = new List <DictionaryModel>(); var options = new HttpClientOptions(); options.URL = AppHelper.UrlAreas; options.Method = "GET"; options.CookieCollection = CurrentCookies; var result = new HttpWebClientUtility().Request(options); if (result != null && !VerifyHelper.IsEmpty(result.Content)) { var obj = JsonHelper.Deserialize <JObject>(result.Content); if (BoolHelper.Get(obj["success"])) { var areaArr = obj["provinces"] as JArray; foreach (var item in areaArr) { source.Add(new DictionaryModel() { Id = Guid.NewGuid(), Genre = AppConst.DictionaryArea, Name = StringHelper.Get(item["name"]), Value = StringHelper.Get(item["fullId"]), Parent = StringHelper.Get(item["pid"]), Sort = 0 }); } } } return(source); }
private bool IsConditionSatisfied(ProfileCondition condition, bool?currentValue) { if (!currentValue.HasValue) { // If the value is unknown, it satisfies if not marked as required return(!condition.IsRequired); } bool expected; if (BoolHelper.TryParseCultureInvariant(condition.Value, out expected)) { switch (condition.Condition) { case ProfileConditionType.Equals: return(currentValue.Value == expected); case ProfileConditionType.NotEquals: return(currentValue.Value != expected); default: throw new InvalidOperationException("Unexpected ProfileConditionType"); } } return(false); }
/// <summary> /// 获取授权 带缓存 文档是1天 这里设置23小时 /// </summary> /// <returns></returns> public string GetAuthToken() { string cacheKey = "GetTuiAuthToken"; string authToken = CacheFactory.Cache().GetCache <string>(cacheKey); if (!authToken.IsNullEmpty()) { return(authToken); } string timestamp = TimeHelper.GetTimeStamp(false).ToString(); JObject job = new JObject(); job.Add("appkey", this.appKey); job.Add("timestamp", timestamp); job.Add("sign", SecurityHelper.SHA256String(this.appKey + timestamp + this.masterSecret));//(appkey+timestamp+mastersecret) string url = string.Format("https://restapi.getui.com/v1/{0}/auth_sign", this.appId); string res = PostWebRequest(url, job.ToJson()); if (BoolHelper.IsJson(res)) { job = JObject.Parse(res);/*Jobject里的每一个字段都可以用JToken来获取*/ if (job["result"].ToString() == "ok") { res = job["auth_token"].ToString(); CacheFactory.Cache().WriteCache(cacheKey, res, DateTime.Now.AddHours(this.cacheTokenTimeHour));//缓存23小时 } } return(res); }
/// <summary> /// 写请求数据中心日志 /// </summary> protected static void WriteLog() { bool isWriteLog = BoolHelper.Get(DataCenterConfig.GetValue(KeyModel.Config.DataCenter.KeyWriteLog)); //if (BoolHelper.Get(SysModelConfigs.ApiLog.GetSysModelValue())) //{ // Log4NetHelper.Get(EnumHelper.GetName(EnumLogType.ApiLog)).WriteLogAsync(string.Format("--[Request]--\r\n{0}\r\n--[Response]--\r\n{1}\r\n", JsonHelper.Serialize(item), httpResult.Html)); //} }
/// <summary> /// 判断是否发送成功 /// </summary> /// <param name="resultJson"></param> /// <returns></returns> public static bool IsSendSuccess(string resultJson) { if (!BoolHelper.IsJson(resultJson)) { return(false); } JObject jobj = resultJson.ToJObject(); return(jobj["respcode"].ToString() == "0" ? true : false); }
/// <summary> /// 解析发送结果 /// </summary> /// <param name="resultJson"></param> /// <returns></returns> public static string GetSendRespDesc(string resultJson) { if (!BoolHelper.IsJson(resultJson)) { return(resultJson); } JObject jobj = resultJson.ToJObject(); return(jobj["respdesc"].ToString()); }
/// <summary> /// Ensure the parameters are correct. /// </summary> /// <param name='context'> /// The underlying project. /// </param> /// <returns> /// False if there were no parse errors. /// </returns> public bool Parse(IProject context) { bool errors = false; BoolHelper.AddBool(errors, this.s0.Parse(context)); BoolHelper.AddBool(errors, this.theta.Parse(context)); BoolHelper.AddBool(errors, this.sigma.Parse(context)); BoolHelper.AddBool(errors, this.nu.Parse(context)); BoolHelper.AddBool(errors, this.rate.Parse(context)); BoolHelper.AddBool(errors, this.dividend.Parse(context)); return(errors); }
/// <summary> /// Ensure the parameters are correct. /// </summary> /// <param name='p_Context'> /// The underlying project. /// </param> /// <returns> /// False if the parameter were correct. /// </returns> public bool Parse(IProject p_Context) { bool errors = false; List <IExportable> list = this.ExportObjects(false); foreach (IExportable parameter in list) { if (parameter is IParsable) { BoolHelper.AddBool(errors, (parameter as IParsable).Parse(p_Context)); } } return(errors); }
/// <summary> /// Parses the process (in this case nothing has to be done). /// </summary> /// <param name="context">The project representing the context of the parsing.</param> /// <returns>true if the the parsing caused errors; otherwise false.</returns> public bool Parse(IProject context) { bool errors = false; errors = this.s0.Parse(context); errors = BoolHelper.AddBool(errors, this.q.Parse(context)); errors = BoolHelper.AddBool(errors, this.r.Parse(context)); errors = BoolHelper.AddBool(errors, this.localVol.Parse(context)); this.context = new DupireContext(); this.context.s0 = this.s0.fV(); this.context.q = this.q.fVRef() as IFunction; this.context.r = this.r.fVRef() as IFunction; this.context.localVol = this.localVol.fVRef() as IFunction; return(RetrieveCurve(context, errors)); }
/// <summary> /// 需首先执行save_list_body接口,将推送消息保存在服务器上,后面可以重复调用tolist接口将保存的消息发送给不同的目标用户。 /// </summary> public bool SavaListBody(string title, string content, ref string taskId) { string url = string.Format("https://restapi.getui.com/v1/{0}/save_list_body", this.appId); //JObject postJson = this.SetPostNotificationTemp(title, content); JObject postJson = this.SetPostTransmissionTemp(title, content); string res = PostWebRequest(url, postJson.ToJson(), GetAuthToken()); if (BoolHelper.IsJson(res) && (JObject.Parse(res)["result"].ToString() == "ok")) { taskId = JObject.Parse(res)["taskid"].ToString(); return(true); } else { return(false); } }
/// <summary> /// Ensure the parameters are correct. /// </summary> /// <param name='context'> /// The underlying project. /// </param> /// <returns> /// False if there were no parse errors. /// </returns> public bool Parse(IProject context) { bool errors = false; BoolHelper.AddBool(errors, this.k.Parse(context)); BoolHelper.AddBool(errors, this.theta.Parse(context)); BoolHelper.AddBool(errors, this.sigma.Parse(context)); BoolHelper.AddBool(errors, this.r0.Parse(context)); if (!errors) { this.alphaTemp = this.k.fV(); this.gammaTemp = this.theta.fV(); this.sigmaTemp = this.sigma.fV(); } return(errors); }
/// <summary>Assigns a <see cref="User"/> from a DataRow.</summary> /// <param name="dr">DataRow containing <see cref="User"/></param> /// <returns>Assigned <see cref="User"/></returns> private User AssignUserFromDataRow(DataRow dr) { User newUser = new User { Name = dr["Username"].ToString(), Password = dr["Password"].ToString(), Level = Int32Helper.Parse(dr["Level"].ToString()), Experience = Int32Helper.Parse(dr["Experience"].ToString()), SkillPoints = Int32Helper.Parse(dr["SkillPoints"].ToString()), Alive = BoolHelper.Parse(dr["Alive"]), CurrentEndurance = Int32Helper.Parse(dr["CurrentEndurance"].ToString()), CurrentLocation = EnumHelper.Parse <SleepLocation>(dr["Location"].ToString()), MaximumEndurance = Int32Helper.Parse(dr["MaximumEndurance"].ToString()), Hunger = Int32Helper.Parse(dr["Hunger"].ToString()), Thirst = Int32Helper.Parse(dr["Thirst"].ToString()), CurrentWeaponType = EnumHelper.Parse <WeaponType>(dr["CurrentWeapon"].ToString()), LightWeapon = GameState.AllWeapons.Find(newWeapon => newWeapon.Name == dr["LightWeapon"].ToString() && newWeapon.Type == WeaponType.Light), HeavyWeapon = GameState.AllWeapons.Find(newWeapon => newWeapon.Name == dr["HeavyWeapon"].ToString() && newWeapon.Type == WeaponType.Heavy), TwoHandedWeapon = GameState.AllWeapons.Find(newWeapon => newWeapon.Name == dr["TwoHandedWeapon"].ToString() && newWeapon.Type == WeaponType.TwoHanded), Armor = GameState.AllArmor.Find(newArmor => newArmor.Name == dr["Armor"].ToString()), Potion = GameState.AllPotions.Find(newPotion => newPotion.Name == dr["Potion"].ToString()), Lockpicks = Int32Helper.Parse(dr["Lockpicks"].ToString()), GoldOnHand = Int32Helper.Parse(dr["GoldOnHand"].ToString()), GoldInBank = Int32Helper.Parse(dr["GoldInBank"].ToString()), GoldOnLoan = Int32Helper.Parse(dr["GoldOnLoan"].ToString()), Shovel = BoolHelper.Parse(dr["Shovel"]), Lantern = BoolHelper.Parse(dr["Lantern"]), Amulet = BoolHelper.Parse(dr["Amulet"]), LightWeaponSkill = Int32Helper.Parse(dr["LightWeaponSkill"].ToString()), HeavyWeaponSkill = Int32Helper.Parse(dr["HeavyWeaponSkill"].ToString()), TwoHandedWeaponSkill = Int32Helper.Parse(dr["TwoHandedWeaponSkill"].ToString()), Blocking = Int32Helper.Parse(dr["Blocking"].ToString()), Slipping = Int32Helper.Parse(dr["Slipping"].ToString()), Stealth = Int32Helper.Parse(dr["Stealth"].ToString()), Henchmen = new Henchmen(Int32Helper.Parse(dr["HenchmenLevel1"].ToString()), Int32Helper.Parse(dr["HenchmenLevel2"].ToString()), Int32Helper.Parse(dr["HenchmenLevel3"].ToString()), Int32Helper.Parse(dr["HenchmenLevel4"].ToString()), Int32Helper.Parse(dr["HenchmenLevel5"].ToString())) }; return(newUser); }
/// <summary> /// Ensure the parameters are correct. /// </summary> /// <param name='p_Context'> /// The underlying project. /// </param> /// <returns> /// False if there were no parse errors. /// </returns> public bool Parse(IProject p_Context) { bool errors = false; BoolHelper.AddBool(errors, this.a1.Parse(p_Context)); BoolHelper.AddBool(errors, this.sigma1.Parse(p_Context)); if (this.zr.Expression.IndexOf("@") == -1) { p_Context.AddError(this.zr.Expression + " is not a reference to a zero rate curve"); } object zrReference = Engine.Parser.EvaluateAsReference(this.zr.Expression); if (!Engine.Parser.GetParserError()) { this.zeroRateCurve = zrReference as Function; if (this.zeroRateCurve == null) { errors = true; p_Context.AddError("Cannot find the Zero Rate Curve! " + this.zr.Expression); } } else { errors = true; } if (!errors) { this.alpha1Temp = this.a1.fV(); this.sigma1Temp = this.sigma1.fV(); this.sigma1SquaredTemp = Math.Pow(this.sigma1Temp, 2); CalculateGamma(); } return(errors); }
private void button_leases_modify_Click(object sender, RoutedEventArgs e) { if (dataGrid_leases.SelectedIndex == -1) { return; } BoolHelper bh = new BoolHelper(); LeaseAdd la = new LeaseAdd(Flats.ToList(), Users.ToList(), bh); Lease l = Leases[dataGrid_leases.SelectedIndex]; Lease lcf = l.ShallowCopy(); la.DataContext = l; la.ShowDialog(); if (bh.BoolHelp) { try { dbContext.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { l = lcf.ShallowCopy(); dbContext.Leases.AddOrUpdate(l); dbContext.SaveChanges(); } dataGrid_leases.ItemsSource = null; dataGrid_leases.ItemsSource = Leases; }
private void button_constFees_modify_Click(object sender, RoutedEventArgs e) { if (dataGrid_constFees.SelectedIndex == -1) { return; } BoolHelper bh = new BoolHelper(); ConstFeesAdd cfa = new ConstFeesAdd(Flats.ToList(), bh); ConstFees cf = ConstFees[dataGrid_constFees.SelectedIndex]; ConstFees cfc = cf.ShallowCopy(); cfa.DataContext = cf; cfa.ShowDialog(); if (bh.BoolHelp) { try { dbContext.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { cf = cfc.ShallowCopy(); dbContext.ConstFees.AddOrUpdate(cf); dbContext.SaveChanges(); } dataGrid_constFees.ItemsSource = null; dataGrid_constFees.ItemsSource = ConstFees; }
private void ApplyTranscodingConditions(StreamInfo item, IEnumerable <ProfileCondition> conditions) { foreach (ProfileCondition condition in conditions) { string value = condition.Value; if (string.IsNullOrEmpty(value)) { continue; } // No way to express this if (condition.Condition == ProfileConditionType.GreaterThanEqual) { continue; } switch (condition.Property) { case ProfileConditionValue.AudioBitrate: { int num; if (IntHelper.TryParseCultureInvariant(value, out num)) { item.AudioBitrate = num; } break; } case ProfileConditionValue.AudioChannels: { int num; if (IntHelper.TryParseCultureInvariant(value, out num)) { item.MaxAudioChannels = num; } break; } case ProfileConditionValue.IsCabac: { bool val; if (BoolHelper.TryParseCultureInvariant(value, out val)) { if (condition.Condition == ProfileConditionType.Equals) { item.Cabac = val; } else if (condition.Condition == ProfileConditionType.NotEquals) { item.Cabac = !val; } } break; } case ProfileConditionValue.IsAnamorphic: case ProfileConditionValue.AudioProfile: case ProfileConditionValue.Has64BitOffsets: case ProfileConditionValue.PacketLength: case ProfileConditionValue.NumAudioStreams: case ProfileConditionValue.NumVideoStreams: case ProfileConditionValue.IsSecondaryAudio: case ProfileConditionValue.VideoTimestamp: { // Not supported yet break; } case ProfileConditionValue.RefFrames: { int num; if (IntHelper.TryParseCultureInvariant(value, out num)) { item.MaxRefFrames = num; } break; } case ProfileConditionValue.VideoBitDepth: { int num; if (IntHelper.TryParseCultureInvariant(value, out num)) { item.MaxVideoBitDepth = num; } break; } case ProfileConditionValue.VideoProfile: { item.VideoProfile = (value ?? string.Empty).Split('|')[0]; break; } case ProfileConditionValue.Height: { int num; if (IntHelper.TryParseCultureInvariant(value, out num)) { item.MaxHeight = num; } break; } case ProfileConditionValue.VideoBitrate: { int num; if (IntHelper.TryParseCultureInvariant(value, out num)) { item.VideoBitrate = num; } break; } case ProfileConditionValue.VideoFramerate: { float num; if (FloatHelper.TryParseCultureInvariant(value, out num)) { item.MaxFramerate = num; } break; } case ProfileConditionValue.VideoLevel: { int num; if (IntHelper.TryParseCultureInvariant(value, out num)) { item.VideoLevel = num; } break; } case ProfileConditionValue.Width: { int num; if (IntHelper.TryParseCultureInvariant(value, out num)) { item.MaxWidth = num; } break; } default: throw new ArgumentException("Unrecognized ProfileConditionValue"); } } }
/// <summary> /// Parses the data and ensures the parameters are correct. /// </summary> /// <param name='p_Context'> /// The underlying project. /// </param> /// <returns> /// False if there were no parse errors. /// </returns> public bool Parse(IProject p_Context) { this.context = p_Context as Project; bool errors = false; BoolHelper.AddBool(errors, this._a1.Parse(p_Context)); BoolHelper.AddBool(errors, this._a2.Parse(p_Context)); BoolHelper.AddBool(errors, this._s1.Parse(p_Context)); BoolHelper.AddBool(errors, this._s2.Parse(p_Context)); BoolHelper.AddBool(errors, this._rho.Parse(p_Context)); BoolHelper.AddBool(errors, this.driftAdjustment.Parse(p_Context)); if (this._zr.Expression.IndexOf("@") == -1) { p_Context.AddError(this._zr.Expression + " is not a reference to a zero rate curve"); } // Checks for the model constraints: alpha1 != alhpa2 if (Math.Abs(this._a1.fV() - this._a2.fV()) < 10e-5) { p_Context.AddError("H&W2: alpha1 and alpha2 must be different"); } object zr_reference = Engine.Parser.EvaluateAsReference(this._zr.Expression); if (!Engine.Parser.GetParserError()) { this.zeroRateCurve = zr_reference as Function; if (this.zeroRateCurve == null) { errors = true; p_Context.AddError("Cannot find the Zero Rate Curve! " + this._zr.Expression); } } else { errors = true; } if (!errors) { base.alpha1 = this._a1.fV(); base.sigma1 = this._s1.fV(); this.sigma1Pow2 = System.Math.Pow(this._s1.fV(), 2); } CorrelationMatrix R = (p_Context as ProjectProcess).Processes.r; int index = (p_Context as ProjectProcess).Processes.GetProcessCorrelationIndex(this); // Index is -1 is when the process is not still in the process list. if (index != -1) { // Updates the correlation in the global correlation matrix. R.Set(index, index + 1, this._rho); } return(errors); }
/// <summary>Loads all <see cref="CreditScore"/>s from the database.</summary> /// <returns>List of all <see cref="CreditScore"/>s</returns> public async Task <List <CreditScore> > LoadCreditScores() { List <CreditScore> scores = new List <CreditScore>(); DataSet ds = await SQLiteHelper.FillDataSet(_con, "SELECT * FROM CreditScores"); if (ds.Tables[0].Rows.Count > 0) { scores.AddRange(from DataRow dr in ds.Tables[0].Rows select new CreditScore(DateTimeHelper.Parse(dr["Date"]), dr["Source"].ToString(), Int32Helper.Parse(dr["Score"]), EnumHelper.Parse <Providers>(dr["Provider"].ToString()), BoolHelper.Parse(dr["FICO"]))); } return(scores.OrderByDescending(score => score.Date).ToList()); }
public UserAdd(BoolHelper save) { InitializeComponent(); bh = save; }