private static void Seed(PracticeSystemDbContext context) { var practice = new Practice("FMI Summer Practices for 2018", DateTime.Parse("20/06/2018"), DateTime.Parse("21/09/2018")); context.Practice.Add(practice); var firm = new Firm("scale", "scalepass", "firm", "ScaleFocus", "Plovdiv, Dunav 5", "Outsorcing company"); context.Firms.Add(firm); var internship = new Internship(6, firm, practice); context.Internships.Add(internship); var users = new[] { new User("admin", "adminpass", "admin", "Admin"), //new Firm("scale", "scalepass", "firm", "ScaleFocus", "Plovdiv, Dunav 5", "Outsorcing company"), new Student("st", "stpass", "student", "Stefan", 1234567890, 5.88f, internship) }; context.Users.AddRange(users); context.SaveChanges(); }
/// <summary> /// /// </summary> /// <param name="practiceId"></param> /// <returns></returns> public async Task <bool> DeletePractice(int practiceId) { //Get the practice by its Id var dbRec = new Practice() { Id = practiceId }; //First delete from the child tables //PracticeDrill //Find all records belonging to the sessionId var practiceDrillsDb = await _db.FindAsync <PracticeDrill>(query => query .Where($"{nameof(PracticeDrill.PracticeId):C} = @practiceId") .WithParameters(new { practiceId })); foreach (var drill in practiceDrillsDb) { //Delete the the record from the DB await _db.DeleteAsync(drill); } //Now, delete from PracticeDto //Delete the the record from the DB return(await _db.DeleteAsync(dbRec)); }
/* * /// <summary> * /// Gibt alle Übungen zu einem Trainingsplan aus der lokalen DB zurück (benötigt für Anlegen eines ScheduleModel) * /// </summary> * /// <param name="scheduleId"></param> * /// <returns></returns> * public IEnumerable<int> GetAllExercisesBySchedule(int scheduleId) * { * IEnumerable<int> result = null; * try * { * var db = new SQLiteConnection(path); * List<int> exercises = db.Query<int>("Select ExerciseId From ScheduleHasExercises Where ScheduleId = ?", scheduleId); * if (exercises != null) * { * result = exercises; * } * } * catch (SQLiteException ex) * { * Console.WriteLine(ex.Message); * } * return result; * } */ #endregion #region Practice /// <summary> /// Speichert oder updatet ein Training in der lokalen DB /// </summary> /// <param name="data">Prcatice</param> /// <param name="path">SQLite Connection String</param> /// <returns>0 -> Update</returns> /// <returns>1 -> Insert</returns> /// <returns>-1 -> Exception</returns> public int insertUpdatePracticeOffline(Practice data) { SQLiteConnection db; List <Practice> tempList; Practice temp; try { db = new SQLiteConnection(path); tempList = db.Query <Practice>("Select * From Practice Where LocalId=?", data.LocalId); if (tempList.Count != 0) { temp = tempList.First <Practice>(); //Bei temp alles updaten außer Id und LocalId und dann ein Update darauf fahren temp.ExerciseId = data.ExerciseId; temp.NumberOfRepetitions = data.NumberOfRepetitions; temp.Repetitions = data.Repetitions; temp.ScheduleId = data.ScheduleId; temp.Timestamp = data.Timestamp; temp.Url = data.Url; temp.UserId = data.UserId; temp.Weight = data.Weight; temp.WasOffline = data.WasOffline; db.Update(temp); return(0); } db.Insert(data); return(1); } catch (SQLiteException ex) { Console.WriteLine(ex.Message); return(-1); } }
/// <summary> /// Setzt den Status des Trainings auf Online /// </summary> /// <param name="data"></param> public bool setPracticeOnline(Practice data) { SQLiteConnection db; List <Practice> practice; Practice p; try { db = new SQLiteConnection(path); practice = db.Query <Practice>("Select * From Practice Where LocalId=?", data.LocalId); List <Practice> res = db.Query <Practice>("Update Practice Set WasOffline='false' Where LocalId=?", data.LocalId); p = practice.First <Practice>(); p.WasOffline = false; if (db.Update(p, typeof(Practice)) != -1) { return(true); } else { return(false); } } catch (SQLiteException ex) { Console.WriteLine(ex.Message); } return(false); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,Title,Content")] Practice practice) { if (id != practice.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var currentPractice = _context.Practice.Find(id); if (currentPractice == null) { return(NotFound()); } currentPractice.Title = practice.Title; currentPractice.Content = practice.Content; currentPractice.UpdatedTime = DateTime.Now; currentPractice.Status = StatusType.Edit; _context.Update(currentPractice); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { //TODO:异常处理 throw; } return(RedirectToAction(nameof(Index))); } return(View(practice)); }
public static void Main() { int[, ] graph = new int[, ] { { 0, 2000, 0, 0, 2800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //1 { 0, 0, 1500, 2600, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //2 { 0, 0, 0, 2100, 0, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //3 { 0, 0, 0, 0, 0, 2600, 2200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //4 { 2800, 3000, 0, 0, 0, 0, 1900, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //5 { 0, 0, 2000, 2600, 0, 0, 1800, 2100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //6 { 0, 0, 2300, 2200, 1900, 1800, 0, 0, 2700, 2400, 2200, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, //7 { 0, 0, 0, 0, 0, 2100, 0, 0, 0, 0, 0, 1900, 0, 0, 0, 0, 0, 0, 0, 0 }, //8 { 0, 0, 0, 0, 0, 0, 2700, 0, 0, 0, 0, 1800, 0, 0, 0, 0, 0, 0, 0, 0 }, //9 { 0, 0, 0, 0, 0, 0, 2400, 0, 0, 0, 0, 0, 2000, 0, 0, 0, 0, 0, 0, 0 }, //10 { 0, 0, 0, 0, 0, 0, 2200, 0, 0, 0, 0, 2500, 2800, 2600, 2300, 0, 0, 0, 0, 0 }, //11 { 0, 0, 0, 0, 0, 0, 0, 1900, 1800, 0, 2500, 0, 0, 0, 2200, 0, 2100, 0, 0, 0 }, //12 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2000, 2800, 0, 0, 2400, 0, 0, 0, 0, 0, 1800 }, //13 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2600, 0, 2400, 0, 1900, 0, 0, 0, 2100, 2200 }, //14 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2300, 2200, 0, 1900, 0, 2600, 0, 2700, 2700, 0 }, //15 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2600, 0, 2900, 2000, 0, 0 }, //16 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2100, 0, 0, 0, 2900, 0, 2200, 0, 0 }, //17 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2700, 2000, 2200, 0, 2100, 0 }, //18 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2100, 2700, 0, 0, 2100, 0, 2500 }, //19 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1800, 2200, 0, 0, 0, 0, 2500, 0 } }; //20 Console.WriteLine("Введите пункт отправки:"); int start = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Введите пункт выдачи:"); int end = Convert.ToInt32(Console.ReadLine()); Practice t = new Practice(); t.dijkstra(graph, start - 1, end - 1); }
internal void InitDbPractice(RequestContext requestContext) { if (this.DbPractice == null && this.DbUser != null) { if (!requestContext.HttpContext.Request.IsAuthenticated) { return; } var authenticatedPrincipal = requestContext.HttpContext.User as AuthenticatedPrincipal; if (authenticatedPrincipal == null) { throw new Exception( "HttpContext.User should be a AuthenticatedPrincipal when the user is authenticated"); } var practiceName = this.RouteData.Values["practice"] as string; var practice = this.db.Users .Where(u => u.Id == this.DbUser.Id && u.Practice.UrlIdentifier == practiceName) .Select(u => u.Practice) .SingleOrDefault(); this.DbPractice = practice; } }
/// <summary> /// /// </summary> /// <param name="practiceDto"></param> /// <param name="noteDto"></param> /// <returns></returns> public async Task <int> CreatePractice(PracticeDto practiceDto) { //Map to the DB entity Practice practiceDb = Mapper.Map <Practice>(practiceDto); //Obtain the team name var teamDb = await _db.GetAsync <Team>(new Team() { Id = practiceDto.TeamId }); practiceDb.Side = teamDb?.Name; //1. Insert into the Practice table await _db.InsertAsync(practiceDb); if (practiceDb.Id == 0) { return(0); } //2. Insert into PracticeDrill table foreach (var drill in practiceDto.PracticeDrills) { var drillDb = Mapper.Map <PracticeDrill>(drill); drillDb.PracticeId = practiceDb.Id; await _db.InsertAsync(drillDb); } return(practiceDb.Id); }
//Update Start Time and End Times for Practice public void UpdatePractice(Practice practice) { try { using (SqlConnection con = new SqlConnection(Connection)) { using (SqlCommand command = new SqlCommand("sp_UpdatePractice", con)) { command.CommandType = CommandType.StoredProcedure; command.CommandTimeout = 10; command.Parameters.AddWithValue("@start", practice.StartTime); command.Parameters.AddWithValue("@end", practice.EndTime); command.Parameters.AddWithValue("@id", practice.PracticeID); command.Parameters.AddWithValue("@type", practice.PracticeType); con.Open(); command.ExecuteNonQuery(); } } } catch (Exception ex) { ExeceptionDataAccess exception = new ExeceptionDataAccess(); exception.StoreExceptions(ex); } }
public ActionResult UpdatePractice(PracticeModel model) { if (ModelState.IsValid) { //Find the current object in the database and store for check later Practice practice = practiceBLL.GetPractice().Find(m => m.PracticeID == model.practice.PracticeID); //perform update practiceBLL.UpdatePractice(model.practice); //Find the new updated practice in the database Practice practiceUpdate = practiceBLL.GetPractice().Find(m => m.PracticeID == model.practice.PracticeID); //if the two objects are not the same then the update was a success if (practice != practiceUpdate) { //display Message ViewBag.Message = "Update Successful"; } else { ViewBag.Message = "Update Failed"; } } else { ViewBag.Message = "Invalid Entry"; } //return view model.PracticeType = model.practice.PracticeType; return(View(model)); }
public async Task <IActionResult> PutPractice([FromRoute] int id, [FromBody] Practice practice) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != practice.Id) { return(BadRequest()); } _context.Entry(practice).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PracticeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult Edit(Practice practice) { if (!ModelState.IsValid) { var practiceDetailsViewModel = new PracticeDetailsViewModel { Practice = _practiceRepository.GetPractice(practice.PracticeID), PracticeDate = practice.PracticeDate }; return(PartialView("_PracticeDetails", practiceDetailsViewModel)); } if (_practiceRepository.PracticeNumberUsed(practice.PracticeID, practice.PracticeNumber)) { TempData["Message2"] = $"Practice #{practice.PracticeNumber} has already been used."; TempData["Style2"] = "alert alert-danger"; } else { _practiceRepository.UpdatePractice(practice); TempData["Message2"] = $"Practice #{practice.PracticeNumber} has been updated."; TempData["Style2"] = "alert alert-info"; } TempData["PracticeDate"] = practice.PracticeDate; return(RedirectToAction("Index", "Attendance")); }
public Practice DeletePractice(int id) { Practice practice = db.Practice.Find(id); if (practice == null) { _loggerService.CreateLog("Jordan", "Practice", "Delete", string.Empty, $"Practice {id} not found to delete."); return(null); } try { db.Practice.Remove(practice); db.SaveChanges(); _loggerService.CreateLog("Jordan", "Practice", "Delete", practice.ToString()); } catch (Exception e) { _loggerService.CreateLog("Jordan", "Practice", "Delete", practice.ToString(), "Error deleting practice: " + e.Message); return(null); } return(practice); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Practice p = new Practice(); // p.PrintValueTypes(); // p.PrintReferenceTypes(); // p.typeConversion(); // p.variable(); // p.consistant(); // p.operation(); // p.runFunc(); // p.nullable(); // p.arrayFunc(); // p.multiDimensionArray(); // p.crossArray(); // p.arrayAsParam(); // p.booksFunc(); // p.displayEnum(); // p.displayBox(); // p.printStaticVar(); // p.printRectangle(); // p.printAdd(); p.printCircle(); }
public void Index_Practices() { //Arrange IPracticeRepository sut = GetInMemoryPracticeRepository(); Practice practice = new Practice() { Id = 1, Date = DateTime.Parse("2020-12-11"), Rounds = 1, Score = 5, SkillId = 2, Notes = "Jo missed second contact on dogwalk.", DogId = 3, ApplicationUserId = "d4eb7d23-d641-4c2d-8cd3-a036e08a3c65" }; //Act Practice savedPractice = sut.CreatePractice(practice); //Assert Assert.Single(sut.AllPractices); Assert.Equal(1, savedPractice.Id); Assert.Equal(DateTime.Parse("2020-12-11"), savedPractice.Date); Assert.Equal(1, savedPractice.Rounds); Assert.Equal(5, savedPractice.Score); Assert.Equal(2, savedPractice.SkillId); Assert.Equal(3, savedPractice.DogId); Assert.Equal("Jo missed second contact on dogwalk.", savedPractice.Notes); Assert.Equal("d4eb7d23-d641-4c2d-8cd3-a036e08a3c65", savedPractice.ApplicationUserId); }
public void OnClick(int practice) { Practice PracticeEnum = (Practice)practice; GameStateManager.Instance.SelectPractice(PracticeEnum); UIMenuController.StaticLoadScene("RateScene"); }
//timer eventhandler private void t_Tick(object sender, EventArgs e) { //get current time int hh = DateTime.Now.Hour; int mm = DateTime.Now.Minute; int ss = DateTime.Now.Second; //time string time = ""; //padding leading zero if (hh < 10) { time += "0" + hh; } else { time += hh; } time += ":"; if (mm < 10) { time += "0" + mm; } else { time += mm; } time += ":"; if (ss < 10) { time += "0" + ss; } else { time += ss; } if (x30MinsLater.ToString("T") == time) { Practice picture = new Practice(); picture.Show(); FlashWindows.FlashWindowEx(this); currentTime = DateTime.Now; int intValue = Convert.ToInt32(TimeToBreak); x30MinsLater = currentTime.AddMinutes(intValue); lbl_nextTime.Text = x30MinsLater.ToString("T"); countSeconds = 0; secondsLeft = Int32.Parse(TimeToBreak) * 60; tbManager.SetProgressValue(countSeconds, secondsLeft); } //update label lbl_time.Text = time; countSeconds++; secondsLeft = Int32.Parse(TimeToBreak) * 60; tbManager.SetProgressValue(countSeconds, secondsLeft); }
public Practice CreatePractice(int _id, string _url, string _contactNumber, string _email, string _callingPlatform, string _logoPath, string _serverName, // string _description, string _emailSubject, string _emailPlainBody, string _emailAdditionalContent ) { var practice = new Practice { practiceId = _id, url = _url, contactNumber = _contactNumber, email = _email, callingPlatform = _callingPlatform, logoPath = _logoPath, serverName = _serverName, description = FewaDbContext._description, emailHtmlBody = FewaDbContext._emailHtmlBody, emailSubject = _emailSubject, emailPlainBody = _emailPlainBody, emailAdditionalContent = _emailAdditionalContent }; return(practice); }
public IHttpActionResult PutPractice(int id, Practice practice) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != practice.PracticeId) { return(BadRequest()); } db.Entry(practice).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PracticeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public bool SetPracticePrivacy(long contentId, bool newState) { Practice practice = (Practice)GetContent(contentId); practice.ChangePrivacy(newState); return(newState); }
public void SavePractice(Practice practice) { if (!DataBase.Practices.Any(x => x.Name == practice.Name && x.Semestr == practice.Semestr && x.PracticeType == practice.PracticeType && x.PracticeView == practice.PracticeView)) { DataBase.Practices.Add(practice); } }
/// <summary> /// 园区切换事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GardensChange(object sender, SelectionChangedEventArgs e) { GardensPopup.IsOpen = false; switch (GardensListView.SelectedIndex) { case 0: //切换园区 Dialogs.SwitchGardenDialog.OpenDialog(this, id => { APP.StudySession.GardenId = id; Practice.ReloadClasses(); }); break; case 1: //切换账号 LoginWindow window = new LoginWindow(); bool? dialogResult = window.ShowDialog(); if (dialogResult.Value == true) { initData(); } break; case 2: App.Current.Shutdown(); break; } }
public async Task <bool> ResendRegistrationOTP(string key) { try { if (key == "73l3M3D") { Practice practice = JsonConvert.DeserializeObject <Practice>(HttpContext.Session.GetString("registrationOtp")); if (practice == null) { return(false); } var result = await _messengerService.SendRegistrationOTP(practice.name, practice.email, practice.otp, Request.Scheme + "://" + Request.Host.Value); return(result); } else { return(false); } } catch (Exception ex) { _logger.LogError($"file: MessengerController.cs method: SendEmail() error: {ex.Message} "); return(false); } }
private void GetPracticeAccountPreviousDetails(out Practice previous_state, Guid id, string connectionString, string sessionTicket, HttpRequest request) { TransactionalInformation transaction = new TransactionalInformation(); var data = Get_Practice_DetailData(id, connectionString, sessionTicket, out transaction, request); previous_state = new Practice() { account_holder = data.account_holder, address = data.address, bank = data.bank, bic = data.bic, bsnr = data.bsnr, contact_email = data.contact_email, contact_person_name = data.contact_person_name, contact_telephone = data.contact_telephone, default_shipping_date_offset = data.default_shipping_date_offset, email = data.email, fax = data.fax, iban = data.iban, id = data.id, IsOnlyLabelRequired = data.IsOnlyLabelRequired, IsOrderDrugs = data.IsOrderDrugs, IsSurgeryPractice = data.IsSurgeryPractice, isWaiveServiceFee = data.isWaiveServiceFee, login_email = data.login_email, name = data.name, No = data.address.Substring(data.address.LastIndexOf(' ') + 1), phone = data.phone, town = data.town.Substring(data.town.IndexOf(' ') + 1), ZIP = Convert.ToInt32(data.town.Substring(0, data.town.IndexOf(' '))), PressEnterToSearch = data.PressEnterToSearch, ShouldDownloadReportUponSubmission = data.ShouldDownloadReportUponSubmission, PracticeHasOctDevice = data.PracticeHasOctDevice }; }
public void CountPositivesSumNegativesTest() { CollectionAssert.AreEqual(new int[] { 10, -65 }, Practice.CountPositivesSumNegatives(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15 })); CollectionAssert.AreEqual(new int[] { 8, -50 }, Practice.CountPositivesSumNegatives(new[] { 0, 2, 3, 0, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14 })); CollectionAssert.AreEqual(new int[] { }, Practice.CountPositivesSumNegatives(null)); CollectionAssert.AreEqual(new int[] { }, Practice.CountPositivesSumNegatives(new int[] { })); }
public async Task <bool> SendRegistrationOTP(string key, [FromBody] Practice obj) { try { if (key == "73l3M3D") { if (obj is null) { return(false); } obj.otp = GenerateOtp(obj.email); var result = await _messengerService.SendRegistrationOTP(obj.name, obj.email, obj.otp, Request.Scheme + "://" + Request.Host.Value); if (result == true) { HttpContext.Session.SetString("registrationOtp", JsonConvert.SerializeObject(obj)); } return(result); } else { return(false); } } catch (Exception ex) { _logger.LogError($"file: MessengerController.cs method: SendEmail() error: {ex.Message} "); return(false); } }
public IHttpActionResult UpdatePractice(int ID, [FromBody] Practice Practice) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (ID != Practice.PracticeID) { return(BadRequest()); } DB.Entry(Practice).State = System.Data.Entity.EntityState.Modified; try { DB.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PracticeExists(ID)) { return(NotFound()); } else { throw; } } return(Ok()); }
public PartialViewResult GetPracticeDetails(DateTime practiceDate) { var practice = _practiceRepository.GetPracticeByDate(practiceDate); var viewName = "_PracticeDetails"; if (practice == null) { practice = new Practice { PracticeDate = practiceDate, PracticeNumber = _practiceRepository.GetNextPracticeNumber(), PracticeTopic = string.Empty, PracticeCost = _defaultRepository.GetDefaultValue("Rental cost"), MiscExpense = 0M, MiscRevenue = 0M }; viewName = "_NewPractice"; } var practiceDetailsViewModel = new PracticeDetailsViewModel { Practice = practice, PracticeDate = practiceDate }; return(PartialView(viewName, practiceDetailsViewModel)); }
public async Task <List <PatientBooking> > GetBookedPatientsAsync( DateTime _dateBooked, Practice _practice) { try { Practice practice = new Practice(); var predicate = _dateBooked == DateTime.Today; var predicate1 = _practice.PracticeName == practice.PracticeName; if (predicate && predicate1) { var filter = Builders <PatientBooking> .Filter .Eq("dateBooked", _dateBooked); //var result = await _context.PracticeCollection.Find(filter); //Temp code return(null); } else { return(null); } } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Edit(int id, [Bind("PractId,Date,Rounds,Score,Notes,DogId")] Practice practice) { if (id != practice.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _db.Update(practice); await _db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PracticeExists(practice.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DogId"] = new SelectList(_db.Dogs, "Id", "DogName", practice.DogId); return(View(practice)); }
public Practice CreateModel(PracticeModel model, Practice datamodel = null) { var result = datamodel ?? new Practice(); result.Timestamp = model.Timestamp; result.Repetitions = model.Repetitions; result.ExerciseId = model.ExerciseId; result.ScheduleId = model.ScheduleId; result.UserId = model.UserId; result.Weight = model.Weight; result.NumberOfRepetitions = model.NumberOfRepetitions; result.Id = model.Id; return result; }
protected void HandlePractice(Character character, ConsideredActions alreadyConsidered, IList<string> log, Ability ability) { // Handle Practice // For now, assume 4pt practice on everything // after lots of math, the right equation is: // Desire * (labTotal + increase)/(labTotal + increase + level) double increase = character.GetAbility(ability).GetValueGain(4); double desire = CalculateDesire(increase) / (BaseTier + 1); if (BaseDueDate != null) { desire /= (double)BaseDueDate; } Practice practiceAction = new Practice(ability, desire); log.Add("Practicing " + ability.AbilityName + " worth " + (desire).ToString("0.00")); alreadyConsidered.Add(practiceAction); }
public ResultsInfo RetrieveResultsInfo() { string[] pracCols = { "PracticeName", "Latitude", "Longitude", "LocationAddress1", "LocationCity", "LocationState", "LocationZip", "Distance" }; string[] provCols = { "ProviderName", "NPI", "RangeMin", "RangeMax", "FairPrice", "HGRecognized", "HGOverallRating", "HGPatientCount", "PracticeName" }; ResultsInfo ri = new ResultsInfo(); ri.ResultCount = this._results.Rows.Count; ri.EndOfResults = true; //We aren't buffering these results so for now just load the whole set and don't try again. List<Result> lResult = new List<Result>(); using (DataView dv = new DataView(this._results)) { string[] UniquePractCol = { "PracticeName" }; using (DataTable uniquePractices = dv.ToTable("ByPractice", true, UniquePractCol)) { foreach (DataRow dr in uniquePractices.Rows) { Result r = new Result(lResult.Count + 1); using (DataView byPractice = new DataView(dv.ToTable("PracticeInfo", true, pracCols))) { byPractice.RowFilter = "PracticeName = '" + dr[0].ToString().Replace("'", "''") + "'"; Practice pr = new Practice(); pr.Name = byPractice[0].Row[pracCols[0].ToString()].ToString(); pr.Lat = byPractice[0].Row[pracCols[1].ToString()].ToString(); pr.Lng = byPractice[0].Row[pracCols[2].ToString()].ToString(); pr.Address1 = byPractice[0].Row[pracCols[3].ToString()].ToString(); pr.City = byPractice[0].Row[pracCols[4].ToString()].ToString(); pr.State = byPractice[0].Row[pracCols[5].ToString()].ToString(); pr.Zip = byPractice[0].Row[pracCols[6].ToString()].ToString(); pr.Distance = byPractice[0].Row[pracCols[7].ToString()].ToString(); FormsAuthenticationTicket tk = new FormsAuthenticationTicket(string.Format("{0}|{1}|{2}|{3}" , pr.Name , "" , "" , pr.Distance) , false, 5); pr.Nav = FormsAuthentication.Encrypt(tk); r.Practice = pr; } List<Provider> provsAtPrac = new List<Provider>(); using (DataView byProvider = new DataView(dv.ToTable("ProviderInfo", false, provCols))) { byProvider.RowFilter = "PracticeName = '" + dr[0].ToString().Replace("'", "''") + "'"; for (int i = 0; i < byProvider.Count; i++) { Provider pr = new Provider(lResult.Count + 1); pr.Name = byProvider[i].Row[provCols[0].ToString()].ToString(); pr.NPI = byProvider[i].Row[provCols[1].ToString()].ToString(); pr.RangeMin = byProvider[i].Row[provCols[2].ToString()].ToString(); pr.RangeMax = byProvider[i].Row[provCols[3].ToString()].ToString(); pr.IsFairPrice = Boolean.Parse(byProvider[i].Row[provCols[4].ToString()].ToString()); pr.IsHGRecognized = Boolean.Parse(byProvider[i].Row[provCols[5].ToString()].ToString()); pr.HGRating = byProvider[i].Row[provCols[6].ToString()].ToString(); pr.HGRatingCount = byProvider[i].Row[provCols[7].ToString()].ToString(); FormsAuthenticationTicket tk = new FormsAuthenticationTicket(string.Format("{0}|{1}|{2}|{3}" , r.Practice.Name , pr.Name , pr.NPI , r.Practice.Distance) , false, 5); pr.Nav = FormsAuthentication.Encrypt(tk); provsAtPrac.Add(pr); } } r.Providers = provsAtPrac.ToArray<Provider>(); lResult.Add(r); } } } ri.Results = lResult.ToArray<Result>(); return ri; }
private void AddPracticeToActionList(Ability ability, ConsideredActions alreadyConsidered, IList<string> log) { // For now, assume 4pt practice on everything double effectiveDesire = GetDesirabilityOfIncrease(Character.GetAbility(ability).GetValueGain(4)); if (!double.IsNaN(effectiveDesire) && effectiveDesire > 0) { Practice practiceAction = new Practice(ability, effectiveDesire); log.Add("Practicing " + ability.AbilityName + " worth " + (effectiveDesire).ToString("0.00")); alreadyConsidered.Add(practiceAction); } }
public PracticeModel CreateViewModel(Practice datamodel) { if (datamodel == null) { throw new ArgumentNullException("datamodel"); } return new PracticeModel() { Id = datamodel.Id, ExerciseId = datamodel.ExerciseId, NumberOfRepetitions = datamodel.NumberOfRepetitions, Repetitions = datamodel.Repetitions, ScheduleId = datamodel.ScheduleId, Timestamp = datamodel.Timestamp, Weight = datamodel.Weight, Url = _UrlHelper.Link("GetPracticeById", new { id = datamodel.Id }) }; }