protected void Printmeritlist_Click(object sender, EventArgs e) { string html = System.IO.File.ReadAllText(Server.MapPath("MeritList.html")); DBFunctions db = new DBFunctions(); string candidtes = ""; var applicants = db.generatemeritlist(int.Parse(Dropdownprogramme.SelectedValue)); CollegeERPDBEntities db1 = new CollegeERPDBEntities(); var result1 = db1.Candidate_tbl.Join(db1.Batches_table, c => c.ID, a => a.ID, (c, a) => new { a.ID }).ToList(); foreach (var app in applicants) { //<tr class="blue-background"><th>Name</th><th>Address</th><th>Cut Off Points</th><th>Programme</th><th>Gender</th><th>Email</th><th>Phone</th><th>Status</th><th>Action</th></tr> int Year = Convert.ToInt16(app.AdmissionYear); candidtes += "<tr><td>" + app.Name + "</td><td>" + app.CuttoffPoints + "</td><td>" + app.Gender + "</td><td>" + app.Email + "</td><td>" + app.Phone + "</td></tr>"; } db.addadmssion(applicants); Byte[] bytes; html = html.Replace("{Programme}", applicants.FirstOrDefault().Program_tbl.ProgramName); html = html.Replace("{year}", DateTime.Now.Year.ToString()); html = html.Replace("{CandidateList}", candidtes); using (var ms = new MemoryStream()) { var doc = new Document(); doc = new Document(PageSize.A4, 30, 30, 30, 30); var writer = PdfWriter.GetInstance(doc, ms); doc.Open(); doc.NewPage(); var example_html = html; using (var htmlWorker = new iTextSharp.text.html.simpleparser.HTMLWorker(doc)) { using (var sr = new StringReader(example_html)) { htmlWorker.Parse(sr); } } doc.Close(); bytes = ms.ToArray(); } long milliseconds = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) / 1000; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + milliseconds + "MeritList.pdf"); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); HttpContext.Current.Response.BinaryWrite(bytes); HttpContext.Current.Response.End(); HttpContext.Current.Response.Close(); }
public List<Program_tbl> getprogramslist() { db = new CollegeERPDBEntities(); var programs = db.Program_tbl.ToList(); return programs; }
public void AddQuestionare(int UserID) { db = new CollegeERPDBEntities(); AdminMails_tbl obj = new AdminMails_tbl {SenderID=UserID,Message="<a href=DownloadReport.aspx?senderid='"+UserID+"'>Download Questionair</a>",Subject="SuggestionRequest",Status=0,Date=DateTime.Now.Date}; db.AdminMails_tbl.Add(obj); db.SaveChanges(); }
public List<FormSections_tbl> getformSectionlist() { using (db = new CollegeERPDBEntities()) { var Sections = db.FormSections_tbl.ToList(); return Sections; } }
public int AddCandidate(Candidate_tbl candidate) { db = new CollegeERPDBEntities(); db.Candidate_tbl.Add(candidate); db.SaveChanges(); return candidate.ID; }
public Candidate_tbl LoginChek(string username, string password) { db = new CollegeERPDBEntities(); var candidate = db.Candidate_tbl.Where(x => x.Username == username && x.Password == password).FirstOrDefault(); return candidate; }
public void AddRegistrationNotice(Mails_tbl t) { db = new CollegeERPDBEntities(); db.Mails_tbl.Add(t); db.SaveChanges(); }
public void addQuestion(string Question,string[] answers) { using (db = new CollegeERPDBEntities()) { Questionaire_tbl qstn = new Questionaire_tbl { Question = Question }; db.Questionaire_tbl.Add(qstn); db.SaveChanges(); foreach (string ans in answers) { Answers_tbl anss = new Answers_tbl { Q_ID = qstn.Q_ID, Answer = ans }; db.Answers_tbl.Add(anss); db.SaveChanges(); } } }
public void addattendance(Attendance_tbl attendance) { db = new CollegeERPDBEntities(); DateTime date = DateTime.Now.Date; var check = db.Attendance_tbl.Where(x => x.Date == date && x.StudentID == attendance.StudentID&&x.CourseID==attendance.CourseID).FirstOrDefault(); if(check==null) { db.Attendance_tbl.Add(attendance); db.SaveChanges(); } }
public bool checkattendance(int courseid) { db = new CollegeERPDBEntities(); DateTime date=DateTime.Now.Date; var check = db.Attendance_tbl.Where(x=>x.CourseID==courseid && x.Date==date).FirstOrDefault(); return (check == null); }
public int getapplicant_count() { db = new CollegeERPDBEntities(); var candidates = db.Candidate_tbl.ToList().Count; return candidates; }
public List<Enroll_Course> getenrolledstudents(int crsid) { db = new CollegeERPDBEntities(); return db.Enroll_Course.Where(x=>x.CourseID==crsid&&x.Status==1).ToList(); }
public List<LibraryMember> getmemberrequestlist(int page, int pageSize) { db = new CollegeERPDBEntities(); // var course = db.Courses_tbl.Where(x => x.ID>=pageStart && x.ID<=pageEnd).FirstOrDefault(); return db.LibraryMembers.Where(x=>x.Status==0).OrderByDescending(x => x.ID).Skip(page * pageSize).Take(pageSize).ToList(); }
public int getBook_Count() { db = new CollegeERPDBEntities(); var totalbook = db.Books.Count(); return totalbook; }
public Mails_tbl getusermail(int mid) { db = new CollegeERPDBEntities(); var mail = db.Mails_tbl.Where(x => x.ID == mid).FirstOrDefault(); mail.Status = 1; db.SaveChanges(); return mail; }
public void addbook(Book book) { using (db = new CollegeERPDBEntities()) { db.Books.Add(book); db.SaveChanges(); } }
public void addmail(Mails_tbl mail) { db = new CollegeERPDBEntities(); db.Mails_tbl.Add(mail); db.SaveChanges(); }
public List<StudentInfo_tbl> getadmittedstudents() { db = new CollegeERPDBEntities(); return db.StudentInfo_tbl.ToList(); }
public void addadmssion(List<Candidate_tbl> candidatelist) { db = new CollegeERPDBEntities(); int prgid=-1; foreach(var cand in candidatelist) { string matricno=DateTime.Now.Year+"-"+cand.Program_tbl.ProgramName+"-"+cand.ID; var std = db.AddmissionList_tbl.Where(x=>x.UserID==cand.ID).FirstOrDefault(); var info = db.StudentInfo_tbl.Where(x => x.UserId == cand.ID).FirstOrDefault(); if(std==null&&info==null){ StudentInfo_tbl student = new StudentInfo_tbl { ProgramID = cand.ProgrammeID, StudentLevel = "ND1", UserId = cand.ID, Semester = 0, DeptID = cand.Program_tbl.DeptID, FeeDiscount = "0", AcadamicYear = DateTime.Now.Year.ToString() }; StudentAcceptanceFee_tbl accfee = new StudentAcceptanceFee_tbl { ProgramID = cand.ProgrammeID, Userid = cand.ID, Status = 0 }; Mails_tbl mail = new Mails_tbl { RecieverID = cand.ID, Message ="Acceptence Fee Of "+ cand.Program_tbl.AcceptenceFee + " Has Been Assigned to You <br> Please Submit This Fees with in One Week", Subject = "Acceptence Fee", Date = DateTime.Now,Status=0 }; addmail(mail); db.StudentInfo_tbl.Add(student); int Year = Convert.ToInt16(student.AcadamicYear); Batches_table temp = db.Batches_table.Where(x => x.BatchYear == Year).FirstOrDefault(); AddmissionList_tbl admission = new AddmissionList_tbl { ProgrameID = cand.ProgrammeID, Status = 0, route = "Merit", UserID = cand.ID, MetricNo = matricno, Password = cand.Password,BatchID=temp.ID }; db.AddmissionList_tbl.Add(admission); db.StudentAcceptanceFee_tbl.Add(accfee); prgid = cand.ProgrammeID.Value; } var candidates = db.Candidate_tbl.Where(x => x.ProgrammeID == prgid).OrderByDescending(x => x.CuttoffPoints).Skip(100).ToList(); foreach(var c in candidates) { c.Status = -1; } var addmittedcandidates = db.Candidate_tbl.Where(x => x.ProgrammeID == prgid).OrderByDescending(x => x.CuttoffPoints).Take(100).ToList(); foreach (var c in addmittedcandidates) { c.Status = 1; } } db.SaveChanges(); }
public List<Candidate_tbl> getcandidatesbyprogram(int prgid) { db = new CollegeERPDBEntities(); string year = DateTime.Now.Year.ToString(); return db.Candidate_tbl.Where(x => x.ProgrammeID == prgid && x.AdmissionYear == year).OrderByDescending(x => x.CuttoffPoints).ToList(); }
public List<Candidate_tbl> getapplicantlist(int page,int pagesize) { db = new CollegeERPDBEntities(); var candidates= db.Candidate_tbl.OrderByDescending(x=>x.CuttoffPoints).Skip(page*pagesize).Take(pagesize).ToList() ; return candidates; }
public IEnumerable<IGrouping<int, Attendance_tbl>> getattendance(int stdid) { db = new CollegeERPDBEntities(); return db.Attendance_tbl.Where(x=>x.StudentID==stdid).GroupBy(x=>x.CourseID.Value); }
//txtHomeaddress.Text, int.Parse(dropdownSto.SelectedValue),int.Parse(dropdownLocalGovtarea.SelectedValue),Emailtxt.Text,dropdownDay.SelectedItem.Text + "-" + dropdownMonth.SelectedItem.Text + "-" + dropdownyears.SelectedItem.Text,Phonetxt.Text public void updatestudtent(int stdid,string Name,int prid,int semester,string feediscount,string address,int sto,int area,string email,string dob,string phone) { db = new CollegeERPDBEntities(); var student= db.StudentInfo_tbl.Where(x=>x.UserId==stdid).FirstOrDefault(); student.ProgramID = prid; student.Semester = semester; student.FeeDiscount = feediscount; student.Candidate_tbl.Name = Name; student.Candidate_tbl.ProgrammeID = prid; student.Candidate_tbl.HomeAdress = address; student.Candidate_tbl.LocalGovtArea = area; student.Candidate_tbl.Stateoforigin = sto; student.Candidate_tbl.Email = email; student.Candidate_tbl.Phone = phone; student.Candidate_tbl.DateofBirth = dob; db.SaveChanges(); }
public List<Attendance_tbl> getattdance_course(int courseid) { db = new CollegeERPDBEntities(); return db.Attendance_tbl.Where(x => x.CourseID == courseid).ToList(); }
public int addresults(Results_tbl result) { db = new CollegeERPDBEntities(); db.Results_tbl.Add(result); db.SaveChanges(); return result.ID; }
public void placeOrder(IssueBook book) { using (db = new CollegeERPDBEntities()) { db.IssueBooks.Add(book); db.SaveChanges(); AdminMails_tbl amail = new AdminMails_tbl { SenderID = book.LibraryMember.UserID, Message = book.LibraryMember.Candidate_tbl.Name + " has Requested for " + book.Book.Title, Date = DateTime.Now.Date, Subject = "Book Request", Status = 0 }; addadminmail(amail); } }
public void addFormField(Forms_tbl form,string [] options) { using (db = new CollegeERPDBEntities()) { db.Forms_tbl.Add(form); db.SaveChanges(); if(form.FormControl!="Text") { foreach (string option in options) db.ControlOptions_tbl.Add(new ControlOptions_tbl { FieldID=form.ID,optionvalue=option}); } db.SaveChanges(); } }
public List<Book> getbooklist(int page, int pagesize) { db = new CollegeERPDBEntities(); List<Book> temp = db.Books.OrderBy(x=>x.ID).Skip(page*pagesize).Take(pagesize).ToList(); // var course = db.Courses_tbl.Where(x => x.ID>=pageStart && x.ID<=pageEnd).FirstOrDefault(); return temp; }
public List<Results_tbl> getresult(int stdid,string term) { db = new CollegeERPDBEntities(); var metricno=db.AddmissionList_tbl.Where(x=>x.UserID==stdid).FirstOrDefault().MetricNo; string year = DateTime.Now.Year.ToString(); return db.Results_tbl.Where(x => x.MetricNo == metricno && x.Year==year && x.ExamType==term).ToList(); }
public StudentInfo_tbl getstdentinfo(int stdid) { db = new CollegeERPDBEntities(); return db.StudentInfo_tbl.Where(x=>x.UserId==stdid).FirstOrDefault(); }
public List<Candidate_tbl> generatemeritlist2(int prgid) { db = new CollegeERPDBEntities(); var candidates = db.Candidate_tbl.Where(x => x.ProgrammeID == prgid).OrderByDescending(x => x.CuttoffPoints).Take(100).ToList(); return candidates; }