public DataTable GetStudentDetails(DTOStudentRegistration tostu) { using (Campus2CaretakerDataContext dbcontext = new Campus2CaretakerDataContext()) { return (dbcontext.GetStudentDetails(tostu.StudentId)).ToDataTable(); } }
protected void btnGetStudentInfo_Click(object sender, EventArgs e) { DTOStudentRegistration tostu = new DTOStudentRegistration(); tostu.StudentId = int.Parse(hfStudentID.Value.ToString()); btnSave.Enabled = false; btnUpdate.Enabled = true; btnDelete.Enabled = true; DataTable dt = new DataTable(); dt = new BOStudentRegistration().GetStudentDetails(tostu); try { txtStudentName.Text = dt.Rows[0][0].ToString(); txtFatherName.Text = dt.Rows[0][2].ToString(); txtMotherName.Text = dt.Rows[0][3].ToString(); txtDOB.Text = DateTime.Parse(dt.Rows[0][4].ToString()).ToString("dd MMMM, yyyy"); if (Session["InstituteType"].ToString() != "S") ddlSemester.SelectedValue = dt.Rows[0][5].ToString(); ddlClass.SelectedValue = dt.Rows[0][6].ToString(); txtRollNo.Text = dt.Rows[0][8].ToString(); txtParentsContactNumber.Text = dt.Rows[0][9].ToString(); txtStudentAddress.Text = dt.Rows[0][11].ToString(); txtParentsEmail.Text = dt.Rows[0][12].ToString(); ddlGender.SelectedValue = dt.Rows[0][13].ToString(); } catch { } }
public bool DeleteStudentDetails(DTOStudentRegistration tostu) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); // Institute Details tblStudentDetail StudDetail = dbContext.tblStudentDetails.Where(x => x.colStudentId == tostu.StudentId).FirstOrDefault(); dbContext.tblStudentDetails.DeleteOnSubmit(StudDetail); dbContext.SubmitChanges(); return true; } catch { return false; } }
protected void btnDelete_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(hfStudentID.Value.ToString())) { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Error.Please select a student';var elem = document.createElement('img');elem.setAttribute('src', 'cross.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Red';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Please Select a Student', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); return; } if (Page.IsValid) { try { DTOStudentRegistration tostu = new DTOStudentRegistration(); tostu.StudentId = int.Parse(hfStudentID.Value.ToString()); ; if (new BOStudentRegistration().DeleteStudentDetails(tostu)) { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Record deleted';var elem = document.createElement('img');elem.setAttribute('src', 'tick.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Green';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Student Details Deleted Sucessfully', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); RefreshGridView(); clear(); } else { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Error';var elem = document.createElement('img');elem.setAttribute('src', 'cross.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Red';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Error', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); } } catch { } } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(hfStudentID.Value.ToString())) { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Error.Please select a student';var elem = document.createElement('img');elem.setAttribute('src', 'cross.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Red';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Please Select Student', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); return; } if (Page.IsValid) { try { DTOStudentRegistration tostud = new DTOStudentRegistration(); tostud.StudentId = int.Parse(hfStudentID.Value.ToString()); tostud.Address = txtStudentAddress.Text; tostud.BranchId = int.Parse(ddlClass.SelectedValue); tostud.DOB = DateTime.Parse(txtDOB.Text); tostud.FatherName = txtFatherName.Text; tostud.InstituteId = int.Parse(Session["InstituteID"].ToString()); tostud.MotherName = txtMotherName.Text; tostud.ParentsMobileNo = txtParentsContactNumber.Text; tostud.ParentsEmail = txtParentsEmail.Text; tostud.RollNo = txtRollNo.Text; if (Session["InstituteType"].ToString() == "S") { tostud.SemesterId = 0; } else { tostud.SemesterId = int.Parse(ddlSemester.SelectedValue); } tostud.StudentName = txtStudentName.Text; tostud.Gender = ddlGender.SelectedValue; if (new BOStudentRegistration().UpdateStudentDetails(tostud)) { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Record updated';var elem = document.createElement('img');elem.setAttribute('src', 'tick.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Green';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Student Details Updated Sucessfully', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); clear(); RefreshGridView(); } else { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Error';var elem = document.createElement('img');elem.setAttribute('src', 'cross.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Red';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Error', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); } } catch { } } }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { try { DTOStudentRegistration tostud = new DTOStudentRegistration(); tostud.Address = txtStudentAddress.Text; tostud.BranchId = int.Parse(ddlClass.SelectedValue); tostud.DOB = DateTime.Parse(txtDOB.Text); tostud.FatherName = txtFatherName.Text; tostud.InstituteId = int.Parse(Session["InstituteID"].ToString()); tostud.MotherName = txtMotherName.Text; tostud.ParentsMobileNo = txtParentsContactNumber.Text; tostud.ParentsEmail = txtParentsEmail.Text; tostud.RollNo = txtRollNo.Text; if (Session["InstituteType"].ToString() == "S") { tostud.SemesterId = 0; } else { tostud.SemesterId = int.Parse(ddlSemester.SelectedValue); } tostud.StudentName = txtStudentName.Text; tostud.Gender = ddlGender.SelectedValue; if (new BOStudentRegistration().SaveStudentDetails(tostud)) { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Record inserted';var elem = document.createElement('img');elem.setAttribute('src', 'tick.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Green';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Student Details Saved Sucessfully', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); #region SMS string _messageTemplate = new BOSms().GetSMSTemplate("NEWSTUDENTADDED"); C2CSMS.SendSMS(_messageTemplate.Replace("##STUDENTNAME##", tostud.StudentName).Replace("##InstituteName##", Session["InstituteName"].ToString()), tostud.ParentsMobileNo); #endregion #region E-Mail //Send mail if (!string.IsNullOrEmpty(tostud.ParentsEmail)) { string s_subject = "Information From Campus2Caretaker"; string s_msg = String.Concat("Greetings from Campus2Caretaker.", Environment.NewLine, Environment.NewLine, _messageTemplate.Replace("##STUDENTNAME##", tostud.StudentName).Replace("##InstituteName##", Session["InstituteName"].ToString())) + Environment.NewLine + Environment.NewLine; C2CEmail.SendC2CMail(s_msg, s_subject, string.Empty, tostud.ParentsEmail, null, null); } #endregion clear(); RefreshGridView(); } else { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Error';var elem = document.createElement('img');elem.setAttribute('src', 'cross.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Red';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Error', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); } } catch { } } }
protected void btnSaveInternals_Click(object sender, EventArgs e) { for (int index = 0; index < gvInternals.Rows.Count - 1; index++) { if (int.Parse(((TextBox)gvInternals.Rows[index].FindControl("txtMarksScored")).Text) > 0) { DTOInternals toInt = new DTOInternals(); toInt.BranchId = int.Parse(ddlClass.SelectedValue); if (Session["InstituteType"].ToString() == "S") { toInt.SemesterId = 0; } else { toInt.SemesterId = int.Parse(ddlSemester.SelectedValue); } toInt.Month = ddlMonth.SelectedValue; toInt.Year = ddlYear.SelectedValue; toInt.SubjectId = int.Parse(ddlSubjects.SelectedValue); toInt.Description = txtDescription.Text; Label lblStudentID = (Label)gvInternals.Rows[index].FindControl("lblStudentID"); Label lblStudentName = (Label)gvInternals.Rows[index].FindControl("lblStudentName"); TextBox txtMaxMarks = (TextBox)gvInternals.Rows[index].FindControl("txtMaxMarks"); TextBox txtMinMarks = (TextBox)gvInternals.Rows[index].FindControl("txtMinMarks"); TextBox txtMarksScored = (TextBox)gvInternals.Rows[index].FindControl("txtMarksScored"); TextBox txtReMarks = (TextBox)gvInternals.Rows[index].FindControl("txtRemarks"); toInt.InstituteId = int.Parse(Session["InstituteID"].ToString()); toInt.MarksScored = decimal.Parse(txtMarksScored.Text); toInt.MaxMarks = decimal.Parse(txtMaxMarks.Text); toInt.MinMarks = decimal.Parse(txtMinMarks.Text); toInt.StudentId = int.Parse(lblStudentID.Text); toInt.Remarks = txtReMarks.Text; DTOStudentRegistration tostu = new DTOStudentRegistration(); tostu.StudentId = int.Parse(lblStudentID.Text); DataTable dtStudDet = new BOStudentRegistration().GetStudentDetails(tostu); if (new BOInternals().SaveUpdateInternals(toInt)) { #region SMS string _messageTemplate = new BOSms().GetSMSTemplate("INTERNALMARKSINTIMATION"); C2CSMS.SendSMS(_messageTemplate.Replace("##STUDENTNAME##", dtStudDet.Rows[0][0].ToString()).Replace("##INTERNALSMARKS##", String.Concat(toInt.MarksScored, " Out of ", toInt.MaxMarks)).Replace("##SUBJECTNAME##", ddlSubjects.SelectedItem.Text).Replace("##MONTHYEAR##", String.Concat(ddlMonth.SelectedItem.Text, string.Empty, ddlYear.SelectedItem.Text)).Replace("##InstituteName##", Session["InstituteName"].ToString()), dtStudDet.Rows[0][9].ToString()); #endregion #region E-Mail //Send mail if (!string.IsNullOrEmpty(dtStudDet.Rows[0][12].ToString())) { string s_subject = "Information From Campus2Caretaker"; string s_msg = String.Concat("Greetings from Campus2Caretaker.", Environment.NewLine, Environment.NewLine, _messageTemplate.Replace("##STUDENTNAME##", dtStudDet.Rows[0][0].ToString()).Replace("##INTERNALSMARKS##", String.Concat(toInt.MarksScored, " Out of ", toInt.MaxMarks)).Replace("##SUBJECTNAME##", ddlSubjects.SelectedItem.Text).Replace("##MONTHYEAR##", String.Concat(ddlMonth.SelectedItem.Text, string.Empty, ddlYear.SelectedItem.Text)).Replace("##InstituteName##", Session["InstituteName"].ToString())) + Environment.NewLine + Environment.NewLine; C2CEmail.SendC2CMail(s_msg, s_subject, string.Empty, dtStudDet.Rows[0][12].ToString(), null, null); } #endregion //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Record updated';var elem = document.createElement('img');elem.setAttribute('src', 'tick.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Green';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Internals Details Saved Successfully', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); } else { //string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='Error';var elem = document.createElement('img');elem.setAttribute('src', 'cross.jpg');document.getElementById('" + divStatus.ClientID + "').appendChild(elem);document.getElementById('" + divStatus.ClientID + "').style.color = 'Red';document.getElementById('" + divStatus.ClientID + "').style.fontSize = '1em' ;document.getElementById('" + divStatus.ClientID + "').style.fontWeight = 'bold' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},4500);"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", script, true); string alertScript = "jAlert('Error', 'Campus2Caretaker');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertScript", alertScript, true); } } } clear(); }
public bool DeleteStudentDetails(DTOStudentRegistration tostu) { return new DAOStudentRegistration().DeleteStudentDetails(tostu); }
public bool UpdateStudentDetails(DTOStudentRegistration tostud) { return new DAOStudentRegistration().UpdateStudentDetails(tostud); }
public DataTable GetStudentDetails(DTOStudentRegistration tostu) { return new DAOStudentRegistration().GetStudentDetails(tostu); }
public bool SaveStudentDetails(DTOStudentRegistration tostudentreg) { return new DAOStudentRegistration().SaveStudentDetails(tostudentreg); }
public bool UpdateStudentDetails(DTOStudentRegistration tostud) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); // Student Details tblStudentDetail studDetail = dbContext.tblStudentDetails.Where(x => x.colStudentId == tostud.StudentId).FirstOrDefault(); studDetail.colStudentName = tostud.StudentName; studDetail.colLastName = tostud.LastName; studDetail.colAddress = tostud.Address; studDetail.colFatherName = tostud.FatherName; studDetail.colMotherName = tostud.MotherName; studDetail.colDOB = tostud.DOB; studDetail.colSemesterId = tostud.SemesterId; studDetail.colBranchId = tostud.BranchId; studDetail.colSection = tostud.Section; studDetail.colRollNo = tostud.RollNo; studDetail.colParentsMobileNo = tostud.ParentsMobileNo; studDetail.colParentsEmail = tostud.ParentsEmail; studDetail.colInstituteId = tostud.InstituteId; studDetail.colGender = tostud.Gender; dbContext.SubmitChanges(); return true; } catch { return false; } }
public bool SaveStudentDetails(DTOStudentRegistration tostudentreg) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); tblStudentDetail studDetail = new tblStudentDetail(); studDetail.colStudentName = tostudentreg.StudentName; studDetail.colLastName = tostudentreg.LastName; studDetail.colAddress = tostudentreg.Address; studDetail.colFatherName = tostudentreg.FatherName; studDetail.colMotherName = tostudentreg.MotherName; studDetail.colDOB = tostudentreg.DOB; studDetail.colSemesterId = tostudentreg.SemesterId; studDetail.colBranchId = tostudentreg.BranchId; studDetail.colSection = tostudentreg.Section; studDetail.colRollNo = tostudentreg.RollNo; studDetail.colParentsMobileNo = tostudentreg.ParentsMobileNo; studDetail.colParentsEmail = tostudentreg.ParentsEmail; studDetail.colInstituteId = tostudentreg.InstituteId; studDetail.colGender = tostudentreg.Gender; dbContext.tblStudentDetails.InsertOnSubmit(studDetail); dbContext.SubmitChanges(); return true; } catch (Exception ex) { return false; } }