// GET: Appointment public ActionResult Index() { if (Session["UserName"] == null) { return(RedirectToAction("Login", "Home")); } AppointmentContext appointmentContext = new AppointmentContext(); List <Customer> customers = appointmentContext.Customer.ToList(); List <Appointment> appointments = appointmentContext.appointments.ToList(); FullDetails fullDetails; List <FullDetails> fullDetailsList = new List <FullDetails>(); int id; foreach (Customer customer in customers) { id = customer.CustomerID; foreach (Appointment appointment in appointments.Where(c => c.CustomerID == id)) { fullDetails = new FullDetails(); fullDetails.customer = customer; fullDetails.appointment = appointment; fullDetailsList.Add(fullDetails); } } return(View(fullDetailsList)); }
private void MergeFullDetails(IEnumerable <TreeItem> source) { foreach (var tiSource in source) { if (((PropType)tiSource.Item) == PropType.Group) { var tiTarget = FullDetails.Where(ti => ti.Name == tiSource.Name).FirstOrDefault(); if (tiTarget == null) { FullDetails.Add(tiSource.Clone()); } else { foreach (var ti in tiSource.Children) { string s = ModuloAsterisk(ti.Name); if (tiTarget.Children.FirstOrDefault(t => ModuloAsterisk(t.Name) == s) == null) { tiTarget.AddChild(ti.Clone()); } } } } } }
//Pop-up public ActionResult Details(int customerID, int appointmentID) { AppointmentContext appointmentContext = new AppointmentContext(); FullDetails fullDetails = new FullDetails(); fullDetails.customer = appointmentContext.Customer.Single(_customer => _customer.CustomerID == customerID); fullDetails.appointment = appointmentContext.appointments.Single(_appointment => _appointment.CustomerID == customerID && _appointment.AppointmentID == appointmentID); return(PartialView("Details", fullDetails)); }
public void RemoveFullDetailsItem(TreeItem toRemove) { if ((PropType)toRemove.Item == PropType.Group) { foreach (var ti in toRemove.Children) { RemovePreviewDetailsProperty(ti.Name); RemoveInfoTipProperty(ti.Name); } FullDetails.Remove(toRemove); } else { RemovePreviewDetailsProperty(toRemove.Name); RemoveInfoTipProperty(toRemove.Name); toRemove.Parent.RemoveChild(toRemove); } }
private void ParseFullDetailsString(string registryEntry) { FullDetails.Clear(); Dictionary <string, TreeItem> groups = new Dictionary <string, TreeItem>(); if (registryEntry.StartsWith("prop:")) { registryEntry = registryEntry.Remove(0, 5); } string[] props = registryEntry.Split(';'); TreeItem curr = null; foreach (string prop in props) { string[] parts = prop.Split('.'); if (parts.Length == 3 && parts[0] == "System" && parts[1] == "PropGroup") { // put following entries under the specified group string group = parts[2]; if (!groups.TryGetValue(group, out curr)) { // Mark the TreeItem as a group property curr = new TreeItem(group, PropType.Group); groups.Add(group, curr); } } else if (curr != null) { // Mark the TreeItem as a normal property curr.AddChild(new TreeItem(prop, PropType.Normal)); } } // Add the tree item roots to the displayable collection foreach (var ti in groups.Values) { FullDetails.Add(ti); } }
private void InsertGroup(TreeItem toInsert, TreeItem target, bool before) { if (target == null) { FullDetails.Add(toInsert); } else { int index; if ((PropType)target.Item == PropType.Group) { index = FullDetails.IndexOf(target) + (before ? 0 : 1); } else { index = FullDetails.IndexOf(target.Parent) + 1; } FullDetails.Insert(index, toInsert); } }
private void InsertFullDetailsProperty(TreeItem toInsert, TreeItem target, bool before) { if (target == null) { // Drop in the last group FullDetails.Last().AddChild(toInsert); } else if ((PropType)target.Item == PropType.Group) { if (before) { int index = FullDetails.IndexOf(target); if (index > 0) { index--; } FullDetails[index].AddChild(toInsert); } else { target.InsertChild(0, toInsert); } } else { int index = target.Parent.Children.IndexOf(target) + (before ? 0 : 1); if (index < target.Parent.Children.Count) { target.Parent.InsertChild(index, toInsert); } else { target.Parent.AddChild(toInsert); } } }
static void Main(string[] args) { var proxy = new GetPubsClient(); FullDetails details = proxy.GetAuthorsAndTitles(); Console.WriteLine("Authors"); foreach (Author author in details.Authors) { Console.WriteLine("\t{0} {1}", author.FirstName, author.LastName); } Console.WriteLine(); Console.WriteLine("Titles"); foreach (Title title in details.Titles) { Console.WriteLine("\t{0} {1:C}", title.Name, title.Price); } //foreach (Author author in proxy.GetAuthors()) //{ // Console.WriteLine("{0} {1}", author.FirstName, author.LastName); //} }
public bool HasGroupInFullDetails(string group) { // Walk the top level of the tree return(FullDetails.FirstOrDefault(ti => ti.Name == group) != null); }