예제 #1
0
        //private void LoadTemplateHistory()
        //{
        //    var submissionFolderPath = Path.Combine(GetProjectDirectory() + Constant.SCRIPT_FILE_PATH);
        //    DirectoryInfo directoryInfo = new DirectoryInfo(submissionFolderPath);
        //    DirectoryInfo[] directories = directoryInfo.GetDirectories();

        //    if (directories.Length > 0)
        //    {
        //        scriptFileCounter = 0;
        //        dgvScriptFiles.Rows.Clear();
        //        for (int i = 0; i < directories.Length; i++)
        //        {
        //            scriptFileCounter++;
        //            dgvScriptFiles.Rows.Add(new string[] { scriptFileCounter.ToString(), directories[i].ToString() });
        //        }
        //    }
        //}

        private void LoadPractical()
        {
            try
            {
                if (PracticalList != null)
                {
                    if (PracticalList.Count > 0)
                    {
                        scriptFileCounter = 0;
                        dgvScriptFiles.Rows.Clear();
                        for (int i = 0; i < PracticalList.Count; i++)
                        {
                            scriptFileCounter++;
                            PracticalDTO dto        = PracticalList[i];
                            string       buttonText = "View";
                            if (dto.State.Equals(Constant.PRACTICAL_STATUS[1]))
                            {
                                buttonText = "Import";
                            }
                            dgvScriptFiles.Rows.Add(scriptFileCounter.ToString(), dto.Code, dto.SubjectCode, dto.Date, dto.State, buttonText);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Practical list is empty!");
                }
            }
            catch (Exception ex)
            {
                Util.LogException("LoadPractical", ex.Message);
            }
        }
예제 #2
0
        private void dgvScriptFiles_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int index = e.RowIndex;

            if (index < 0 || index > PracticalList.Count - 1)
            {
                return;
            }
            PracticalDTO dto = PracticalList[index];

            if (Constant.PRACTICAL_STATUS[1].Equals(dto.State))
            {
                ImportTemplate(dto.Code);
            }
            else
            {
                var submissionFol = Path.Combine(Util.GetProjectDirectory() + Constant.SUBMISSION_FOLDER_PATH);
                ShowLecturerForm(dto.Code, dto.State, submissionFol);
            }
        }