示例#1
0
        private void delete_Click(object sender, EventArgs e)
        {
            var stamping = new StampingDao().SetStampingDto(this.StampingTable);

            this.SelectedRows = dataGridView1.SelectedRows;
            string      message          = "";
            StampingDto selectedStamping = null;

            if (this.SelectedRows.Count != 0)
            {
                for (var i = 0; i < this.SelectedRows.Count; i++)
                {
                    selectedStamping = stamping[this.SelectedRows[i].Index];
                    message         += "\n" + selectedStamping.Attendance.ToString("yyyy/MM/dd");
                }

                DialogResult result = MessageBox.Show(message + "のレコードを削除します。", "", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK)
                {
                    for (var i = 0; i < this.SelectedRows.Count; i++)
                    {
                        selectedStamping = stamping[this.SelectedRows[i].Index];
                        new StampingDao().DeleteRecord(selectedStamping);
                    }
                }
                this.SetGredView();
            }
        }
示例#2
0
        private void delete_Click(object sender, EventArgs e)
        {
            var stamping = new StampingDao().SetStampingDto(this.StampingTable);

            this.SelectedRows = dataGridView1.SelectedRows;
            string message         = "";
            var    selectStampings = this.GetSelectedRecords();

            if (this.SelectedRows.Count != 0)
            {
                foreach (var selectStamping in selectStampings)
                {
                    message += "\n" + selectStamping.Attendance.ToString("yyyy/MM/dd");
                }
                DialogResult result = MessageBox.Show(message + "のレコードを削除します。", "", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK)
                {
                    foreach (var selectStamping in selectStampings)
                    {
                        new StampingDao().DeleteRecord(selectStamping);
                    }
                }
                this.SetGredView();
            }
        }
示例#3
0
        private List <StampingDto> GetSelectedRecords()
        {
            var stamping = new StampingDao().SetStampingDto(this.StampingTable);

            this.SelectedRows = dataGridView1.SelectedRows;
            List <StampingDto> SelectStampings = new List <StampingDto>();

            for (var i = 0; i < this.SelectedRows.Count; i++)
            {
                SelectStampings.Add(stamping[this.SelectedRows[i].Index]);
            }
            return(SelectStampings);
        }
示例#4
0
        private void edit_Click_1(object sender, EventArgs e)
        {
            var stamping = new StampingDao().SetStampingDto(this.StampingTable);

            this.SelectedRows = dataGridView1.SelectedRows;
            if (this.SelectedRows.Count == 1)
            {
                var editRecordForm = new EditRecordForm(cmbEmployee1.GetSelectedEmployee(), stamping[this.SelectedRows[0].Index]);
                if (System.Windows.Forms.DialogResult.OK == editRecordForm.ShowDialog())
                {
                    this.SetGredView();
                }
            }
            else
            {
                MessageBox.Show("編集する打刻レコードを1行選択してください。");
            }
        }
示例#5
0
        public void SaveFileDialog(string startPoint, string endPoint)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName         = "attendance.csv";
            sfd.InitialDirectory = @"C:\Users\user\Desktop\test";
            sfd.Filter           = "TXTファイル|*.txt|CSVファイル|*.csv|すべてのファイル|*.*";
            sfd.FilterIndex      = 2;
            sfd.Title            = "保存先のファイルを選択してください";



            //ダイアログを表示する
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                //OKボタンがクリックされたとき、選択されたファイル名を表示する
                var Stampinglists = new StampingDao().GetTermStamping(startPoint, endPoint);
                Console.WriteLine($"{sfd.FileName}{Stampinglists}");
                this.WriteCsv(sfd.FileName, false, Stampinglists);
            }
        }