private void Login() { PostMessage pm = new PostMessage(); //pm.getCapchta(); bool result = pm.login(tb_loginCode.Text, tb_password.Text, tb_captcha.Text); if (result) { MainView mv = new MainView(); mv.Show(); this.Hide(); } }
private void LoginView_Load(object sender, EventArgs e) { PostMessage pm = new PostMessage(); using (var sr = pm.getCapchta()) { pictureBox1.Image = new Bitmap(sr); if (sr != null) { sr.Close(); sr.Dispose(); } } }
private void btn_getTaskList_Click(object sender, EventArgs e) { PostMessage pm = new PostMessage(); string result = string.Empty; StreamReader strRead = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + "json.txt"); result = strRead.ReadToEnd(); //pm.getTaskList(); System.Data.DataTable table = new System.Data.DataTable("ParentTable"); // Declare variables for DataColumn and DataRow objects. DataColumn column; DataRow row; table.Columns.AddRange(new DataColumn[] { new DataColumn("taskId", typeof(string)), new DataColumn("taskNo", typeof(string)), new DataColumn("agentCode", typeof(string)), new DataColumn("operateDate", typeof(string)), new DataColumn("stageName", typeof(string)), new DataColumn("stateName", typeof(string))}); //table.Columns.Add("taskNo", typeof(string)); Hashtable hs = (Hashtable)JsonUtil.getObject(result); // Create three sets of DataRow objects, // five rows each, and add to DataTable. Hashtable hs1 = (Hashtable)hs["pagingDTO"]; foreach (Hashtable hs2 in (ArrayList)hs1["resultList"]) { row = table.NewRow(); row["taskId"] = hs2["taskId"]; row["taskNo"] = hs2["taskNo"]; row["agentCode"] = ((Hashtable)hs2["agentDTO"])["agentCode"]; row["operateDate"] = hs2["operateDate"]; row["stageName"] = hs2["stageName"]; row["stateName"] = hs2["stateName"]; table.Rows.Add(row); } dvTaskList.Columns.Clear(); //取消dataGridView1按默认方式显示 dvTaskList.AutoGenerateColumns = false; dvTaskList.DataSource = table; DataGridViewTextBoxColumn column1 = new DataGridViewTextBoxColumn(); column1.DataPropertyName = "taskId";//SQL语句得到的列名,可从集合中获得 column1.HeaderText = "Task Id";//列头显示的汉字dtcTimeStamp.Width = 110; dvTaskList.Columns.Add(column1);//最后一定要添加进去 DataGridViewTextBoxColumn column2 = new DataGridViewTextBoxColumn(); column2.DataPropertyName = "taskNo";//SQL语句得到的列名,可从集合中获得 column2.HeaderText = "Task No";//列头显示的汉字dtcTimeStamp.Width = 110; dvTaskList.Columns.Add(column2);//最后一定要添加进去 DataGridViewTextBoxColumn column3 = new DataGridViewTextBoxColumn(); column3.DataPropertyName = "agentCode";//SQL语句得到的列名,可从集合中获得 column3.HeaderText = "IIN";//列头显示的汉字dtcTimeStamp.Width = 110; dvTaskList.Columns.Add(column3);//最后一定要添加进去 DataGridViewTextBoxColumn column4 = new DataGridViewTextBoxColumn(); column4.DataPropertyName = "stageName";//SQL语句得到的列名,可从集合中获得 column4.HeaderText = "progession";//列头显示的汉字dtcTimeStamp.Width = 110; dvTaskList.Columns.Add(column4);//最后一定要添加进去 DataGridViewTextBoxColumn column5 = new DataGridViewTextBoxColumn(); column5.DataPropertyName = "stateName";//SQL语句得到的列名,可从集合中获得 column5.HeaderText = "state";//列头显示的汉字dtcTimeStamp.Width = 110; dvTaskList.Columns.Add(column5);//最后一定要添加进去 DataGridViewButtonColumn column6 = new DataGridViewButtonColumn(); //设定列的名字 column6.Name = "Button"; //在所有按钮上表示"点击阅览" column6.UseColumnTextForButtonValue = true; column6.Text = "Operation"; dvTaskList.Columns.Add(column6);//最后一定要添加进去 }
private void button3_Click(object sender, EventArgs e) { PostMessage post = new PostMessage(); //richTextBox1.Text = post.login(); //richTextBox1.Text = post.getTaskList(); string json = "{\"SERVICE_RESPONSE_CODE\":\"S0005\",\"success\":true,\"pagingDTO\":{\"start\":0,\"limit\":10,\"condition\":{\"dto\":{\"userName\":null,\"agentId\":null,\"agentDTO\":null,\"userId\":null,\"userType\":null,\"loginId\":null,\"userEmail\":null,\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0}},\"totalRecord\":44,\"totalPages\":5,\"resultList\":[{\"userName\":\"xiaoxiao\",\"agentId\":\"20001\",\"agentDTO\":{\"address\":null,\"order\":\"20001\",\"agentName\":\"Comconn Inc.\",\"agentCode\":\"30130840\",\"agentId\":\"20001\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":\"Comconn\",\"city\":null,\"agentPro\":\"2\",\"branchId\":\"105\",\"agentGrade\":\"1\",\"nationName\":\"United States\",\"nationCode\":\"0840\",\"testContractor\":\"Sherry Wu\",\"email\":\"[email protected]\",\"zipCode\":null,\"tel\":\"021-60823337-318\",\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":\"Comconn Inc.\",\"chShotName\":\"Comconn\",\"agentTypeDesc\":null},\"userId\":\"1402543145180\",\"userType\":\"1\",\"loginId\":\"10001\",\"userEmail\":\"[email protected]\",\"userTel\":\"\",\"userRemark\":\"\",\"userFlag\":\"1\",\"userOrder\":999},{\"userName\":\"test001\",\"agentId\":\"20001\",\"agentDTO\":{\"address\":null,\"order\":\"20001\",\"agentName\":\"Comconn Inc.\",\"agentCode\":\"30130840\",\"agentId\":\"20001\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":\"Comconn\",\"city\":null,\"agentPro\":\"2\",\"branchId\":\"105\",\"agentGrade\":\"1\",\"nationName\":\"United States\",\"nationCode\":\"0840\",\"testContractor\":\"Sherry Wu\",\"email\":\"[email protected]\",\"zipCode\":null,\"tel\":\"021-60823337-318\",\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":\"Comconn Inc.\",\"chShotName\":\"Comconn\",\"agentTypeDesc\":null},\"userId\":\"30001\",\"userType\":\"1\",\"loginId\":\"test001\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0},{\"userName\":\"test002\",\"agentId\":\"20002\",\"agentDTO\":{\"address\":null,\"order\":\"20002\",\"agentName\":\"Spitamen Bank\",\"agentCode\":\"30030762\",\"agentId\":\"20002\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"102\",\"agentGrade\":\"1\",\"nationName\":\"Tajikistan\",\"nationCode\":\"0762\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"userId\":\"30002\",\"userType\":\"1\",\"loginId\":\"test002\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0},{\"userName\":\"test003\",\"agentId\":\"20003\",\"agentDTO\":{\"address\":null,\"order\":\"20003\",\"agentName\":\"Russlavbank\",\"agentCode\":\"29280643\",\"agentId\":\"20003\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"102\",\"agentGrade\":\"1\",\"nationName\":\"Russian Federation\",\"nationCode\":\"0643\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"userId\":\"30003\",\"userType\":\"1\",\"loginId\":\"test003\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0},{\"userName\":\"test004\",\"agentId\":\"20004\",\"agentDTO\":{\"address\":null,\"order\":\"20004\",\"agentName\":\"PaySquare (via Omnipay)\",\"agentCode\":\"29510528\",\"agentId\":\"20004\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"107\",\"agentGrade\":\"1\",\"nationName\":\"Netherlands\",\"nationCode\":\"0528\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"userId\":\"30004\",\"userType\":\"1\",\"loginId\":\"test004\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0},{\"userName\":\"test005\",\"agentId\":\"20005\",\"agentDTO\":{\"address\":null,\"order\":\"20005\",\"agentName\":\"PaySquare (via Omnipay) Belgium \",\"agentCode\":\"29510056\",\"agentId\":\"20005\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"107\",\"agentGrade\":\"2\",\"nationName\":\"Belgium\",\"nationCode\":\"0056\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":{\"address\":null,\"order\":\"20004\",\"agentName\":\"PaySquare (via Omnipay)\",\"agentCode\":\"29510528\",\"agentId\":\"20004\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"107\",\"agentGrade\":\"1\",\"nationName\":\"Netherlands\",\"nationCode\":\"0528\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"userId\":\"30005\",\"userType\":\"1\",\"loginId\":\"test005\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0},{\"userName\":\"test006\",\"agentId\":\"20006\",\"agentDTO\":{\"address\":null,\"order\":\"20006\",\"agentName\":\"PaySquare (via Omnipay) Luxembourg \",\"agentCode\":\"29510442\",\"agentId\":\"20006\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"107\",\"agentGrade\":\"2\",\"nationName\":\"Luxembourg\",\"nationCode\":\"0442\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":{\"address\":null,\"order\":\"20004\",\"agentName\":\"PaySquare (via Omnipay)\",\"agentCode\":\"29510528\",\"agentId\":\"20004\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"107\",\"agentGrade\":\"1\",\"nationName\":\"Netherlands\",\"nationCode\":\"0528\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"userId\":\"30006\",\"userType\":\"1\",\"loginId\":\"test006\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0},{\"userName\":\"test007\",\"agentId\":\"20007\",\"agentDTO\":{\"address\":null,\"order\":\"20007\",\"agentName\":\"Spitamen Bank Hongkong\",\"agentCode\":\"30030344\",\"agentId\":\"20007\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"111\",\"agentGrade\":\"2\",\"nationName\":\"Hong Kong\",\"nationCode\":\"0344\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":{\"address\":null,\"order\":\"20002\",\"agentName\":\"Spitamen Bank\",\"agentCode\":\"30030762\",\"agentId\":\"20002\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"102\",\"agentGrade\":\"1\",\"nationName\":\"Tajikistan\",\"nationCode\":\"0762\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"userId\":\"30007\",\"userType\":\"1\",\"loginId\":\"test007\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0},{\"userName\":\"test008\",\"agentId\":\"20008\",\"agentDTO\":{\"address\":null,\"order\":\"20008\",\"agentName\":\"ITAU\",\"agentCode\":\"27540076\",\"agentId\":\"20008\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"105\",\"agentGrade\":\"1\",\"nationName\":\"Brazil\",\"nationCode\":\"0076\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"userId\":\"30008\",\"userType\":\"1\",\"loginId\":\"test008\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0},{\"userName\":\"test009\",\"agentId\":\"20009\",\"agentDTO\":{\"address\":null,\"order\":\"20009\",\"agentName\":\"Closed Joint Stock Company Kyrgyz Investment and Credit Bank\",\"agentCode\":\"27730417\",\"agentId\":\"20009\",\"flag\":\"1\",\"agentType\":\"1\",\"enAgentShotName\":null,\"city\":null,\"agentPro\":\"2\",\"branchId\":\"102\",\"agentGrade\":\"1\",\"nationName\":\"Kyrgyzstan\",\"nationCode\":\"0417\",\"testContractor\":null,\"email\":null,\"zipCode\":null,\"tel\":null,\"fax\":null,\"helpdesk\":null,\"parentAgent\":null,\"chAgentName\":null,\"chShotName\":null,\"agentTypeDesc\":null},\"userId\":\"30009\",\"userType\":\"1\",\"loginId\":\"test009\",\"userEmail\":\"[email protected]\",\"userTel\":null,\"userRemark\":null,\"userFlag\":null,\"userOrder\":0}]}}"; Object obj = JsonUtil.getObject(json); }