private void btnModify_Click(object sender, EventArgs e) { try { lblErr.Text = ""; if (ddlClassAdd.SelectedValue.ToString() == "0") { lblErr.ForeColor = Color.Red; lblErr.Text = "班制不能选所有!"; return; } if (ddlTimerIntervalAdd.SelectedValue.ToString() == "0") { lblErr.ForeColor = Color.Red; lblErr.Text = "时段不能选所有!"; return; } if (txtBlockAdd.Text.Trim() == "") { lblErr.ForeColor = Color.Red; lblErr.Text = "标识卡不能为空!"; return; } if (txtUserNameAdd.Text.Trim() == "") { lblErr.ForeColor = Color.Red; lblErr.Text = "姓名不能为空!"; return; } if (dtpEndTimeAdd.Value > DateTime.Now) { lblErr.ForeColor = Color.Red; lblErr.Text = "下班时间不能大于当前时间!"; return; } if (dtpDataAttendanceAdd.Value > DateTime.Now) { lblErr.ForeColor = Color.Red; lblErr.Text = "记工日期不能大于当前时间!"; return; } if (dtpBeginTimeAdd.Value > dtpEndTimeAdd.Value) { lblErr.ForeColor = Color.Red; lblErr.Text = "上班时间不能大于下班时间!"; return; } ham.BlockID = Convert.ToInt32(txtBlockAdd.Text.Trim()); ham.EmployeeName = txtUserNameAdd.Text; // ham.DeptID = Convert.ToInt32(ddlDeptAdd.SelectedValue.ToString()); ham.TimerIntervalID = Convert.ToInt32(ddlTimerIntervalAdd.SelectedValue.ToString()); ham.ClassShortName = ddlTimerIntervalAdd.Text.ToString(); ham.ClassID = Convert.ToInt32(ddlClassAdd.SelectedValue.ToString()); ham.BeginWorkTime = dtpBeginTimeAdd.Value.ToString(); ham.EndWorkTime = dtpEndTimeAdd.Value.ToString(); ham.DataAttendance = dtpDataAttendanceAdd.Value.ToString(); ham.Remark = txtRemark.Text.Trim(); if (cbOutStation.Text == "无") { lblErr.ForeColor = Color.Red; lblErr.Text = "出井分站不能选无!"; return; } string[] str = this.cbOutStation.SelectedValue.ToString().Split(new char[] { ',' }); DataSave dsave = new DataSave(); if (dsave.SaveCodeSenderInfo(Convert.ToInt32(str[0]), Convert.ToInt32(str[1]), 0, 0, Convert.ToDateTime(ham.EndWorkTime), ham.BlockID.ToString(), true)) { dsave.SaveCodeSenderInfo(Convert.ToInt32(str[0]), Convert.ToInt32(str[1]), 0, 1, Convert.ToDateTime(ham.EndWorkTime).AddSeconds(16), ham.BlockID.ToString(), true); //aBLL.InertHistoryOutStationAndDeleteRealTimeInStation(ham.BlockID, Convert.ToDateTime(ham.EndWorkTime), Convert.ToInt32(str[0]), Convert.ToInt32(str[1]), out strErr); //aBLL.GetEmployeeAttendanceRealTimeInsertAndDelete(ham, out strErr); //if (strErr.ToString() == "Succeeds") //{ // aBLL.GetEmployeeAttendanceRealTimeDelete(ham.BlockID, out strErr); //存入日志 LogSave.Messages("[AttendanceRealTime]", LogIDType.UserLogID, "实时考勤补单,部门为:" + textBox_dep.Text + ",发码器编号:" + txtBlockAdd.Text + ",员工姓名:" + txtUserNameAdd.Text + ",上班时间:" + dtpBeginTimeAdd.Value.ToString("yyyy-MM-dd HH:mm:ss") + ",下班时间为:" + dtpEndTimeAdd.Value.ToString("yyyy-MM-dd HH:mm:ss") + "。"); bt_Save.Enabled = false; lblErr.ForeColor = Color.Black; lblErr.Text = "保存成功!"; frmARt.RefreshBackUp(); //} } else { lblErr.ForeColor = Color.Red; lblErr.Text = "保存失败!"; } } catch { lblErr.Text = "填写格式不正确"; lblErr.ForeColor = Color.Red; } }