Exemple #1
0
        public int InsertAttendence(BOStudents presents)
        {
            SqlParameter[] sqlParams = new SqlParameter[9];
            sqlParams[0] = new SqlParameter("@Date", presents.PresentDate);
            sqlParams[1] = new SqlParameter("@Attendence", presents.Presents);
            sqlParams[4] = new SqlParameter("@HostCode", presents.HostCode);
            sqlParams[3] = new SqlParameter("@RecordId", presents.Id);
            sqlParams[5] = new SqlParameter("@CreatedDate", DateTime.Now);
            sqlParams[6] = new SqlParameter("@ModifiedDate", DateTime.Now);
            sqlParams[7] = new SqlParameter("@CreatedBy", presents.UserId);
            sqlParams[8] = new SqlParameter("@ModifiedBy", presents.UserId);

            return cmnDA.ExecuteNonQuery("pr_StudentMarks_AddOrUpdate", sqlParams);
        }
Exemple #2
0
 public int InsertAttendence(BOStudents marks)
 {
     DAStudentMarks pDAL = new DAStudentMarks();
     try
     {
         return pDAL.InsertAttendence(marks);
     }
     catch
     {
         throw;
     }
     finally
     {
         pDAL = null;
     }
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {

                if (gvStudentMarks.Rows.Count == 0) return;

                var students = new BOStudents();

                StringBuilder attendece = new StringBuilder();
                foreach (GridViewRow item in gvStudentMarks.Rows)
                {
                    var chk = (CheckBox)item.FindControl("chkSelect");
                    var lbl = (Label)item.FindControl("lblAdmissionId");
                    if (chk.Checked)
                        attendece.Append(lbl + "|" + "1" + ",");
                    else
                        attendece.Append(lbl + "|" + "0" + ",");
                }

                students.Presents = attendece.ToString();
                students.PresentDate = Convert.ToDateTime(txtattendencedate.Text);

                var isInserted = (new BLStudentMarks()).InsertAttendence(students);
                if (isInserted == 1)
                {
                    lblErrorMsg.ForeColor = System.Drawing.Color.Green;
                    lblErrorMsg.Text = "Attendence inserted successfully.";
                }
                else
                {
                    lblErrorMsg.ForeColor = System.Drawing.Color.Red;
                    lblErrorMsg.Text = "Attendence insertion failed.";
                }
            }
            catch (Exception)
            {
            }
        }