public ActionResult ExportParticipantCallerMapping(int followgroupid) { string message = string.Empty; using (var followUpManager = new FollowUpManager(GetLoginUser())) { var participantCallerMappingExportViewModel = followUpManager.CreateParticipantCallerMappingDataTable(followgroupid, out message); var gridView = new GridView(); gridView.DataSource = participantCallerMappingExportViewModel.ValuesDataTable; gridView.DataBind(); StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); gridView.RenderControl(htw); byte[] fileBytes = Encoding.ASCII.GetBytes(sw.ToString()); String guid = Guid.NewGuid().ToString(); TempData[guid] = fileBytes; return(new JsonResult() { Data = new { FileGuid = guid, FileName = "{0}.xls".FormatWith(participantCallerMappingExportViewModel.Title) } }); } }
public void Update() { txtRate.Text = "0"; FollowUPMaster FollowUP = new FollowUPMaster(); FollowUP.Description = Convert.ToString(txtDescription.Text); FollowUP.Rate = Convert.ToDouble(txtRate.Text); FollowUP.DepartmentId = cmbDeparment.SelectedValue.ToString(); FollowUP.FollowUpItemName = txtName.Text; var subItems = listOfSubItem.Items; FollowUP.ID = Convert.ToInt16(txtID.Text); FollowUP.SubItems = new List <FollowUpSubItem>(); for (int i = 0; i < subItems.Count; i++) { FollowUpSubItem item = new FollowUpSubItem(); item.ItemId = Convert.ToInt32(txtID.Text); item.Id = subItems[i].SubItems[1].Text; item.SubItemName = subItems[i].SubItems[2].Text; FollowUP.SubItems.Add(item); } MessageModel messageModel = new FollowUpManager().UpdateService(FollowUP); MessageBox.Show(messageModel.MessageBody, messageModel.MessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); SetNew(); }
private void getItemID(string ID) { DataTable dt = new FollowUpManager().GetMasterItemID(); if (dt != null && dt.Rows.Count > 0) { ID = dt.Rows[0][0].ToString(); } }
public void SetupTest() { var connection = DbConnectionFactory.CreateTransient(); _context = new PHSContext(connection); _unitOfWork = new MockUnitOfWork(_context); _target = new MockFollowUpManager(_unitOfWork); }
public static void Run() { // ExStart:ReadFollowupFlagOptionsForMessage // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); MapiMessage mapi = MapiMessage.FromFile(dataDir + "message.msg"); FollowUpOptions options = FollowUpManager.GetOptions(mapi); // ExEnd:ReadFollowupFlagOptionsForMessage }
public ActionResult GetParticipantsByFollowUpConfiguration(int followupconfigurationid) { string message = string.Empty; using (var followUpManager = new FollowUpManager()) { var result = followUpManager.GetParticipantsByFollowUpConfiguration(followupconfigurationid, out message); return(PartialView("_ParticipantsTable", result)); } }
public ActionResult GetParticipantsByLoginUser(int?eventid) { string message = string.Empty; using (var followUpManager = new FollowUpManager()) { var result = followUpManager.GetParticipantsByLoginUser(eventid.Value, GetLoginUser(), out message); return(PartialView("_ParticipantCallerTable", result)); } }
public void CleanupTest() { // dispose of the database and connection _context.Dispose(); _unitOfWork.Dispose(); _target.Dispose(); _unitOfWork = null; _context = null; _target = null; }
public static void Run() { // ExStart:CheckPasswordProtection // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); MapiMessage mapiMessage = MapiMessage.FromFile(dataDir + "message1.msg"); FollowUpManager.MarkAsCompleted(mapiMessage); mapiMessage.Save(dataDir + "MarkedCompleted_out.msg"); }
public static void Run() { // ExStart:AddVotingButtonToExistingMessage // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); MapiMessage mapi = MapiMessage.FromFile(dataDir + "message.msg"); FollowUpManager.AddVotingButton(mapi, "Indeed!"); mapi.Save(dataDir + "AddVotingButtonToExistingMessage_out.msg"); // ExEnd:AddVotingButtonToExistingMessage }
public static void Run() { // ExStart:MarkFollowUpFlagAsCompleted // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); MapiMessage mapiMessage = MapiMessage.FromFile(dataDir + "Message.msg"); FollowUpManager.MarkAsCompleted(mapiMessage); mapiMessage.Save(dataDir + "MarkedCompleted_out.msg"); // ExEnd:MarkFollowUpFlagAsCompleted }
public static void Run() { //ExStart:RemoveFollowUpflag // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); // Load file from Disk MapiMessage mapi = MapiMessage.FromFile(dataDir + "message.msg"); FollowUpManager.ClearFlag(mapi); mapi.Save(dataDir + "RemoveFollowUpflag_out.msg"); //ExEnd:RemoveFollowUpflag }
public void DepartmentWiseFollowupItem() { try { var MaterID = ""; List <FollowUPMaster> List = new List <FollowUPMaster>(); FollowUpManager manager = new FollowUpManager(); List = manager.GetALLFollowUpWithSubItemsByDepartment(cmbDept.Text, MaterID); gridControl1.DataSource = List; } catch { } }
public static void Run() { // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); MapiMessage msg = CreateTestMessage(false); FollowUpOptions options = new FollowUpOptions(); options.VotingButtons = "Yes;No;Maybe;Exactly!"; FollowUpManager.SetOptions(msg, options); msg.Save(dataDir + "MapiMsgWithPoll.msg"); }
public void ItemWiseFollowupItem() { try { var MaterID = ""; List <FollowUPMaster> List = new List <FollowUPMaster>(); FollowUpManager manager = new FollowUpManager(); List = manager.GetALLFollowUpWithSubItems(MaterID); gridControl1.DataSource = List; } catch { } }
public ActionResult DeployFollowUpConfiguration(int followupconfigurationid) { string message = string.Empty; using (var followUpManager = new FollowUpManager()) { var success = followUpManager.DeployFollowUpConfiguration(followupconfigurationid, out message); if (!success) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new { Error = message })); } return(Json(new { Success = "Deployment Successful." })); } }
public static void Run() { string dataDir = RunExamples.GetDataDir_Outlook(); string fileName = dataDir + "MessageWithVotingButtons.msg"; using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(fileName))) { // ExStart:ReadingOnlyVotingButtons MapiMessage testMsg = MapiMessage.FromStream(ms); // This method can be useful when it is necessary to read only voting buttons Voting buttons will be introduced as a collection of string values IList buttons = FollowUpManager.GetVotingButtons(testMsg); // ExEnd:ReadingOnlyVotingButtons } }
public static void Run() { string dataDir = RunExamples.GetDataDir_Outlook(); string fileName = dataDir + "MessageWithVotingButtons.msg"; // ExStart:ReadingVotingOptions MapiMessage message = MapiMessage.FromFile(fileName); // This method can be useful when except voting buttons it is necessary to get other parameters (ex. a category) FollowUpOptions options = FollowUpManager.GetOptions(message); // Voting buttons will be introduced as a string with semi-column as a separator string votingButtons = options.VotingButtons; // ExEnd:ReadingVotingOptions }
public static void Run() { // ExStart:ReadVotingOptionsFromMapiMessage // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); // Create new Message MapiMessage msg = CreateTestMessage(false); // Set FollowUpOptions Properties FollowUpOptions options = new FollowUpOptions(); options.VotingButtons = "Yes;No;Maybe;Exactly!"; FollowUpManager.SetOptions(msg, options); msg.Save(dataDir + "MapiMsgWithPoll.msg"); // ExEnd:ReadVotingOptionsFromMapiMessage }
public ActionResult SaveParticipantCallerMapping([Bind(Exclude = "ParticipantID,FollowUpGroupID,PhaseIFollowUpVolunteer,PhaseIIFollowUpVolunteer,PhaseICommitteeMember,PhaseIICommitteeMember")] ParticipantCallerMapping participantCallerMapping) { string message = string.Empty; using (var followUpManager = new FollowUpManager()) { bool isSaved = followUpManager.SaveParticipantCallerMapping(participantCallerMapping, out message); if (!isSaved) { return(Json(new { success = false, error = message, isautosave = false })); } else { return(Json(new { success = true, message = "Your changes were saved.", isautosave = false })); } } }
public static void Run() { // ExStart:DeletVotingButtonFromMessage // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); // Create New Message and set FollowUpOptions, FollowUpManager properties MapiMessage msg = CreateTestMessage(false); FollowUpOptions options = new FollowUpOptions(); options.VotingButtons = "Yes;No;Maybe;Exactly!"; FollowUpManager.SetOptions(msg, options); msg.Save(dataDir + "MapiMsgWithPoll.msg"); FollowUpManager.RemoveVotingButton(msg, "Exactly!"); // Deleting a single button OR FollowUpManager.ClearVotingButtons(msg); // Deleting all buttons from a MapiMessage msg.Save(dataDir + "MapiMsgWithPoll.msg"); // ExEnd:DeletVotingButtonFromMessage }
public void GetSubItems(int ItemId) { var subItem = new FollowUpManager().GetALLFollowUpWithSubItems().FirstOrDefault(a => a.ID == ItemId); if (subItem != null) { if (subItem.SubItems.Count > 0) { foreach (FollowUpSubItem followUpSubItem in subItem.SubItems) { ListViewItem lvi = new ListViewItem(); lvi.SubItems.Add(followUpSubItem.Id.ToString()); lvi.SubItems.Add(followUpSubItem.SubItemName); lvi.SubItems.Add(followUpSubItem.ItemId.ToString()); listOfSubItem.Items.Add(lvi); } } } }
public static void Run() { // ExStart:SetColorCategories // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); MapiMessage msg = MapiMessage.FromFile(dataDir + "message1.msg"); // Add Two category FollowUpManager.AddCategory(msg, "Purple Category"); FollowUpManager.AddCategory(msg, "Red Category"); // Retrieve the list of available categories IList categories = FollowUpManager.GetCategories(msg); // Remove the specified category and then Clear all categories FollowUpManager.RemoveCategory(msg, "Red Category"); FollowUpManager.ClearCategories(msg); // ExEnd:SetColorCategories }
public ActionResult ImportCaller(int followgroupid) { string message = string.Empty; if (Request.Files.Count > 0) { try { // Get all files from Request object HttpFileCollectionBase files = Request.Files; for (int i = 0; i < files.Count; i++) { //string path = AppDomain.CurrentDomain.BaseDirectory + "Uploads/"; //string filename = Path.GetFileName(Request.Files[i].FileName); HttpPostedFileBase file = files[i]; byte[] data = ReadData(file.InputStream); using (var followUpManager = new FollowUpManager()) { var followupParticipantList = followUpManager.ImportCaller(data, followgroupid, out message); } //System.IO.File.Delete(filePath); if (!message.Equals("success")) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new { Error = message })); } } } catch (Exception ex) { return(Json("Error occurred. Error details: " + ex.Message)); } } return(Json(new { Success = "Import Caller Successful." })); }
public static void Run() { // ExStart:SetFollowUpForRecipients // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); MailMessage mailMsg = new MailMessage(); mailMsg.Sender = "*****@*****.**"; mailMsg.To = "*****@*****.**"; mailMsg.Body = "This message will test if follow up options can be added to a new mapi message."; MapiMessage mapi = MapiMessage.FromMailMessage(mailMsg); mapi.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT); // Mark this message as draft DateTime dtReminderDate = new DateTime(2013, 5, 23, 16, 40, 0); // Add the follow up flag for receipient now FollowUpManager.SetFlagForRecipients(mapi, "Follow up", dtReminderDate); mapi.Save(dataDir + "SetFollowUpForRecipients_out.msg"); // ExEnd:SetFollowUpForRecipients }
public static void Run() { //ExStart:SetFollowUpflag // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); MailMessage mailMsg = new MailMessage(); mailMsg.Sender = "*****@*****.**"; mailMsg.To = "*****@*****.**"; mailMsg.Body = "This message will test if follow up options can be added to a new mapi message."; MapiMessage mapi = MapiMessage.FromMailMessage(mailMsg); DateTime dtStartDate = new DateTime(2013, 5, 23, 14, 40, 0); DateTime dtReminderDate = new DateTime(2013, 5, 23, 16, 40, 0); DateTime dtDueDate = dtReminderDate.AddDays(1); FollowUpOptions options = new FollowUpOptions("Follow Up", dtStartDate, dtDueDate, dtReminderDate); FollowUpManager.SetOptions(mapi, options); mapi.Save(dataDir + "SetFollowUpflag_out.msg"); //ExEnd:SetFollowUpflag }
private void btnSave_Click(object sender, EventArgs e) { List <FollowUPMaster> List = new List <FollowUPMaster>(); foreach (int row in gridView1.GetSelectedRows()) { FollowUPMaster master = new FollowUPMaster(); master.SubItems = new List <FollowUpSubItem>(); var followupItem = gridView1.GetRowCellValue(row, "ID"); master.ID = Convert.ToInt16(followupItem.ToString()); master.DepartmentId = cmbDept.SelectedValue.ToString(); bool wasExpanded = gridView1.GetMasterRowExpanded(row); if (!wasExpanded) { gridView1.ExpandMasterRow(row); } GridView detail = gridView1.GetDetailView(row, 0) as GridView; if (detail != null) { foreach (int child in detail.GetSelectedRows()) { var subItem = detail.GetRowCellValue(child, "Id"); master.SubItems.Add(new FollowUpSubItem { ItemId = Convert.ToInt16(followupItem), Id = subItem.ToString() }); } } List.Add(master); } string msage = new FollowUpManager().SaveFollowUpSheet(List); MessageBox.Show(msage); }
public ActionResult PrintHealthReportByFollowUpGroup(int followgroupid, string healthReportType) { string message = string.Empty; if (string.IsNullOrEmpty(healthReportType)) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new { Error = "None" })); } string englishTemplatePath = null; if (Constants.Followup_Print_HealthReport_Normal.Equals(healthReportType)) { englishTemplatePath = Server.MapPath("~/App_Data/Normal_English.docx"); } else if (Constants.Followup_Print_HealthReport_Abnormal.Equals(healthReportType)) { englishTemplatePath = Server.MapPath("~/App_Data/Abnormal_English.docx"); } else if (Constants.Followup_Print_HealthReport_AbnormalNonEligible.Equals(healthReportType)) { englishTemplatePath = Server.MapPath("~/App_Data/Abnormal Non-eligible_English.docx"); } if (string.IsNullOrEmpty(healthReportType)) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new { Error = "Invalid health report type" })); } using (var followUpManager = new FollowUpManager()) { var followupParticipantList = followUpManager.PrintHealthReportByFollowUpGroup(followgroupid, out message); if (!message.Equals("success")) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(new { Error = message })); } //followupParticipantList = Testing(); string directoryName = Path.GetRandomFileName(); string directoryFolder = Path.Combine(Path.GetTempPath(), directoryName); Directory.CreateDirectory(directoryFolder); String guid = Guid.NewGuid().ToString(); using (ZipFile zip = new ZipFile()) { zip.AlternateEncodingUsage = ZipOption.AsNecessary; foreach (var followupParticipant in followupParticipantList) { zip.AddDirectoryByName(followupParticipant.Participant.Nric); byte[] fileBytes = generateHealthReport(englishTemplatePath, followupParticipant); string englishResultPath = directoryFolder + "\\" + followupParticipant.Participant.Nric + "English.docx"; System.IO.File.WriteAllBytes(englishResultPath, fileBytes); // Requires System.IO zip.AddFile(englishResultPath, followupParticipant.Participant.Nric); if (!string.IsNullOrEmpty(followupParticipant.Participant.Language)) { if (followupParticipant.Participant.Language.Contains("Mandarin")) { } else if (followupParticipant.Participant.Language.Contains("Tamil")) { } else if (followupParticipant.Participant.Language.Contains("Malay")) { } } } string zipName = String.Format("Zip_{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss")); using (MemoryStream memoryStream = new MemoryStream()) { zip.Save(memoryStream); memoryStream.Flush(); //Always catches me out memoryStream.Position = 0; //Not sure if this is required TempData[guid] = memoryStream.ToArray(); Directory.Delete(directoryFolder, true); return(new JsonResult() { Data = new { FileGuid = guid, FileName = zipName } }); } } } }