private void RemoveMember() { if (lbxMembership.SelectedItems == null || lbxMembership.SelectedItems.Count < 1) { MessageBox.Show("삭제할 회원을 먼저 선택해 주십시오.", "회원정보삭제 안내"); lbxMembership.Focus(); return; } int idx = lbxMembership.SelectedItems[0].Index; int id = Convert.ToInt32(lbxMembership.Items[idx].Name); int rent = vrsDataSet.tblRentVideo.Count(o => o.MemberId == id); if (rent < 1) { if (MessageBox.Show("정말 삭제하시겠습니까?", "회원정보 삭제안내") == DialogResult.OK) { VRSDataSet.tblMembershipRow row = vrsDataSet.tblMembership.FindById(id); row.Delete(); this.tblMembershipTableAdt.Update(row); SetMemberListView(); } } else { MessageBox.Show("대여기록이 있는 회원분은 삭제할 수 없습니다.", "회원정보 삭제안내"); } }
private void ModifyMember() { if (lbxMembership.SelectedItems == null || lbxMembership.SelectedItems.Count < 1) { MessageBox.Show("수정할 회원을 먼저 선택해 주십시오.", "회원정보수정 안내"); lbxMembership.Focus(); return; } int idx = lbxMembership.SelectedItems[0].Index; VRSMemberForm dlg = new VRSMemberForm(); dlg.Text = "회원 정보 수정"; dlg.m_Member = lbxMembership.Items[idx].Tag as Membership; if (dlg.ShowDialog() == DialogResult.OK) { int id = Convert.ToInt32(lbxMembership.Items[idx].Name); VRSDataSet.tblMembershipRow row = vrsDataSet.tblMembership.FindById(id); SetMemberData(dlg.m_Member, ref row); if (row.RowState == DataRowState.Modified) { //데이터소스에 반영 this.Validate(); this.tblMembershipTableAdt.Update(row); SetMemberListView(); } } }
private void RendVideo() { if (lbxMembership.SelectedItems == null || lbxMembership.SelectedItems.Count < 1 || lbxVideo.SelectedItems == null || lbxVideo.SelectedItems.Count < 1) { MessageBox.Show("대여할 회원과 비디오를 먼저 선택해 주십시오.", "비디오 대여안내"); lbxVideo.Focus(); return; } int idxMember = lbxMembership.SelectedItems[0].Index; int idxVideo = lbxVideo.SelectedItems[0].Index; int memberId = Convert.ToInt32(lbxMembership.Items[idxMember].Name); int videoId = Convert.ToInt32(lbxVideo.Items[idxVideo].Name); VRSDataSet.tblVideoRow rowVideo = vrsDataSet.tblVideo.FindById(videoId); VRSDataSet.tblMembershipRow rowMember = vrsDataSet.tblMembership.FindById(memberId); if (rowVideo == null || rowMember == null) { MessageBox.Show("회원정보와 비디오정보를 확인해 주십시오", "대여정보 확인안내"); lbxVideo.Focus(); return; } if (rowVideo.Stock - vrsDataSet.tblRentVideo.Count(o => o.VideoId == rowVideo.Id && !o.IsReturn) < 0) { MessageBox.Show("대여할 비디오가 없습니다.", "대여정보 확인안내"); lbxVideo.Focus(); return; } if (MessageBox.Show("대여하시겠습니까?", "대여확인안내") == DialogResult.OK) { VRSDataSet.tblRentVideoRow row = vrsDataSet.tblRentVideo.NewtblRentVideoRow(); row.BeginEdit(); row.MemberId = memberId; row.VideoId = videoId; row.RentDate = DateTime.Now; row.IsReturn = false; row.EndEdit(); vrsDataSet.tblRentVideo.Rows.Add(row); //데이터소스에 반영 this.Validate(); this.tblRentVideoTableAdt.Update(row); SetMemberListView(); SetVideoListView(); SetRendVideoListView(); } }
private void CreaterMember() { VRSMemberForm dlg = new VRSMemberForm(); dlg.Text = "신규회원 등록"; if (dlg.ShowDialog() == DialogResult.OK) { VRSDataSet.tblMembershipRow row = vrsDataSet.tblMembership.NewtblMembershipRow(); SetMemberData(dlg.m_Member, ref row); vrsDataSet.tblMembership.Rows.Add(row); //데이터소스에 반영 this.Validate(); this.tblMembershipTableAdt.Update(row); SetMemberListView(); } }
private void SetMemberData(DAL.Membership dlgData, ref VRSDataSet.tblMembershipRow row) { if (row.IsNull("Name") || !row.Name.Equals(dlgData.Name)) { row.Name = dlgData.Name; } if (row.IsNull("Male") || !row.Male.Equals(dlgData.Male)) { row.Male = dlgData.Male; } if (row.IsNull("Birthday") || !row.Birthday.Equals(dlgData.Birthday)) { row.Birthday = dlgData.Birthday; } if (row.IsNull("ZipCode") || !row.Zipcode.Equals(dlgData.ZipCode)) { row.Zipcode = dlgData.ZipCode; } if (row.IsNull("Addr") || !row.Addr.Equals(dlgData.Addr)) { row.Addr = dlgData.Addr; } if (row.IsNull("Addr2") || !row.Addr2.Equals(dlgData.AddrDetail)) { row.Addr2 = dlgData.AddrDetail; } if (row.IsNull("Cellphone") || !row.Cellphone.Equals(dlgData.Cellphone)) { row.Cellphone = dlgData.Cellphone; } if (row.IsNull("GradeCode") || !row.GradeCode.Equals(dlgData.MGradeCode)) { row.GradeCode = dlgData.MGradeCode; } if (row.IsNull("Deposit") || !row.Deposit.Equals(dlgData.MDeposit)) { row.Deposit = dlgData.MDeposit; } }