예제 #1
0
        private void button_issueSickLeaveCert_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }

            int nDays = int.Parse(((dateTimePicker_sickLeaveEnd.Value - dateTimePicker_sickLeaveStart.Value).Days + 1).ToString());

            if (nDays < 1)
            {
                MessageBox.Show("病假結束日期不能早於開始日期", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ConsultationMgr consMgr = new ConsultationMgr();
            int             certId  = consMgr.issue_sick_leave_cert(int.Parse((listView1.SelectedItems[0].Text).ToString()), dateTimePicker_sickLeaveStart.Value.ToString("dd/MM/yyyy"), dateTimePicker_sickLeaveEnd.Value.ToString("dd/MM/yyyy"), nDays);

            if (certId > 0)
            {
                rptViewer.prepareSickLeaveCert(certId);
                rptViewer.ShowDialog();
            }
            else if (certId == -1)
            {
                MessageBox.Show("現時距離診症完成時間已超24小時, 不能補發病假證明書", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (certId == -2)
            {
                MessageBox.Show("病假開始日期不能早於診症日期", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void button_issueSickLeaveCert_Click(object sender, EventArgs e)
        {
            int certId = consMgr.issue_sick_leave_cert(int.Parse(consId), dateTimePicker_sickLeaveStart.Value.ToString("dd/MM/yyyy"), dateTimePicker_sickLeaveEnd.Value.ToString("dd/MM/yyyy"), int.Parse(textBox_sickLeaveNDays.Text));

            if (certId > 0)
            {
                ReportViewer rptViewer = new ReportViewer();
                rptViewer.prepareSickLeaveCert(certId);
                rptViewer.ShowDialog();
            }
            else if (certId == -1)
            {
                MessageBox.Show("現時距離診症完成時間已超24小時, 不能補發病假證明書", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (certId == -2)
            {
                MessageBox.Show("病假開始日期不能早於診症日期", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }