static void Main(string[] args) { Console.WriteLine("Hello World!"); String user = ""; String pwd = ""; PublicVariable4CS.ServerIP = INIhelp.GetValue("serverip"); PublicVariable4CS.ServerPort = int.Parse(INIhelp.GetValue("serverport")); Console.WriteLine("请输入用户名!"); PublicVariable4CS.UserName = Console.ReadLine(); Console.WriteLine("请输入密码!"); PublicVariable4CS.PassWord = Console.ReadLine(); getLink(); Console.WriteLine("请输入指令!输入 help 查看指令表"); while (true) { String command = ""; Console.Write("PCC>>:"); command = Console.ReadLine(); commandTable(command); } }
static void getLink() { string link_str = INIhelp.GetValue("link");//读取历史转发记录并自动填写 ipconfigList = new List <Hashtable>(); if (link_str.Length > 0) { string[] links = link_str.Split('|'); for (int i = 0; i < links.Length; i++) { Hashtable hashtable = new Hashtable(); string[] tmp = links[i].Split(';'); string[] tmptmp = tmp[0].Split(':'); hashtable.Add("AG_IP", tmptmp[0]); hashtable.Add("AG_PORT", tmptmp[1]); tmptmp = tmp[1].Split(':'); hashtable.Add("RM_IP", tmptmp[0]); hashtable.Add("RM_PORT", tmptmp[1]); ipconfigList.Add(hashtable); } } }
public Login() { InitializeComponent(); string userid = INIhelp.GetValue("userid"); string userpwd = INIhelp.GetValue("userpwd"); string serverIp = INIhelp.GetValue("serverip"); string serverPort = INIhelp.GetValue("serverport"); string saveUser = INIhelp.GetValue("saveuser"); if (!"false".Equals(INIhelp.GetValue("isNewVersion"))) { updateMessage updateM = new updateMessage(); INIhelp.SetValue("isNewVersion", "false"); updateM.ShowDialog(); // 模式窗体 } this.serverIP.Text = serverIp; this.serverPort.Text = serverPort; this.userName.Text = userid; this.passWord.Text = userpwd; if ("true" == saveUser) { this.saveUsername.Checked = true; } else { this.saveUsername.Checked = false; } }
private IEnumerable <t_finace> GetFinacesWithPlateType(int order, string date1, string date2, string ptype, int index) { string key = "Codes"; float rate = -100; var codeArray = INIhelp.GetValue(key, ptype).Split(','); var t_finaces = proc.ProcServer.ExecFinanceProc(rate, order, date1, date2.IsDateTime() ? date2 : date1); var pd = t_finaces.Where(d => codeArray.Contains(d.Code)).ToList().ToPagedList(index, pageSize); return(pd); }
public static void saveConfig() { String links = ""; for (int i = 0; i < ipconfigList.Count; i++) { links += (ipconfigList[i]["AG_IP"] + ":" + ipconfigList[i]["AG_PORT"] + ";" + ipconfigList[i]["RM_IP"] + ":" + ipconfigList[i]["RM_PORT"]); if (i != (ipconfigList.Count - 1)) { links += "|"; } } INIhelp.SetValue("link", links); }
static void Main(string[] args) { int serverPort = int.Parse(INIhelp.GetValue("port")); Boolean offline = false; if (INIhelp.GetValue("offline") == "true") { offline = true; } TcpListener tl = new TcpListener(serverPort); //IPEndPoint ipe = new IPEndPoint(serverPort); tl.Start(); while (true) { try { TcpClient tc1 = tl.AcceptTcpClient();//这里是等待数据再执行下边,不会100%占用cpu Console.WriteLine("线程数:" + threadCount); NetworkStream ns1 = tc1.GetStream(); byte[] bt = new byte[10240]; int count = ns1.Read(bt, 0, bt.Length); string str = System.Text.Encoding.UTF8.GetString(bt); Hashtable message = getMessages(str); Hashtable reMessage = new Hashtable(); if ((string)message["TYPE"] == "LOGIN") { float ver = float.Parse((string)message["VER"]); if (ver < float.Parse(INIhelp.GetValue("ver"))) { reMessage.Add("TYPE", "LOGIN-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "客户端版本过低!当前版本 v" + ver + ",请更新至 v" + INIhelp.GetValue("ver")); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } if (!offline) { DataTable dt = queryUserLoginMessage((string)message["USER"]); if (dt.Rows.Count <= 0) { reMessage.Add("TYPE", "LOGIN-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "用户不存在!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } String pwd = dt.Rows[0]["PASSWORD"].ToString(); String username = dt.Rows[0]["userdesc"].ToString(); String inherit = dt.Rows[0]["inherit"].ToString(); if ((string)message["PWD"] == pwd) { reMessage.Add("TYPE", "LOGIN-RE"); reMessage.Add("RE_ANSWER", "TRUE"); reMessage.Add("USERDESC", username); if (inherit == "admin") { reMessage.Add("INHERIT", "ADMIN"); } else { reMessage.Add("INHERIT", "USER"); } byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } else { reMessage.Add("TYPE", "LOGIN-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "密码错误!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } continue; } else { if ((string)message["USER"] == "zdkj") { if ((string)message["PWD"] == "scyy@68669820") { reMessage.Add("TYPE", "LOGIN-RE"); reMessage.Add("RE_ANSWER", "TRUE"); reMessage.Add("USERDESC", "离线管理账户"); reMessage.Add("INHERIT", "ADMIN"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } } else { reMessage.Add("TYPE", "LOGIN-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "用户不存在!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } continue; } } else if ((string)message["TYPE"] == "CONNECT") { float ver = float.Parse((string)message["VER"]); if (ver < float.Parse(INIhelp.GetValue("ver"))) { reMessage.Add("TYPE", "CONNECT-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "客户端版本过低!当前版本 v" + ver + ",请更新至 v" + INIhelp.GetValue("ver")); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } if (!offline) { DataTable dt = queryUserLicense((string)message["USER"], (string)message["PWD"], (string)message["TOTAL_IP"], (string)message["TOTAL_PORT"]); if (int.Parse(dt.Rows[0]["License"].ToString()) <= 0) { reMessage.Add("TYPE", "CONNECT-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "权限不足"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } else { try { TcpClient tc2 = new TcpClient((string)message["TOTAL_IP"], int.Parse((string)message["TOTAL_PORT"])); ThreadMessage threadMessage1 = new ThreadMessage(); ThreadMessage threadMessage2 = new ThreadMessage(); threadMessage1.TOTAL_IP = (string)message["TOTAL_IP"]; threadMessage2.TOTAL_IP = (string)message["TOTAL_IP"]; threadMessage1.TOTAL_PORT = (string)message["TOTAL_PORT"]; threadMessage2.TOTAL_PORT = (string)message["TOTAL_PORT"]; reMessage.Add("TYPE", "CONNECT-RE"); reMessage.Add("RE_ANSWER", "TRUE"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); threadMessage1.tc1 = tc1; threadMessage1.tc2 = tc2; threadMessage2.tc1 = tc2; threadMessage2.tc2 = tc1; threadMessage1.type = "user"; threadMessage2.type = "target"; //object obj1 = (object)(new TcpClient[] { tc1, tc2 }); //object obj2 = (object)(new TcpClient[] { tc2, tc1 }); object obj1 = (object)threadMessage1; object obj2 = (object)threadMessage2; ThreadPool.QueueUserWorkItem(new WaitCallback(transfer), obj1); ThreadPool.QueueUserWorkItem(new WaitCallback(transfer), obj2); } catch (Exception ex) { reMessage.Add("TYPE", "CONNECT-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", ex.Message); byte[] byteArray1 = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray1, 0, byteArray1.Length); continue; } //TcpClient tc2 = new TcpClient("172.30.200.50", 3389); } continue; } else { try { TcpClient tc2 = new TcpClient((string)message["TOTAL_IP"], int.Parse((string)message["TOTAL_PORT"])); reMessage.Add("TYPE", "CONNECT-RE"); reMessage.Add("RE_ANSWER", "TRUE"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); object obj1 = (object)(new TcpClient[] { tc1, tc2 }); object obj2 = (object)(new TcpClient[] { tc2, tc1 }); ThreadPool.QueueUserWorkItem(new WaitCallback(transfer), obj1); ThreadPool.QueueUserWorkItem(new WaitCallback(transfer), obj2); } catch (Exception ex) { reMessage.Add("TYPE", "CONNECT-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", ex.Message); byte[] byteArray1 = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray1, 0, byteArray1.Length); continue; } continue; } } else if ((string)message["TYPE"] == "CHANGPWD") { float ver = float.Parse((string)message["VER"]); if (ver < float.Parse(INIhelp.GetValue("ver"))) { reMessage.Add("TYPE", "CHANGPWD-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "客户端版本过低!当前版本 v" + ver + ",请更新至 v" + INIhelp.GetValue("ver")); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } DataTable dt = queryUserLoginMessage((string)message["USER"]); if (dt.Rows.Count <= 0) { reMessage.Add("TYPE", "CHANGPWD-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "用户不存在!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } String pwd = dt.Rows[0]["PASSWORD"].ToString(); String username = dt.Rows[0]["userdesc"].ToString(); String inherit = dt.Rows[0]["inherit"].ToString(); if ((string)message["PWD"] == pwd) { updateUserPwd((string)message["USER"], (string)message["NEWPWD"]); reMessage.Add("TYPE", "CHANGPWD-RE"); reMessage.Add("RE_ANSWER", "TRUE"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } else { reMessage.Add("TYPE", "CHANGPWD-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "原密码错误!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } } else if ((string)message["TYPE"] == "CHANGENAME") { float ver = float.Parse((string)message["VER"]); if (ver < float.Parse(INIhelp.GetValue("ver"))) { reMessage.Add("TYPE", "CHANGENAME-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "客户端版本过低!当前版本 v" + ver + ",请更新至 v" + INIhelp.GetValue("ver")); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } DataTable dt = queryUserLoginMessage((string)message["USER"]); if (dt.Rows.Count <= 0) { reMessage.Add("TYPE", "CHANGENAME-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "用户不存在!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } String pwd = dt.Rows[0]["PASSWORD"].ToString(); String username = dt.Rows[0]["userdesc"].ToString(); String inherit = dt.Rows[0]["inherit"].ToString(); if ((string)message["PWD"] == pwd) { updateUserName((string)message["USER"], (string)message["NEWDESC"]); reMessage.Add("TYPE", "CHANGENAME-RE"); reMessage.Add("RE_ANSWER", "TRUE"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } else { reMessage.Add("TYPE", "CHANGENAME-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "原密码错误!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } } else if ((string)message["TYPE"] == "RESET-USER-PWD") { float ver = float.Parse((string)message["VER"]); if (ver < float.Parse(INIhelp.GetValue("ver"))) { reMessage.Add("TYPE", "RESET-USER-PWD-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "客户端版本过低!当前版本 v" + ver + ",请更新至 v" + INIhelp.GetValue("ver")); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } DataTable dt = queryUserLoginMessage((string)message["USER"]); if (dt.Rows.Count <= 0) { reMessage.Add("TYPE", "RESET-USER-PWD-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "用户不存在!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); continue; } String pwd = dt.Rows[0]["PASSWORD"].ToString(); String username = dt.Rows[0]["userdesc"].ToString(); String inherit = dt.Rows[0]["inherit"].ToString(); if ((string)message["PWD"] == pwd) { updateTargetUserPwd((string)message["TARGET-USER"]); reMessage.Add("TYPE", "RESET-USER-PWD-RE"); reMessage.Add("RE_ANSWER", "TRUE"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } else { reMessage.Add("TYPE", "CHANGENAME-RE"); reMessage.Add("RE_ANSWER", "FALSE"); reMessage.Add("RE_MESSAGE", "你的密码错误!"); byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(setMessages(reMessage)); ns1.Write(byteArray, 0, byteArray.Length); } } else { continue; } } catch (Exception ex) { errorMessage(ex); } } }
/// <summary> /// 启动服务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void startPort_Click(object sender, EventArgs e) { if (PublicVariable4CS.portOpen) { PublicVariable4CS.portOpen = !PublicVariable4CS.portOpen; this.toolStripMenuItem2.Text = "开启端口映射"; //this.startPort.Visible = false; } else { PublicVariable4CS.portOpen = !PublicVariable4CS.portOpen; this.toolStripMenuItem2.Text = "停止端口映射"; this.startPort.Visible = false; int ret = this.portList.Rows.Count; if (ret > 0) { for (int i = 0; i < ret - 1; i++) { DataGridViewRow tmpRow = this.portList.Rows[i]; int[] tmpPorts = new int[2]; String[] tmpIPs = new String[2]; try { tmpIPs[0] = tmpRow.Cells[0].Value.ToString(); tmpIPs[1] = tmpRow.Cells[2].Value.ToString(); tmpPorts[0] = int.Parse(tmpRow.Cells[1].Value.ToString()); tmpPorts[1] = int.Parse(tmpRow.Cells[3].Value.ToString()); }catch (Exception ex) { MessageBox.Show("第" + (i + 1) + "行不符合规范!"); return; } try { object listenPort = (object)(new String[] { tmpPorts[0] + "", tmpIPs[1] + ":" + tmpPorts[1] }); ThreadPool.QueueUserWorkItem(new WaitCallback(localListener1), listenPort); } catch (Exception ex) { MessageBox.Show("启动监听程序时发生错误:" + ex.ToString()); } } string links = ""; string host = ""; for (int i = 0; i < ret - 1; i++) { try { DataGridViewRow tmpRow = this.portList.Rows[i]; links += tmpRow.Cells[0].Value.ToString(); links += ":"; links += tmpRow.Cells[1].Value.ToString(); links += ";"; links += tmpRow.Cells[2].Value.ToString(); links += ":"; links += tmpRow.Cells[3].Value.ToString(); if (i != (ret - 2)) { links += "|"; } host += ("127.0.0.1:" + tmpRow.Cells[0].Value.ToString() + "|"); } catch (Exception ex) { MessageBox.Show("第" + (i + 1) + "行不符合规范!"); return; } } if (PublicVariable4CS.UAC) { updateHosts(host); } else { MessageBox.Show("权限不足,代理地址无法使用,请使用127.0.0.1加代理端口号进行端口转发"); } INIhelp.SetValue("link", links); } } }
public mainForm() { InitializeComponent(); Login login = new Login(); login.Visible = false; login.ShowDialog(); this.userDesc.Text = PublicVariable4CS.UserDesc; if (!PublicVariable4CS.login) { Environment.Exit(0); } string link_str = INIhelp.GetValue("link");//读取历史转发记录并自动填写 if (link_str.Length > 0) { string[] links = link_str.Split('|'); for (int i = 0; i < links.Length; i++) { this.portList.Rows.Add(); DataGridViewRow dgvr = this.portList.Rows[i]; string[] tmp = links[i].Split(';'); string[] tmptmp = tmp[0].Split(':'); dgvr.Cells[0].Value = tmptmp[0]; dgvr.Cells[1].Value = tmptmp[1]; tmptmp = tmp[1].Split(':'); dgvr.Cells[2].Value = tmptmp[0]; dgvr.Cells[3].Value = tmptmp[1]; } } label1.BackColor = Color.Transparent; userDesc.BackColor = Color.Transparent; startPort.BackColor = Color.Transparent; this.toolStripMenuItem2.Text = "开启端口映射"; if (PublicVariable4CS.INHERIT == "ADMIN") { this.adminBox.Visible = false; } else { this.adminBox.Visible = false; } /*this.portList.Rows.Add(); * * * DataGridViewRow dgvr = this.portList.Rows[0]; * dgvr.Cells[0].Value = 3; * dgvr.Cells[1].Value = "直接添加一行"; * dgvr.Cells[2].Value = 3; * dgvr.Cells[3].Value = "直接添加一行";*/ }
private void button1_Click(object sender, EventArgs e) { if (this.saveUsername.Checked) { INIhelp.SetValue("userid", this.userName.Text); INIhelp.SetValue("userpwd", this.passWord.Text); INIhelp.SetValue("serverip", this.serverIP.Text); INIhelp.SetValue("serverport", this.serverPort.Text); INIhelp.SetValue("saveuser", "true"); } else { INIhelp.SetValue("userid", ""); INIhelp.SetValue("userpwd", ""); INIhelp.SetValue("saveuser", "false"); } PublicVariable4CS.UserName = this.userName.Text; PublicVariable4CS.PassWord = this.passWord.Text; PublicVariable4CS.ServerIP = this.serverIP.Text; PublicVariable4CS.ServerPort = int.Parse(this.serverPort.Text); PublicVariable4CS.SaveUser = this.saveUsername.Checked; PublicVariable4CS.ver = 2.0; PublicVariable4CS.serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress ip = IPAddress.Parse(PublicVariable4CS.ServerIP); IPEndPoint point = new IPEndPoint(ip, PublicVariable4CS.ServerPort); try { //绑定IP地址和端口号 PublicVariable4CS.serverSocket.Connect(point); Hashtable sendTable = new Hashtable(); sendTable.Add("VER", PublicVariable4CS.ver); sendTable.Add("TYPE", "LOGIN"); sendTable.Add("USER", PublicVariable4CS.UserName); sendTable.Add("PWD", PublicVariable4CS.PassWord); //发送登录信息 PublicVariable4CS.serverSocket.Send(Encoding.UTF8.GetBytes(PublicVariable4CS.setMessages(sendTable))); byte[] dat = new byte[2048]; String data = System.Text.Encoding.UTF8.GetString(dat, 0, PublicVariable4CS.serverSocket.Receive(dat)); Hashtable getTable = PublicVariable4CS.getMessages(data); if ((string)getTable["TYPE"] == "LOGIN-RE") { if ((string)getTable["RE_ANSWER"] == "TRUE") { PublicVariable4CS.UserDesc = (string)getTable["USERDESC"]; PublicVariable4CS.INHERIT = (string)getTable["INHERIT"]; PublicVariable4CS.login = true; this.Close(); } else if ((string)getTable["RE_ANSWER"] == "FALSE") { MessageBox.Show("登陆失败:" + (string)getTable["RE_MESSAGE"]); } else { String a = "服务器响应异常!" + data; PublicVariable4CS.errorMessage(a); } } else { PublicVariable4CS.errorMessage("答复类型错误:" + (string)getTable["TYPE"]); } } catch (Exception ex) { PublicVariable4CS.errorMessage("服务器连接错误,请检查服务器地址是否正确,并保证网络连接正常!\n" + ex); } ; }
public async Task <JsonResult> GetChanges(string ptype) { IEnumerable <t_change> changesList = new List <t_change>(); Dictionary <string, int> dic = new Dictionary <string, int>(); if (String.IsNullOrEmpty(ptype)) { return(Json(changesList)); } if (int.TryParse(ptype, out int _page)) { int _size = 10; int _skip = _page * _size; changesList = await(from v in db.ChangesList where v.Date_x == db.ChangesList.Max(dx => dx.Date_x) select v) .OrderByDescending(v => v.Change_x - v.Change_9) .ThenByDescending(v => v.Change_9 - v.Change_8) .ThenByDescending(v => v.Change_8 - v.Change_7) .ThenByDescending(v => v.Change_7 - v.Change_6) .ThenByDescending(v => v.Change_6 - v.Change_5) .ThenByDescending(v => v.Change_5 - v.Change_4) .ThenByDescending(v => v.Change_4 - v.Change_3) .ThenByDescending(v => v.Change_3 - v.Change_2) .ThenByDescending(v => v.Change_2 - v.Change_1) .ThenByDescending(v => v.Change_1) .Take(_skip + _size).Skip(_skip).ToArrayAsync(); } else { string key = "Codes"; var codeArray = INIhelp.GetValue(key, ptype).Split(','); changesList = await(from v in db.ChangesList where v.Date_x == db.ChangesList.Max(dx => dx.Date_x) select v).Where(v => codeArray.Contains(v.Code)).OrderByDescending(v => v.Change_x - v.Change_9) .OrderByDescending(v => v.Change_x - v.Change_9) .ThenByDescending(v => v.Change_9 - v.Change_8) .ThenByDescending(v => v.Change_8 - v.Change_7) .ThenByDescending(v => v.Change_7 - v.Change_6) .ThenByDescending(v => v.Change_6 - v.Change_5) .ThenByDescending(v => v.Change_5 - v.Change_4) .ThenByDescending(v => v.Change_4 - v.Change_3) .ThenByDescending(v => v.Change_3 - v.Change_2) .ThenByDescending(v => v.Change_2 - v.Change_1) .ThenByDescending(v => v.Change_1).ToArrayAsync(); dic = TotalSamples(codeArray); } var pd = changesList.Select(d => new { name = String.Format("{0}({1})", d.Name, (dic.ContainsKey(d.Code) ? dic[d.Code].ToString() : "")), type = "line", axis = new string[] { d.Date_1, d.Date_2, d.Date_3, d.Date_4, d.Date_5, d.Date_6, d.Date_7, d.Date_8, d.Date_9, d.Date_x }, data = new decimal?[] { d.Change_1, d.Change_2, d.Change_3, d.Change_4, d.Change_5, d.Change_6, d.Change_7, d.Change_8, d.Change_9, d.Change_x } }); return(Json(pd)); }
public IEnumerable <string> GetPlateCodes(string pkey) { return(INIhelp.GetValue("Codes", pkey).Split(',').AsEnumerable()); }
public IEnumerable <string> GetPlateTypes() { return(INIhelp.GetValue("PlateType", "plateType").Split(',').AsEnumerable()); }