Ejemplo n.º 1
0
 private void SetVideoData(DAL.Video dlgData, ref VRSDataSet.tblVideoRow row)
 {
     if (row.IsNull("Title") || !row.Title.Equals(dlgData.Title))
     {
         row.Title = dlgData.Title;
     }
     if (row.IsNull("Stock") || !row.Stock.Equals(dlgData.Stock))
     {
         row.Stock = dlgData.Stock;
     }
     if (row.IsNull("Producer") || !row.Producer.Equals(dlgData.Producer))
     {
         row.Producer = dlgData.Producer;
     }
     if (row.IsNull("Director") || !row.Director.Equals(dlgData.Director))
     {
         row.Director = dlgData.Director;
     }
     if (row.IsNull("Starring") || !row.Starring.Equals(dlgData.Starring))
     {
         row.Starring = dlgData.Starring;
     }
     if (row.IsNull("ProductionYear") || !row.ProductionYear.Equals(dlgData.ProductionYear))
     {
         row.ProductionYear = dlgData.ProductionYear;
     }
     if (row.IsNull("Description") || !row.Description.Equals(dlgData.Description))
     {
         row.Description = dlgData.Description;
     }
     if (row.IsNull("VideoCode") || !row.VideoCode.Equals(dlgData.VideoType))
     {
         row.VideoCode = dlgData.VideoType;
     }
 }
Ejemplo n.º 2
0
        private void RemoveVideo()
        {
            if (lbxVideo.SelectedItems == null || lbxVideo.SelectedItems.Count < 1)
            {
                MessageBox.Show("삭제할 비디오를 먼저 선택해 주십시오.", "비디오삭제 안내");
                lbxVideo.Focus();
                return;
            }

            int idx  = lbxVideo.SelectedItems[0].Index;
            int id   = Convert.ToInt32(lbxVideo.Items[idx].Name);
            int rent = vrsDataSet.tblRentVideo.Count(o => o.VideoId == id);

            if (rent < 1)
            {
                if (MessageBox.Show("정말 삭제하시겠습니까?", "비디오정보 삭제안내") == DialogResult.OK)
                {
                    VRSDataSet.tblVideoRow row = vrsDataSet.tblVideo.FindById(id);
                    row.Delete();
                    this.tblVideoTableAdt.Update(row);

                    SetVideoListView();
                }
            }
            else
            {
                MessageBox.Show("대여기록이 있는 비디오는 삭제할 수 없습니다.", "비디오정보 삭제안내");
            }
        }
Ejemplo n.º 3
0
        private void ModifyVideo()
        {
            if (lbxVideo.SelectedItems == null || lbxVideo.SelectedItems.Count < 1)
            {
                MessageBox.Show("수정할 비디오를 먼저 선택해 주십시오.", "비디오정보 수정안내");
                lbxVideo.Focus();
                return;
            }

            int idx = lbxVideo.SelectedItems[0].Index;

            VRSVideoForm dlg = new VRSVideoForm();

            dlg.Text = "비디오정보 수정";

            dlg.m_Video = lbxVideo.Items[idx].Tag as Video;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                int id = Convert.ToInt32(lbxVideo.Items[idx].Name);
                VRSDataSet.tblVideoRow row = vrsDataSet.tblVideo.FindById(id);
                SetVideoData(dlg.m_Video, ref row);

                if (row.RowState == DataRowState.Modified)
                {
                    //데이터소스에 반영
                    this.Validate();
                    this.tblVideoTableAdt.Update(row);

                    SetVideoListView();
                }
            }
        }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        private void CreateVideo()
        {
            VRSVideoForm dlg = new VRSVideoForm();

            dlg.Text = "비디오정보 등록";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                VRSDataSet.tblVideoRow row = vrsDataSet.tblVideo.NewtblVideoRow();
                SetVideoData(dlg.m_Video, ref row);

                vrsDataSet.tblVideo.Rows.Add(row);

                //데이터소스에 반영
                this.Validate();
                this.tblVideoTableAdt.Update(row);

                SetVideoListView();
            }
        }