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)); }
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) { } }
public List <BOStudents> LoadStudents(int userid, string hostCode) { DACategories pDAL = new DACategories(); try { var dtStudents = pDAL.LoadStudents(userid, hostCode); var students = new List <BOStudents>(); BOStudents std = null; foreach (DataRow item in dtStudents.Rows) { std = new BOStudents(); std.AdmissionId = item["AdmissionId"].ToString(); std.Class = Convert.ToInt32(item["StudentClass"].ToString()); std.Section = Convert.ToInt32(item["StudentSection"].ToString()); std.ClassName = item["StudentClassDesc"].ToString(); std.SectionName = item["StudentSectionDesc"].ToString(); std.Id = Convert.ToInt32(item["StudentId"]); std.FirstName = item["FirstName"].ToString(); std.SurName = item["LastName"].ToString(); std.DOB = item["DOB"].ToString(); std.ResAddress = item["Address"].ToString(); std.TeleNumber = item["ContactNo"].ToString(); std.MotherName = item["MotherName"].ToString(); std.FatherName = item["FatherName"].ToString(); students.Add(std); } return(students); } catch { throw; } finally { pDAL = null; } }