I want to create histogram with Machine names on X axis and observations on Y axis using canvas.js.
Thanks.
Thanks.
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Runtime.Serialization;using System.Runtime.Serialization.Formatters.Binary;namespace Keycard
{
[Serializable()]publicclass Keycard : ISerializable
{protectedstring name;protectedint mykey;public Keycard(string name, int mykey)
{this.Name = name;this.Mykey = mykey;
}publicstring Name
{get { return name; }set { name = value; }
}publicint Mykey
{get { return mykey; }set { mykey = value; }
}publicvoid GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Name", name);
info.AddValue("Keynumber", mykey);
}
public Keycard(SerializationInfo info, StreamingContext context)
{
Name = (string)info.GetValue("Name", typeof(string));
Mykey = (int)info.GetValue("Keynumber", typeof(int));
}publicoverridestring ToString()
{return"Name: " + name + " ---- " + " Keynumber: " + mykey;
}
}
}
using System;using System.Collections;using System.Collections.Generic;using System.Linq;using System.Xml.Serialization;using System.IO;using System.Runtime.Serialization.Formatters.Binary;namespace Keycard
{class Class1
{publicstaticvoid Main(string[] args)
{
Keycard d1 = new Keycard("John", 102030);
Stream stream = File.Open("KeycardData.dat",
FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(stream, d1);
stream.Close();
d1 = null;
stream = File.Open("KeycardData.dat", FileMode.Open);
bf = new BinaryFormatter();
d1 = (Keycard)bf.Deserialize(stream);
stream.Close();
Console.WriteLine(d1.ToString());
Console.ReadLine();
}
}
}
[HttpGet]public ActionResult Index()
{
List<UserData> data = new List<UserData>
{new UserData
{
ID = 1,
Name = "Simon"
},new UserData
{
ID = 2,
Name = "Alex"
}
};return View(data);
}
var keys = Object.keys(@Html.Raw(Json.Encode(Model[0])));var columns = keys.map(function (key) {return { title: key };
});var data = @Html.Raw(Json.Encode(Model));var dataSet = data.map(function (d) {returnObject.values(d);
});
console.log(columns);
console.log(dataSet);
var keys = Object.keys(@Html.Raw(Json.Encode(Model[0])));var columns = keys.map(function (key) {return { title: key };
});
var data = @Html.Raw(Json.Encode(Model));var dataSet = data.map(function (d) {returnObject.values(d);
});
No assigned work orders found.
Project Name/Work Order | Date | Time | Location | Tech | Pay Rate | Pay Type | Actions |
---|---|---|---|---|---|---|---|
@model JQDataTable.Controllers.TestData
@Html.Raw(Json.Encode(@Model))
OR
@Html.Raw(Model)
Master: // These style sheet classes match each textbox below<style> .floating_label1 { position: absolute; z-index: 200; top: 65px; **left: 115px;** // border: hidden; } .floating_label2 { position: absolute; z-index: 200; top: 65px; **left: 130px;** // border: hidden; } .floating_label3 { position: absolute; z-index: 200; top: 65px; **left: 150px;** // border: hidden; } .floating_label4 { position: absolute; z-index: 200; top: 65px; **left: 170px;** // border: hidden; } .floating_label5 { position: absolute; z-index: 200; top: 65px; **left: 190px;** // border: hidden; } .floating_label6 { position: absolute; z-index: 200; top: 65px; **left: 210px;** border: hidden; } }</style> Content:<div style="position:relative;"><img src="Images/PAXSummary.jpg" /><asp:TextBox ID="TextBox1" runat="server" Text="1" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label1" /> <asp:TextBox ID="TextBox2" runat="server" Text="2" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label2" /> <asp:TextBox ID="TextBox3" runat="server" Text="3" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label3" /> <asp:TextBox ID="TextBox4" runat="server" Text="4" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label4" /> <asp:TextBox ID="TextBox5" runat="server" Text="5" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label5" /> <asp:TextBox ID="TextBox6" runat="server" Text="6" style="height:25px; width:25px; vertical-align:central; text-align:center" CssClass="floating_label6" /> </div>
in the file: C:\WebSite2010\Controls\MenuLeft.ascx<%@ControlLanguage="C#"AutoEventWireup="true"CodeFile="MenuLeft.ascx.cs"Inherits="MenuLeft"%><%@ImportNamespace="webapp4U"%><%@RegisterSrc="~/Controls/ThuvienHinhAnh.ascx"TagPrefix="uc"TagName="ThuvienHinhAnh"%><%@RegisterSrc="~/Controls/QuangCaoLeft.ascx"TagPrefix="uc"TagName="QuangCaoLeft"%><%@RegisterSrc="~/Controls/WebURL.ascx"TagPrefix="uc"TagName="WebURL"%><%@RegisterSrc="~/Controls/Newsletter.ascx"TagPrefix="uc"TagName="Newsletter"%><%@Registersrc="DanhMucBDS.ascx"tagname="DanhMucBDS"tagprefix="uc"%><%@RegisterTagPrefix="webapp4U"Namespace="webapp4U.UI"%><tablecellspacing="0"cellpadding="0"width="180"border="0">
...</table>
in the file: C:\WebSite2010\WebMaster\Controls\MenuLeft.ascx<%@ControlLanguage="C#"AutoEventWireup="true"CodeFile="MenuLeft.ascx.cs"Inherits="MenuLeft"%><%@ImportNamespace="webapp4U"%><tablewidth="185px"border="0"cellpadding="0"cellspacing="0">
...</table>
public void GetDoc(int id) { string fileInfo = "ID=[" + id + "] "; try { var file = this.DomainLogicUnitOfWork.UploadedDocumentManager.GetById(id); fileInfo = "FILENAME=[" + file.FileName + "]"; Response.Clear(); Response.ContentType = file.FileContentType; Response.AppendHeader("content-disposition", "attachment; filename=" + file.FileName); Response.OutputStream.Write(file.DocumentImage, 0, file.DocumentImage.Length); Response.Output.Flush(); Response.End(); } catch (Exception ex) { LogHandler.LogError(4617, "Error Downloading Document " + fileInfo, ex); throw ex; } }
@{ Layout = "~/Views/Shared/_Layout.cshtml"; var myChart = new Chart(width: 600, height: 400, theme: ChartTheme.Green) .AddTitle("Product Life Cycle") .AddSeries( name: "Employee", chartType: "Spline", xValue: new[] { "2003", "2004", "2005", "2006", "2007", "2008", "2009", "20010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2022", "2023", "2024", "2025", "2026" }, yValues: new[] { "5.40", "16.17", "109.46", "347.87", "791.62", "1865.88", "2899.26", "4083.32", "4693.27", "6442.52", "8053.77", "9388.84", "9964.89", "10776.18", "4931.34", "2582.54", "752.53", "150.83", "77.87", "31.21", "0.33", "0", "0" }) .Write(); }
<div class="panel panel-primary" style="margin-top: 10px"><div class="panel-heading"> Work Opportunities Available</div><div class="panel-body"><p id="noWorkopportunities" class="text-info"> No available work opportunities found.</p> I can get the table Id data but I need to get above the table and need <table id="workopportunities" class="table table-bordered"><tbody><tr><th>Project Name/Work Order</th><th>Date</th><th>Time</th><th>Location</th><th>Pay Rate</th><th>Pay Type</th><th>Tech</th><th>Actions</th></tr></tbody><tbody></tbody></table></div></div>
private async void GetCasesButton_Click(object sender, EventArgs e) { if (CaseNumbersTextBox.Text.Length < 1) { MessageBox.Show("Casenumber textbox cannot be empty.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ComboboxItem requestorItem = new ComboboxItem(); requestorItem = (ComboboxItem)RequestorComboBox.SelectedItem; ComboboxItem reasonItem = new ComboboxItem(); reasonItem = (ComboboxItem)ReasonComboBox.SelectedItem; if (requestorItem.Value < 1) { MessageBox.Show("Please select a Requestor.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (reasonItem.Value < 1) { MessageBox.Show("Please select a Reason.", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string userEnteredCaseNumbers = CaseNumbersTextBox.Text; userEnteredCaseNumbers = userEnteredCaseNumbers.Replace("\r", ","); userEnteredCaseNumbers = userEnteredCaseNumbers.Replace("\n", ","); while (userEnteredCaseNumbers.Contains(",,")) userEnteredCaseNumbers = userEnteredCaseNumbers.Replace(",,", ","); List<string> userEnteredCaseNumberList = new List<string>(); userEnteredCaseNumberList = userEnteredCaseNumbers.Split(',').Where(x => x.Length > 0).ToList(); userEnteredCaseNumberList = userEnteredCaseNumberList.Select(s => s.Trim()).ToList(); try { int newBatchNumber = await CandidateCaseController.GetNextBatchNumber(); foreach (string caseNumber in userEnteredCaseNumberList) { EditCandidateCaseModel newCandidate = new EditCandidateCaseModel(); newCandidate.CaseNbr = caseNumber; newCandidate.RequestorInfoID = requestorItem.Value; newCandidate.ReasonID = reasonItem.Value; newCandidate.BatchNumber = newBatchNumber; newCandidate.EntryStaffUserName = this._loggedInUserName; await CandidateCaseController.PostCandidate(newCandidate); } List<GetCandidateCaseModel> candidateList = await CandidateCaseController.GetAllCandidates(); candidateList = candidateList.Where(x => x.BatchNumber == newBatchNumber).ToList(); string candidateCasesString = string.Empty; Regex rgxDash = new Regex("[^a-zA-Z0-9 ,]"); candidateCasesString = string.Join(",", candidateList.Select(p => p.CaseNbr.ToString())); candidateCasesString = rgxDash.Replace(candidateCasesString, "").ToString(); //Get MNCIS info on cases candidateCasesString List<string> smallEnoughStrings = new List<string>(); while (candidateCasesString.Length > 0) { int sendLength = 200; bool isLastString = false; if (candidateCasesString.Length < sendLength) { sendLength = candidateCasesString.Length; isLastString = true; } string smallChunk = candidateCasesString.Substring(0, sendLength); if (!isLastString) { int lastComma = smallChunk.LastIndexOf(','); smallChunk = smallChunk.Substring(0, lastComma); candidateCasesString = candidateCasesString.Remove(0, lastComma); if (candidateCasesString[0] == ',') candidateCasesString = candidateCasesString.Remove(0, 1); } else candidateCasesString = candidateCasesString.Remove(0, sendLength); smallEnoughStrings.Add(smallChunk); } List<AcceptCaseNumbersModel> mncisDetailList = new List<AcceptCaseNumbersModel>(); List<AcceptCaseNumbersModel> smallEnoughMncisDetailList = new List<AcceptCaseNumbersModel>(); foreach (string smallEnoughString in smallEnoughStrings) { smallEnoughMncisDetailList = await FTACaseReset.Controllers.JusticeController.GetAllAcceptCaseNumbers(smallEnoughString); mncisDetailList.AddRange(smallEnoughMncisDetailList); } //Parse data from MNCIS and add it to Candidate table //use candidateList to pull records out of mncisDetailList then update CandidateCase table foreach (GetCandidateCaseModel candidateCase in candidateList) { string caseNbrWODash = rgxDash.Replace(candidateCase.CaseNbr, "").ToString(); AcceptCaseNumbersModel mncisDetail = mncisDetailList.Where(x => x.CaseNbrSrch.ToLower() == caseNbrWODash.ToLower()).FirstOrDefault(); if (mncisDetail != null) { //if it found a mncis record then edit Candidate details with MNCIS data candidateCase.FirstPenalty = mncisDetail.FirstPenaltyFlag == 1 ? true : false; candidateCase.SecondPenalty = mncisDetail.SecondPenaltyFlag == 1 ? true : false; if (candidateCase.CaseNbr.ToLower().Contains("vb") == false) candidateCase.RejectionReason = await FTACaseReset.Controllers.RejectionController.GetRejectionByDescription(Enumerations.Rejections.No_Records_To_Reset.ToString().Replace("_", " ")); else if (candidateCase.FirstPenalty == false && candidateCase.SecondPenalty == false) candidateCase.RejectionReason = await FTACaseReset.Controllers.RejectionController.GetRejectionByDescription(Enumerations.Rejections.No_Records_To_Reset.ToString().Replace("_", " ")); if (candidateCase.RejectionReason == null) candidateCase.RejectionReason = await FTACaseReset.Controllers.RejectionController.GetRejectionByDescription(Enumerations.Rejections.Valid.ToString()); candidateCase.Title = mncisDetail.Style; await FTACaseReset.Controllers.CandidateCaseController.PutCandidate(candidateCase); } else { //if it didn't find a mncis record then change the rejection code on the Candidate candidateCase.RejectionReason = await FTACaseReset.Controllers.RejectionController.GetRejectionByDescription(Enumerations.Rejections.Invalid_Case_Number.ToString().Replace("_", " ")); await FTACaseReset.Controllers.CandidateCaseController.PutCandidate(candidateCase); } } GetCasesProgressBar.PerformStep(); this.ClearForm(); //Populate Results ValidTabPage.Controls.Clear(); InvalidTabPage.Controls.Clear(); ValidTabPage.Text = "Valid Cases"; InvalidTabPage.Text = "Invalid Cases"; //Repopulate Batch ComboBox this.PopulateBatchComboBox(); List<GetCandidateCaseModel> thisBatchCasesList = new List<GetCandidateCaseModel>(); thisBatchCasesList = await Controllers.CandidateCaseController.GetCandidateByBatchID(newBatchNumber); if (thisBatchCasesList.Count > 0) this.EmailButton.Enabled = true; else { this.EmailButton.Enabled = false; return; } this.PopulateTabs(thisBatchCasesList, true); this.GetCasesPanel.Visible = false; this.UpdateExistingPanel.Visible = true; ComboboxItem batchItem = new ComboboxItem(thisBatchCasesList[0].BatchNumber); SelectBatch(batchItem); ComboboxItem requestorUpdateItem = new ComboboxItem(thisBatchCasesList[0].RequestorInfo); SelectRequestorUpdate(requestorUpdateItem); ComboboxItem reasonUpdateItem = new ComboboxItem(thisBatchCasesList[0].Reason); SelectReasonUpdate(reasonUpdateItem); } catch (Exception ex) { string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "GetCasesButton_Click()", ex.Message); MessageBox.Show(errorMsg, "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protectedvoid EmailButton_Click(object sender, EventArgs e)
{//get selected emailstring requestor = RequestorDropDownList.SelectedValue.ToString();//string message = "The following records have been prepped for processing. Valid cases will be processed.{0}{1}{2}";string message = "The following records have been prepped for processing. Valid cases will be processed.";if (requestor.Length >0)
message = string.Format(message);using (MailMessage mailMessage = new MailMessage())
{
mailMessage.From = new MailAddress("NoReply_FTA@courts.state.mn.us");//MailAddress to = new MailAddress(requestorEmail);
MailAddress to = new MailAddress("okaymy1112@gmail.com");
mailMessage.To.Add(to);string ccEmailAddress = "okaymy1112@mail.com";if (ccEmailAddress.Length >0)
{
MailAddress ccto = new MailAddress(ccEmailAddress);
mailMessage.CC.Add(ccto);
}
mailMessage.Subject = "FTA Case Reset Notice";
mailMessage.Body = message;
mailMessage.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient();
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
smtpClient.PickupDirectoryLocation = @"c:\smtp";
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = true;
smtpClient.Timeout = 60000;
smtpClient.Send(mailMessage);//Error occurs on this line
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('An email has been sent to '" + requestorName + "');", true);
}
<asp:DropDownList ID="RequestorDropDownList" runat="server" Font-Size="8.25pt"
Height="20px" ToolTip="Requestor" Width="160px" SelectMethod="GetRequestorEmail"
DataTextField="DisplayName" DataValueField="Email"
OnSelectedIndexChanged="RequestorDropDownList_SelectedIndexChanged"></asp:DropDownList>
#region Requestor dropdownlistpublicasync Task<IEnumerable<GetRequestorInfoModel>> GetRequestorEmail()
{ try
{var requestors = await FTACaseReseting.Controllers.RequestorInfoController.GetAllRequestorInfoes();//Show first name as selectedreturn requestors.OrderBy(x => x.DisplayName);
}catch (Exception ex)
{string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "PopulateRequestorComboBox()", ex.Message);
Response.Write("<script>alert(" + HttpUtility.JavaScriptStringEncode(errorMsg, true) + ")</script>");return Enumerable.Empty<GetRequestorInfoModel>();
}
}#endregion
protectedvoid RequestorDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{if (RequestorDropDownList.SelectedItem ==null)
{
ListItem requestorItem = new ListItem();
requestorItem = (ListItem)RequestorDropDownList.SelectedItem;if (requestorItem.Text.Length <0)
{string selectRequestor = "Please select a Requestor.";
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + selectRequestor + "');", true);
}this.EmailButton.Enabled = false;
RequestorDropDownList.SelectedValue = RequestorDropDownList.SelectedItem.Value;
}
}
In file Web.config<appSettings>
...<add key="SmtpServer"value="localhost"/><add key="EmailWebmaster"value="admin"/><add key="Password"value="123"/>
...</appSettings>
In file Logon_Redirect.aspx
...
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title>Untitled Page</title></head><body><form id="form1" runat="server"><div></div></form></body></html>
In file Logon_Redirect.aspx.cs
...
publicpartialclass Logon_Redirect : System.Web.UI.Page
{protectedvoid Page_Load(object sender, EventArgs e)
{// kiem tra va Redirect toi trang can thietif (Page.User.IsInRole(Globals.Settings.AppRoles.KhachHang))
Response.Redirect(Globals.ApplicationPath);elseif (Page.User.IsInRole(Globals.Settings.AppRoles.Admin))
Response.Redirect(Globals.ApplicationPath + "WebMaster/Contacts/Contact.aspx");
}
}
In file Logon.aspx.cs
protectedvoid btLogon_Click(object sender, EventArgs e)
{//I can't Login User/Pass in file Web.config, check User: admin and Pass: 123if (Membership.ValidateUser(txtEmail.Text, txtPassword.Text))
{ if (Request.QueryString["ReturnUrl"] != null)
{
FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, false);
}else
{
FormsAuthentication.SetAuthCookie(txtEmail.Text, false);
Session["username"] = txtEmail.Text.Trim();
Response.Redirect(Globals.ApplicationPath + "Logon_Redirect.aspx");//I am debugging and running to the code here and opens the Logon_Redirect.aspx file but nothing
}
}else//Login SQL Server very good
{// check User/pass other on SQL Serverif (webapp4U.BOL.User.CheckUserName(txtEmail.Text) && txtPassword.Text == ConfigurationManager.AppSettings["Password"].ToString())
{
FormsAuthentication.SetAuthCookie(txtEmail.Text, false);
Session["username"] = txtEmail.Text.Trim();
Response.Redirect(Globals.ApplicationPath + "Logon_Redirect.aspx");
}else
lblMsg.Text = ResourceManager.GetString("Logon_False");
}
}