public async Task Deleting() { if (!DeleteMessagesOnSuccess) { return; } foreach (var m in AssociatedMessages) { try { m.DeleteAsync().ConfigureAwait(false); } catch (Exception) { Console.WriteLine("Failed to delete message."); } } // delete the parent message as well. try { if (ParentMessage != null) { await ParentMessage.DeleteAsync(); } } catch (Exception) { Console.WriteLine("Failed to delete parent message."); } }
//Received Message private void CurrencyEditResponseMessageReceived(ParentMessage obj) { if (obj.level.Equals("Main")) { ////OK button clicked if (obj.currentObject != null) { if (obj.action.Equals("Update")) { this.CurrentSelectItem.ItemContent = (obj.currentObject as CM_ALLCODE_SearchResult); } else { this.isInsert = true; } } else { this.messagePop.Reset(); ActionMenuButton.actionControl.SetAllAction(actionButton, null, actionButton, actionButton, actionButton, actionButton, null); PageAnimation.ToFront(); if (this.isInsert) { this.isInsert = false; this.Search(); } } } }
//Received Message private void CurrencyEditResponseMessageReceived(ParentMessage obj) { //OK button clicked if (obj.currentObject != null) { this.currentData.Add(obj.currentObject as CM_BRANCH); } else { this.messagePop.Reset(); ActionMenuButton.actionControl.SetAllAction(actionButton, null, actionButton, actionButton, actionButton, actionButton, null); PageAnimation.ToFront(); } }
//Received Message private void CurrencyEditResponseMessageReceived(ParentMessage obj) { //OK button clicked if (obj.currentObject != null) { ZOO_LOTHUOC newitem = (obj.currentObject as ZOO_LOTHUOC); this.DANHSACHLOTHUOC.Add(newitem); } else { this.messagePop.Reset(); ActionMenuButton.actionControl.SetAllAction(actionButton, null, actionButton, actionButton, actionButton, actionButton, null); PageAnimation.ToFront(); } }
public void ReplacedMessageDoesntGenerateEvents() { var parent = new ParentMessage(); var childA = new ChildMessage(); parent.B = childA; var childB = new ChildMessage(); parent.B = childB; parent.ClearEvents(); // childA changes shouldn't generate events on the parent anymore childA.C = 100; AssertNotGenerated(parent); }
public void subscribed_parent_and_child_handler_handle_parent_messages() { // GIVEN var parentHandler = new ParentHandler(); var childHandler = new ChildHandler(); Bus.Subscribe(parentHandler); Bus.Subscribe(childHandler); // WHEN var parentMessage = new ParentMessage(); Bus.Publish(parentMessage); // EXPECT CollectionAssert.IsEmpty(childHandler.HandledMessages); CollectionAssert.AreEqual(new[] { parentMessage }, parentHandler.HandledMessages); }
public void SendMessage() { // Read Connection String " StudentEportfolioConnectionString" from web.config file string strConn = ConfigurationManager.ConnectionStrings ["StudentEPortfolioConnectionString"].ToString(); //Instantiate a SqlConnection object with the Connection String read SqlConnection conn = new SqlConnection(strConn); // Instantiate SQLCOMMAND object, supply it with the SQL statement //SELECT that operates against the database, and the connection object //used for connecting to database SqlCommand cmd = new SqlCommand("SELECT Mentor.MentorID FROM Mentor INNER JOIN Student " + "ON Mentor.MentorID = Student.MentorID" + " INNER JOIN ViewingRequest " + "ON ViewingRequest.StudentID = Student.StudentID " + "WHERE ParentID = " + Session["ParentID"].ToString(), conn); //Instantiate a DataAdapter oject and pass the SqlCommand object // created as a parameter SqlDataAdapter daStaff = new SqlDataAdapter(cmd); //create a dataset object to contain the records retrieved from database DataSet result = new DataSet(); //a connection must be opened before any operations made conn.Open(); // use dataadapter to fetch data to a table "StaffDetails" in DataSet. //DataSet " Result" will store the result of the SELECT operation. daStaff.Fill(result, "MentorID"); //A connection should always be closed , whether error occurs or not. conn.Close(); //new post message object ParentMessage objPostMessage = new ParentMessage(); //add entered details to class objPostMessage.fromID = Convert.ToInt32(Session["ParentID"]); objPostMessage.toID = Convert.ToInt32(result.Tables["MentorID"].Rows[0][0]); objPostMessage.DateTimePosted = DateTime.Now; objPostMessage.Title = txtParentPMTitle.Text; objPostMessage.Text = txtParentMsg.Text; int id = objPostMessage.addMessage(); }
private void UserEditResponseMessageReceived(ParentMessage obj) { if (obj.currentObject != null) { //this.currentData.Add(obj.currentObject as TL_USER_SearchResult); this.isInsert = true; //this.DataRefresh(); } else { if (this.isInsert) { this.isInsert = false; this.Search(); } this.messagePop.Reset(); ActionMenuButton.actionControl.SetAllAction(actionButton, null, actionButton, actionButton, actionButton, actionButton, null); PageAnimation.ToFront(); } }
public void ShouldGenerateEventsWithObjectIntializer() { var a = new ChildMessage { D = new ChildChildMessage() }; var b = new ChildMessage { D = new ChildChildMessage() }; var parent = new ParentMessage { B = b }; AssertGenerated(parent); parent.ClearEvents(); parent.B.D.E = 10; AssertDeltaPath(parent, new int[] { 2, 4, 5 }); }
//Received Message private void CurrencyEditResponseMessageReceived(ParentMessage obj) { //OK button clicked if (obj.currentObject != null) { TL_MENU newitem = (obj.currentObject as TL_MENU); this.currencyData.Add(newitem); if (newitem.MENU_PARENT.Equals("")) { this.ParentData.Add(new TL_MENU() { MENU_PARENT = newitem.MENU_ID.ToString(), MENU_NAME = newitem.MENU_NAME }); } } else { this.messagePop.Reset(); ActionMenuButton.actionControl.SetAllAction(actionButton, null, actionButton, actionButton, actionButton, actionButton, null); PageAnimation.ToFront(); } }
//Received Message private void CurrencyEditResponseMessageReceived(ParentMessage obj) { //OK button clicked if (obj.currentObject != null) { this.currentData.Add(obj.currentObject as SYS_PARAMETER); } else { this.messagePop.Reset(); ActionMenuButton.actionControl.SetAllAction(null, null, actionButton, actionButton, actionButton, actionButton, null); PageAnimation.ToFront(); } }
//Received Message private void CurrencyEditResponseMessageReceived(ParentMessage obj) { //OK button clicked if (obj.currentObject != null) { this.currentData.Add(obj.currentObject as CM_DEPARTMENT_SearchResult); this.DataRefresh(); } else { this.messagePop.Reset(); ActionMenuButton.actionControl.SetAllAction(actionButton, null, actionButton, actionButton, actionButton, actionButton, null); PageAnimation.ToFront(); } }
//Received Message private void CurrencyEditResponseMessageReceived(ParentMessage obj) { //OK button clicked if (obj.currentObject != null) { ZOO_PHIEUNHAPTHUOC newitem = (obj.currentObject as ZOO_PHIEUNHAPTHUOC); this.DANHSACHPHIEUNHAP.Add(newitem); } else { this.messagePop.Reset(); ActionMenuButton.actionControl.SetAllAction(actionButton, null, actionButton, actionButton, actionButton, actionButton, null); PageAnimation.ToFront(); } }