コード例 #1
0
        protected void btnPost_Click(object sender, EventArgs e)
        {
            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.Status = 1;
                }
                else
                {
                    atd.Status = 0;
                }

                atd.AttendanceId = util.CheckNullInt(gr.Cells[2].Text);

                attdList.Add(atd);
            }

            aBll.PostAttendance(site, attdList);
        }
コード例 #2
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);
        }