protected void btnGo_Click(object sender, EventArgs e)
    {
        FpSpread1.Sheets[0].ColumnHeader.RowCount          = 0;
        FpSpread1.Sheets[0].SheetCorner.Columns[0].Visible = false;
        FpSpread1.Sheets[0].ColumnCount = 4;
        FpSpread1.Sheets[0].RowCount    = 0;
        //FpSpread1.Sheets[0].Columns[0].Width = 30;
        //FpSpread1.Sheets[0].Columns[1].Width = 10;
        //FpSpread1.Sheets[0].Columns[2].Width = 10;
        FpSpread1.Sheets[0].RowCount++;
        FpSpread1.Sheets[0].Cells[0, 0].Text            = "Sl. No";
        FpSpread1.Sheets[0].Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
        FpSpread1.Sheets[0].Columns[0].Width            = 100;
        FpSpread1.Sheets[0].Cells[0, 0].Font.Bold       = true;

        FpSpread1.Sheets[0].Cells[0, 1].Text            = "Reg. No";
        FpSpread1.Sheets[0].Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
        FpSpread1.Sheets[0].Columns[1].Width            = 200;
        FpSpread1.Sheets[0].Cells[0, 1].Font.Bold       = true;


        FpSpread1.Sheets[0].SpanModel.Add(0, 2, 1, 2);
        FpSpread1.Sheets[0].Cells[0, 2].Text            = "Bar Code";
        FpSpread1.Sheets[0].Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
        FpSpread1.Sheets[0].Cells[0, 2].Font.Bold       = true;
        FpSpread1.Sheets[0].Columns[3].Width            = 100;


        string ddlbatch_value = ddlbatch.SelectedValue.ToString();
        string s = ddldegree.SelectedValue.ToString();
        string ddlbranch_value   = ddlbranch.SelectedValue.ToString();
        string ddlduration_value = ddlduration.SelectedValue.ToString();
        string reg_number        = "";

        FarPoint.Web.Spread.TextCellType ttype = new FarPoint.Web.Spread.TextCellType();
        sl_no = 1;
        con_reg.Close();
        con_reg.Open();
        query_reg = "select reg_no from registration where batch_year=" + ddlbatch_value + " and degree_code=" + ddlbranch_value + " and current_semester=" + ddlduration_value + " and cc=0 and delflag=0 and exam_flag <> 'DEBAR'";
        SqlCommand    com_reg = new SqlCommand(query_reg, con_reg);
        SqlDataReader dr_reg;

        dr_reg = com_reg.ExecuteReader();
        if (dr_reg.HasRows == true)
        {
            while (dr_reg.Read())
            {
                reg_number = dr_reg["reg_no"].ToString();

                lblnorec.Visible = false;
                FpSpread1.Sheets[0].RowCount++;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = sl_no.ToString();
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                if (reg_number != "")
                {
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].CellType        = ttype;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = dr_reg["reg_no"].ToString();
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].SpanModel.Add(FpSpread1.Sheets[0].RowCount - 1, 2, 1, 2);

                    string dummynumber = dr_reg["reg_no"].ToString();
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text      = "*" + dummynumber + "*";
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name = "IDAutomationHC39M";


                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].VerticalAlign   = VerticalAlign.Middle;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].VerticalAlign   = VerticalAlign.Middle;
                }
                else
                {
                    FpSpread1.Sheets[0].SpanModel.Add(FpSpread1.Sheets[0].RowCount - 1, 2, 1, 2);
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = "-";
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Rows[FpSpread1.Sheets[0].RowCount - 1].Height              = 45;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text            = "-";
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                }
                sl_no++;
            }
            logo_settings();
            FpSpread1.Visible            = true;
            FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
        }
        else
        {
            lblnorec.Visible  = true;
            lblnorec.Text     = "Generate Register Number First";
            FpSpread1.Visible = false;
        }
    }
示例#2
0
    protected void btnGo_Click(object sender, EventArgs e)
    {
        try
        {
            string valDegree = string.Empty;
            string valBatch  = string.Empty;
            string valSem    = string.Empty;
            string collCode  = Convert.ToString(ddlCollege.SelectedValue);
            Label1.Visible   = false;
            Button2.Visible  = false;
            TextBox1.Visible = false;
            Button1.Visible  = false;
            DataSet ds1 = new DataSet();

            if (cblBatch.Items.Count > 0)
            {
                valBatch = rs.GetSelectedItemsValueAsString(cblBatch);
            }
            if (cblBranch.Items.Count > 0)
            {
                valDegree = rs.GetSelectedItemsValueAsString(cblBranch);
            }
            if (cbl_sem.Items.Count > 0)
            {
                valSem = rs.GetSelectedItemsValueAsString(cbl_sem);
            }

            string query1 = string.Empty;
            query1 = "select r.reg_no,r.Batch_Year,r.degree_code,s.subject_no,s.subject_code,s.subject_name,ed.exam_code,r.Current_Semester,sy.semester, me.roll_no,me.external_mark,me.internal_mark,me.result,me.evaluation1,me.evaluation2,me.evaluation3,me.external_mark,me.total,c.Course_Name,de.Dept_Name  from mark_entry me,Exam_Details ed,subject s,Registration r,syllabus_master sy,Degree d,Department de,course c where c.Course_Id=d.Course_Id and d.Dept_Code=de.Dept_Code and r.degree_code=d.degree_code and s.syll_code=sy.syll_code and  r.Roll_No=me.roll_no and ed.degree_code=r.degree_code and ed.batch_year=r.Batch_Year and me.exam_code=ed.exam_code and me.subject_no=s.subject_no and r.batch_year=ed.batch_year and ed.Exam_Month='" + Convert.ToString(ddlmonth.SelectedValue) + "' and ed.Exam_year='" + Convert.ToString(ddlyear.SelectedValue) + "'  and ed.degree_code in('" + valDegree + "') and  ed.batch_year in('" + valBatch + "')  and  r.college_code='" + collCode + "' and result<>'pass' group by c.Course_Name,de.Dept_Name,r.reg_no,r.degree_code,r.batch_year,s.subject_no,s.subject_code,s.subject_name,ed.exam_code,r.Current_Semester,sy.semester, me.roll_no,me.external_mark,me.internal_mark,me.result,me.evaluation1,me.evaluation2,me.evaluation3,me.external_mark,me.total   order by r.reg_no";//sy.semester=r.Current_Semester and

            ds1 = da.select_method_wo_parameter(query1, "text");

            if (ds1.Tables[0].Rows.Count > 0)
            {
                FpSpread1.Visible    = true;
                g1btnprint.Visible   = false;
                g1btnexcel.Visible   = false;
                Printcontrol.Visible = false;
                txtexcelname.Visible = false;
                //lblexportxl.Visible = false;
                FpSpread1.Sheets[0].RowCount                = 0;
                FpSpread1.Sheets[0].ColumnCount             = 0;
                FpSpread1.Sheets[0].SheetCorner.ColumnCount = 0;
                FpSpread1.Sheets[0].ColumnHeader.RowCount   = 1;
                FpSpread1.Sheets[0].ColumnCount             = 9;
                FpSpread1.Width  = 970;
                FpSpread1.Height = 900;

                FarPoint.Web.Spread.TextCellType txt     = new FarPoint.Web.Spread.TextCellType();
                FarPoint.Web.Spread.StyleInfo    MyStyle = new FarPoint.Web.Spread.StyleInfo();
                MyStyle.Font.Size       = FontUnit.Medium;
                MyStyle.HorizontalAlign = HorizontalAlign.Center;
                MyStyle.Font.Name       = "Book Antiqua";
                MyStyle.ForeColor       = Color.Black;
                MyStyle.Font.Bold       = true;
                MyStyle.BackColor       = ColorTranslator.FromHtml("#0CA6CA");
                FpSpread1.Sheets[0].DefaultStyle.Font.Size    = FontUnit.Medium;
                FpSpread1.Sheets[0].ColumnHeader.DefaultStyle = MyStyle;
                FpSpread1.Sheets[0].DefaultStyle.Font.Size    = FontUnit.Medium;
                FpSpread1.Sheets[0].DefaultStyle.Font.Name    = "Book Antiqua";
                FpSpread1.Sheets[0].DefaultStyle.Font.Bold    = false;
                FpSpread1.Sheets[0].RowHeader.Visible         = false;
                FpSpread1.Sheets[0].AutoPostBack = false;
                FpSpread1.CommandBar.Visible     = false;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Degree";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Department";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Reg. No.";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Subject Code";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Text = "Subject Name";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Text = "INT";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Text = "EXT";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 8].Text = "Final Mark";

                FpSpread1.Sheets[0].Columns[0].Width = 70;
                FpSpread1.Sheets[0].Columns[1].Width = 100;
                FpSpread1.Sheets[0].Columns[2].Width = 150;
                FpSpread1.Sheets[0].Columns[3].Width = 150;
                FpSpread1.Sheets[0].Columns[4].Width = 120;
                FpSpread1.Sheets[0].Columns[5].Width = 170;
                FpSpread1.Sheets[0].Columns[6].Width = 70;
                FpSpread1.Sheets[0].Columns[7].Width = 70;
                FpSpread1.Sheets[0].Columns[8].Width = 70;

                FpSpread1.Sheets[0].SetColumnMerge(1, FarPoint.Web.Spread.Model.MergePolicy.Always);
                FpSpread1.Sheets[0].SetColumnMerge(2, FarPoint.Web.Spread.Model.MergePolicy.Always);
                FpSpread1.Sheets[0].SetColumnMerge(3, FarPoint.Web.Spread.Model.MergePolicy.Always);
                int sno         = 0;
                int maxarrCount = 0;
                int.TryParse(txtMaxArrCount.Text, out maxarrCount);

                if (maxarrCount > 0)
                {
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        DataTable dicStudent = ds1.Tables[0].DefaultView.ToTable(true, "reg_no", "roll_no");
                        foreach (DataRow dt in dicStudent.Rows)
                        {
                            string regNo  = Convert.ToString(dt["reg_no"]);
                            string rollNo = Convert.ToString(dt["roll_no"]);
                            ds1.Tables[0].DefaultView.RowFilter = "reg_no='" + regNo + "'";
                            DataTable dtSubjectCount = ds1.Tables[0].DefaultView.ToTable();
                            if (dtSubjectCount.Rows.Count <= maxarrCount)
                            {
                                for (int j = 0; j < dtSubjectCount.Rows.Count; j++)
                                {
                                    string cusem       = Convert.ToString(dtSubjectCount.Rows[j]["Current_Semester"]);
                                    string subSem      = Convert.ToString(dtSubjectCount.Rows[j]["semester"]);
                                    string subjectCode = Convert.ToString(dtSubjectCount.Rows[j]["subject_code"]);
                                    string SubName     = Convert.ToString(dtSubjectCount.Rows[j]["subject_name"]);
                                    string Course      = Convert.ToString(dtSubjectCount.Rows[j]["Course_Name"]);
                                    string deptname    = Convert.ToString(dtSubjectCount.Rows[j]["Dept_Name"]);
                                    string CIA         = loadmarkat(Convert.ToString(dtSubjectCount.Rows[j]["internal_mark"]));
                                    string EXt         = loadmarkat(Convert.ToString(dtSubjectCount.Rows[j]["external_mark"]));
                                    string tot         = loadmarkat(Convert.ToString(dtSubjectCount.Rows[j]["total"]));


                                    if (subSem.Trim() == cusem.Trim())
                                    {
                                        FpSpread1.Sheets[0].RowCount = FpSpread1.Sheets[0].RowCount + 1;
                                        sno++;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = sno + "";
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Locked          = true;

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].VerticalAlign   = VerticalAlign.Middle;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].CellType        = txt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = Course;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Locked          = true;

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].VerticalAlign   = VerticalAlign.Middle;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].CellType        = txt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text            = deptname;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Locked          = true;

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].VerticalAlign   = VerticalAlign.Middle;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].CellType        = txt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text            = regNo;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Locked          = true;

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].CellType        = txt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text            = subjectCode;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Locked          = true;

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Left;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].CellType        = txt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Text            = SubName;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Locked          = true;

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].CellType        = txt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Text            = CIA;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Locked          = true;

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].CellType        = txt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Text            = EXt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Locked          = true;

                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].HorizontalAlign = HorizontalAlign.Center;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].CellType        = txt;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Text            = tot;
                                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Locked          = true;
                                    }
                                }
                            }
                        }
                        FpSpread1.Visible = true;
                        FpSpread1.SaveChanges();
                        FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
                        Label1.Visible   = true;
                        TextBox1.Visible = true;
                        Button1.Visible  = true;
                        Button2.Visible  = true;
                    }
                    else
                    {
                        FpSpread1.Visible   = false;
                        lblAlertMsg.Visible = true;
                        lblAlertMsg.Text    = "No Record Found";
                        divPopAlert.Visible = true;
                        Label1.Visible      = false;
                        TextBox1.Visible    = false;
                        Button1.Visible     = false;
                        Button2.Visible     = false;
                        //lblerrormsg.Text = "No Records Found";
                    }
                }
                else
                {
                    FpSpread1.Visible   = false;
                    lblAlertMsg.Visible = true;
                    lblAlertMsg.Text    = "Max.Arrear Count Not valid!";
                    divPopAlert.Visible = true;
                    Label1.Visible      = false;
                    TextBox1.Visible    = false;
                    Button1.Visible     = false;
                    Button2.Visible     = false;
                }
            }
            else
            {
                FpSpread1.Visible   = false;
                lblAlertMsg.Visible = true;
                lblAlertMsg.Text    = "No Record Found";
                divPopAlert.Visible = true;
                Label1.Visible      = false;
                TextBox1.Visible    = false;
                Button1.Visible     = false;
                Button2.Visible     = false;
                //lblerrormsg.Text = "No Records Found";
            }
        }
        catch (Exception ex)
        {
        }
    }