public ActionResult CorrectiveMeasures(CorrectiveMeasure data, string nextBtn) { Preventive obj = GetMaintenanceTaxi(); if (nextBtn != null) { if (ModelState.IsValid) { obj.MT_Equ_For_Corr_Measure = data.MT_Equ_For_Corr_Measure; obj.MT_Corr_Measure_Taken = data.MT_Corr_Measure_Taken; obj.MT_Comment_Box_For_Technicians = data.MT_Comment_Box_For_Technicians; obj.MT_Old_SerialNo_If_Replaced = data.MT_Old_SerialNo_If_Replaced; return(View("CSignOffDetails", obj)); } else { var errors = ModelState.Values.SelectMany(v => v.Errors); } } return(View()); }
private void CorrectiveActionReportForm_Load(object sender, EventArgs e) { if (Authorizer.Instance.Guest == 1) { comboBox1.Enabled = false; comboBox2.Enabled = false; comboBox3.Enabled = false; textBox1.Enabled = false; textBox3.Enabled = false; richTextBox1.Enabled = false; richTextBox2.Enabled = false; richTextBox3.Enabled = false; dateTimePicker1.Enabled = false; dateTimePicker2.Enabled = false; checkBox1.Enabled = false; } textBox2.Enabled = false; departments = Department.getList(); users = User.getList().Where((x) => x.IsPerson == 1).ToList(); foreach (var department in departments) { comboBox3.Items.Add(department.Name); } foreach (var user in users) { if (user.IsPerson == 1) { comboBox1.Items.Add(user.Name); comboBox2.Items.Add(user.Name); } } if (Action != null) { User _user = users.First(x => x.Id == Action.ExecutorId.Value); foreach (String item in comboBox1.Items) { if (item == _user.Name) { comboBox1.SelectedIndex = comboBox1.Items.IndexOf(item); } } _user = users.First(x => x.Id == Action.CuratorId.Value); foreach (String item in comboBox2.Items) { if (item == _user.Name) { comboBox2.SelectedIndex = comboBox2.Items.IndexOf(item); } } Department department = departments.First(x => x.Id == Action.DepartmentId); foreach (String item in comboBox3.Items) { if (item == department.Name) { comboBox3.SelectedIndex = comboBox3.Items.IndexOf(item); } } this.dateTimePicker1.Value = Action.DateEnd; this.dateTimePicker2.Value = Action.MemoDate; textBox2.Text = Action.Id.ToString(); textBox3.Text = this.Action.MemoNumber; richTextBox1.Text = this.Action.Content; richTextBox2.Text = this.Action.Compliance; richTextBox3.Text = this.Action.FailReason; } else { Action = new CorrectiveMeasure(); Action.EventId = this.anEvent.Id; Action.DateEnd = this.dateTimePicker1.Value; Action.MemoDate = this.dateTimePicker1.Value; Action.Finished = 0; } }