Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        protected void SaveStudent()
        {
            StudentBll st_bll = null;

            st_bll = new StudentBll();
            StudentBll.StudenEntity student = new StudentBll.StudenEntity();

            try
            {
                site = new DBSite();
                site.BeginTrans();

                student.StudentName  = txtStudentName.Text;
                student.AdmNo        = txtAdmNo.Text;
                student.PresentClass = util.CheckNullInt(ddlPresentClass.SelectedValue);

                student.SectionId = util.CheckNullInt(ddlSection.SelectedValue);

                student.IdCardNo   = txtIdCardNo.Text;
                student.FatherName = txtFatherName.Text;
                student.MotherName = txtMotherName.Text;

                student.MobileNoF = txtMobileNoF.Text;
                student.MobileNoM = txtMobileNoM.Text;
                student.DOB       = txtDOB.Text;

                if (txtMobileNoF.Text.Length != 10)
                {
                    lblError.Text    = "Mobile Number should be of 10 digits";
                    lblError.Visible = true;
                    txtMobileNoF.Focus();
                    ClearSuccessMessage();
                    return;
                }



                student.Email = txtDOB.Text;


                string message = "";



                if (this.lblStudentMasterId.Text == "New")
                {
                    //if (IsDuplicateCardNo(site, student.IdCardNo, -1))
                    //{
                    //    txtIdCardNo.Focus();
                    //    isErr = true;

                    //    return;
                    //}

                    st_bll.SaveStudent(site, student);
                    message = " Successfully Added !";
                }
                else
                {
                    student.StudentMasterId = util.CheckNullInt(lblStudentMasterId.Text);

                    //if (IsDuplicateCardNo(site, student.IdCardNo, student.StudentMasterId))
                    //{
                    //    txtIdCardNo.Focus();
                    //    isErr = true;
                    //    return;
                    //}

                    st_bll.UpdateStudent(site, student);
                    message = " Successfully Updated !";
                }

                site.Commit();
                lblMessage.Text    = message;
                lblMessage.Visible = true;
                isErr = false;
                ClearErrorMessage();
            }
            catch (Exception ex)
            {
                site.RollBack();
                util.HandleExpception(ex, Response);
            }
            finally
            {
                site.Close();
            }
        }
Ejemplo n.º 5
0
        protected void btnSendSMS_Click(object sender, EventArgs e)
        {
            List <string> selectedMobieNosList = GetArr90(40);
            //string msg = "Dear Parents, " + txtMessage.Text + ".";
            // string msg = ddlTemplate.SelectedValue.ToString()  + txtMessage.Text + ".";



            // string msg = ddlTemplate.SelectedValue.ToString() + TextBox2.Text + ".";

            string msg = ddlTemplate.SelectedValue.ToString() + TranslateSan() + ".";


            string result = "";
            //string selectedMobieNos = GetSelectedIds(gridView1, 5);
            string selectedMobieNos = GetSelectedIds(gridView1, 6);

            string[] arr        = selectedMobieNos.Split();
            int      mobileCoun = arr.Length;

            string mobs     = "";
            string mobsTest = "";

            DBSite site = new DBSite();

            string sms_result = "";

            int sms_count = 0;

            // if check box is selected
            bool isUnicode = ckbUnicode.Checked;


            //try
            {
                foreach (string str in selectedMobieNosList)
                {
                    mobs = str.Replace("&nbsp;,", "");

                    msg = msg.Replace("'", "");

                    try
                    {
                        site.BeginTrans();
                        sms_count += util.SaveSentSMSToDB(site, mobs, msg, isUnicode, Util_BLL.User);
                        site.Commit();
                    }
                    catch (Exception ex)
                    {
                        site.RollBack();
                        throw ex;
                    }


                    result += util.SendSms(site, mobs, msg, Util_BLL.User, Response, isUnicode);
                    //sms_result = util.SMSResult(result);



                    mobsTest += "\n" + mobs;
                }

                // txtMessage.Text = result;

                lblMessage.Text    = sms_count + " SMS Sent";
                lblMessage.Visible = true;
            }
            //catch (Exception ex)
            //{
            //    lblError.Text = "Ooops ...Some Error ! " + ex.Message;
            //    lblError.Visible = true;
            //}

            int sms_bal = util.GetSMSBalance(site, Util_BLL.User.UserId);



            if (sms_bal == -99)
            {
                lblBalance.Text = "Remaining SMS : ";
            }
            else
            {
                lblBalance.Text = "Remaining SMS : " + sms_bal.ToString();
            }
            //
        }
Ejemplo n.º 6
0
        protected void btnSendSMSToAbsentees_Click(object sender, EventArgs e)
        {
            Util_BLL      util = new Util_BLL();
            AttendanceBll abll = new AttendanceBll();

            site = new DBSite();
            List <AttendanceBll.AttendanceEntity> attdList = new List <AttendanceBll.AttendanceEntity>();

            AttendanceBll.AttendanceEntity atd;

            foreach (GridViewRow gr in gridView1.Rows)
            {
                atd = new AttendanceBll.AttendanceEntity();



                CheckBox cb = (CheckBox)gr.Cells[0].FindControl("ckbPresent");
                if (!cb.Checked)
                {
                    atd.AttendanceId = util.CheckNullInt(gr.Cells[2].Text);

                    string msg = "Dear Parent, Your Child Name <40> is absent today.";
                    msg = msg.Replace("<40>", util.CheckNull(gr.Cells[3].Text));

                    // 5cs School, Lalpur
                    if (Util_BLL.User.SenderId == "FifthC")
                    {
                        msg = "Dear Parents, Your ward '<40>' is absent today from School.";
                        msg = msg.Replace("<40>", util.CheckNull(gr.Cells[3].Text));
                    }


                    // if not class is Staff then do not send sms
                    // and not sms has been sent already

                    string mobileNo = abll.GetMobileNo(site, atd.AttendanceId);

                    string ss = util.SendSms(site, mobileNo, msg, Util_BLL.User, this.Response, false);

                    int sms_count = 0;

                    try
                    {
                        site.BeginTrans();

                        sms_count = util.SaveSentSMSToDB(site, mobileNo, msg, false, Util_BLL.User);
                        site.Commit();
                    }
                    catch (Exception ex)
                    {
                        site.RollBack();
                    }



                    if (abll.GetClassName(site, atd.AttendanceId).ToUpper() != "STAFF" && !abll.IsSMSSent(site, atd.AttendanceId))
                    {
                        //string ss = util.SendSms(abll.GetMobileNo(site, atd.AttendanceId), msg, Util_BLL.User, this.Response);
                    }


                    attdList.Add(atd);
                }
            }

            abll.PostSMS(site, attdList);
        }
Ejemplo n.º 7
0
        void SaveExam()
        {
            exmBll = new ExamMasterBll();
            ExamMasterBll.ExamMasterEntity exam = new ExamMasterBll.ExamMasterEntity();

            try
            {
                string message = "";

                exam.ExamName        = this.txtExamName.Text;
                exam.ExamCode        = this.txtExamCode.Text;
                exam.ExamDate        = util.CheckNullDate(DateTime.Today);
                exam.ClassMasterID   = util.CheckNullInt(ddlClass.SelectedValue);
                exam.SectionMasterID = util.CheckNullInt(ddlSection.SelectedValue);
                exam.TermId          = util.CheckNullInt(ddlTerm.SelectedValue);
                exam.MaxMarks        = util.CheckNullInt(txtMaxMarks.Text);
                exam.PassMarks       = util.CheckNullInt(txtPassMarks.Text);
                exam.ExamOrder       = util.CheckNullInt(txtExamOrder.Text);

                site = new DBSite();



                // save or updare


                site.BeginTrans();

                if (lblExamMasterId.Text == "New")
                {
                    exmBll.SaveExam(site, exam);
                    message = "\t '" + exam.ExamName + "' Successfully Added !";
                }
                else
                {
                    exam.ExamMasterId = util.CheckNullInt(lblExamMasterId.Text);
                    exmBll.UpdateExam(site, exam);
                    message = "\t '" + exam.ExamName + "' Successfully Updated !";
                }

                site.Commit();

                lblMessage.Text    = message;
                lblMessage.Visible = true;
                ClearErrorMessage();
            }
            catch (Exception ex)
            {
                site.RollBack();
                if (ex.Message.Contains("UNQ_ExamName"))
                {
                    lblMessage.Text    = "\t '" + exam.ExamName + "' is already present !";
                    lblMessage.Visible = true;
                }
                else
                {
                    util.HandleExpception(ex, Response);
                }
            }
            finally
            {
                site.Close();
            }
        }