예제 #1
0
        private void RememberChenged()
        {
            int    restorationID = (int)RestorationListBox.SelectedValue;
            string nameText      = CFunc.CheckTextBox(this, RestorerNameTextBox.Text, EnterNameRestorations);

            if (nameText == "")
            {
                return;
            }
            if (indexNewRestorer == 0)
            {
                CFunc.ShowMessage(ChooseNewRestorer);
                return;
            }
            if (indexNewExhibit == 0)
            {
                CFunc.ShowMessage(ChooseNewExhibit);
                return;
            }
            if (photoFilePath != "NOTHING" || photoFilePath != null)
            {
                dataset.Exhibit.Rows.Find(restorationID)["Photo"] = photoFilePath;
                photoFilePath = "";
            }

            dataset.Restoration.Rows.Find(restorationID)["Name"]        = RestorerNameTextBox.Text;
            dataset.Restoration.Rows.Find(restorationID)["ExhibitID"]   = RestorationRestorerComboBox.SelectedValue;
            dataset.Restoration.Rows.Find(restorationID)["RestorerID"]  = comboBoxExhibit.SelectedValue;
            dataset.Restoration.Rows.Find(restorationID)["Start"]       = RestorationStart.Value;
            dataset.Restoration.Rows.Find(restorationID)["End"]         = RestorationEnd.Value;
            dataset.Restoration.Rows.Find(restorationID)["Photo"]       = photoFilePath;
            dataset.Restoration.Rows.Find(restorationID)["Description"] = descriptionTextBox.Text;
            getRestorationList() = new DataView(dataset.Restoration);
        }
예제 #2
0
        private void CreateNewRestorer()
        {
            var newExhibit = dataset.Restoration.NewRow();

            if (indexRestorer == 0)
            {
                CFunc.ShowMessage("Выберите реставратора!");
                return;
            }
            newExhibit["RestorerID"] = RestorationRestorerComboBox.SelectedValue;

            if (indexExhibit == 0)
            {
                CFunc.ShowMessage("Выберите экспонат!");
                return;
            }
            newExhibit["ExhibitID"] = comboBoxExhibit.SelectedValue;

            newExhibit["Start"] = RestorationStart.Value;
            newExhibit["End"]   = RestorationEnd.Value;

            if (photoFilePath == "NOTHING")
            {
                CFunc.ShowMessage("Выберите фотографию!");
                return;
            }
            newExhibit["Photo"] = photoFilePath;

            newExhibit["Description"] = descriptionTextBox.Text;

            dataset.Restoration.Rows.Add(newExhibit);
        }
예제 #3
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            DataView tempView = new DataView(dataset.Rent);

            tempView.RowFilter = "ExhibitID = " + ExhibitCombo.SelectedValue;
            for (int i = 0; i < tempView.Count; i++)
            {
                DateTime temp1         = (DateTime)tempView[i]["Start"];
                DateTime temp2         = (DateTime)tempView[i]["End"];
                int      tempInt       = (int)tempView[i]["ID"];
                int      tempExhibitID = (int)tempView[i]["ExhibitID"];
                if (temp1 <= rentStart.Value && temp2 >= rentStart.Value || temp1 <= rentEnd.Value && temp2 >= rentEnd.Value)
                {
                    if (tempInt != rentIndex)
                    {
                        CFunc.ShowMessage("В указанный период данный экспонат находится в аренде в музее '" + dataset.Museum.Rows.Find(tempView[i]["MuseumID"])["Name"] + "'!!!");
                        return;
                    }
                }
            }

            dataset.Rent.Rows.Find(rentIndex)["MuseumID"]  = museumtenantComboBox.SelectedValue;
            dataset.Rent.Rows.Find(rentIndex)["Start"]     = rentStart.Value;
            dataset.Rent.Rows.Find(rentIndex)["End"]       = rentEnd.Value;
            dataset.Rent.Rows.Find(rentIndex)["ExhibitID"] = ExhibitCombo.SelectedValue;

            saveButton.Enabled = false;
            setExhibitListBox();
        }
예제 #4
0
        private void AddMuseum_Click(object sender, EventArgs e)
        {
            string nameText = CFunc.CheckTextBox(this, NameMuseum.Text, EnterNameMuseum);

            if (nameText == "")
            {
                return;
            }
            foreach (DataRow item in dataset.Museum)
            {
                if (item["Name"].ToString() == nameText)
                {
                    CFunc.ShowMessage("Музей '" + nameText + "' уже существует!");
                    return;
                }
            }
            var dr = dataset.Museum.NewRow();

            dr["Name"] = nameText;
            dataset.Museum.Rows.Add(dr);
            ExW.SaveToDataBase();

            DataView tempMuseum = new DataView(dataset.Museum);

            tempMuseum.RowFilter = "Name = " + "'" + nameText + "'";
            var newRow = dataset.Crutch.NewRow();

            newRow["From"]       = "Museum";
            newRow["InstanceID"] = tempMuseum[0][0];
            dataset.Crutch.Rows.Add(newRow);
            ChangeMuseum.Enabled = false;
            ExW.SaveToDataBase();
        }
예제 #5
0
 private void ChangeMaecenas_Click(object sender, EventArgs e)
 {
     if (idListBox != 0)
     {
         string nameText = CFunc.CheckTextBox(this, NameMaecenas.Text, EnterNameMaecenas);
         if (nameText == "")
         {
             return;
         }
         dataset.Maecenas.Rows.Find(idListBox)["Name"] = NameMaecenas.Text;
         canChooseMaecenas          = true;
         MaecenasListBox.DataSource = dataset.Maecenas;
     }
     else
     {
         CFunc.ShowMessage(NeedChooseMaecenas);
     }
 }
예제 #6
0
        private void addButton_Click(object sender, EventArgs e)
        {
            string nameText = CFunc.CheckTextBox(this, nameTextBox.Text, EnterNameShowRoom);

            if (nameText == "")
            {
                return;
            }
            foreach (DataRow item in dataset.Showroom)
            {
                if (item["Name"].ToString() == nameText)
                {
                    CFunc.ShowMessage("Зал '" + nameText + "' уже существует!");
                    return;
                }
            }
            var dr = dataset.Showroom.NewRow();

            dr["Name"] = nameTextBox.Text;
            dataset.Showroom.Rows.Add(dr);
        }
예제 #7
0
 private void deleteButton_Click(object sender, EventArgs e)
 {
     canChooseRestorer = false;
     if (idListBox != 0)
     {
         nameTextBox.Text = "";
         dataset.Restorer.Rows.Find(idListBox).Delete();
         idListBox = 0;
     }
     else
     {
         CFunc.ShowMessage(ChooseRestorer);
     }
     canChooseRestorer = true;
 }
예제 #8
0
        private void CreateNewExhibit()
        {
            var      newExhibit = dataset.Exhibit.NewRow();
            DateTime temp       = appearanceDate.Value;

            string nameText = CFunc.CheckTextBox(this, nameTextBox.Text, EnterNameExhibit);

            if (nameText == "")
            {
                return;
            }
            newExhibit["Name"]       = nameText;
            newExhibit["CategoryID"] = comboBoxExhibitCategor.SelectedValue;
            nameText = CFunc.CheckTextBox(this, nameTextBox.Text, EnterCreationDate);
            if (nameText == "")
            {
                return;
            }
            newExhibit["CreatedDate"]    = dateCreationTextBox.Text;
            newExhibit["AppearanceDate"] = appearanceDate.Value;
            if (photoFilePath == "NOTHING")
            {
                CFunc.ShowMessage("Выберите фотографию!");
                return;
            }
            newExhibit["Photo"]       = photoFilePath;
            newExhibit["Description"] = descriptionTextBox.Text;

            int      getFromID    = (int)comboBoxGetFrom.SelectedValue;
            string   crutchFilter = "[From] = '" + tableNameDaritel + "' " + "AND InstanceID = " + getFromID;
            DataView tempCrutch   = new DataView(dataset.Crutch);

            tempCrutch.RowFilter   = crutchFilter;
            newExhibit["CrutchID"] = (int)tempCrutch[0][0];

            dataset.Exhibit.Rows.Add(newExhibit);
        }