private void btnSure_Click(object sender, EventArgs e) { if (txtTerminal_ID.Text.Trim() == "") { UMessageBox.Show("请填写人井编号。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtLongitude.Text.Trim() == "" && txtLatitude.Text.Trim() == "") { UMessageBox.Show("请填写经度纬度。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtTerminal_Phone.Text.Trim() == "") { UMessageBox.Show("请填写终端手机号。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (cbOperator.SelectedIndex == -1) { UMessageBox.Show("请选择值班人员。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (tbReportInterval.Text.Trim() == "" && !isNumber(tbReportInterval.Text.Trim())) { UMessageBox.Show("请填写上报时间间隔。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.DialogResult = DialogResult.OK; terminal_ID = wellInfo.Terminal_ID = txtTerminal_ID.Text.Trim(); wellInfo.Name = txtName.Text.Trim(); wellInfo.Longitude = txtLongitude.Text.Trim(); wellInfo.Latitude = txtLatitude.Text.Trim(); wellInfo.Place = txtPlace.Text.Trim(); wellInfo.Terminal_Phone = txtTerminal_Phone.Text.Trim(); wellInfo.Operator_ID = (int)cbOperator.SelectedValue; reportInterval = int.Parse(tbReportInterval.Text.Trim()); if (_isInsert) { if (wellInfoService.GetWellInfoByTerminal_ID(txtTerminal_ID.Text.Trim()) == null && wellInfoService.GetWellInfoByPhone(txtTerminal_Phone.Text.Trim()) == null) { wellInfoService.InsertWellInfo(wellInfo); wellStateService.InsertWellCurrentStateInfo(wellInfo.Terminal_ID, (int)cbState.SelectedValue); wellInfoService.InsertReportInfo(wellInfo.Terminal_ID, reportInterval); userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "添加人井。", CommonClass.UserName, null, null); } else { UMessageBox.Show("当前人井已存在。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { wellInfoService.UpdateWellInfo(wellInfo); wellStateService.UpdateWellCurrentStateInfo((int)cbState.SelectedValue, wellInfo.Terminal_ID); wellInfoService.UpdateReportInterval(reportInterval, wellInfo.Terminal_ID); userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "更新人井信息。", CommonClass.UserName, null, null); } UMessageBox.Show(this.Text + "成功!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
/// <summary> /// 处理信息 /// </summary> private void DisposeMsg(CSPNType type) { switch (type) { case CSPNType.AlarmInfo: switch (well_State_ID) { case 2: SenAlarmMsg("报警信息", time, realName); break; case 3: SenAlarmMsg("状态信息(低电量报警)", time, realName); break; case 4: SenAlarmMsg("状态信息(烟感报警)", time, realName); break; case 5: SenAlarmMsg("状态信息(烟感低电量报警)", time, realName); break; } wellStateService.UpdateWellCurrentStateInfo(7, terminal_ID); wellInfoService.UpdateReportInfo_Pending(1, terminal_ID); wellInfoService.UpdateReportInfo_Send(7, terminal_ID); GetSMS.UpdateMap(terminal_ID); if (refreshMessageDelegate != null) { refreshMessageDelegate(); } break; case CSPNType.DisposeInfo: switch (well_State_ID) { //case 2: // UpdateDisposeMsg("报警信息", time, realName); // break; //case 3: // UpdateDisposeMsg("状态信息(低电量报警)", time, realName); // break; //case 4: // UpdateDisposeMsg("状态信息(烟感报警)", time, realName); // break; //case 5: // UpdateDisposeMsg("状态信息(烟感低电量报警)", time, realName); // break; case 7: UpdateDisposeMsg("报警信息", time, realName); break; } wellStateService.UpdateWellCurrentStateInfo(1, terminal_ID); wellInfoService.UpdateReportInfo_Send(1, terminal_ID); GetSMS.UpdateMap(terminal_ID); break; case CSPNType.NotReportInfo: CDMASMS.SendCHNSms(string.Format("位于:{0}的{1}已经{2}天或超过{2}天未发送信息。", place, terminal_Name, ReadWriteXml.ReadXml("NotReportTimes")), phone); wellInfoService.Empty_NotReportNumInfo(terminal_ID); userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "处理未上报信息。", CommonClass.UserName, null, null); break; } }
//确定添加/更新 private void btnSure_Click(object sender, EventArgs e) { operatorInfo = new OperatorInfo() { Area = txtArea.Text.Trim(), //区域 Work_ID = txtWorkID.Text.Trim(), //工号 RealName = txtName.Text.Trim(), //姓名 Telephone = txtTelephone.Text.Trim(), //联系方式 Gender = cmbGender.SelectedItem.ToString().Trim(), //性别 ReceiveMsg = cmbreceive.SelectedItem.ToString().Trim(), //接收消息 }; if (txtWorkID.Text.Trim() == "") { UMessageBox.Show("请输入值班人员工号!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtName.Text.Trim() == "") { UMessageBox.Show("请输入值班人员姓名!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtTelephone.Text.Trim() == "") { UMessageBox.Show("请输入值班人员手机号!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //添加 if (_isInsert) { if (userService.GetOperatorByWork_ID(txtWorkID.Text.Trim()) != null) { UMessageBox.Show("该值班人员已存在,请勿重复添加!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int a = userService.InsertOperatorInfo(operatorInfo); if (a > 0) { UMessageBox.Show("数据添加成功!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "添加值班人员。", CommonClass.UserName, null, null); this.Close(); } else { UMessageBox.Show("数据添加失败!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } //更新 else { int a = userService.UpdateOperatorInfo(operatorInfo); if (a > 0) { UMessageBox.Show("数据修改成功!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "更新值班人员信息。", CommonClass.UserName, null, null); this.Close(); } else { UMessageBox.Show("数据修改失败!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
//确定添加/更新 private void btnSure_Click(object sender, EventArgs e) { usersInfo = new UsersInfo() { Work_ID = txtWorkID.Text.Trim(), //工号 RealName = txtRealName.Text.Trim(), //姓名 Gender = cmbGender.SelectedItem.ToString().Trim(), //性别 Telephone = txtTelephone.Text.Trim(), //联系方式 UserName = txtUserName.Text.Trim(), //用户名 PassWord = txtPassWord.Text.Trim() //密码 }; if (txtWorkID.Text.Trim() == "") { UMessageBox.Show("请输入人员工号!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtRealName.Text.Trim() == "") { UMessageBox.Show("请输入人员姓名!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtTelephone.Text.Trim() == "") { UMessageBox.Show("请输入人员手机号!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (userService.GetUsersByUserName(txtUserName.Text.Trim()) != null) { UMessageBox.Show("该用户名已存在,请修改!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //添加 if (_isInsert) { if (userService.GetUsersByWork_ID(txtWorkID.Text.Trim()) != null) { UMessageBox.Show("该人员已存在,请勿重复添加!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int a = userService.InsertUserInfo(usersInfo); if (a > 0) { UMessageBox.Show("数据添加成功!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "添加用户信息。", CommonClass.UserName, null, null); this.Close(); } else { UMessageBox.Show("数据添加失败!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } //更新 else { int a = userService.UpdateUserInfo(usersInfo); if (a > 0) { UMessageBox.Show("数据修改成功!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "更新用户信息。", CommonClass.UserName, null, null); this.Close(); } else { UMessageBox.Show("数据修改失败!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }