public ContentResult Search(SearchFilter SearchKey) { SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "Id" : SearchKey.OrderBy; QueuedEmailCollection collection = QueuedEmailManager.Search(SearchKey); return(Content(JsonConvert.SerializeObject(collection), "application/json")); }
public ContentResult Save(string objdata, string value) { JsonObject js = new JsonObject(); js.StatusCode = 200; js.Message = "Upload Success"; try { QueuedEmail obj = JsonConvert.DeserializeObject <QueuedEmail>(objdata); obj = QueuedEmailManager.Update(obj); if (obj.Id == 0) { js.StatusCode = 400; js.Message = "Has Errors. Please contact Admin for more information"; } else { js.Data = obj; } } catch (Exception objEx) { js.StatusCode = 400; js.Message = objEx.Message; } return(Content(JsonConvert.SerializeObject(js), "application/json")); }
public ActionResult QueuedEmailEvt(int[] Id, string Action) { // You have your books IDs on the deleteInputs array switch (Action.ToLower()) { case "delete": if (Id != null && Id.Length > 0) { int length = Id.Length; QueuedEmail objItem; for (int i = 0; i <= length - 1; i++) { objItem = QueuedEmailManager.GetById(Id[i], CurrentUser.CompanyID); if (objItem != null) { QueuedEmailManager.Delete(objItem); } } return(View(ViewFolder + "list.cshtml", QueuedEmailManager.GetAll(CurrentUser.CompanyID))); } break; } return(View("PostFrm")); }
/// <summary> /// use for setting up default value /// </summary> /// <returns></returns> public ActionResult Update(int Id, string TargetID = "QueuedEmaillist") { QueuedEmail objItem = QueuedEmailManager.GetById(Id, CurrentUser.CompanyID); objItem.TargetDisplayID = TargetID; return(View(ViewFolder + "Create.cshtml", objItem)); }
/// <summary> /// use for scrolling page /// </summary> /// <returns></returns> public ContentResult GetPg(int page, int pagesize) { string condition = ""; SearchFilter SearchKey = SearchFilter.SearchPG(CurrentUser.CompanyID, page, pagesize, "Id", "Id", "Desc", condition); QueuedEmailCollection objItem = QueuedEmailManager.Search(SearchKey); return(Content(JsonConvert.SerializeObject(objItem), "application/json")); }
/// <summary> /// Send notification /// </summary> /// <param name="messageTemplate">Message template</param> /// <param name="emailAccount">Email account</param> /// <param name="languageId">Language identifier</param> /// <param name="tokens">Tokens</param> /// <param name="toEmailAddress">Recipient email address</param> /// <param name="toName">Recipient name</param> /// <param name="attachmentFilePath">Attachment file path</param> /// <param name="attachmentFileName">Attachment file name</param> /// <param name="replyToEmailAddress">"Reply to" email</param> /// <param name="replyToName">"Reply to" name</param> /// <param name="fromEmail">Sender email. If specified, then it overrides passed "emailAccount" details</param> /// <param name="fromName">Sender name. If specified, then it overrides passed "emailAccount" details</param> /// <param name="subject">Subject. If specified, then it overrides subject of a message template</param> /// <returns>Queued email identifier</returns> public virtual int SendNotification(DNHMessageTemplate messageTemplate, EmailAccount emailAccount, int languageId, IEnumerable <Token> tokens, string toEmailAddress, string toName, string attachmentFilePath = null, string attachmentFileName = null, string replyToEmailAddress = null, string replyToName = null, string fromEmail = null, string fromName = null, string subject = null) { if (messageTemplate == null) { throw new ArgumentNullException("messageTemplate"); } if (emailAccount == null) { throw new ArgumentNullException("emailAccount"); } Tokenizer _tokenizer = new Tokenizer(new MessageTemplatesSettings()); //retrieve localized message template data var bcc = messageTemplate.BccEmailAddresses; if (String.IsNullOrEmpty(subject)) { subject = messageTemplate.Subject; } var body = messageTemplate.Body; //Replace subject and body tokens var subjectReplaced = _tokenizer.Replace(subject, tokens, false); var bodyReplaced = _tokenizer.Replace(body, tokens, true); //limit name length toName = CommonHelper.EnsureMaximumLength(toName, 300); var email = new QueuedEmail { Priority = QueuedEmailPriority.High, From = !string.IsNullOrEmpty(fromEmail) ? fromEmail : emailAccount.Email, FromName = !string.IsNullOrEmpty(fromName) ? fromName : emailAccount.DisplayName, To = toEmailAddress, ToName = toName, ReplyTo = replyToEmailAddress, ReplyToName = replyToName, CC = string.Empty, Bcc = bcc, Subject = subjectReplaced, Body = bodyReplaced, AttachmentFilePath = attachmentFilePath, AttachmentFileName = attachmentFileName, AttachedDownloadId = messageTemplate.AttachedDownloadId, CreatedOnUtc = DateTime.UtcNow, ///EmailAccountId = emailAccount.Id, DontSendBeforeDateUtc = !messageTemplate.DelayBeforeSend.HasValue ? null : (DateTime?)(DateTime.UtcNow + TimeSpan.FromHours(messageTemplate.DelayPeriod.ToHours(messageTemplate.DelayBeforeSend.Value))) }; QueuedEmailManager.Add(email); return(email.Id); }
public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel) { SearchFilter SearchKey = SearchFilter.SearchData(CurrentUser.CompanyID, requestModel, "Id", "Id"); QueuedEmailCollection collection = QueuedEmailManager.Search(SearchKey); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } //QueuedEmailCollection data = QueuedEmailManager.GetAll(CurrentUser.CompanyID); return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
public JsonResult GetSearchData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm) { SearchFilter SearchKey = BindSearch(searchprm); SearchKey = SearchFilter.SearchData(SearchKey, requestModel); QueuedEmailCollection collection = QueuedEmailManager.Search(SearchKey); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
public ActionResult Update(QueuedEmail model) { try { if (ModelState.IsValid) { // TODO: Add insert logic here QueuedEmailManager.Update(model); //return RedirectToAction("Index"); } return(View(model)); } catch { return(View(model)); } }
/// <summary> /// ExportExcel File /// </summary> /// <returns></returns> public string ExportExcel() { QueuedEmailCollection collection = QueuedEmailManager.GetAll(CurrentUser.CompanyID); DataTable dt = collection.ToDataTable <QueuedEmail>(); string fileName = "QueuedEmail_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy"); string[] RemoveColumn = { "CompanyID", "TargetDisplayID", "ReturnDisplay", "TotalRecord", "CreatedUser", "CreatedDate" }; for (int i = 0; i < RemoveColumn.Length; i++) { if (dt.Columns.Contains(RemoveColumn[i])) { dt.Columns.Remove(RemoveColumn[i]); } } FileInputHelper.ExportExcel(dt, fileName, "QueuedEmail List", false); return(fileName); }
// PUT api/<controller>/5 /// <summary> /// Puts the specified identifier. /// </summary> /// <param name="id">The identifier.</param> /// <param name="value">The value.</param> /// <returns></returns> /// <exception cref="HttpResponseException"></exception> public QueuedEmail Put(string id, [FromBody] QueuedEmail value) { QueuedEmail objItem = new QueuedEmail(); try { objItem = QueuedEmailManager.UpdateItem(value); } catch (Exception ObjEx) { IfindLogManager.AddItem(new IfindLog() { LinkUrl = Request.RequestUri.AbsoluteUri, Exception = ObjEx.Message, Message = ObjEx.StackTrace }); } return(objItem); }
public ContentResult SaveExcel(string item) { //string b = Request["item"]; IEnumerable <QueuedEmail> objItemList = JsonConvert.DeserializeObject <IEnumerable <QueuedEmail> >(item); JsonObject obj = new JsonObject(); obj.StatusCode = 200; obj.Message = "The process is sucessed"; foreach (QueuedEmail objitem in objItemList) { //default value // objitem.CreatedUser = CurrentUser.UserName; objitem.CreatedDate = SystemConfig.CurrentDate; objitem.CompanyID = CurrentUser.CompanyID; QueuedEmailManager.Add(objitem); } return(Content(JsonConvert.SerializeObject(obj), "application/json")); }
public ActionResult Create(QueuedEmail model) { try { if (ModelState.IsValid) { model.CompanyID = CurrentUser.CompanyID; if (model.Id != 0) { //get default value QueuedEmail objOldQueuedEmail = QueuedEmailManager.GetById(model.Id, CurrentUser.CompanyID); if (objOldQueuedEmail != null) { model.CreatedDate = objOldQueuedEmail.CreatedDate; model.CreatedUser = objOldQueuedEmail.CreatedUser; } QueuedEmailManager.Update(model); } else { // TODO: Add insert logic here // model.CreatedUser = CurrentUser.UserName; model.CreatedDate = SystemConfig.CurrentDate; QueuedEmailManager.Add(model); } return(View(ViewFolder + "list.cshtml", QueuedEmailManager.GetAll(CurrentUser.CompanyID))); } } catch (Exception ObjEx) { //LogHelper.AddLog(new IfindLog() { LinkUrl = Request.Url.AbsoluteUri, Exception = ObjEx.Message, Message = ObjEx.StackTrace }); return(View(model)); } return(View(model)); }
// GET api/<controller>/5 /// <summary> /// Gets the specified COM group identifier. /// </summary> /// <param name="QueuedEmailId">The COM group identifier.</param> /// <returns></returns> public QueuedEmail Get(int Id, int CompanyID) { return(QueuedEmailManager.GetItemByID(Id, CompanyID)); }
public ActionResult Get(int Id, string action) { QueuedEmail objItem = QueuedEmailManager.GetById(Id, CurrentUser.CompanyID); return(Content(JsonConvert.SerializeObject(objItem), "application/json")); }
public QueuedEmailCollection Get(int CompanyID) { return(QueuedEmailManager.GetAllItem(CompanyID)); }
public QueuedEmailCollection GetbyUser(string usr, int CompanyID) { return(QueuedEmailManager.GetbyUser(usr, CompanyID)); }
// DELETE api/<controller>/5 /// <summary> /// Deletes the specified identifier. /// </summary> /// <param name="id">The identifier.</param> public void Delete(int id, int CompanyID) { QueuedEmailManager.DeleteItem(id, CompanyID); }
// GET api/<controller> /// <summary> /// Gets this instance. /// </summary> /// <returns></returns> public QueuedEmailCollection Post(string method, [FromBody] SearchFilter value) { return(QueuedEmailManager.Search(value)); }
public QueuedEmailServices(User user) { _manager = new QueuedEmailManager(user); }
public ActionResult list() { QueuedEmailCollection collection = QueuedEmailManager.GetAll(CurrentUser.CompanyID); return(View(ViewFolder + "list.cshtml", collection)); }
public ActionResult Get(int Id) { QueuedEmail objItem = QueuedEmailManager.GetById(Id, CurrentUser.CompanyID); return(View(objItem)); }