private void rexaButton1_Click(object sender, EventArgs e) { Hide(); if (current_Dopcument != null && IsUpdate) { var document = db.DocumentUpdateCommand(textBox1.Text, current_Dopcument.Create, current_Dopcument.OwnerUsername, int.Parse(comboBox1.SelectedValue.ToString()) , current_Dopcument.IsDeleted, current_Dopcument.Id) .Select(x => new Models.DocumentSelectCommandResult { Id = x.Id, Create = x.Create, DocumentGroupId = x.DocumentGroupId, OwnerUsername = x.OwnerUsername, IsDeleted = x.IsDeleted, Title = x.Title }) .FirstOrDefault(); var dvd = new DocumentVersionDraft { current_document = document }; dvd.textBox_Group.Text = comboBox1.Text; dvd.textBox_Title.Text = textBox1.Text; dvd.ShowDialog(); } else if (current_Dopcument != null && !IsUpdate) { db.DocumentDeleteCommand(current_Dopcument.Id); } else if (current_Dopcument == null) { var document = db.DocumentInsertCommand(textBox1.Text, DateTime.Now, Program.this_user.Username, int.Parse(comboBox1.SelectedValue.ToString()) , false) .Select(x => new Models.DocumentSelectCommandResult { Id = x.Id, Create = x.Create, DocumentGroupId = x.DocumentGroupId, OwnerUsername = x.OwnerUsername, IsDeleted = x.IsDeleted, Title = x.Title }) .FirstOrDefault(); var dvd = new DocumentVersionDraft { current_document = document }; dvd.textBox_Group.Text = comboBox1.Text; dvd.textBox_Title.Text = textBox1.Text; dvd.ShowDialog(); } Close(); }
private void rexaGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex >= 0 && e.ColumnIndex <= 3) { int id = Convert.ToInt32(rexaGrid1.Rows[e.RowIndex].Cells[3] .Value.ToString()); int document_id = sings[e.RowIndex].DocumentId; int document_version_id = sings[e.RowIndex].DocumentVersion; string group_name = sings[e.RowIndex].DocumentGroupName; string group = sings[e.RowIndex].DocumentGroupName; string document_tilte = sings[e.RowIndex].DocumentTitle; if (e.ColumnIndex == 0) { var current_document = db.DocumentSelectCommand().Where(x => x.Id == document_id).FirstOrDefault(); var current_document_version = db.DocumentVersionSelectCommand().Where(x => x.Id == document_version_id).FirstOrDefault(); var d = new DocumentVersionDraft(); d.current_document = current_document; d.current_document_version = current_document_version; d.textBox_Group.Text = group_name; d.textBox_Title.Text = document_tilte; d.ShowDialog(); } else if (e.ColumnIndex == 1) { // TODO db.DocumentVersionSignUpdateCommand("OK", id); } else if (e.ColumnIndex == 2) { db.DocumentVersionSignUpdateCommand("Canceled", id); } MyReload(); } }
private void rexaButton2_Click(object sender, EventArgs e) { var last_document = db.DocumentVersionSelectCommand() .Where(x => x.DocumentId == current_Dopcument.Id) .OrderByDescending(x => x.Id) .FirstOrDefault(); if (last_document == null) { MessageBox.Show("هیچ نسخه ای برای این سند ثبت نشده است"); return; } var dvd = new DocumentVersionDraft { current_document_version = last_document }; dvd.textBox_Group.Text = comboBox1.Text; dvd.textBox_Title.Text = textBox1.Text; dvd.ShowDialog(); }