private void barButtonItem_DeleteSession_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { string message = "断开所选用户?"; string caption = "消息提示框!"; int selectedRow = gridView9.GetSelectedRows()[0]; DialogResult messageResult = MessageBox.Show(message,caption,MessageBoxButtons.YesNo,MessageBoxIcon.Question); if ( messageResult == DialogResult.Yes ) { int retVal = new UtilSystem().DeleteSessionClient(gridView9.GetDataRow(selectedRow)["session_LoginMac"].ToString()); if ( retVal == 1 ) gridControl_SessionUser.DataSource = new UtilSystem().GetSessionDetails(); else MessageBox.Show("断开操作失败,请重试!"); } }
private void button1_Click(object sender, System.EventArgs e) { DataSet ds = new UtilSystem().GetUploadInfoForXDD(); if (ds != null && ds.Tables.Count == 2) { try { SystemFramework.Util.UploadInfoToXDD(ds.Tables[0].Rows[0]["info_gardenID"].ToString(), ds.Tables[0].Rows[0]["info_gardenName"].ToString(), ds.Tables[1]); MessageBox.Show("数据上传成功!"); } catch(Exception) { MessageBox.Show("数据上传失败!"); } } }
private void DoDownloadData() { while (true) { try { var tuple = new UtilSystem().GetDownloadRevAndID(); if (!string.IsNullOrEmpty(tuple.Item6)) { YlmfDataDownload.StudentInfoDownload.DownloadLog log = null; int totalCount = 0; int succCount = 0; foreach (var student in YlmfDataDownload.StudentInfoDownload.GetDownloadData(tuple.Item6, tuple.Item1, out log)) { try { totalCount++; if (new UtilSystem().InsertDownloadStudentInfo( student.id, student.gradeid, student.gradename, student.gradetype, student.classid, student.className, student.name, student.ValidStudentNumber, student.ValidBirthday, student.ValidGender, student.ValidEnterType, student.ValidEnterDate, student.HasLeftSchool)) { succCount++; } } catch (Exception ex) { SystemFramework.Util.WriteLog(ex.ToString(), SystemFramework.Util.EXCEPTION_LOG_TITLE); } } if (succCount > 0 && log != null) new UtilSystem().InsertDownloadLog(log.lastupttime, log.Raw, succCount, totalCount, 0); totalCount = 0; succCount = 0; YlmfDataDownload.StudentSignInInfoDownload.DownloadLog studentSignInLog = null; foreach (var signIn in YlmfDataDownload.StudentSignInInfoDownload.GetDownloadData(tuple.Item6, tuple.Item3, out studentSignInLog)) { try { totalCount++; if (new UtilSystem().InsertSignIn(signIn.ValidStudentNumber, signIn.Time, signIn.Status)) { succCount++; } } catch (Exception ex) { SystemFramework.Util.WriteLog(ex.ToString(), SystemFramework.Util.EXCEPTION_LOG_TITLE); } } if (succCount > 0 && log != null) new UtilSystem().InsertDownloadLog(log.lastupttime, log.Raw, succCount, totalCount, 2); totalCount = 0; succCount = 0; YlmfDataDownload.TeacherInfoDownload.DownloadLog teacherLog = null; new UtilSystem().InsertDefaultDeptAndDuty(); foreach (var teacher in YlmfDataDownload.TeacherInfoDownload.GetDownloadData(tuple.Item6, tuple.Item2, out teacherLog)) { try { totalCount++; if (new UtilSystem().InsertDownloadTeacherInfo( teacher.id, "教务", "教务", teacher.name, Convert.ToInt32(teacher.teacherNum), teacher.gender == 0 ? "女" : "男")) { succCount++; } } catch (Exception ex) { SystemFramework.Util.WriteLog(ex.ToString(), SystemFramework.Util.EXCEPTION_LOG_TITLE); } } if (succCount > 0 && log != null) new UtilSystem().InsertDownloadLog(log.lastupttime, log.Raw, succCount, totalCount, 1); } } catch (Exception ex) { SystemFramework.Util.WriteLog(ex.ToString(), SystemFramework.Util.EXCEPTION_LOG_TITLE); } Thread.Sleep(1000 * 60 * 5); } }
private void OptionsForm_Load(object sender, System.EventArgs e) { if ( Thread.CurrentPrincipal.Identity.Name.ToLower() != "admin" ) { xtraTabPage_ComPortSet.PageVisible = false; //xtraTabPage_BatchCreate.PageVisible = false; } else { comboBoxEdit_BatchCreate_Grade.SelectedItem = "全部"; foreach(DataRow getGradeList in optionSystem.getGradeInfo("","",false).Tables[0].Rows) { comboBoxEdit_BatchCreate_Grade.Properties.Items.AddRange( new object[]{getGradeList[1].ToString()}); } } settings = ConfigurationManager.GetConfiguration("CustomizeSettings") as ArrayList; isAutoShutDown = Convert.ToBoolean((settings[2] as XmlNode[])[1].InnerText); shutDownTime = Convert.ToDateTime((settings[3] as XmlNode[])[1].InnerText); textEdit_UpdateAddress.Text = (settings[6] as XmlNode[])[1].InnerText; if(isAutoShutDown) { notePanel2.Visible = true; checkEdit1.Enabled = true; timeEdit_DutyStartTime.Time = shutDownTime; checkEdit2.Checked = true; checkEdit1.Checked = true; } else { notePanel2.Visible = false; checkEdit1.Enabled = false; timeEdit_DutyStartTime.Time = DateTime.Now; checkEdit1.Checked = false; checkEdit2.Checked = false; } int COMNum = Convert.ToInt32((settings[1] as XmlNode[])[1].InnerText); if(COMNum == 1) { radioButton1.Checked = true; } else if(COMNum == 2) { radioButton2.Checked = true; } else if(COMNum == 3) { radioButton3.Checked = true; } else if(COMNum == 4) { radioButton4.Checked = true; } DataTable dtGradeNumberList = optionSystem.GetGradeNumberList(); comboBoxEdit_GradeNumber.Properties.Items.Clear(); if ( dtGradeNumberList.Rows.Count > 0 ) { foreach(DataRow dr in dtGradeNumberList.Rows) { comboBoxEdit_GradeNumber.Properties.Items.AddRange( new object[]{dr["info_gradeNumber"].ToString()}); } comboBoxEdit_GradeNumber.SelectedIndex = 0; } else comboBoxEdit_GradeNumber.Properties.Items.AddRange(new object[]{"无法获取年级信息!"}); DataTable dtLoginUser = new UtilSystem().GetSessionDetails(); if ( dtLoginUser != null ) gridControl_SessionUser.DataSource = dtLoginUser; }
//private void UploadDataForXDD() //{ // while (true) // { // int uploadVersion = 1; // try // { // uploadCount = 0; // DataTable dt = new UtilSystem().GetUploadDataForXDD(); // if (dt != null && dt.Rows.Count > 0) // { // SystemFramework.Util.UploadDataToXDD(dt); // } // uploadCount = dt.Rows.Count; // } // catch(Exception ex) // { // SystemFramework.Util.WriteLog(ex.Message, SystemFramework.Util.EXCEPTION_LOG_TITLE); // } // finally // { // uploadVersion++; // } // Thread.Sleep(300000); // } //} //private void UploadInfoforXDD() //{ // DataSet ds = new UtilSystem().GetUploadInfoForXDD(); // if (ds != null && ds.Tables.Count == 2) // { // SystemFramework.Util.UploadInfoToXDD(ds.Tables[0].Rows[0]["info_gardenID"].ToString(), ds.Tables[0].Rows[0]["info_gardenName"].ToString(), ds.Tables[1]); // } //} private void DoUploadData() { while (true) { int uploadVersion = 1; try { uploadCount = 0; uploadTeacherCount = 0; DataTable dt = new UtilSystem().GetUploadDataForYlm(); if (dt != null && dt.Rows.Count > 0) { YlmfDataUploader.StudentInfoUpload.UploadDataToYlmf(dt); } uploadCount = dt.Rows.Count; dt = new UtilSystem().GetUploadDataForYlm_teacher(); if (dt != null && dt.Rows.Count > 0) { YlmfDataUploader.TeacherInfoUpload.UploadDataToYlmf(dt); } uploadTeacherCount = dt.Rows.Count; } catch (Exception ex) { SystemFramework.Util.WriteLog(ex.ToString(), SystemFramework.Util.EXCEPTION_LOG_TITLE); } finally { uploadVersion++; } Thread.Sleep(300000); } }
public Login() { utilSystem = new UtilSystem(); #if MaxClients int maxClients = utilSystem.GetMaxClients(); if ( maxClients != -1 ) CPTT.SystemFramework.Util.MaxClients = maxClients; else { MessageBox.Show("初始化服务器会话状态时发生严重错误,请与供应商联系!"); return; } #endif _alUnAuthenticatedHardWare = HardWareAuthentication.GetUnAuthorizedHardWare(); _alAuthenticatedHardWare = HardWareAuthentication.GetAuthorizedHardWare(); _registerDays = HardWareAuthentication.GetDaysValid; //显示Splash // Splash splash = new Splash(); // splash.StartPosition = FormStartPosition.CenterScreen; // splash.Show(); //初始化LoginForm InitializeComponent(); userSystem = new UserSystem(); ArrayList settings = ConfigurationManager.GetConfiguration("CustomizeSettings") as ArrayList; isAutoShutDown = Convert.ToBoolean((settings[2] as XmlNode[])[1].InnerText); // shutDownTime = Convert.ToDateTime((settings[3] as XmlNode[])[1].InnerText); if(isAutoShutDown) { timer_AutoShutDown.Enabled = true; } // appUpdater_ForCTPP.UpdateUrl = CPTT.SystemFramework.Util.AUTO_UPDATE_ADDRESS; prepareForCheckThread = new Thread(new ThreadStart(PrepareForCheck)); prepareForCheckThread.IsBackground = true; prepareForCheckThread.Priority = ThreadPriority.Normal; prepareForCheckThread.Start(); //splash.Close(); //初始化查询线程 if(!COM_PORT_IS_BUSY) { handleComClass = new HandleCom(); handleComClass.Start(CPTT.SystemFramework.Util.COM1_PORT_NUMBER,CPTT.SystemFramework.Util.COM_BAUD_RATE,1); handleComClass.DataArrived += new _IHandleComEvents_DataArrivedEventHandler(handleComClass_DataArrived); machineSystem = new MachineSystem(); queryThread = new Thread(new ThreadStart(SendQuery)); queryThread.IsBackground = true; queryThread.Priority = ThreadPriority.Normal; queryThread.Start(); // queryThread = new Thread(new ThreadStart(SendHardWareAuthenticationToken)); // queryThread.IsBackground = true; // queryThread.Priority = ThreadPriority.Normal; // queryThread.Start(); controlFrame = new ControlFrame(); responseFrame = new ControlFrame(); responseFrame.sym = new byte[]{(byte)'*',(byte)'*'}; // responseFrame.desAddr = 1; responseFrame.srcAddr = 0; responseFrame.response = CPTT.SystemFramework.Util.RECEIVE_SUCCESS_TOKEN; responseFrame.seq = CPTT.SystemFramework.Util.FRAME_SEQUENCE_VALUE; handleComData = new HandleComData(this.InsertMorningCheckData); } this.StartPosition = FormStartPosition.CenterScreen; // this.Opacity = 0.0; // Activate(); // Refresh(); // fadeTimer.Start(); // Refresh(); textEdit_UserLoginID.Text=""; textEdit_UserLoginPwd.Text=""; }
private void AssignUniqueGardenID() { bool hasAssigned = new UtilSystem().CheckHasAssignedUniqueGardenID(); if (!hasAssigned) { AddGardenName newAdd = new AddGardenName(); newAdd.StartPosition = FormStartPosition.CenterScreen; newAdd.ShowDialog(); } }
private static void DownloadGrowUpCheckReportData() { while (true) { int totalCount = 0; int succCount = 0; try { var tuple = new UtilSystem().GetDownloadRevAndID(); var reportHistory = new List<dynamic>(); YlmfDataDownload.GrowUpCheckReportDownload.DownloadLog log = null; if (!string.IsNullOrEmpty(tuple.Item6)) { var dt = new ClassSystem().GetGetClassAndGrade(); if (dt != null) { foreach (DataRow row in dt.Rows) { var rev = new UtilSystem().GetDownloadRev(row["info_className"].ToString(), 4); log = YlmfDataDownload.GrowUpCheckReportDownload.GetDownloadData(tuple.Item6, row["info_className"].ToString(), rev); if (log.code == 1) { foreach (var studentReport in log.result.list) { succCount = 1; totalCount = 1; var studentNumber = studentReport.studentNum; var referrerID = studentReport.id; foreach (var report in studentReport.reportList) { reportHistory.Add(new { referrerID = referrerID, studentNo = studentNumber, date = report.time, detail = report.reportDetail }); } new UtilSystem().InsertDownloadLog(log.lastupttime, log.Raw, succCount, totalCount, 4, row["info_className"].ToString()); } } } foreach (var item in reportHistory) { int reportID = 0; new UtilSystem().InsertGrowUpCheckReportHistory(item.studentNo, item.referrerID, item.date, out reportID); if (reportID > 0) { var reportDetail = item.detail as IList<YlmfDataDownload.GrowUpCheckReportDownload.ReportItem>; foreach (var detail in reportDetail) { totalCount++; try { new UtilSystem().InsertGrowUpCheckReportDetail(reportID, detail.resultType, detail.type); succCount++; } catch (Exception ex) { SystemFramework.Util.WriteLog(ex.ToString(), SystemFramework.Util.EXCEPTION_LOG_TITLE); } } } } } } } catch (Exception ex) { SystemFramework.Util.WriteLog(ex.ToString(), SystemFramework.Util.EXCEPTION_LOG_TITLE); } if (succCount == 0) Thread.Sleep(1000 * 60 * 20); } }
public MainForm() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // userStyle = new UserStyle(); MenuDisplayByRole(); //加载皮肤名称集 loadSkinName(); //加载用户选择的窗体风格信息 loadUserStyleProfile(); healthManagementSystem = new HealthManagementSystem(); utilSystem = new UtilSystem(); #if DisableSessionTimeout timerSynSession.Enabled = false; #endif }