コード例 #1
0
 // delete rows from clos
 private void gvClo_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         if (AskYesNo() == false)
         {
             return;
         }
         int             selectedrowindex = gvClo.SelectedCells[0].RowIndex;
         DataGridViewRow selectedRow      = gvClo.Rows[selectedrowindex];
         string          _id       = Convert.ToString(selectedRow.Cells["id"].Value);
         AJ_DataClass    ajdbClass = new AJ_DataClass();
         string          s         = ajdbClass.DeleteFromDatabase("delete from clo where id='" + _id + "'");
         ajdbClass.popGrid(gvClo, "select id,name from clo");
         ajdbClass.popCmb(cmbClo, "select * from clo", "id", "name");
         lblrubricLevels.Text = "Rubrics Level - Settings Clo:" + cmbClo.Text;
     }
 }
コード例 #2
0
        private void AttandanceReport_Load(object sender, EventArgs e)
        {
            ajdbClass.popGrid(gvClo, "SELECT dbo.Student.Id, dbo.Student.FirstName,  dbo.ClassAttendance.AttendanceDate, dbo.Lookup.Name  FROM  dbo.StudentAttendance INNER JOIN dbo.Student ON dbo.StudentAttendance.StudentId = dbo.Student.Id INNER JOIN dbo.ClassAttendance ON dbo.StudentAttendance.AttendanceId = dbo.ClassAttendance.Id INNER JOIN  dbo.Lookup ON dbo.StudentAttendance.AttendanceStatus = dbo.Lookup.LookupId order by AttendanceId asc");   //  ajdbClass.popGrid(gvClo, "select id,name from clo");
            Document doc = new Document(PageSize.A4, 7f, 5f, 5f, 0f);

            iTextSharp.text.Font mainFont = FontFactory.GetFont("Segoe UI", 22, new iTextSharp.text.BaseColor(System.Drawing.ColorTranslator.FromHtml("#999")));
            Phrase mainPharse             = new Phrase();


            //Creating iTextSharp Table from the DataTable data
            PdfPTable pdfTable = new PdfPTable(gvClo.ColumnCount);

            pdfTable.DefaultCell.Padding = 5;
            pdfTable.WidthPercentage     = 90;
            int[] firstTablecellwidth = { 20, 25, 32, 25 };
            pdfTable.SetWidths(firstTablecellwidth);
            pdfTable.HorizontalAlignment     = Element.ALIGN_LEFT;
            pdfTable.DefaultCell.BorderWidth = 1;

            //Adding Header row
            foreach (DataGridViewColumn column in gvClo.Columns)
            {
                PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText));
                pdfTable.AddCell(cell);
            }

            int row   = gvClo.Rows.Count;
            int cell2 = gvClo.Rows[1].Cells.Count;

            for (int i = 0; i < row - 1; i++)
            {
                for (int j = 0; j < cell2; j++)
                {
                    if (gvClo.Rows[i].Cells[j].Value == null)
                    {
                        //return directly
                        //return;
                        //or set a value for the empty data
                        gvClo.Rows[i].Cells[j].Value = "null";
                    }
                    pdfTable.AddCell(gvClo.Rows[i].Cells[j].Value.ToString());
                }
            }

            //Exporting to PDF
            string folderPath = @"e:\";

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }
            using (FileStream stream = new FileStream(folderPath + "AttandanceReport.pdf", FileMode.Create))
            {
                Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
                PdfWriter.GetInstance(pdfDoc, stream);
                pdfDoc.Open();
                pdfDoc.Add(new Phrase("\t\t\t Attandance Report\n"));

                pdfDoc.Add(pdfTable);
                pdfDoc.Close();
                stream.Close();
            }
        }
コード例 #3
0
        private void StudentReport_Load(object sender, EventArgs e)

        {
            string qry = "SELECT Student.Id, Student.FirstName AS StudentName, Student.Contact, Student.Email, Student.RegistrationNumber as RegNo, Lookup.Name as Status " +
                         " FROM Student INNER JOIN " + " Lookup ON Student.Status = Lookup.LookupId ";

            ajdbClass.popGrid(gvStudRep, qry);

            PdfPTable pdfTable = new PdfPTable(gvStudRep.ColumnCount);

            pdfTable.DefaultCell.Padding     = 5;
            pdfTable.WidthPercentage         = 60;
            pdfTable.HorizontalAlignment     = Element.ALIGN_LEFT;
            pdfTable.DefaultCell.BorderWidth = 1;

            //set overall width
            pdfTable.WidthPercentage = 90f;
            //set column widths
            int[] firstTablecellwidth = { 20, 25, 25, 32, 25, 25 };
            pdfTable.SetWidths(firstTablecellwidth);
            //Adding Header row
            foreach (DataGridViewColumn column in gvStudRep.Columns)
            {
                PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText));
                pdfTable.AddCell(cell);
            }

            int row   = gvStudRep.Rows.Count;
            int cell2 = gvStudRep.Rows[1].Cells.Count;

            for (int i = 0; i < row - 1; i++)
            {
                for (int j = 0; j < cell2; j++)
                {
                    if (gvStudRep.Rows[i].Cells[j].Value == null)
                    {
                        gvStudRep.Rows[i].Cells[j].Value = "null";
                    }
                    pdfTable.AddCell(gvStudRep.Rows[i].Cells[j].Value.ToString());
                    this.gvStudRep.Columns[1].Width = 100;
                }
            }

            //Exporting to PDF
            string folderPath = @"e:\";

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }
            using (FileStream stream = new FileStream(folderPath + "StudentReport1.pdf", FileMode.Create))
            {
                Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
                PdfWriter.GetInstance(pdfDoc, stream);
                pdfDoc.Open();
                pdfDoc.Add(new Phrase("\t\t\t STUDENT REPORT\n"));
                pdfDoc.Add(pdfTable);
                pdfDoc.Close();
                stream.Close();
            }
        }
コード例 #4
0
        private void CloReport_Load(object sender, EventArgs e)
        {
            string qry = "SELECT        Student.FirstName, Clo.Name, Rubric.Details AS Rubric, RubricLevel.Details AS [Level] FROM Student INNER JOIN StudentResult ON Student.Id = StudentResult.StudentId INNER JOIN" +
                         "  RubricLevel ON StudentResult.RubricMeasurementId = RubricLevel.Id INNER JOIN" +
                         "   Rubric ON RubricLevel.RubricId = Rubric.Id INNER JOIN" +
                         "  Clo ON Rubric.CloId = Clo.Id";

            ajdbClass.popGrid(gvClo, qry);
            //Document doc = new Document(PageSize.A4, 7f, 5f, 5f, 0f);
            //iTextSharp.text.Font mainFont = FontFactory.GetFont("Segoe UI", 22, new iTextSharp.text.BaseColor(System.Drawing.ColorTranslator.FromHtml("#999")));
            //Phrase mainPharse = new Phrase();

            //Creating iTextSharp Table from the DataTable data
            PdfPTable pdfTable = new PdfPTable(gvClo.ColumnCount);

            pdfTable.DefaultCell.Padding = 5;
            pdfTable.WidthPercentage     = 90;
            int[] firstTablecellwidth = { 30, 25, 32, 25 };
            pdfTable.SetWidths(firstTablecellwidth);
            pdfTable.HorizontalAlignment     = Element.ALIGN_LEFT;
            pdfTable.DefaultCell.BorderWidth = 1;

            //Adding Header row
            foreach (DataGridViewColumn column in gvClo.Columns)
            {
                PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText));
                pdfTable.AddCell(cell);
            }

            //Adding DataRow
            //foreach (DataGridViewRow row in gvClo.Rows)
            //{
            //    foreach (DataGridViewCell cell in row.Cells)
            //    {
            //        pdfTable.AddCell(cell.Value.ToString());
            //    }
            //}
            int row   = gvClo.Rows.Count;
            int cell2 = gvClo.Rows[1].Cells.Count;

            for (int i = 0; i < row - 1; i++)
            {
                for (int j = 0; j < cell2; j++)
                {
                    if (gvClo.Rows[i].Cells[j].Value == null)
                    {
                        //return directly
                        //return;
                        //or set a value for the empty data
                        gvClo.Rows[i].Cells[j].Value = "null";
                    }
                    pdfTable.AddCell(gvClo.Rows[i].Cells[j].Value.ToString());
                }
            }

            //Exporting to PDF
            try
            {
                string folderPath = @"e:\";
                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }
                using (FileStream stream = new FileStream(folderPath + "CloReport.pdf", FileMode.Create))
                {
                    Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
                    PdfWriter.GetInstance(pdfDoc, stream);
                    pdfDoc.Open();
                    pdfDoc.Add(new Phrase("\t\t\t CLO Report\n"));
                    pdfDoc.Add(pdfTable);
                    pdfDoc.Close();
                    stream.Close();
                }
            }
            catch
            {
            }
        }
コード例 #5
0
        /// <summary>
        /// Load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            // fill combos
            ajdbClass.popCmb(cmbClo, "select * from clo", "id", "name");
            ajdbClass.popCmb(cmbRubrics, "select * from Rubric where CloId='" + cmbClo.SelectedValue + "'", "id", "Details");
            ajdbClass.popCmb(cmbStatus, "select * from Lookup where category='STUDENT_STATUS'", "Lookupid", "Name");

            ajdbClass.popCmb(cmbRubAsses, "select * from Rubric ", "id", "details");
            ajdbClass.popCmb(cmbStudent, "SELECT * FROM STUDENT", "id", "FirstName");
            ajdbClass.popCmb(cmbAseesRE, "SELECT *  FROM  Assessment ", " Assessment.Id", "Title");
            ajdbClass.popCmb(cmbAssesR, "SELECT *  FROM  AssessmentComponent where AssessmentId='" + cmbAseesRE.SelectedValue + "'", "  AssessmentComponent.Id", "Name");
            ajdbClass.popCmb(cmbRubRes, "select * from RubricLevel", "Id", "Details");
            ajdbClass.popCmb(cmbAssesment, "SELECT *  FROM  Assessment ", " Assessment.Id", "Title");
            // fill data grid view
            ajdbClass.popGrid(gvClo, "select id,name from clo");
            ajdbClass.popGrid(gvRub, "select id,details from Rubric where cloid='" + cmbClo.SelectedValue + "'");
            ajdbClass.popGrid(gvRubSettings, "select id,details,MeasurementLevel from RubricLevel where RubricId='" + cmbRubrics.SelectedValue + "'");
            string qry = "SELECT Student.Id, Student.FirstName, Student.LastName, Student.Contact, Student.Email, Student.RegistrationNumber, Lookup.Name, Lookup.LookupId " +
                         " FROM Student INNER JOIN " + " Lookup ON Student.Status = Lookup.LookupId ";

            ajdbClass.popGrid(gvStudents, qry); txtRubricSetDetails.Text = ""; txtRubricSetLevel.Text = "";
            ajdbClass.popGrid(gvAssesment, "SELECT Assessment.Id, Title, DateCreated, TotalMarks, TotalWeightage  FROM  Assessment");
            gvAttandance.DataSource = GetAttendanceRecord();
            ajdbClass.popGrid(gvAssesComp, "select AssessmentComponent.Id, Name, Assessment.Title,Rubric.details as Rubric ,AssessmentComponent.TotalMarks from AssessmentComponent inner join Rubric on  AssessmentComponent.RubricId=Rubric.Id INNER JOIN Assessment ON AssessmentComponent.AssessmentId = Assessment.Id ");
            ajdbClass.popGrid(gvResult, "select FirstName,Assessment.Title,AssessmentComponent.Name,EvaluationDate,RubricLevel.details as Rubric from  Student INNER JOIN   StudentResult ON Student.Id = StudentResult.StudentId INNER JOIN RubricLevel ON StudentResult.RubricMeasurementId = RubricLevel.Id INNER JOIN AssessmentComponent ON StudentResult.AssessmentComponentId = AssessmentComponent.Id INNER JOIN Assessment ON AssessmentComponent.AssessmentId = Assessment.Id");
        }
コード例 #6
0
        private void AssesmentReport_Load(object sender, EventArgs e)
        {
            try {
                ajdbClass.popGrid(gvAssesRep, "select FirstName,Assessment.Title,AssessmentComponent.Name,EvaluationDate,RubricLevel.details as Rubric from  Student INNER JOIN   StudentResult ON Student.Id = StudentResult.StudentId INNER JOIN RubricLevel ON StudentResult.RubricMeasurementId = RubricLevel.Id INNER JOIN AssessmentComponent ON StudentResult.AssessmentComponentId = AssessmentComponent.Id INNER JOIN Assessment ON AssessmentComponent.AssessmentId = Assessment.Id");

                // ajdbClass.popGrid(gvAssesRep, qry);

                PdfPTable pdfTable = new PdfPTable(gvAssesRep.ColumnCount);

                //set overall width

                pdfTable.DefaultCell.Padding     = 5;
                pdfTable.WidthPercentage         = 60;
                pdfTable.HorizontalAlignment     = Element.ALIGN_LEFT;
                pdfTable.DefaultCell.BorderWidth = 1;

                pdfTable.WidthPercentage = 90f;
                //set column widths
                //  int[] firstTablecellwidth = { 20, 25, 25,25};
                //   pdfTable.SetWidths(firstTablecellwidth);
                //Adding Header row
                foreach (DataGridViewColumn column in gvAssesRep.Columns)
                {
                    PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText));
                    pdfTable.AddCell(cell);
                }

                int row   = gvAssesRep.Rows.Count;
                int cell2 = gvAssesRep.Rows[0].Cells.Count;
                for (int i = 0; i < row - 1; i++)
                {
                    for (int j = 0; j < cell2; j++)
                    {
                        if (gvAssesRep.Rows[i].Cells[j].Value == null)
                        {
                            gvAssesRep.Rows[i].Cells[j].Value = "null";
                        }
                        pdfTable.AddCell(gvAssesRep.Rows[i].Cells[j].Value.ToString());
                        this.gvAssesRep.Columns[0].Width = 100;
                    }
                }

                //Exporting to PDF
                string folderPath = @"e:\";
                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }
                using (FileStream stream = new FileStream(folderPath + "AssesmentReport.pdf", FileMode.Create))
                {
                    Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
                    PdfWriter.GetInstance(pdfDoc, stream);
                    pdfDoc.Open();
                    pdfDoc.Add(new Phrase("\t\t\t Assesment Report\n"));
                    pdfDoc.Add(pdfTable);
                    pdfDoc.Close();
                    stream.Close();
                }
            }
            catch (Exception ex)
            {
                //   MessageBox.Show("error");
            }
        }