Example #1
0
        public static void ShowMessage(this Control c, string text, MessageLevel lvl,
                                       string caption = "")
        {
            var icon = (MsgBoxIcon)((int)lvl);

            c.ShowDialog(text, icon, caption, DefaultButton.Button1, "OK");
        }
Example #2
0
        public DialogResult ShowDialog(Window parent)
        {
            swf.DialogResult result;
            if (customColors != null)
            {
                Control.CustomColors = customColors;
            }

            if (parent?.HasFocus == false)
            {
                parent.Focus();
            }

            if (parent != null)
            {
                result = Control.ShowDialog(parent.GetContainerControl());
            }
            else
            {
                result = Control.ShowDialog();
            }

            if (result == swf.DialogResult.OK)
            {
                Callback.OnColorChanged(Widget, EventArgs.Empty);
            }

            customColors = Control.CustomColors;

            return(result.ToEto());
        }
Example #3
0
		public DialogResult ShowDialog(Control parent)
		{
			if (parent != null) Control.ShowDialog((swf.Control)parent.ControlObject);
			else Control.ShowDialog ();

			return Widget.DialogResult;
		}
Example #4
0
        public DialogResult ShowDialog(Window parent)
        {
            if (parent != null)
            {
                var owner = parent.ControlObject as sw.Window;
                Control.Owner = owner;
                Control.WindowStartupLocation = sw.WindowStartupLocation.CenterOwner;
            }
            if (Font != null)
            {
                var fontHandler = (FontHandler)Font.Handler;
                Control.SelectedFontFamily    = fontHandler.WpfFamily;
                Control.SelectedFontPointSize = fontHandler.Size;
                Control.SelectedFontStyle     = fontHandler.WpfFontStyle;
                Control.SelectedFontWeight    = fontHandler.WpfFontWeight;
            }
            var result = Control.ShowDialog();

            if (result == true)
            {
                var fontHandler = new FontHandler(Widget.Generator, Control.SelectedFontFamily, Control.SelectedFontPointSize, Control.SelectedFontStyle, Control.SelectedFontWeight);
                Font = new Font(Widget.Generator, fontHandler);
                Widget.OnFontChanged(EventArgs.Empty);
            }

            return(result != null && result.Value ? DialogResult.Ok : DialogResult.Cancel);
        }
Example #5
0
        public DialogResult ShowDialog(Window parent)
        {
#if WINFORMS
            // use reflection since adding a parameter requires us to reference PresentationFramework which we don't want in winforms
            cp.CommonFileDialogResult result;
            var handle = parent.ToNative()?.Handle;
            if (handle == null)
            {
                result = Control.ShowDialog();
            }
            else
            {
                var showDialogMethod = Control.GetType().GetMethod("ShowDialog", new[] { typeof(IntPtr) });
                result = (cp.CommonFileDialogResult)showDialogMethod.Invoke(Control, new object[] { handle.Value });
            }
#elif WPF
            // don't use WPF window, parent might be a HwndFormHandler
            var wpfParent = parent?.NativeHandle;
            var result    = wpfParent != null?Control.ShowDialog(wpfParent.Value) : Control.ShowDialog();
#endif
            switch (result)
            {
            case cp.CommonFileDialogResult.Cancel:
                return(DialogResult.Cancel);

            case cp.CommonFileDialogResult.Ok:
                return(DialogResult.Ok);

            default:
            case cp.CommonFileDialogResult.None:
                return(DialogResult.None);
            }
        }
Example #6
0
        public DialogResult ShowDialog(Window parent)
        {
            if (parent?.HasFocus == false)
            {
                parent.Focus();
            }

            swf.DialogResult result;

            Control.PrinterSettings = _printSettings.ToSD();

            if (parent != null)
            {
                result = Control.ShowDialog(((IWindowHandler)parent.Handler).Win32Window);
            }
            else
            {
                result = Control.ShowDialog();
            }

            if (result == swf.DialogResult.OK && Document != null)
            {
                Document.PrintSettings = _printSettings;
                Document.Print();
            }

            return(result.ToEto());
        }
Example #7
0
        public DialogResult ShowDialog(Window parent)
        {
            SWF.DialogResult result;
            if (customColors != null)
            {
                Control.CustomColors = customColors;
            }

            if (parent != null)
            {
                result = Control.ShowDialog(parent.GetContainerControl());
            }
            else
            {
                result = Control.ShowDialog();
            }

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                Callback.OnColorChanged(Widget, EventArgs.Empty);
            }

            customColors = Control.CustomColors;

            return(result.ToEto());
        }
Example #8
0
        public void ShowModal()
        {
            ReloadButtons();

            var owner = Widget.Owner;

            if (LocationSet)
            {
                Control.WindowStartupLocation = sw.WindowStartupLocation.Manual;
            }
            else if (owner != null)
            {
                // CenterOwner does not work in certain cases (e.g. with autosizing)
                Control.WindowStartupLocation = sw.WindowStartupLocation.Manual;
                parentWindowBounds            = owner.Bounds;
                Control.Loaded += HandleLoaded;
            }

            // if the owner doesn't have focus, windows changes the owner's z-order after the dialog closes.
            if (owner != null && !owner.HasFocus)
            {
                owner.Focus();
            }

            Control.ShowDialog();
            WpfFrameworkElementHelper.ShouldCaptureMouse = false;

            ClearButtons();
        }
Example #9
0
        public void ShowModal()
        {
            ReloadButtons();

            Control.ShowDialog();
            Control.Owner = null;             // without this, the dialog is still active as part of the owner form

            ClearButtons();
        }
Example #10
0
        public DialogResult ShowDialog(Window parent)
        {
            Control.SetEtoSettings(settings);
            var result = Control.ShowDialog();

            if (result == true)
            {
                settings.SetFromDialog(Control);
                return(DialogResult.Ok);
            }
            return(DialogResult.Cancel);
        }
Example #11
0
        public DialogResult ShowDialog(Window parent)
        {
            var result = Control.ShowDialog();

            if (result == swf.DialogResult.OK)
            {
                font = Control.Font.ToEto(Widget.Generator);
                Widget.OnFontChanged(EventArgs.Empty);
                return(DialogResult.Ok);
            }
            return(DialogResult.Cancel);
        }
        public DialogResult ShowDialog(Window parent)
        {
            if (parent?.HasFocus == false)
            {
                parent.Focus();
            }

            var dr = Control.ShowDialog();

            WpfFrameworkElementHelper.ShouldCaptureMouse = false;
            return(dr == swf.DialogResult.OK ? DialogResult.Ok : DialogResult.Cancel);
        }
Example #13
0
 public void ShowModal()
 {
     if (Widget.Owner != null)
     {
         // CenterOwner does not work in certain cases (e.g. with autosizing)
         Control.WindowStartupLocation = sw.WindowStartupLocation.Manual;
         Control.SourceInitialized    += HandleSourceInitialized;
         parentWindowBounds            = Widget.Owner.Bounds;
     }
     Control.ShowDialog();
     WpfFrameworkElementHelper.ShouldCaptureMouse = false;
 }
Example #14
0
        public DialogResult ShowDialog(Window parent)
        {
            var result = Control.ShowDialog();

            if (result == swf.DialogResult.OK)
            {
                _font = null;
                Callback.OnFontChanged(Widget, EventArgs.Empty);
                return(DialogResult.Ok);
            }
            return(DialogResult.Cancel);
        }
Example #15
0
 public DialogResult ShowDialog(Window parent)
 {
     SWF.DialogResult dr;
     if (parent != null)
     {
         dr = Control.ShowDialog((SWF.IWin32Window)parent.ControlObject);
     }
     else
     {
         dr = Control.ShowDialog();
     }
     return(Generator.Convert(dr));
 }
Example #16
0
 public Eto.Forms.DialogResult ShowDialog(Window parent)
 {
     swf.DialogResult dr;
     if (parent != null)
     {
         dr = Control.ShowDialog((swf.Control)parent.ControlObject);
     }
     else
     {
         dr = Control.ShowDialog();
     }
     return(dr.ToEto());
 }
Example #17
0
 public DialogResult ShowDialog(Window parent)
 {
     SWF.DialogResult dr;
     if (parent != null)
     {
         dr = Control.ShowDialog((SWF.IWin32Window)parent.ControlObject);
     }
     else
     {
         dr = Control.ShowDialog();
     }
     return(dr.ToEto());
 }
Example #18
0
        public DialogResult ShowDialog(Control parent)
        {
            if (parent != null)
            {
                Control.ShowDialog((swf.Control)parent.ControlObject);
            }
            else
            {
                Control.ShowDialog();
            }

            return(Widget.DialogResult);
        }
Example #19
0
        public DialogResult ShowDialog(Window parent)
        {
            bool?result;

            if (parent != null)
            {
                var owner = parent.ControlObject as sw.Window;
                result = Control.ShowDialog(owner);
            }
            else
            {
                result = Control.ShowDialog();
            }
            return(result != null && result.Value ? DialogResult.Ok : DialogResult.Cancel);
        }
Example #20
0
        public void ShowModal()
        {
            ReloadButtons();
            var owner = Widget.Owner;

            if (owner != null && !owner.HasFocus)
            {
                owner.Focus();
            }

            Control.ShowDialog();
            Control.Owner = null;             // without this, the dialog is still active as part of the owner form

            ClearButtons();
        }
Example #21
0
        public DialogResult ShowDialog(Window parent)
        {
            Control.SetEtoSettings(settings);
            var result = Control.ShowDialog();

            if (result == true)
            {
                settings = null;
                return(DialogResult.Ok);
            }
            else
            {
                return(DialogResult.Cancel);
            }
        }
Example #22
0
        public virtual DialogResult ShowDialog(Window parent)
        {
            bool?result;

            if (parent != null)
            {
                var owner = parent.ControlObject as sw.Window;
                result = Control.ShowDialog(owner);
            }
            else
            {
                result = Control.ShowDialog();
            }
            WpfFrameworkElementHelper.ShouldCaptureMouse = false;
            return(result != null && result.Value ? DialogResult.Ok : DialogResult.Cancel);
        }
Example #23
0
        // Returns whether continue to calculate.
        private bool CheckWeight(TOParameters para)
        {
            if (para.WeightKg > ac.MaxTOWtKg || para.WeightKg < ac.OewKg)
            {
                var result = parentControl.ShowDialog(
                    "Takeoff weight is not within valid range. Continue to calculate?",
                    MsgBoxIcon.Warning,
                    "",
                    DefaultButton.Button2,
                    "Yes", "No");

                return(result == MsgBoxResult.Button1);
            }

            return(true);
        }
Example #24
0
        public void ShowModal()
        {
            ReloadButtons();

            if (Widget.Owner != null)
            {
                // CenterOwner does not work in certain cases (e.g. with autosizing)
                Control.WindowStartupLocation = sw.WindowStartupLocation.Manual;
                parentWindowBounds            = Widget.Owner.Bounds;
                Control.Loaded += HandleLoaded;
            }
            Control.ShowDialog();
            WpfFrameworkElementHelper.ShouldCaptureMouse = false;

            ClearButtons();
        }
Example #25
0
 public void ShowModal(Control parent)
 {
     if (parent != null)
     {
         var parentWindow = parent.ParentWindow;
         if (parentWindow != null)
         {
             var parentHandler = parentWindow.Handler as IWindowHandler;
             if (parentHandler != null)
             {
                 Control.ShowDialog(parentHandler.Win32Window);
                 return;
             }
         }
     }
     Control.ShowDialog();
 }
Example #26
0
        public DialogResult ShowDialog(Window parent)
        {
            swf.DialogResult result;

            Control.PrinterSettings = printSettings.ToSD();

            if (parent != null)
            {
                result = Control.ShowDialog(((IWindowHandler)parent.Handler).Win32Window);
            }
            else
            {
                result = Control.ShowDialog();
            }

            return(result.ToEto());
        }
Example #27
0
        public DialogResult ShowDialog(Window parent)
        {
            if (parent != null)
            {
                var owner = parent.ControlObject as sw.Window;
                Control.Owner = owner;
                Control.WindowStartupLocation = sw.WindowStartupLocation.CenterOwner;
            }
            var result = Control.ShowDialog();

            if (result == true)
            {
                Widget.OnColorChanged(EventArgs.Empty);
                return(DialogResult.Ok);
            }
            return(DialogResult.Cancel);
        }
Example #28
0
 public void ShowModal(Control parent)
 {
     if (parent != null && !LocationSet)
     {
         parentWindow = parent.ParentWindow;
         if (parentWindow != null)
         {
             var handler = (IWpfWindow)parentWindow.Handler;
             handler.SetOwnerFor(Control);
             // CenterOwner does not work in certain cases (e.g. with autosizing)
             Control.WindowStartupLocation = sw.WindowStartupLocation.Manual;
             Control.SourceInitialized    += HandleSourceInitialized;
         }
     }
     Control.ShowDialog();
     WpfFrameworkElementHelper.ShouldCaptureMouse = false;
 }
Example #29
0
        public DialogResult ShowDialog(Window parent)
        {
            bool?result = null;

            if (parent != null)
            {
                var owner = parent.ControlObject as sw.Window;
                Control.Owner = owner;
                Control.WindowStartupLocation = sw.WindowStartupLocation.CenterOwner;
                result = Control.ShowDialog();
            }
            else
            {
                result = Control.ShowDialog();
            }
            return(result != null && result.Value ? DialogResult.Ok : DialogResult.Cancel);
        }
Example #30
0
 public virtual DialogResult ShowDialog(Control parent)
 {
     if (parent != null)
     {
         var parentWindow = parent.ParentWindow;
         if (parentWindow != null)
         {
             var owner = ((IWpfWindow)parentWindow.Handler).Control;
             Control.Owner = owner;
             // CenterOwner does not work in certain cases (e.g. with autosizing)
             Control.WindowStartupLocation = sw.WindowStartupLocation.Manual;
             Control.SourceInitialized    += HandleSourceInitialized;
         }
     }
     Control.ShowDialog();
     WpfFrameworkElementHelper.ShouldCaptureMouse = false;
     return(Widget.DialogResult);
 }
Example #31
0
        private static void CreateOblicForOneSubject(Workbook book, Group group, string subjectName, int pivricha)
        {
            Log.Info(LoggerConstants.ENTER);
            Workbook bookOfOblic = null;
            try
            {
                var subjectFind = group.Subjects.Find(subject => subject.Name.Equals(subjectName));
                var nameOfOblic = "";
                if (subjectFind != null)
                {
                    var semestrFindSemestr = pivricha == 1 ? subjectFind.FirstSemestr : subjectFind.SecondSemestr;
                    if (semestrFindSemestr != null)
                    {
                        nameOfOblic = semestrFindSemestr.CursovaRobota > 0
                            ? CreateSheetName("КП" + subjectName)
                            : CreateSheetName(subjectName);
                    }
                    else
                    {
                        Log.Info(LoggerConstants.EXIT);
                        return;
                    }
                }
                else
                {
                    Log.Warn("For group `" + group.Name + "` don`t find any subjects");
                    Log.Info(LoggerConstants.EXIT);
                    return;
                }

                bookOfOblic = App.OpenBook(PathsFile.PathsDto.PathToFolderWithOblicUspishnosti
                                           + group.Name + PathsFile.PathsDto.ExcelExtensial);

                Worksheet sheetOfOblic;

                if (bookOfOblic == null)
                {
                    if (!File.Exists(PathsFile.PathsDto.PathToFileWithMacros))
                    {
                        Log.Error(LoggerConstants.FILE_NOT_EXIST + ": " + PathsFile.PathsDto.PathToFileWithMacros);
                        Log.Info(LoggerConstants.EXIT);
                        return;
                    }

                    File.Copy(PathsFile.PathsDto.PathToFileWithMacros,
                        PathsFile.PathsDto.PathToFolderWithOblicUspishnosti + group.Name +
                        PathsFile.PathsDto.ExcelExtensial);

                    bookOfOblic =
                        App.OpenBook(PathsFile.PathsDto.PathToFolderWithOblicUspishnosti + group.Name +
                                     PathsFile.PathsDto.ExcelExtensial);

                    sheetOfOblic = App.OpenWorksheet(bookOfOblic, 1);
                    sheetOfOblic.Name = nameOfOblic;
                }
                else
                {
                    var exist = bookOfOblic.Worksheets.Cast<object>()
                        .Any(sheet => ((Worksheet) sheet).Name.Equals(nameOfOblic));
                    if (exist)
                    {
                        if (!Control.IfShow)
                        {
                            var control =
                                new Control("Група [" + group.Name + "]. Уже існує облік успішності для предмету:\n" +
                                            subjectName);
                            control.ShowDialog();
                            if (Control.ButtonClick == 1)
                            {
                                var newApp = new Application
                                {
                                    Visible = true
                                };
                                ((Worksheet)
                                    newApp.Workbooks.Open(PathsFile.PathsDto.PathToFolderWithOblicUspishnosti +
                                                          group.Name
                                                          + PathsFile.PathsDto.ExcelExtensial).Worksheets[nameOfOblic])
                                    .Select();

                                Control.ButtonClick = 0;
                                control.SetButtonReseachEnabled(false);
                                control.ShowDialog();

                                newApp.Quit();
                                ExcelApplication.ExcelApplication.Kill(newApp);
                            }
                            if (Control.ButtonClick == 2)
                                return;

                            sheetOfOblic = bookOfOblic.Worksheets[nameOfOblic];
                            sheetOfOblic.Cells.Delete();
                            Control.ButtonClick = 0;
                        }
                        else
                        {
                            if (Control.ButtonClick == 2)
                            {
                                Log.Info(LoggerConstants.EXIT);
                                return;
                            }
                            sheetOfOblic = bookOfOblic.Worksheets[nameOfOblic];
                            sheetOfOblic.Cells.Delete();
                        }
                    }
                    else
                    {
                        sheetOfOblic = App.CreateNewSheet(bookOfOblic, nameOfOblic);
                    }
                }


                foreach (var subject in @group.Subjects)
                {
                    var semestr = pivricha == 1 ? subject.FirstSemestr : subject.SecondSemestr;
                    if (semestr != null && subject.Name.Equals(subjectName))
                    {
                        if (semestr.DyfZalik > 0 || semestr.Zalic > 0 || semestr.Isput > 0)
                        {
                            CreateZalicExamenAndDufZalic(book.Worksheets["Залік - ДифЗалік - Екзамен"], sheetOfOblic,
                                group, subject, semestr, pivricha);
                        }
                        else if (semestr.StateExamination > 0)
                        {
                            CreateStateExamen(book.Worksheets["Державний екзамен"], sheetOfOblic, group, subject,
                                semestr, pivricha);
                        }
                        else if (semestr.CursovaRobota > 0 || !string.IsNullOrWhiteSpace(semestr.PracticeFormOfControl))
                        {
                            CreateKpOrPractice(book.Worksheets["КП - Технологічна практика"], sheetOfOblic, group,
                                subject, semestr, pivricha);
                        }
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Log.Warn("Something wrong while reading obliks uspishnosti", e);
            }
            finally
            {
                App.CloseBook(bookOfOblic, true);
                Log.Info(LoggerConstants.EXIT);
            }
        }
Example #32
0
        private static void CreateZvedeniaVidomist(Group @group, int pivricha, string mount)
        {
            Log.Info(LoggerConstants.ENTER);

            Workbook bookTamplate = null;
            Workbook book = null;

            try
            {
                var stringPivricha = pivricha == 1 ? "1-ше півріччя.xls" : "2-ге півріччя.xls";
                var pathToVidomist = PathsFile.PathsDto.PathToFolderWithZvedeniaVidomistUspishnosti
                                     + "Зведена відомість успішності за " + (string.IsNullOrWhiteSpace(mount)
                                         ? stringPivricha
                                         : mount + PathsFile.PathsDto.ExcelExtensial);

                if (!File.Exists(PathsFile.PathsDto.PathToExcelDataForProgram))
                {
                    Log.Error(LoggerConstants.FILE_NOT_EXIST + ": DataToProgram");
                    Log.Info(LoggerConstants.EXIT);
                    return;
                }

                bookTamplate = App.OpenBook(PathsFile.PathsDto.PathToExcelDataForProgram);
                var sheetTamplate = App.OpenWorksheet(bookTamplate, "Зведена відомість");

                if (sheetTamplate == null)
                {
                    Log.Error("DataToProgram must contains sheet with name `Зведена відомість`");
                    Log.Info(LoggerConstants.EXIT);
                    return;
                }

                Worksheet sheet;

                if (!File.Exists(pathToVidomist))
                {
                    if (!File.Exists(PathsFile.PathsDto.PathToFileWithMacros))
                    {
                        Log.Warn("Empty Excel file with macros not find");
                        Log.Info(LoggerConstants.EXIT);
                        return;
                    }
                    File.Copy(PathsFile.PathsDto.PathToFileWithMacros, pathToVidomist);

                    book = App.OpenBook(pathToVidomist);
                    sheet = App.OpenWorksheet(book, 1);

                    sheet.Cells.Delete();
                    sheet.Name = group.Name;
                }
                else
                {
                    book = App.OpenBook(pathToVidomist);
                    var exist =
                        book.Worksheets.Cast<object>()
                            .Any(sheet2 => ((Worksheet) sheet2).Name.Equals(group.Name));
                    if (exist)
                    {
                        if (!Control.IfShow)
                        {
                            var control =
                                new Control("Уже існує зведена відомість для групи:\n" + group.Name);
                            control.ShowDialog();
                            if (Control.ButtonClick == 1)
                            {
                                var newApp = new Application {Visible = true};
                                ((Worksheet)
                                    newApp.Workbooks.Open(pathToVidomist).Worksheets[group.Name]).Select();

                                Control.ButtonClick = 0;
                                control.SetButtonReseachEnabled(false);
                                control.ShowDialog();

                                newApp.Quit();
                                ExcelApplication.ExcelApplication.Kill(newApp);
                            }
                            if (Control.ButtonClick == 2)
                            {
                                Log.Info(LoggerConstants.EXIT);
                                return;
                            }

                            sheet = App.OpenWorksheet(book, group.Name);
                            if (sheet != null)
                                sheet.Cells.Delete();
                            else
                            {
                                Log.Warn("Some sheet == null");
                            }
                        }
                        else
                        {
                            if (Control.ButtonClick == 2)
                            {
                                Log.Info(LoggerConstants.EXIT);
                                return;
                            }
                            sheet = App.OpenWorksheet(book, group.Name);
                            if (sheet != null)
                                sheet.Cells.Delete();
                            else
                            {
                                Log.Warn("Some sheet == null");
                            }
                        }
                    }
                    else
                    {
                        sheet = App.CreateNewSheet(book, group.Name);
                    }
                }

                var semestrCurrent = pivricha == 1
                    ? group.FirstRomeSemestr
                    : ArabToRome(FromRomeToArab(group.FirstRomeSemestr) + 1);

                var yearCurrent = string.IsNullOrWhiteSpace(group.Year)
                    ? 0
                    : int.Parse(group.Year.Trim()) + 1;

                sheet.Cells.PasteSpecial(sheetTamplate.Cells.Copy());

                sheet.Cells[4, "C"].Value = "спеціальності \"" + group.Speciality + "\"";

                sheet.Cells[5, "D"].Value = "групи " + group.Name + " за " + semestrCurrent + " семестр " + group.Year +
                                            "-" +
                                            yearCurrent + " навчального року";

                sheet.Cells[46, "K"].Value = "/ " + group.Curator + " /";

                var subjects = pivricha == 1
                    ? @group.Subjects.FindAll(subject => subject.FirstSemestr != null)
                    : @group.Subjects.FindAll(subject => subject.SecondSemestr != null);

                if (subjects.Count == 0)
                {
                    Log.Info(LoggerConstants.EXIT);
                    return;
                }

                var subjectList = new Dictionary<string, List<Subject>>();

                foreach (Subject subject in @group.Subjects)
                {
                    subject.Ocinka.Clear();
                }

                List<Ocinka> ocinkas = new List<Ocinka>();
                foreach (Student student in @group.Students)
                {
                    ocinkas.AddRange(student.Ocinkas);
                }

                SortSubject(pivricha, mount, subjects, subjectList, ocinkas, group.Students);

                var count = -1;
                char[] c = { 'F', 'F' };

                if (subjectList.Count(pair => pair.Value.Count > 0) > 0)
                {
                    foreach (var keyValuePair in subjectList.Where(pair => pair.Value.Count != 0))
                    {
                        foreach (var subject in keyValuePair.Value)
                        {
                            count++;
                            sheet.Cells[9, c[1].ToString()] = subject.Name;
                            sheet.Cells[9, c[1].ToString()].ColumnWidth = ColumnWidth(subject.Name);
                            sheet.Cells[43, c[1].ToString()] = subject.Teacher;
                            sheet.Cells[44, c[1].ToString()] = pivricha == 1
                                ? subject.FirstSemestr.CountOfHours
                                : subject.SecondSemestr.CountOfHours;

                            var n = 10;

                            if (subject.Ocinka != null)
                            {
                                foreach (var ocinka in subject.Ocinka)
                                {
                                    n++;
                                    sheet.Cells[n, c[1].ToString()].Value = ocinka.Mark;
                                }
                            }

                            if (group.Students != null && group.Students.Count != 0)
                            {
                                sheet.Cells[41, c[1].ToString()].Value = "=Uspishnist(" + count + "," +
                                                                         group.Students.Count + ")";
                                sheet.Cells[42, c[1].ToString()].Value = "=Quality(" + count + "," +
                                                                         group.Students.Count + ")";
                            }

                            c[1]++;
                        }

                        CaseForMergingSubject(keyValuePair, sheet, c);

                        if (!keyValuePair.Key.Equals(ConstantExcel.Practice))
                        {
                            sheet.Cells[7, "F"].Value = "Предмети";
                            sheet.Range["F" + 7, ((char)(c[1] - (char)1)).ToString() + 7].Merge();
                            sheet.Range["F" + 7, ((char)(c[1] - (char)1)).ToString() + 7].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                        }

                        c[0] = c[1];
                    }
                }

                var row = 10;
                sheet.Cells[9, c[1].ToString()].Value = "Середній бал";
                var cBenefics = c[1];
                c[0] = c[1];
                c[0]--;

                cBenefics++;
                cBenefics++;

                foreach (var student in @group.Students)
                {
                    row++;

                    sheet.Cells[row, "D"].Value = string.IsNullOrWhiteSpace(student.PibChanged)
                        ? student.Pib
                        : student.PibChanged;

                    sheet.Cells[row, "E"].Value = student.FormaTeaching;
                    sheet.Cells[row, cBenefics.ToString()].Value = student.Benefits;
                    sheet.Cells[row, c[1].ToString()].Formula = "=AVERAGE(" + "F" + row + ":" + c[0] + row + ") - 0.5";
                    sheet.Cells[row, c[1].ToString()].NumberFormatLocal = "##";

                    var hight = true;
                    var sum = 0;
                    var countOf = 0;

                    if (student.Ocinkas.Count >= 1 && string.IsNullOrWhiteSpace(mount))
                    {
                        foreach (var ocinka in student.Ocinkas)
                        {
                            if (string.IsNullOrWhiteSpace(ocinka.Mark))
                            {
                                countOf++;
                            }

                            int number;

                            if (!int.TryParse(ocinka.Mark, out number))
                            {
                                continue;
                            }

                            if (number < 10)
                            {
                                hight = false;
                            }

                            sum += number;
                        }

                        if (student.FormaTeaching.Equals("п"))
                        {
                            hight = false;
                        }

                        var stupendiaColumnPosution = c[1];
                        stupendiaColumnPosution++;

                        if (group.Students[0].Ocinkas.Count - countOf == 0)
                        {
                            hight = false;
                        }
                        else if (sum/(group.Students[0].Ocinkas.Count - countOf) >= 7 &&
                                 !student.FormaTeaching.Equals("п"))
                        {
                            sheet.Cells[row, stupendiaColumnPosution.ToString()].Value = 1;
                        }

                        if (hight)
                        {
                            sheet.Cells[row, stupendiaColumnPosution.ToString()].Interior.Color =
                                ColorTranslator.ToOle(Color.Yellow);
                        }
                    }

                    if (string.IsNullOrWhiteSpace(mount))
                    {
                        sheet.Cells[row, cBenefics].Value = student.Benefits;
                    }
                }

                sheet.Range["C7", c[1].ToString() + 45].Borders.LineStyle = XlLineStyle.xlContinuous;

                if (group.Students.Count < 30)
                    sheet.Range["A" + (group.Students.Count + 11), "IV" + 40].Delete(
                        XlDeleteShiftDirection.xlShiftUp);

                // Add vidomist to arhive
                if (string.IsNullOrWhiteSpace(mount))
                    ArhiveZvedVidomist(sheet, semestrCurrent);
                else
                    sheet.Cells[6, "D"].Value = "Зведена відомість успішності за " + mount;
            }
            catch (Exception e)
            {
                Log.Warn(LoggerConstants.SOMETHING_WRONG, e);
            }
            finally
            {
                App.CloseBook(book, true);
                App.CloseBook(bookTamplate, true);
            }
        }