Exemple #1
0
        //완료
        private void GrdDivTbl_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow data = GrdRentalTbl.Rows[e.RowIndex];
                TxtIdx.Text                = data.Cells[0].Value.ToString();
                TxtIdx.ReadOnly            = true;
                CboMemberIdx.SelectedIndex = CboMemberIdx.FindString(data.Cells[1].Value.ToString());
                CboBookIdx.SelectedIndex   = CboBookIdx.FindString(data.Cells[3].Value.ToString());

                DtpRentalDate.CustomFormat = "yyyy-MM-dd";
                DtpRentalDate.Format       = DateTimePickerFormat.Custom;
                DtpRentalDate.Value        = DateTime.Parse(data.Cells[5].Value.ToString());

                if (string.IsNullOrEmpty(data.Cells[6].Value.ToString()))
                {
                    DtpReturnDate.CustomFormat = " ";
                    DtpReturnDate.Format       = DateTimePickerFormat.Custom;
                }
                else
                {
                    DtpReturnDate.CustomFormat = "yyyy-MM-dd";
                    DtpReturnDate.Format       = DateTimePickerFormat.Custom;
                    DtpReturnDate.Value        = DateTime.Parse(data.Cells[6].Value.ToString());
                }
                mode = "UPDATE"; // 수정은 UPDATE
            }
        }
        private void GrdDivTbl_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow data = GrdRentalTbl.Rows[e.RowIndex];
                TxtIdx.Text      = data.Cells[0].Value.ToString(); // ID
                TxtIdx.ReadOnly  = true;                           //Division이 PK라서 변경하면 안 된다.
                TxtIdx.BackColor = Color.Red;

                CboMemberIdx.SelectedIndex = CboMemberIdx.FindString(data.Cells[1].Value.ToString());
                CboBookIdx.SelectedIndex   = CboBookIdx.FindString(data.Cells[2].Value.ToString());
                //CboDivision.SelectedIndex = CboDivision.FindString(data.Cells[3].Value.ToString()); // 책 장르
                DtpRentalDate.Value = DateTime.Parse(data.Cells[3].Value.ToString());  // 발간일
                DtpReturnDate.Value = DateTime.Parse(data.Cells[4].Value.ToString());  // 반납일


                DtpRentalDate.CustomFormat = "yyyy-MM-dd";
                DtpRentalDate.Format       = DateTimePickerFormat.Custom;

                DtpReturnDate.CustomFormat = "yyyy-MM-dd";
                DtpReturnDate.Format       = DateTimePickerFormat.Custom;

                mode = "UPDATE"; // 수정은 UPDATE
            }
        }
Exemple #3
0
        private void metroGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow data = GrdRentalTbl.Rows[e.RowIndex];
                TxtIdx.Text      = data.Cells[0].Value.ToString();
                TxtIdx.ReadOnly  = true;
                TxtIdx.BackColor = Color.Red;

                CboMemberIdx.SelectedIndex = CboMemberIdx.FindString(data.Cells[1].Value.ToString());
                CboBookIdx.SelectedIndex   = CboBookIdx.FindString(data.Cells[2].Value.ToString());

                date();
                DtpRentDate.Value = DateTime.Parse(data.Cells[3].Value.ToString());
                if (data.Cells[4].Value.ToString() == "")
                {
                    DtpReturnDate.CustomFormat = " ";
                    DtpReturnDate.Format       = DateTimePickerFormat.Custom;
                    date();
                }
                else
                {
                    DtpReturnDate.Value = DateTime.Parse(data.Cells[4].Value.ToString());
                    date();
                }


                mode = "UPDATE"; // 수정은 UPDATE
            }
        }
Exemple #4
0
        private void GrdRentalTbl_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1) // INDEX가 0이상이면
            {
                DataGridViewRow data = GrdRentalTbl.Rows[e.RowIndex];
                txtIdx.Text = data.Cells[0].Value.ToString();
                if ((data.Cells == null) || (data.Cells.Count == 0))
                {
                    return;
                }

                CboMemberIdx.Text          = CboMemberIdx.FindString(data.Cells[1].Value.ToString());
                txtIdx.ReadOnly            = true;
                txtIdx.BackColor           = Color.Salmon;
                CboBookIdx.SelectedIndex   = CboBookIdx.FindString(data.Cells[2].Value.ToString());
                dtpRentalDate.CustomFormat = "yyyy-MM-dd";
                dtpRentalDate.Format       = DateTimePickerFormat.Custom;
                dtpReturnDate.CustomFormat = "yyyy-MM-dd";
                dtpReturnDate.Format       = DateTimePickerFormat.Custom;


                mode = "UPDATE";
            }
        }