// Method to import records from the CSV file private static void ImportStudentsCSV() { //Recover CSV file path string sruta = System.Configuration.ConfigurationManager.AppSettings["RutaFile"]; string[] lines = File.ReadAllLines(sruta); string PreMessage = "ConsoleApp.exe input.csv "; foreach (var line in lines) { //Separate comma values, for each line var values = line.Split(','); //Instance the object clsStudent oStudent = new clsStudent(); bool sw; // Use the object method to Insert sw = oStudent.AddStudent(values[0].ToString(), values[1].ToString(), values[2].ToString(), FormatDate(values[3].ToString())); if (sw) { Console.WriteLine(PreMessage + "name=" + values[1].ToString()); // name Console.WriteLine(PreMessage + "type=" + values[0].ToString()); // type string sGender = (values[2].ToString() == "F") ? "female" : "male"; Console.WriteLine(PreMessage + "gender=" + sGender); // gender Console.WriteLine("Registered line... "); } else { Console.WriteLine("Error"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { ServerSideValidations(); if (oValidation.ValidateMe(lblErrorMsg)) { Hashtable oHt = CreateHashTableForCETSave(); oStudent = new clsStudent(); string sResult = oStudent.SaveCETDetails(oHt); if (sResult.Equals("Y")) { lblSaveMsg.Visible = true; } else { lblErrorMsg.Text = "Information can not be saved, Please contance Admin."; lblSaveMsg.Visible = false; lblErrorMsg.Visible = true; } //Write Ur Logic here } else { lblErrorMsg.Visible = true; } }
public void CountMatchesTestList() { //Create an instance of the class we want to create clsStudentCollection Student = new clsStudentCollection(); //create a list of data to assign to the property List <clsStudent> TestList = new List <clsStudent>(); //add item to the list clsStudent TestItem = new clsStudent(); //set its properties TestItem.FirstName = "Upesh"; TestItem.LastName = "Chavda"; TestItem.AddressLine1 = "40 Western Road"; TestItem.AddressLine2 = "Flat1245"; TestItem.City = "Leicester"; TestItem.PostCode = "LE3 0GH"; TestItem.DateOfBirth = new DateTime(1996, 02, 08); TestItem.Telephone = "07885547885"; TestItem.Email = "*****@*****.**"; //Add items to the list TestList.Add(TestItem); //assign the data to the property Student.AllStudents = TestList; //test to see if they are equal Assert.AreEqual(Student.Count, TestList.Count); }
protected void btnProceed_Click(object sender, EventArgs e) { string sPRN = txtPRN.Text.Trim(); oStud = new clsStudent(); DataTable oDTReplace = new DataTable(); oDTReplace = oStud.Get_Student_Details_For_Replace_PRN(sPRN); if (oDTReplace != null && oDTReplace.Rows.Count > 0) { divStudentDetails.Style.Add("display", "inline"); lblStudentName.Text = oDTReplace.Rows[0]["Student_Name"].ToString(); lblStudentPRN.Text = oDTReplace.Rows[0]["PRN_Number"].ToString(); lblCourse.Text = oDTReplace.Rows[0]["Course_Name"].ToString(); lblBranch.Text = oDTReplace.Rows[0]["Branch_Name"].ToString(); lblMessage.Visible = false; } else { lblMessage.Text = "No Record Found"; lblMessage.CssClass = "errorNote"; lblMessage.Visible = true; } }
public void bindStudents(int Admission_Year_ID,int Class_ID) { clsStudent stud = new clsStudent(); DataSet ds = stud.listStudentByAdmission_Year_ID(Admission_Year_ID, Class_ID); rpt_Students.DataSource = ds.Tables[0]; rpt_Students.DataBind(); }
/// <summary> /// This function is used to display the photograph . /// </summary> private void showPhotograph() { oStudent = new clsStudent(UniID, YearID, StudentID, true); DataTable dt = new DataTable(); if (oCDNKeys != null) { objCDN = new clsCDN(oCDNKeys.PhotoSignKey); sPathExists = !string.IsNullOrEmpty(Convert.ToString(oStudent.PhotoPath)) ? "Y" : "N"; ImgPhoto.ImageUrl = objCDN.PhotoSignDisplay(Convert.ToString(oStudent.PhotoPath), sPathExists, "P"); ImgPhoto.Visible = true; } //if (oStudent.PhotoPath != null) //{ // ImgPhoto.ImageUrl = dtRow["Download_Path"].ToString() + oStudent.PhotoPath;//"..\\PhotoSignTemp.ashx?QS_Student_ID=" + StudentID + "&img=Photo&Year=" + YearID; // ImgPhoto.Visible = true; // DivNoPhoto.Visible = false; //} //else //{ // DivNoPhoto.Visible = true; // ImgPhoto.Visible = false; //} }
public void bindstudentgrid() { clsStudent s = new clsStudent(); DataSet ds = s.listStudent(); gvstudent.DataSource = ds; gvstudent.DataBind(); }
public ActionResult GetStudents() { clsStudent oStudent = new clsStudent();// used Business List <clsStudent> ListaStudents = new List <clsStudent>(); ListaStudents = ConvertDataTable <clsStudent>(oStudent.GetStudentsSortedName()); return(Json(ListaStudents, JsonRequestBehavior.AllowGet)); }
protected void BindYearDropdown() { clsStudent cs = new clsStudent(); DataSet ds = cs.SelectAdYear(); ddCourse.DataSource = ds; ddCourse.DataTextField = "YearName"; ddCourse.DataValueField = "Admission_Year_ID"; ddCourse.DataBind(); ddCourse.Items.Insert(0, new ListItem("Select Year", "-1")); }
public void AddStudent_Test() { //Instance the object clsStudent oStudent = new clsStudent(); var vResult = oStudent.AddStudent("university", "ivan", "M", DateTime.Now); Assert.IsNotNull(vResult, "Test"); Console.WriteLine("-----Test Method AddStudent-----"); Console.WriteLine(vResult); }
public void DeleteStudent_Test() { // parameter test int pId = 6; //Instance the object clsStudent oStudent = new clsStudent(); var vResult = oStudent.DeleteStudent(pId); Assert.IsNotNull(vResult, "Test"); Console.WriteLine("-----Test Method DeleteStudent-----"); Console.WriteLine(vResult + " Record delete: " + pId); }
//public void CreateReport() //{ // try // { // Hashtable ht = new Hashtable(); // ht.Add("fk_AcademicYear_ID", ddlAcademicYr.SelectedValue); // clsStudent objStudent = new clsStudent(); // DataTable dtCancelAdmission = objStudent.CancelAdmissionReport(ht).Tables[0]; // if (dtCancelAdmission != null && dtCancelAdmission.Rows.Count > 0) // { // ReportDataSource ReportDetailsDS1 = new ReportDataSource("DSCancelAdmission", dtCancelAdmission); // ReportParameter[] p = new ReportParameter[6]; // p.SetValue(new ReportParameter("UniName", clsGetSettings.Name), 0); // p.SetValue(new ReportParameter("UniAdd", clsGetSettings.Address), 1); // p.SetValue(new ReportParameter("UserName", ((clsUser)Session["User"]).Name), 2); // p.SetValue(new ReportParameter("Logo", Classes.clsGetSettings.SitePath + @"/Images/" + Classes.clsGetSettings.UniversityLogo), 3); // rptViewer.LocalReport.DataSources.Clear(); // rptViewer.LocalReport.ReportPath = Server.MapPath(@"~\Eligibility\Rdlc\rpt_CancelAdmission.rdlc"); // rptViewer.LocalReport.EnableExternalImages = true; // rptViewer.LocalReport.DataSources.Add(ReportDetailsDS1); // rptViewer.LocalReport.SetParameters(p); // rptViewer.LocalReport.Refresh(); // } // else // { // lblSave.Text = "No data found."; // lblSave.CssClass = "ErrorNote"; // } // } // catch (Exception Ex) // { // Exception e = new Exception(Ex.Message, Ex); // } //} #endregion private bool BindReport() { DataTable oDt = null; Hashtable oHt = new Hashtable(); clsUser oUser = null; oUser = (clsUser)Session["User"]; oHt.Add("fk_AcademicYear_ID", ddlAcademicYr.SelectedValue); clsStudent objStudent = new clsStudent(); try { using (oDt = objStudent.CancelAdmissionReport(oHt).Tables[0]) { if (oDt != null && oDt.Rows.Count > 0) { rptViewer.LocalReport.DataSources.Clear(); rptViewer.LocalReport.ReportPath = clsGetSettings.PhysicalSitePath + @"Eligibility\Rdlc\rpt_CancelAdmission.rdlc"; ReportDataSource oRds = new ReportDataSource("DSCancelAdmission", oDt); ReportParameter[] param = new ReportParameter[8]; param[0] = new ReportParameter("UniName", clsGetSettings.UniversityName.ToString(), true); param[1] = new ReportParameter("UniLogo", clsGetSettings.SitePath + "Images/" + clsGetSettings.Logo, true); param[2] = new ReportParameter("UniSitePath", clsGetSettings.SitePath.ToString(), true); param[3] = new ReportParameter("UniversityCity", clsGetSettings.UniversityCity, true); param[4] = new ReportParameter("UserName", oUser.Name, true); param[5] = new ReportParameter("Address", clsGetSettings.Address, true); string sCriteria = "Branch Change details for " + oUser.Name;; param[6] = new ReportParameter("ReportCriteria", sCriteria, true); param[7] = new ReportParameter("Culture", CultureInfo.CurrentCulture.Name); //param[7] = new ReportParameter("UniId", clsGetSettings.UniversityID.ToString(), true); ReportDataSource MultNomDS = new ReportDataSource("dsMultiNom", MultinomenClature()); rptViewer.LocalReport.EnableExternalImages = true; rptViewer.LocalReport.SetParameters(param); rptViewer.LocalReport.DataSources.Add(oRds); rptViewer.LocalReport.DataSources.Add(MultNomDS); rptViewer.LocalReport.Refresh(); DivReportViewerDesign.Visible = true; divAllCriterion.Visible = false; return(true); } else { lblErrorMsg.Visible = true; return(false); } } } catch (Exception ex) { throw ex; } }
private void DisplayStudentDetails() { oViewStudent = new clsStudent(); oDataSet = new DataSet(); oHashTable = new Hashtable(); oHashTable["UniID"] = clsGetSettings.UniversityID; oHashTable["StudentID"] = hid_pk_Student_ID.Value; oHashTable["Year"] = hid_pk_Year.Value; oDataSet = oViewStudent.GetViewStudentDetails(oHashTable); RenderTable(oDataSet); }
public void GetStudentById_Test() { // parameter test int pId = 4; //Instance the object clsStudent oStudent = new clsStudent(); var vResult = oStudent.GetStudentbyId(pId); Assert.IsNotNull(vResult, "Test"); Console.WriteLine("-----Test Get Student by Id-----"); Console.WriteLine(vResult + " Record: " + vResult.Id + " " + vResult.StudentType + " " + vResult.StudentName + " " + vResult.Gender + " " + vResult.DateTimeStamp.ToString()); }
public void bindStudentAttendance(int Student_ID) { clsStudent cs = new clsStudent(); DataSet ds = cs.StudentAttendance(Student_ID); if (ds.Tables[0].Rows.Count > 0) { lblStudent_Name.Text=ds.Tables[0].Rows[0]["Student_Name"].ToString(); lblLectureConducted.Text=ds.Tables[0].Rows[0]["LectureConducted"].ToString(); lblAbsent.Text = ds.Tables[0].Rows[0]["Abse"].ToString(); lblPresent.Text = ds.Tables[0].Rows[0]["Present"].ToString(); } }
protected void btnStudentConfirm_Click(object sender, EventArgs e) { clsStudent ThisStudent = new clsStudent(); string ErrorMsg; ErrorMsg = ThisStudent.StudentValid(txtStudentPNumber.Text, txtStudentNames.Text, txtStudentDate.Text, txtStudentAttendancePercentage.Text, txtStartingYear.Text); lblError.Visible = true; if (ErrorMsg == "") { clsStudentCollection NewStudent = new clsStudentCollection(); if (StudentNo == -1) { NewStudent.ThisStudent.StudentPNumber = txtStudentPNumber.Text; NewStudent.ThisStudent.StudentFullName = txtStudentNames.Text; NewStudent.ThisStudent.StudentAdditionDate = Convert.ToDateTime(txtStudentDate.Text); NewStudent.ThisStudent.StudentAttendancePercentage = Convert.ToDecimal(txtStudentAttendancePercentage.Text); NewStudent.ThisStudent.StudentExpelled = chkStudentExpelled.Checked; NewStudent.ThisStudent.StudentStartingYear = Convert.ToInt32(txtStartingYear.Text); NewStudent.ThisStudent.StudentCourseNo = Convert.ToInt32(ddlStudentCourse.SelectedValue); NewStudent.ThisStudent.StudentTutorNo = Convert.ToInt32(ddlStudentTutor.SelectedValue); NewStudent.Add(); } else { NewStudent.ThisStudent.StudentNo = StudentNo; NewStudent.ThisStudent.StudentPNumber = txtStudentPNumber.Text; NewStudent.ThisStudent.StudentFullName = txtStudentNames.Text; NewStudent.ThisStudent.StudentAdditionDate = Convert.ToDateTime(txtStudentDate.Text); NewStudent.ThisStudent.StudentAttendancePercentage = Convert.ToDecimal(txtStudentAttendancePercentage.Text); NewStudent.ThisStudent.StudentExpelled = chkStudentExpelled.Checked; NewStudent.ThisStudent.StudentStartingYear = Convert.ToInt32(txtStartingYear.Text); NewStudent.ThisStudent.StudentCourseNo = Convert.ToInt32(ddlStudentCourse.SelectedValue); NewStudent.ThisStudent.StudentTutorNo = Convert.ToInt32(ddlStudentTutor.SelectedValue); NewStudent.Update(); } Response.Redirect("Default.aspx"); } else { lblError.Text = ErrorMsg; } }
public bool addStudent(clsStudent s) { SqlParameter[] sp = new SqlParameter[8]; sp[0] = new SqlParameter("@Admission_Year_ID", s.Admission_Year_ID); sp[1] = new SqlParameter("@Student_Name", s.Student_name); sp[2] = new SqlParameter("@Contact_No",s.Contact_No); sp[3] = new SqlParameter("@Email",s.Email); sp[4] = new SqlParameter("@Password", s.Password); sp[5] = new SqlParameter("@Class_ID",s.Class_ID); sp[6] = new SqlParameter("@Current_Subject_ID",s.Current_Subject_ID); sp[7] = new SqlParameter("@Faculty_ID",s.Faculty_ID); return datalayer.Execute_NonQuery("sp_addStudent", CommandType.StoredProcedure, sp); }
protected void ddCourse_SelectedIndexChanged(object sender, EventArgs e) { if (ddCourse.SelectedIndex > 0) { int Admission_Year_ID = Convert.ToInt32(ddCourse.SelectedValue); clsStudent stud = new clsStudent(); DataSet ds = stud.listClassIDbyAdmissionProgramme(Admission_Year_ID); drp_ClassID.DataSource = ds.Tables[0]; drp_ClassID.DataTextField = "Class_Name"; drp_ClassID.DataValueField = "Class_ID"; drp_ClassID.DataBind(); drp_ClassID.Items.Insert(0, new ListItem("Select One", "-1")); } }
private void lstStudent_SelectedIndexChanged(object sender, EventArgs e) { int index = lstStudent.SelectedIndex - 2; if (lstStudent.SelectedIndex == -1) { clearUserInput(); return; } if (index < 0 || index >= mStudents.Count) { ShowMessage("Please select a valid student."); lstStudent.SelectedIndex = -1; return; } clsStudent temp = (clsStudent)mStudents[index]; txtStudentID.Text = temp.UnivID.ToString(); txtFirstName.Text = temp.FirstName; txtLastName.Text = temp.LastName; txtSchool.Text = temp.Street; txtCity.Text = temp.City; txtState.Text = temp.State; txtZip.Text = temp.Zip.ToString(); try { openDatabaseConnection(); mDB.Open(); string sql = "SELECT University.ID, UniversityName " + "FROM StudentInfo, StudentUniversity, University " + "WHERE StudentInfo.UnivID = StudentUniversity.StudentID " + "AND University.ID = studentUniversity.UniversityID " + "AND StudentInfo.UnivID = " + clsSQL.ToSql(temp.UnivID) + ";"; OleDbCommand cmd = new OleDbCommand(sql, mDB); OleDbDataReader rdr = cmd.ExecuteReader(); rdr.Read(); rdr.Close(); } catch (Exception ex) { ShowMessage("There was an unexpected error: " + ex.Message); } finally { closeDatabaseConnection(); } }
//Method for get Students public static void ListStudents() { clsStudent oStudent = new clsStudent(); var vDataStudents = oStudent.GetStudentsSortedName(); Console.WriteLine("-----Students List sorted by name-----"); int count = 0; foreach (DataRow datarow in vDataStudents.Rows) { count++; Console.WriteLine("***************** Record " + count + "********************"); Console.WriteLine(datarow[0].ToString() + " " + datarow[1].ToString() + " " + datarow[2].ToString() + " " + datarow[3].ToString() + " " + datarow[4].ToString()); } }
void DisplayStudent(Int32 StudentNo) { clsStudent myStudent = new clsStudent(); myStudent.Find(StudentNo); txtStudentPNumber.Text = myStudent.StudentPNumber; txtStudentNames.Text = myStudent.StudentFullName; txtStudentDate.Text = myStudent.StudentAdditionDate.ToString("dd/MM/yyyy"); txtStartingYear.Text = Convert.ToString(myStudent.StudentStartingYear); txtStudentAttendancePercentage.Text = Convert.ToString(myStudent.StudentAttendancePercentage); chkStudentExpelled.Checked = myStudent.StudentExpelled; ddlStudentCourse.SelectedValue = Convert.ToString(myStudent.StudentCourseNo); ddlStudentTutor.SelectedValue = Convert.ToString(myStudent.StudentTutorNo); }
public void GetStudentsByType_Test() { //Instance the object clsStudent oStudent = new clsStudent(); var vResult = oStudent.GetStudentsByType("Kinder"); Assert.IsNotNull(vResult, "Test"); Console.WriteLine("-----Test Get Students by Type-----"); int count = 0; foreach (DataRow datarow in vResult.Rows) { count++; Console.WriteLine("***************** Record " + count + "********************"); Console.WriteLine(datarow[0].ToString() + " " + datarow[1].ToString() + " " + datarow[2].ToString() + " " + datarow[3].ToString() + " " + datarow[4].ToString()); } }
private bool BindReport() { oHt = new Hashtable(); oHt = CreateHashTable(); oStudent = new clsStudent(); using (oDt = oStudent.GetCollegeCourseStudentDetails(oHt)) { if (oDt != null && oDt.Rows.Count > 0) { rptViewer.LocalReport.DataSources.Clear(); rptViewer.LocalReport.ReportPath = clsGetSettings.PhysicalSitePath + "Eligibility\\Rdlc\\rptCollegeCourseStudentDetailsMUHS.rdlc"; ReportDataSource oRds = new ReportDataSource("DSOAReports", oDt); ReportParameter[] param = new ReportParameter[7]; param[0] = new ReportParameter("UniName", clsGetSettings.UniversityName.ToString(), true); param[1] = new ReportParameter("UniLogo", clsGetSettings.SitePath + "Images/" + clsGetSettings.Logo, true); param[2] = new ReportParameter("CollegeName", hidCollName.Value.Trim(), true); param[3] = new ReportParameter("CourseName", hidCrName.Value.Trim(), true); param[4] = new ReportParameter("userName", oUser.Name, true); param[5] = new ReportParameter("Address", clsGetSettings.Address, true); string sLoginType = "C"; if (oUser.UserTypeCode != "2") { sLoginType = "A"; } param[6] = new ReportParameter("LoginType", sLoginType, true); //string sCriteria = "Branch Change details for " + oUser.Name; ; // param[6] = new ReportParameter("ReportCriteria", sCriteria, true); ReportDataSource MultNomDS = new ReportDataSource("dsMultiNom", MultinomenClature()); rptViewer.LocalReport.EnableExternalImages = true; rptViewer.LocalReport.SetParameters(param); rptViewer.LocalReport.DataSources.Add(oRds); rptViewer.LocalReport.DataSources.Add(MultNomDS); rptViewer.LocalReport.Refresh(); return(true); } else { lblErrorMsg.Visible = true; return(false); } } }
protected void btnUpdate_Click(object sender, EventArgs e) { oStud = new clsStudent(); lblMessage.Visible = false; int i = oStud.ReplacePRN(txtPRN.Text.Trim(), txtReplacePRN.Text.Trim(), user.User_ID); if (i > 0) { lblMessage.Text = "PRN Repalced"; lblMessage.CssClass = "saveNote"; lblMessage.Visible = true; } else { lblMessage.Text = "Error while replacing PRN"; lblMessage.CssClass = "errorNote"; lblMessage.Visible = true; } }
public void bindStudentInfo() { clsStudent cs = new clsStudent(); DataSet ds = cs.GetStudentInfoByUsername(uname); if (ds.Tables[0].Rows.Count > 0) { lblAdmission_Year_ID.Text = ds.Tables[0].Rows[0]["Admission_Year_ID"].ToString(); lblStudent_ID.Text = ds.Tables[0].Rows[0]["Student_ID"].ToString(); lblStudent_Name.Text = ds.Tables[0].Rows[0]["Student_Name"].ToString(); lblContact_No.Text = ds.Tables[0].Rows[0]["Contact_No"].ToString(); lblEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString(); lblPassword.Text = ds.Tables[0].Rows[0]["Password"].ToString(); lblClass_ID.Text = ds.Tables[0].Rows[0]["Class_ID"].ToString(); lblCurrent_Subject_ID.Text = ds.Tables[0].Rows[0]["Current_Subject_ID"].ToString(); lblFaculty.Text = ds.Tables[0].Rows[0]["Faculty_Name"].ToString(); Session["facultyID"] = ds.Tables[0].Rows[0]["Faculty_ID"].ToString(); Session["Student_ID"] = ds.Tables[0].Rows[0]["Student_ID"].ToString(); } }
private void LoadDBTable(string sql) { if (mUserFile == null) { ShowMessage("Please select a valid file."); return; } try { mStudents.Clear(); openDatabaseConnection(); mDB.Open(); OleDbCommand cmd = new OleDbCommand(sql, mDB);; OleDbDataReader rdr = cmd.ExecuteReader(); while (rdr.Read() == true) { clsStudent tempRecord = new clsStudent( (int)rdr["StudentID"], (string)rdr["LastName"], (string)rdr["FirstName"], (string)rdr["School"], (string)rdr["City"], (string)rdr["State"], (int)rdr["Zip"]); mStudents.Add(tempRecord); } rdr.Close(); } catch (Exception ex) { ShowMessage("There was an unexpected error: " + ex); } finally { closeDatabaseConnection(); } }
protected void gvstudent_RowCommand(object sender,GridViewCommandEventArgs e) { if (e.CommandName == "change_Password") { string email = e.CommandArgument.ToString(); hfEmailID.Value = email; Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "Func_PopUp()", true); } if (e.CommandName == "remove_Student") { string email = e.CommandArgument.ToString(); hfEmailID.Value = email; if (!string.IsNullOrEmpty(hfEmailID.Value)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", "<script>alert('Are you sure you want to delete the role');</script>"); clsStudent cs = new clsStudent(); cs.removeStudent(email); Membership.DeleteUser(email); bindstudentgrid(); } } }
protected void btnsubmitstudent_Click(object sender, EventArgs e) { MembershipCreateStatus status; Membership.CreateUser(txtstudentemailid.Text, txtstudentpassword.Text, txtstudentemailid.Text, "Que", "Ans", true, out status); if (status == MembershipCreateStatus.Success) { Roles.AddUserToRole(txtstudentemailid.Text, "student"); clsStudent s = new clsStudent(); s.Student_name = txtstudentname.Text; s.Admission_Year_ID = Convert.ToInt32(ddCourse.SelectedValue); s.Contact_No = txtstudentcontactno.Text; s.Email = txtstudentemailid.Text; s.Password = txtstudentpassword.Text; s.Class_ID = Convert.ToInt32(drp_ClassID.SelectedValue); s.Current_Subject_ID =1; s.Faculty_ID =Convert.ToInt32(drpFaculty.SelectedValue); if (!string.IsNullOrEmpty(s.Student_name) && !string.IsNullOrEmpty(s.Contact_No) && !string.IsNullOrEmpty(s.Email) && !string.IsNullOrEmpty(s.Password) && !string.IsNullOrEmpty(drp_ClassID.SelectedValue) && !string.IsNullOrEmpty(drpFaculty.SelectedValue)) { try { s.addStudent(s); string body = "Congratulations" + s.Student_name + "You are successfully registered.Welcome to Hare Krishna Diamond Institute"; mailing ms = new mailing(); ms.SendEmail(s.Email, "Admission Registered", body); } catch (Exception ex) { Membership.DeleteUser(txtstudentemailid.Text); } bindstudentgrid(); pnldata.Visible = true; pnlform.Visible = false; txtstudentname.Text = ""; txtstudentemailid.Text = ""; txtstudentpassword.Text = ""; txtstudentcontactno.Text = ""; //ddCourse.SelectedValue= ""; drpFaculty.SelectedIndex= 0; txtCurrentSubject.Text = ""; } } }
void CancelStudentAdmission(string UniStudID, string sCancelReason) { string[] StudentIDs = UniStudID.Split('|'); string sResult = string.Empty; //string sISDirectAdmission = string.Empty; Classes.clsUser user = (Classes.clsUser)Session["User"]; Hashtable oHt = new Hashtable(); oHt["pk_Uni_ID"] = StudentIDs[0]; oHt["pk_Year"] = StudentIDs[1]; oHt["pk_Student_ID"] = StudentIDs[2]; oHt["pk_Fac_ID"] = StudentIDs[3]; oHt["pk_Cr_ID"] = StudentIDs[4]; oHt["pk_MoLrn_ID"] = StudentIDs[5]; oHt["pk_Ptrn_ID"] = StudentIDs[6]; oHt["pk_Brn_ID"] = StudentIDs[7]; oHt["pk_CrPr_Details_ID"] = StudentIDs[9]; oHt["pk_CrPrCh_ID"] = StudentIDs[10]; oHt["CrPr_Seq"] = StudentIDs[8]; oHt["CrPrCh_Seq"] = StudentIDs[11]; //oHt["Admission_Form_No"] = StudentIDs[12]; //oHt["AdmissionMode"] = StudentIDs[13]; //oHt["CrPr_OrderNo"] = StudentIDs[14]; //oHt["MINumber"] = StudentIDs[15]; //oHt["IsDirectAdmission"] = sISDirectAdmission; //oHt["Prn_number "] = ((Label)((Repeater)(source)).Items[e.Item.ItemIndex].FindControl("lblPRN")).Text; oHt["User"] = user.User_ID; oHt["CancellationReason"] = sCancelReason; //string sAdmissionFormNo = StudentIDs[12]; //string sAdmissionMode = StudentIDs[13]; //int sCrPr_OrderNo = Convert.ToInt16(StudentIDs[14]); //string sMINumber = StudentIDs[15]; //bool isDirectAdmission = StudentIDs[16].Equals("1") ? true : false; //oHt["CancellationReason"]=txtReasonforCancellation. clsStudent oStudent = new clsStudent(); clsOthers sOthers = new clsOthers(); sResult = oStudent.CancelAdmission(oHt); switch (sResult) { case "N": //#region Followng code is added to cancel the admission at OA side, call to API //string OaMessage = string.Empty; //Hashtable oHs = new Hashtable(); //oHs.Add("pk_Uni_ID", StudentIDs[0]); //if (sOthers.Allow_CancelAdmissionAtOASide(oHs)) //{ // if (sAdmissionMode == "11" || sAdmissionMode == "12") //OA unregistered // { // if (sCrPr_OrderNo.Equals(1) || isDirectAdmission) // { // clsUserLogin userLogin = new clsUserLogin(); // DataSet ds = new DataSet(); // DataTable dt = new DataTable("CancelAdmissionTable"); // dt.Columns.Add(new DataColumn("ApplicationID", typeof(string))); // dt.Columns.Add(new DataColumn("DUDCFlag", typeof(string))); // dt.Columns.Add(new DataColumn("Username", typeof(string))); // dt.Columns.Add(new DataColumn("MINumber", typeof(string))); // DataRow dr = dt.NewRow(); // dr["ApplicationID"] = sAdmissionFormNo; // dr["DUDCFlag"] = "DU"; // dr["Username"] = user.User_Name; // dr["MINumber"] = sMINumber; // dt.Rows.Add(dr); // ds.Tables.Add(dt); // string dtToJson = string.Empty; // dtToJson = JsonConvert.SerializeObject(ds, Formatting.Indented); // //old Code commented for API CALL // /* // try // { // string apiPath = userLogin.getSyncURL() + "PostStudentCancelAdmission"; // using (ExtendedWebClient client = new ExtendedWebClient()) // { // client.Headers.Add("content-type", "application/json; charset=utf-8"); // client.Encoding = System.Text.Encoding.UTF8; // OaMessage = client.UploadString(apiPath, "POST", dtToJson); // } // }*/ // try // { // string apiPath = userLogin.getSyncURL() + "PostStudentCancelAdmission"; // var httpWebRequest = (HttpWebRequest)WebRequest.Create(apiPath); // httpWebRequest.Method = "POST"; // httpWebRequest.ContentType = "application/json"; // using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) // { // streamWriter.Write(dtToJson); // streamWriter.Flush(); // streamWriter.Close(); // var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); // using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) // { // OaMessage = streamReader.ReadToEnd(); // } // } // } // catch (Exception exOA) // { // //Log the error in database Table // Hashtable oHsErrorLog = new Hashtable(); // string[] sStudentIDs = UniStudID.Split('|'); // oHsErrorLog.Add("pk_Uni_ID", sStudentIDs[0]); // oHsErrorLog.Add("pk_Year", sStudentIDs[1]); // oHsErrorLog.Add("pk_Student_ID", sStudentIDs[2]); // oHsErrorLog.Add("pk_Fac_ID", sStudentIDs[3]); // oHsErrorLog.Add("pk_Cr_ID", sStudentIDs[4]); // oHsErrorLog.Add("pk_MoLrn_ID", sStudentIDs[5]); // oHsErrorLog.Add("pk_Ptrn_ID", sStudentIDs[6]); // oHsErrorLog.Add("pk_Brn_ID", sStudentIDs[7]); // oHsErrorLog.Add("pk_CrPr_Details_ID", sStudentIDs[8]); // oHsErrorLog.Add("CrPr_Seq", sStudentIDs[9]); // oHsErrorLog.Add("CrPrCh_ID", sStudentIDs[10]); // oHsErrorLog.Add("CrPrCh_Seq", sStudentIDs[11]); // oHsErrorLog.Add("Error_Msg", exOA.Message); // oHsErrorLog.Add("UserName", user.User_Name); // sOthers.WriteOAErrorLog(oHsErrorLog); // OaMessage = "There is some issue while updating at OA side, Please contact Administrator."; // } // } // } //} ///*******************************************************************************************/ //#endregion lblMsg.Text = "Admission of the selected term cancelled successfully."; lblMsg.CssClass = "saveNote"; break; case "Y": lblMsg.Text = "Admission of the selected term cannot be cancelled."; lblMsg.CssClass = "errorNote"; break; case "E": lblMsg.Text = "Admission of the selected term could not be cancelled as the Seat number is generated for this Term."; lblMsg.CssClass = "errorNote"; break; case "I": lblMsg.Text = "Admission of the selected term could not be cancelled as the Invoice is generated for this Term."; lblMsg.CssClass = "errorNote"; break; case "": lblMsg.Text = "Admission of the selected term cannot be cancelled."; lblMsg.CssClass = "errorNote"; break; default: break; } DisplayStudentDetails(); }
private void Display() { oStudent = new clsStudent(); if (oHt != null) { oHt.Clear(); } CreateHashTable(); oDt = oStudent.GetCETDetails(oHt); if (oDt != null && oDt.Rows.Count > 0) { ListItem oLi = null; oLi = ddlCETType.Items.FindByValue(oDt.Rows[0]["CET_Type"].ToString()); if (oLi != null) { ddlCETType.ClearSelection(); oLi.Selected = true; if (oLi.Value.Equals("11")) { txtCETMarks.Enabled = false; } } oLi = ddlQuotaType.Items.FindByValue(oDt.Rows[0]["Quota_Type"].ToString()); if (oLi != null) { ddlQuotaType.ClearSelection(); oLi.Selected = true; } txtCETMarks.Text = oDt.Rows[0]["CET_Marks"].ToString(); oLi = rblSelectionLettter.Items.FindByValue(oDt.Rows[0]["Selection_Letter"].ToString()); if (oLi != null) { rblSelectionLettter.ClearSelection(); oLi.Selected = true; } txtPhysicsParks.Text = oDt.Rows[0]["HSc_Marks_Physics"].ToString(); txtChemistryMarks.Text = oDt.Rows[0]["HSc_Marks_Chemistry"].ToString(); txtBioMarks.Text = oDt.Rows[0]["HSc_Marks_Biology"].ToString(); txtEnglishMarks.Text = oDt.Rows[0]["HSc_Marks_English"].ToString(); txtUrduMarks.Text = oDt.Rows[0]["HSc_Marks_Urdu"].ToString(); txtHscBoard.Text = oDt.Rows[0]["Place_Of_HSc"].ToString(); txtCompMarks.Text = oDt.Rows[0]["HSc_Marks_Computer"].ToString(); oLi = rblFromMaharashtra.Items.FindByValue(oDt.Rows[0]["Is_Maharashtra"].ToString()); if (oLi != null) { rblFromMaharashtra.ClearSelection(); oLi.Selected = true; } oLi = rblDipGNMsheet.Items.FindByValue(oDt.Rows[0]["Is_Dip_Cert_GNM_Marksheet"].ToString()); if (oLi != null) { rblDipGNMsheet.ClearSelection(); oLi.Selected = true; } oLi = rblIsForeigner.Items.FindByValue(oDt.Rows[0]["Is_Foreigner"].ToString()); if (oLi != null) { rblIsForeigner.ClearSelection(); oLi.Selected = true; } } //else //{ // cetDetails.Visible = false; // lblErrorMsg.Visible = true; // lblErrorMsg.Text = "Record Not found."; //} }