Exemplo n.º 1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            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;
            }

            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();

            //存入日志
            LogSave.Messages("[AttendanceRealTime]", LogIDType.UserLogID, "实时考勤补单,部门编号为:"
                             + ham.DeptID.ToString() + ",发码器编号:" + ham.BlockID.ToString() + ",员工姓名:" + ham.EmployeeName
                             + ",上班时间:" + ham.BeginWorkTime + "。");


            if (cbOutStation.Text == "无")
            {
                lblErr.Text = "<font color=red>出井分站不能选无!</font>";
                return;
            }

            string[] str = this.cbOutStation.SelectedValue.ToString().Split(new char[] { ',' });
            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")
            {
                lblErr.ForeColor  = Color.Blue;
                lblErr.Text       = "补单成功!";
                btnModify.Enabled = false;

                if (!New_DBAcess.IsDouble)
                {
                    BindDataGridView();
                }
                else
                {
                    timer1.Start();
                }
            }
        }