/// <summary> /// 从服务器获取report列表 /// </summary> private void GetAllReport() { ClientCloudEyesServer.CloudEyesSoapClient serviceClient = new ClientCloudEyesServer.CloudEyesSoapClient("CloudEyesSoap"); string jsonResult = serviceClient.GetReportsByUserID(SystemConfiguration.LoginUser.User_ID); //把集合放入json中 //反序列化对象 //JavaScriptSerializer js = new JavaScriptSerializer(); //List<Reports> reportsList = js.Deserialize<List<Reports>>(jsonResult); List <Reports> reportsList = JsonConvert.DeserializeObject <List <Reports> >(jsonResult.ToString()); Reports[] tempReports = new Reports[reportsList.Count()]; int i = 0; foreach (Reports report in reportsList) { tempReports[i] = report; i++; } _reports = tempReports; }
/// <summary> /// 检索功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonQuery_Click(object sender, EventArgs e) { //advTreePoints.Nodes.Clear(); //GetAllReport(); // bool isRetrievalByPatient = true; //radioButton2.Checked = false; //radioButton1.Checked = false; if (string.IsNullOrEmpty(textBoxQuery.Text)) { InitTree(); } else if (textBoxQuery.Text == "未审核") { advTreePoints.Nodes.Clear(); foreach (Reports report in _reports) { if (report.IsAudited == false) { AddReportNode(report); } } } else if (textBoxQuery.Text == "已审核") { advTreePoints.Nodes.Clear(); foreach (Reports report in _reports) { if (report.IsAudited == true) { AddReportNode(report); } } } else { //if (isRetrievalByPatient) advTreePoints.Nodes.Clear(); ClientCloudEyesServer.CloudEyesSoapClient serviceClient = new ClientCloudEyesServer.CloudEyesSoapClient("CloudEyesSoap"); //数据库方法 string jsonResult = serviceClient.GetReportInfoByRetrieval(textBoxQuery.Text); List <Reports> reportsList = JsonConvert.DeserializeObject <List <Reports> >(jsonResult.ToString()); Reports[] tempReports = new Reports[reportsList.Count()]; int i = 0; foreach (Reports report in reportsList) { tempReports[i] = report; i++; } _reports = tempReports; foreach (Reports report in _reports) { //advTreePoints.Nodes.Clear(); AddReportNode(report); } } // foreach (Reports report in _reports) // { // if ((textBoxQuery.Text == report.PatientName) || (report.IsAudited == false && textBoxQuery.Text == "未审核") || (report.IsAudited == true && textBoxQuery.Text == "已审核")) // { // advTreePoints.Nodes.Clear(); // AddReportNode(report); // } // } // foreach (Reports report in _reports) // { // if ((textBoxQuery.Text != report.PatientName) || (report.IsAudited != false && textBoxQuery.Text != "未审核") || (report.IsAudited != true && textBoxQuery.Text != "已审核")) // { // AddReportNode(report); // } // } }
/// <summary> /// 用户登录 /// </summary> /// <returns>是否成功</returns> private bool LogOn() { // 设置鼠标繁忙状态,并保留原先的状态 Cursor holdCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; // 已经登录次数 ++ this.LogOnCount++; try { string userName = this.textBoxUser.Text; string password = this.textBoxPassword.Text; ClientCloudEyesServer.CloudEyesSoapClient serviceClient = new ClientCloudEyesServer.CloudEyesSoapClient("CloudEyesSoap"); string jsonResult = serviceClient.Login(userName, password); //把集合放入json中 //反序列化对象 JavaScriptSerializer js = new JavaScriptSerializer(); UserInfo userInfo = js.Deserialize <UserInfo>(jsonResult); //User_ID // check Logon Boolean isLogSuccess = false; if (userInfo != null) { isLogSuccess = true; } if (isLogSuccess == true) { this.buttonConfirm.Enabled = false; SystemConfiguration.LoginUser = userInfo; // 这里是登录功能部分 if (this.Parent == null) { this.DialogResult = DialogResult.OK; //this.Hide(); //Form mainForm = this.Owner; //mainForm.Show(); //mainForm.Refresh(); } // 登录次数归零,允许重新登录 this.LogOnCount = 0; } else { MessageBox.Show("密码输入不正确,请注意大小写!"); this.textBoxPassword.Focus(); this.textBoxPassword.SelectAll(); return(false); } } catch (Exception ex) { throw (ex); } finally { // 已经忙完了 this.Cursor = holdCursor; } return(true); }