private void UpdateFile() { if (_statusUpdate == true) { if (MessageBox.Show("Вы действительно желаете изменить информацию о файле?", "Изменение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _statusUpdate = false; _userStruct = DataMethod.GetUser(_userStruct.userId); _fileStruct = DataMethod.GetFile(_fileStruct.fileId); _changeStruct = DataMethod.GetChange(_fileStruct.fileId); DataMethod.UpdateFile(_userActive.userId, _fileStruct.fileId, textBoxName.Text, richTextBoxComment.Text, comboBoxStatusFile.Text); this.textBoxName.Enabled = false; this.richTextBoxComment.Enabled = false; this.comboBoxStatusFile.Enabled = false; this.buttonUpdate.Text = "Изменить"; } } else { _statusUpdate = true; this.textBoxName.Enabled = true; this.richTextBoxComment.Enabled = true; this.comboBoxStatusFile.Enabled = true; this.buttonUpdate.Text = "Сохранить"; } this.FillForm(); }
public FileForm(int fileId, int userId) { _fileStruct = DataMethod.GetFile(fileId); _changeStruct = DataMethod.GetChange(fileId); _userStruct = DataMethod.GetUser(_fileStruct.userId); _userActive = DataMethod.GetUser(userId); this.InitializeComponent(); }