コード例 #1
0
ファイル: StudentMaster.aspx.cs プロジェクト: sandeep2314/sql
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            site = new DBSite();
            StudentBll stBll = new StudentBll();

            List <string> student_id_list = new List <string>();

            try
            {
                foreach (GridViewRow gr in gridView1.Rows)
                {
                    CheckBox cb = (CheckBox)gr.Cells[0].FindControl("myCheckBox");
                    if (cb.Checked)
                    {
                        //if (stBll.IsStudentPresentInAttendance(site, util.CheckNullInt(gr.Cells[2].Text)))
                        //{
                        //    lblError.Text = "Can't Delete Record:'" + gr.Cells[4].Text + "' This Student is being entered in Attendance Entry.";
                        //    lblError.Visible = true;
                        //    ClearSuccessMessage();
                        //    return;
                        //}

                        student_id_list.Add(gr.Cells[3].Text);
                    }
                }


                if (student_id_list.Count < 1)
                {
                    lblError.Text    = "Can't Delete Records. Select at least one Record  ";
                    lblError.Visible = true;
                    ClearSuccessMessage();
                    return;
                }

                string st_ids = util.ConvertListToCommaSeparatedString(student_id_list);


                site.BeginTrans();
                stBll.DeleteStudent(site, st_ids);
                site.Commit();

                lblMessage.Text    = " [ " + student_id_list.Count + "] Record Deleted ";
                lblMessage.Visible = true;
                ClearErrorMessage();
            }
            catch (Exception del_exception)
            {
                site.RollBack();
                util.HandleExpception(del_exception, Response);
            }
            finally
            {
                site.Close();
            }
            GetStudents();
        }
コード例 #2
0
ファイル: ExamMasterFrm.aspx.cs プロジェクト: sandeep2314/sql
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ExamMasterBll exBll = new ExamMasterBll();

            site = new DBSite();

            List <string> Ids = new List <string>();

            foreach (GridViewRow gr in gridView1.Rows)
            {
                CheckBox cb = (CheckBox)gr.Cells[0].FindControl("myCheckBox");
                if (cb.Checked)
                {
                    Ids.Add(gr.Cells[3].Text);
                }
            }

            if (Ids.Count < 1)
            {
                lblError.Text    = "Can't Delete Records [ Select at least one Record ] ";
                lblError.Visible = true;
                //ClearSuccessMessage();
                return;
            }

            string cls_ids = util.ConvertListToCommaSeparatedString(Ids);

            // check if the exam exits in examMarks table

            String exam_Name = exBll.IsExamPresentInExamMarksTable(site, cls_ids);


            if (exam_Name.Length > 1)
            {
                lblMessage.Text = " [ '" + exam_Name + "'] Can not be Deleted. As it is present in Exam Marks.";
            }
            else
            {
                site.BeginTrans();

                exBll.DeleteExam(site, cls_ids);

                site.Commit();
                lblMessage.Text = " [ " + Ids.Count + "] Record Deleted ";
            }
            lblMessage.Visible = true;
            ClearErrorMessage();
            GetExams();
        }
コード例 #3
0
ファイル: ExamMarks.aspx.cs プロジェクト: sandeep2314/sql
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ExamMarksBll exmBll = new ExamMarksBll();

            site = new DBSite();

            List <string> Ids = new List <string>();

            foreach (GridViewRow gr in gridView1.Rows)
            {
                CheckBox cb = (CheckBox)gr.Cells[0].FindControl("ckbPresent");
                if (cb.Checked)
                {
                    Ids.Add(gr.Cells[12].Text);
                }
            }

            if (Ids.Count < 1)
            {
                lblError.Text    = "Can't Delete Records [ Select at least one Record ] ";
                lblError.Visible = true;
                //ClearSuccessMessage();
                return;
            }

            string cls_ids = util.ConvertListToCommaSeparatedString(Ids);

            // check if the exam exits in examMarks table


            site.BeginTrans();

            exmBll.DeleteExam(site, cls_ids);
            site.Commit();

            lblMessage.Text    = " [ " + Ids.Count + "] Record Deleted ";
            lblMessage.Visible = true;
            ClearErrorMessage();

            GetMarks();
            ClearAll();
        }