/// <summary> /// Executed if one of the Intents is received defined by the IntentFilter. /// <seealso cref="BroadcastReceiver.OnReceive(Context, Intent)"/> /// <seealso cref="IntentFilter"/> /// </summary> /// <param name="context">the received Context</param> /// <param name="intent">the received Intent</param> public override void OnReceive(Context context, Intent intent) { XMLAccess <List <Appointment> > xmlAccess = new XMLAccess <List <Appointment> >("Appointments"); IEnumerable <Appointment> appointmentsWithOpenNotifications = xmlAccess.Load().Where(appointment => appointment.AppointmentReminder && !appointment.AppointmentDone); NotificationEventReceiver.UpdateAlarms(context, appointmentsWithOpenNotifications); }
protected void AddBookButton_Click(object sender, EventArgs e) { Label1.Visible = true; XMLAccess xmlAccess = new XMLAccess(); if (xmlAccess.GetBookNodeByISBN(IsbnTextBox.Text) == null) { Dictionary <string, string> bookInfo = new Dictionary <string, string>(); bookInfo.Add("Title", TitleTextBox.Text); bookInfo.Add("Author", AuthorTextBox.Text); bookInfo.Add("Illustrator", IllustratorTextBox.Text); bookInfo.Add("Genre", GenreTextBox.Text); bookInfo.Add("Price", PriceTextBox.Text); bookInfo.Add("Year", YearTextBox.Text); bookInfo.Add("ISBN", IsbnTextBox.Text); if (xmlAccess.AddBookNode(bookInfo)) { Label1.Text = String.Format("Success: Added {0} to database", IsbnTextBox.Text); } else { Label1.Text = String.Format("Failure: Unable to add {0} to database", IsbnTextBox.Text); } } else { Label1.Text = String.Format("Failure: {0} already exists in database", IsbnTextBox.Text); } }
protected void registerBtn_Click(object sender, EventArgs e) { resultsLabel.Visible = true; XMLAccess xmlAccess = new XMLAccess(); if (!xmlAccess.SearchUserNode(username.Text)) { Dictionary <string, string> userInfo = new Dictionary <string, string>(); userInfo.Add("name", username.Text); userInfo.Add("password", passwd.Text); userInfo.Add("isAdmin", adminRights.Checked ? "yes" : "no"); if (xmlAccess.AddUserNode(userInfo)) { if (Session["SignedIn"] == null || (bool)Session["SignedIn"] == false) { Session["SignedIn"] = true; Session["UserName"] = username.Text; Session["isAdmin"] = adminRights.Checked; } resultsLabel.Text = "Success! Welcome to the Carrell Books family."; } else { resultsLabel.Text = "For some reason, we could not register you."; } } else { resultsLabel.Text = String.Format("User {0} already exists. Please choose a different name.", username.Text); } }
protected void loginBtn_Click(object sender, EventArgs e) { resultLabel.Visible = false; XMLAccess xmlAccess = new XMLAccess(); if (!xmlAccess.SearchUserNode(username.Text, password.Text)) { resultLabel.Text = "We couldn't find that person."; resultLabel.Visible = true; Session["SignedIn"] = false; } else { Session["SignedIn"] = true; Session["UserName"] = username.Text; Hashtable userInfo = xmlAccess.GetUserNode(username.Text); bool isAdmin = ("yes" == (string)userInfo["isAdmin"]) ? true : false; Session["isAdmin"] = isAdmin; if (isAdmin) { resultLabel.Text = String.Format("You are now signed in, {0}. Enjoy your stay, administrator!", username.Text); } else { resultLabel.Text = String.Format("You are now signed in, {0}. Enjoy your stay!", username.Text); } resultLabel.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { XMLAccess xmlAccess = new XMLAccess(); DataSet data = xmlAccess.GetBookNodes(); BooksGridView.DataSource = data.Tables[0]; BooksGridView.DataBind(); }
public ViewModelOperation() { _xmlAccess = new XMLAccess <Operation>("Operation"); Operation = _xmlAccess.Load(); if (Operation == null) { Operation = new Operation(); } }
/// <summary> /// Constructor for ViewModelOverview which initializes all Lists and loads the static Appointments-List if it's not set already. /// </summary> public ViewModelOverview() { _xmlAccess = new XMLAccess <ObservableCollection <Appointment> >("Appointments"); PlannedAppointments = new ObservableCollection <Appointment>(); FixedAppointments = new ObservableCollection <Appointment>(); DoneAppointments = new ObservableCollection <Appointment>(); if (Appointments == null) { Reload(); } Regroup(); Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(SaveData); }
protected void RemoveBookButton_Click(object sender, EventArgs e) { Label1.Visible = true; XMLAccess xmlAccess = new XMLAccess(); if (xmlAccess.RemoveBookNode(IsbnTextBox.Text)) { Label1.Text = String.Format("Success: Removed {0} from database", IsbnTextBox.Text); } else { Label1.Text = String.Format("Failure: Unable to remove {0} from database", IsbnTextBox.Text); } }
protected void Remove_Click(object sender, EventArgs e) { XMLAccess xmlAccess = new XMLAccess(); if (xmlAccess.RemoveNode(BookName.Text)) { Response.Write("removed"); } else { Response.Write("DNE"); } }
protected void AddBook_Click(object sender, EventArgs e) { XMLAccess xmlAccess = new XMLAccess(); Dictionary <string, string> books = new Dictionary <string, string>(); books.Add("Title", title.Text); books.Add("Author", Author.Text); if (xmlAccess.AddNode(books)) { Response.Write(title.Text + " is added to xml database."); } else { Response.Write("Can not add the new student."); } }
protected void btnAdd_Click(object sender, EventArgs e) { XMLAccess xmlAccess = new XMLAccess(); Dictionary <string, string> bookInfo = new Dictionary <string, string>(); bookInfo.Add("name", txtName.Text); bookInfo.Add("author", txtAuthor.Text); bookInfo.Add("genre", txtGenre.Text); if (xmlAccess.AddNode(bookInfo)) { Response.Write(txtName.Text + " is added to database."); } else { Response.Write("Can not add the new book."); } }
public ViewModelSettings() { _xmlAccess = new XMLAccess <Settings>("Settings"); SmaNaSettings = _xmlAccess.Load(); newSettings = false; old_schema = null; // the first time no settings are set, so we have to initialize them. if (SmaNaSettings == null) { newSettings = true; SmaNaSettings = new Settings() { //TnmM = Enumerations.TnmM.M0, //TnmN = Enumerations.TnmN.N0, //TnmT = Enumerations.TnmT.T0, Schema = "", OperationDate = DateTime.Now, StageingComplete = false }; // determine the correct, supported .NET culture // See ILocalize for specific source // Access the platformdependant resources over the ILocalize-Interface to get the right cultureInformation if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android) { SmaNaSettings.Language = DependencyService.Get <ILocalize>().GetCurrentCultureInfo(); App.SetCulture(SmaNaSettings.Language); } } else { App.SetCulture(SmaNaSettings.Language); old_schema = SmaNaSettings.Schema; } //TODO initialize Appointments-List in a more clever way if (ViewModelOverview.Appointments == null) { new ViewModelOverview(); } }
protected void SearchByIsbnButton_Click(object sender, EventArgs e) { XMLAccess xmlAccess = new XMLAccess(); Hashtable bookInfo = new Hashtable(); bookInfo = xmlAccess.GetBookNodeByISBN(IsbnTextBox.Text); if (bookInfo != null) { AuthorTextBox.Text = bookInfo["Author"].ToString(); IllustratorTextBox.Text = bookInfo["Illustrator"].ToString(); GenreTextBox.Text = bookInfo["Genre"].ToString(); PriceTextBox.Text = bookInfo["Price"].ToString(); YearTextBox.Text = bookInfo["Year"].ToString(); TitleTextBox.Text = bookInfo["Title"].ToString(); Label1.Visible = false; } else { Label1.Text = "We don't seem to have that book."; Label1.Visible = true; } }
protected void bntDelete_Click(object sender, EventArgs e) { XMLAccess xmlAccess = new XMLAccess(); Response.Write(xmlAccess.RemoveNode(txtName.Text)); }
protected void bntSearch_Click(object sender, EventArgs e) { XMLAccess xmlAccess = new XMLAccess(); Response.Write(xmlAccess.SearchNode(txtName.Text)); }