private void EditDicLevelOfRisk_Shown(object sender, EventArgs e) { if (this._editableId != -1) { this._entity = ApplicationMap.OutsideOrg[this._editableId]; this.nameTB.Text = _entity.Name; this.fullNameTB.Text = _entity.FullName; } }
private void saveBtn_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(nameTB.Text.Trim())) { this.Close(); return; } if (this._editableId != -1) { this._entity.Name = nameTB.Text.Trim(); this._entity.FullName = fullNameTB.Text.Trim(); ApplicationMap.OutsideOrg[this._editableId] = this._entity; } else { this._entity = new OutsideOrg(this.fullNameTB.Text.Trim(), this.nameTB.Text.Trim()); ApplicationMap.OutsideOrg[this._editableId] = this._entity; } this.DialogResult = System.Windows.Forms.DialogResult.OK; }
public bool MakeCAPEx(int aPlanId) { Plan plan = null; bool result = true; plan = ApplicationMap.Plan[aPlanId]; if (plan == null) { return(false); } OutsideOrg org = ApplicationMap.OutsideOrg[plan.OrgID]; this.StartExcel(0); Range range, workRange; //Формируем шапку range = _exSht.UsedRange; range.Cells[7, 1] = "План корректирующих мероприятий по результатам проведения комплексной аудиторской проверки в " + org.FullName; range.Cells[5, 1] = String.Format("\" ___ \" {0} {1} г.", _ci.DateTimeFormat.MonthGenitiveNames[DateTime.Now.Month - 1].ToLower(), DateTime.Now.Year); range.Cells[5, 6] = String.Format("\" ___ \" {0} {1} г.", _ci.DateTimeFormat.MonthGenitiveNames[DateTime.Now.Month - 1].ToLower(), DateTime.Now.Year); List <PlanContent> content = new List <PlanContent>(); //Заполняем содержание foreach (int i in plan.Content) { content.Add(ApplicationMap.PlanContent[i]); } /* Голый линк (вложенность только до второго уровня) */ //Получаем список всех родителей List <PlanContent> parents = content.Where(parent => parent.ParentId == -1).ToList(); List <PlanContent> children = null; parents.Sort(SimpleEntity.CompareSimpleEntities); int row = 9; //Выводим содержание foreach (PlanContent parent in parents) { //Заголовок раздела range.Cells[row, 1] = parent.Name; range.Cells[row, 2] = parent.Recomendation; //Жирность и шрифт workRange = _exSht.get_Range("a" + row.ToString(), "b" + row.ToString()); workRange.Font.Bold = true; workRange.Font.Size = 10; //Выравнивание workRange = _exSht.get_Range("a" + row.ToString()); workRange.VerticalAlignment = XlVAlign.xlVAlignCenter; workRange.HorizontalAlignment = XlHAlign.xlHAlignCenter; workRange = _exSht.get_Range("b" + row.ToString()); workRange.VerticalAlignment = XlVAlign.xlVAlignCenter; workRange.HorizontalAlignment = XlHAlign.xlHAlignLeft; row++; //Обходим потомков children = content.Where(item => item.ParentId == parent.Id).ToList(); children.Sort(SimpleEntity.CompareSimpleEntities); foreach (PlanContent child in children) { //Раздел range.Cells[row, 1] = child.Name; range.Cells[row, 2] = child.Recomendation; range.Cells[row, 3] = child.CorrectActions; range.Cells[row, 4] = ApplicationMap.OutsideEmp[child.EmployeeId].ToString(); range.Cells[row, 5] = child.Expired.ToShortDateString(); range.Cells[row, 6] = child.Comments; range.Cells[row, 7] = ApplicationMap.LevelsOfRisk[child.RiskId].Name; row++; } //оформление if (children.Count > 0) { //Выравнивание workRange = _exSht.get_Range("a" + (row - children.Count).ToString(), "g" + (row - 1).ToString()); workRange.VerticalAlignment = XlVAlign.xlVAlignCenter; //шрифт workRange = _exSht.get_Range("a" + (row - children.Count).ToString(), "c" + (row - 1).ToString()); workRange.Font.Size = 9; workRange = _exSht.get_Range("d" + (row - children.Count).ToString(), "f" + (row - 1).ToString()); workRange.Font.Size = 8; //Выравнивание workRange = _exSht.get_Range("a" + (row - children.Count).ToString(), "a" + (row - 1).ToString()); workRange.HorizontalAlignment = XlHAlign.xlHAlignCenter; workRange = _exSht.get_Range("b" + (row - children.Count).ToString(), "c" + (row - 1).ToString()); workRange.HorizontalAlignment = XlHAlign.xlHAlignLeft; workRange = _exSht.get_Range("d" + (row - children.Count).ToString(), "e" + (row - 1).ToString()); workRange.HorizontalAlignment = XlHAlign.xlHAlignCenter; workRange = _exSht.get_Range("f" + (row - children.Count).ToString(), "f" + (row - 1).ToString()); workRange.HorizontalAlignment = XlHAlign.xlHAlignLeft; //граница workRange = _exSht.get_Range("a" + (row - children.Count).ToString(), "f" + (row - 1).ToString()); workRange.Borders.LineStyle = XlLineStyle.xlDot; workRange.Borders.Weight = XlBorderWeight.xlHairline; workRange.Borders.ColorIndex = 0; workRange.Borders.Color = 0; } } //Выводим подписи row += 2; workRange = _exSht.get_Range("b" + row.ToString()); workRange.Font.Bold = true; workRange.Font.Size = 12; range.Cells[row, 2] = "Согласовано"; row += 2; OutsideEmp emp = null; OutsideOrg orge = null; emp = ApplicationMap.OutsideEmp[plan.Employee1ID]; orge = ApplicationMap.OutsideOrg[emp.OrgID]; workRange = _exSht.get_Range("b" + row.ToString(), "c" + row.ToString()); workRange.Font.Size = 12; range.Cells[row, 2] = emp.PostName + " " + orge.FullName; range.Cells[row, 3] = emp.GetFIO(); if (plan.Employee2ID != -1) { row += 2; emp = null; orge = null; emp = ApplicationMap.OutsideEmp[plan.Employee2ID]; orge = ApplicationMap.OutsideOrg[emp.OrgID]; workRange = _exSht.get_Range("b" + row.ToString(), "c" + row.ToString()); workRange.Font.Size = 12; range.Cells[row, 2] = emp.PostName + " " + orge.FullName; range.Cells[row, 3] = emp.GetFIO(); } if (plan.Employee3ID != -1) { row += 2; emp = null; orge = null; emp = ApplicationMap.OutsideEmp[plan.Employee3ID]; orge = ApplicationMap.OutsideOrg[emp.OrgID]; workRange = _exSht.get_Range("b" + row.ToString(), "c" + row.ToString()); workRange.Font.Size = 12; range.Cells[row, 2] = emp.PostName + " " + orge.FullName; range.Cells[row, 3] = emp.GetFIO(); } this.TerminateExcel(); return(result); }