protected void Page_Load(object sender, EventArgs e)
    {
        string pagename     = Path.GetFileName(Request.PhysicalPath);
        bool   loggedStatus = false;

        if (System.Web.HttpContext.Current.User != null)
        {
            if (!IsPostBack)
            {
                loggedStatus = System.Web.HttpContext.Current.User.Identity.IsAuthenticated;
                if (loggedStatus)
                {
                    DBFunctions       db = new DBFunctions();
                    DatabaseFunctions d  = new DatabaseFunctions();
                    Userid = Membership.GetUser().ProviderUserKey.ToString();
                    uid    = d.GetCandidateID(Userid);
                    //  loadprogrammes();

                    StudentInfo_tbl temp = db.getstdentinfo(uid);

                    StudentSelectedCredit obj = db.getStudentCredits(uid).FirstOrDefault();
                    if (obj != null)
                    {
                        Credits = Convert.ToInt16(obj.SelectedCourseCount);
                    }

                    getcourses();
                }
                else
                {
                    Response.Redirect("Login.aspx?Redirecturl=" + pagename);
                }
            }
        }
        //  dropdownCourse.DataSource=
    }
Esempio n. 2
0
    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();
    }