private void btnSave_Click(object sender, EventArgs e) { if (dtpSdate.Value > dtpEdate.Value) { MessageBox.Show("시작일과 종료일을 확인해주세요"); this.DialogResult = DialogResult.None; return; } bool bResult = false; ShiftVO vo = new ShiftVO(); ShiftService S_service = new ShiftService(); vo.m_id = int.Parse(cboM_code.SelectedValue.ToString()); vo.shift_id = cboShiftID.SelectedValue.ToString(); vo.shift_stime = txtStime.Text; vo.shift_etime = txtEtime.Text; vo.shift_sdate = dtpSdate.Value.ToShortDateString(); vo.shift_edate = dtpEdate.Value.ToShortDateString(); vo.shift_udate = txtUdate.Text; vo.shift_uadmin = txtUadmin.Text; vo.shift_yn = cboYN.Text; vo.shift_comment = txtComment.Text; if (mode == EditMode.Input) { bResult = S_service.InsertShift(vo); this.DialogResult = DialogResult.OK; if (bResult) { this.DialogResult = DialogResult.OK; } else if (!bResult) { this.DialogResult = DialogResult.None; return; } } if (mode == EditMode.Update) { vo.s_id = Convert.ToInt32(lblID.Text); bResult = S_service.UpdateShift(vo); if (bResult) { this.DialogResult = DialogResult.OK; } else if (!bResult) { this.DialogResult = DialogResult.None; return; } } }
private void btnInsert_Click(object sender, EventArgs e) { ShiftService S_service = new ShiftService(); ShiftPop frm = new ShiftPop(ShiftPop.EditMode.Input); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); SetBottomStatusLabel("Shift정보 등록성공"); MessageBox.Show("Shift정보 등록성공"); } }
private void ShiftPop_Load(object sender, EventArgs e) { ShiftService S_service = new ShiftService(); InitComboBind(); if (mode == EditMode.Update) { ShiftVO vo = S_service.GetShiftByID(Convert.ToInt32(lblID.Text)); cboM_code.Text = vo.m_code; cboShiftID.Text = vo.shift_name; txtStime.Text = vo.shift_stime; txtEtime.Text = vo.shift_etime; dtpSdate.Value = Convert.ToDateTime(vo.shift_sdate); dtpEdate.Value = Convert.ToDateTime(vo.shift_edate); cboYN.Text = vo.shift_yn; txtComment.Text = vo.shift_comment; txtUadmin.Text = vo.shift_uadmin; txtUdate.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", today); } }