private void CreateButton_Click(object sender, EventArgs e) { FormBlank fb = new FormBlank(); fb.Owner = this.Owner; fb.Text = "Создание заявки"; fb.CreateButton.Text = "Создать"; DateTime dt = DateTime.Now; fb.BeginTimeDTP.Value = dt.AddHours(1).AddMinutes(-dt.Minute).AddSeconds(-dt.Second); fb.EndTimeDTP.Value = dt.AddHours(1).AddMinutes(-dt.Minute).AddSeconds(-dt.Second); fb.ShowDialog(); FillRequestDGV(); }
private void EditButton_Click(object sender, EventArgs e) { if (RequestDGV.SelectedRows.Count != 0) { FormBlank fb = new FormBlank(); fb.Owner = this.Owner; int row = RequestDGV.SelectedRows[0].Index; fb.GuestFIOTB.Text = RequestDGV.Rows[row].Cells[3].Value.ToString(); fb.GuestJobTB.Text = RequestDGV.Rows[row].Cells[4].Value.ToString(); fb.AutoMarkTB.Text = RequestDGV.Rows[row].Cells[5].Value.ToString(); fb.AutoNumberTB.Text = RequestDGV.Rows[row].Cells[6].Value.ToString(); fb.LocationTB.Text = RequestDGV.Rows[row].Cells[7].Value.ToString(); fb.PurposeTB.Text = RequestDGV.Rows[row].Cells[12].Value.ToString(); fb.BeginDateDTP.Value = (DateTime)RequestDGV.Rows[row].Cells[8].Value; fb.BeginTimeDTP.Value = (DateTime)RequestDGV.Rows[row].Cells[8].Value; fb.EndDateDTP.Value = (DateTime)RequestDGV.Rows[row].Cells[9].Value; fb.EndTimeDTP.Value = (DateTime)RequestDGV.Rows[row].Cells[9].Value; fb.MeetFIOTB.Text = RequestDGV.Rows[row].Cells[10].Value.ToString(); fb.PhoneTB.Text = RequestDGV.Rows[row].Cells[14].Value.ToString(); if (sender.ToString() == "System.Windows.Forms.DataGridView") { fb.CreateButton.Visible = false; fb.Text = "Просмотр заявки № " + RequestDGV.Rows[row].Cells[0].Value.ToString() + " (" + RequestDGV.Rows[row].Cells[1].Value.ToString() + ")"; foreach (Control control in fb.Controls) { if (control.Name != "Cancel2Button") { control.Enabled = false; } } } else { fb.CreateButton.Text = "Изменить"; fb.Text = "Изменение заявки № " + RequestDGV.Rows[row].Cells[0].Value.ToString() + " (" + RequestDGV.Rows[row].Cells[1].Value.ToString() + ")"; fb.request_id = (int)RequestDGV.Rows[row].Cells[0].Value; } if (RequestDGV.Rows[row].Cells[13].Value != null) { fb.Text += " (утверждено: " + RequestDGV.Rows[row].Cells[13].Value.ToString() + ")"; } fb.ShowDialog(); if (sender.ToString() != "System.Windows.Forms.DataGridView") { FillRequestDGV(); } } }
private void EditButton_Click(object sender, EventArgs e) { FormBlank fb = new FormBlank(); fb.Owner = this.Owner; int row = WarehouseDGV.SelectedRows[0].Index; fb.GuestFIOTB.Text = WarehouseDGV.Rows[row].Cells[1].Value.ToString(); fb.GuestJobTB.Text = WarehouseDGV.Rows[row].Cells[11].Value.ToString(); fb.AutoMarkTB.Text = WarehouseDGV.Rows[row].Cells[2].Value.ToString(); fb.AutoNumberTB.Text = WarehouseDGV.Rows[row].Cells[3].Value.ToString(); fb.LocationTB.Text = WarehouseDGV.Rows[row].Cells[4].Value.ToString(); fb.PurposeTB.Text = WarehouseDGV.Rows[row].Cells[14].Value.ToString(); fb.BeginDateDTP.Value = (DateTime)WarehouseDGV.Rows[row].Cells[5].Value; fb.BeginTimeDTP.Value = (DateTime)WarehouseDGV.Rows[row].Cells[5].Value; fb.EndDateDTP.Value = (DateTime)WarehouseDGV.Rows[row].Cells[6].Value; fb.EndTimeDTP.Value = (DateTime)WarehouseDGV.Rows[row].Cells[6].Value; fb.MeetFIOTB.Text = WarehouseDGV.Rows[row].Cells[10].Value.ToString(); if (WarehouseDGV.Rows[row].Cells[12].Value != null) { fb.WHTB.Text = WarehouseDGV.Rows[row].Cells[12].Value.ToString(); } fb.WHTB.Visible = true; fb.WHLabel.Visible = true; fb.PhoneTB.Text = WarehouseDGV.Rows[row].Cells[16].Value.ToString(); if (WarehouseDGV.Rows[row].Cells[17].Value != null) { fb.WHPersonLabel.Text = WarehouseDGV.Rows[row].Cells[17].Value.ToString(); } fb.WHPersonLabel.Visible = true; if (sender.ToString() == "System.Windows.Forms.DataGridView") { fb.CreateButton.Visible = false; fb.Text = "Просмотр заявки № " + WarehouseDGV.Rows[row].Cells[0].Value.ToString() + " (" + WarehouseDGV.Rows[row].Cells[13].Value.ToString() + ") (утверждено: " + WarehouseDGV.Rows[row].Cells[15].Value.ToString() + ")"; foreach (Control control in fb.Controls) { if (control.Name != "Cancel2Button") { control.Enabled = false; } } } else { fb.CreateButton.Text = "Редактирование"; fb.Text = "Редактирование заявки № " + WarehouseDGV.Rows[row].Cells[0].Value.ToString() + " (" + WarehouseDGV.Rows[row].Cells[13].Value.ToString() + ") (утверждено: " + WarehouseDGV.Rows[row].Cells[15].Value.ToString() + ")"; fb.request_id = (int)WarehouseDGV.Rows[row].Cells[0].Value; foreach (Control control in fb.Controls) { if (control.Name != "Cancel2Button" && control.Name != "WHTB" && control.Name != "CreateButton") { control.Enabled = false; } } } fb.ShowDialog(); if (sender.ToString() != "System.Windows.Forms.DataGridView") { FillWarehouse(); } }