public void DeleteMessageFolder(MessageFolder messageFolder) { using (SPKTDataContext dc = conn.GetContext()) { dc.MessageFolders.DeleteOnSubmit(messageFolder); dc.SubmitChanges(); } }
public void DeleteMessageFolder(MessageFolder messageFolder) { using (SPKTDataContext dc = conn.GetContext()) { dc.MessageFolders.DeleteOnSubmit(messageFolder); dc.SubmitChanges(); } }
/// <summary> /// Retrieves all the messages from the specified folder. /// </summary> /// <param name="folder">The folder to retrieve messages from, by default <see cref="MessageFolder.Inbox"/>.</param> /// <returns>The message records.</returns> public Task <IEnumerable <MessageRecord> > GetMessagesAsync(MessageFolder folder = MessageFolder.Inbox) { string path = "/messages/index_json"; if (folder != MessageFolder.Inbox) { path += $"/{folder}"; } return(WAPI.GetAsync <IEnumerable <MessageRecord> >(_session, _role.Slug + path)); }
public MessageFolder GetMessageFolderByID(Int32 MessageFolderID) { MessageFolder result = null; using (SPKTDataContext dc = conn.GetContext()) { result = dc.MessageFolders.Where(mf => mf.MessageFolderID == MessageFolderID).FirstOrDefault(); } return(result); }
/// <summary> /// Transaction of Dictionary /// </summary> /// <param name="data">Object MessageFolder</param> /// <param name="action">I: Insert, U: Update, D: delete</param> /// <returns>true/false</returns> public async Task <int> Transaction(MessageFolder data, char action) { try { var val = await _adapterPattern.SingleTransaction <MessageFolder, int>(data, "usp_MessageFolder_Transaction", action, DataConfiguration.instanceCore); return(val); } catch (Exception ex) { Logger.LogError(ex); return(0); } }
public void SaveMessageFolder(MessageFolder messageFolder) { using (SPKTDataContext dc = conn.GetContext()) { if (messageFolder.MessageFolderID > 0) { dc.MessageFolders.Attach(messageFolder, true); } else { dc.MessageFolders.InsertOnSubmit(messageFolder); } dc.SubmitChanges(); } }
public void SaveMessageFolder(MessageFolder messageFolder) { using (SPKTDataContext dc = conn.GetContext()) { if (messageFolder.MessageFolderID > 0) { dc.MessageFolders.Attach(messageFolder, true); } else { dc.MessageFolders.InsertOnSubmit(messageFolder); } dc.SubmitChanges(); } }
public Message(User owner, User from, User to, string subject, string text, MessageFolder folder) { this.Id = Guid.NewGuid(); this.Subject = subject; this.Text = text; this.Owner = owner; this.OwnerId = owner.Id; this.From = from; this.FromId = from.Id; this.Recipient = to; this.RecipientId = to.Id; this.Folder = folder; }
public Message(User owner, User from, User to, string subject, string text, MessageFolder folder) { this.Id = Guid.NewGuid(); this.Subject = subject; this.Text = text; this.Owner = owner; this.OwnerId = owner.Id; this.From = from; this.FromId = from.Id; this.Recipient = to; this.RecipientId = to.Id; this.Folder = folder; }
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>Success</returns> /// <exception cref="ImperaPlusException">A server side error occurred.</exception> public async Task<List<DTO.Messages.Message>> GetAllAsync(MessageFolder? messageFolder, string folder, CancellationToken cancellationToken) { var url_ = string.Format("{0}/{1}?", BaseUrl, "api/messages/folder/{folder}"); if (folder == null) throw new ArgumentNullException("folder"); url_ = url_.Replace("{folder}", Uri.EscapeDataString(folder.ToString())); if (messageFolder != null) url_ += string.Format("messageFolder={0}&", Uri.EscapeDataString(messageFolder.Value.ToString())); var client_ = await CreateHttpClientAsync(cancellationToken).ConfigureAwait(false); var request_ = new HttpRequestMessage(); PrepareRequest(client_, ref url_); request_.Method = new HttpMethod("GET"); request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute); var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false); ProcessResponse(client_, response_); var responseData_ = await response_.Content.ReadAsByteArrayAsync().ConfigureAwait(false); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var result_ = default(List<DTO.Messages.Message>); try { if (responseData_.Length > 0) result_ = JsonConvert.DeserializeObject<List<DTO.Messages.Message>>(Encoding.UTF8.GetString(responseData_, 0, responseData_.Length)); return result_; } catch (Exception exception) { throw new ImperaPlusException("Could not deserialize the response body.", status_, responseData_, exception); } } else { } throw new ImperaPlusException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", status_, responseData_, null); }
/// <returns>Success</returns> /// <exception cref="ImperaPlusException">A server side error occurred.</exception> public Task<List<DTO.Messages.Message>> GetAllAsync(MessageFolder? messageFolder, string folder) { return GetAllAsync(messageFolder, folder, CancellationToken.None); }