Ejemplo n.º 1
0
        private void loadScores()
        {
            var db = new eRegisterContext();

            int currUserID = UserMasterPage.getCurrUser().UserID;
            var listScore  = from reg in db.Registers
                             join ac in db.Actors
                             on reg.StudentID equals ac.ActorID
                             join sc in db.ScoreTypes
                             on reg.ScoreTypeID equals sc.ScoreTypeID
                             where ac.UserID == currUserID
                             where reg.SubjectID == dropDownListSubjects.SelectedIndex
                             where reg.StudyYearID == dropDownListStudyYear.SelectedIndex
                             where reg.TermID == dropDownListTerm.SelectedIndex
                             orderby reg.Date
                             select new
            {
                date      = reg.Date,
                scoreType = sc.ScoreType1,
                score     = reg.ScoreNum
            };

            if (listScore.Any())
            {
                gridViewScore.DataSource = listScore.ToList();
                gridViewScore.DataBind();
                gridViewScore.Visible   = true;
                lblWarningScore.Visible = false;
            }
            else
            {
                gridViewScore.Visible   = false;
                lblWarningScore.Visible = true;
            }
        }
Ejemplo n.º 2
0
        private void loadAbsences()
        {
            var db         = new eRegisterContext();
            int currUserID = UserMasterPage.getCurrUser().UserID;
            int actorId    = db.Actors.FirstOrDefault(x => x.UserID == currUserID).ActorID;

            var absencesList = from ab in db.Absences
                               join sub in db.Subjects
                               on ab.SubjectID equals sub.SubjectID
                               join abType in db.AbsenceTypes
                               on ab.AbsenceTypeID equals abType.AbsenceTypeID
                               where ab.StudentID == actorId
                               orderby ab.Date
                               select new
            {
                subject = sub.Name,
                type    = abType.Absence,
                date    = ab.Date
            };

            if (absencesList.Any())
            {
                gridViewAbsences.DataSource = absencesList.ToList();
                gridViewAbsences.DataBind();
                lblAbsences.Visible = false;
            }
            else
            {
                lblAbsences.Visible = true;
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int userId = UserMasterPage.getCurrUser().UserID;

            currActor = db.Actors.FirstOrDefault(x => x.UserID == userId);
            if (!Page.IsPostBack)
            {
                onInitData();
            }
        }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     LoadImages();
     if (UserMasterPage.getCurrUser().UserTypeID != 2)
     {
         lblHeader.Visible   = false;
         FileUpload1.Visible = false;
         Button1.Visible     = false;
     }
 }
Ejemplo n.º 5
0
        private void LoadPage()
        {
            var   db           = new eRegisterContext();
            Actor currentActor = new Actor();
            int   userId       = Convert.ToInt32(Session["userid"]);

            if (db.Actors.Any(x => x.UserID == userId))
            {
                currentActor = db.Actors.First(x => x.UserID == userId);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/UserWebForms/LogInForm.aspx");
            }
            firstNameLbl.InnerText  = currentActor.FirstName;
            middleNameLbl.InnerText = currentActor.MiddleName;
            lastNameLbl.InnerText   = currentActor.LastName;
            genderLbl.InnerText     = getGender(currentActor.Gender);
            phoneLbl.InnerText      = currentActor.PhoneNumber;
            mailLbl.InnerText       = currentActor.email;
            addressLbl.InnerText    = currentActor.Address;


            egnLbl.InnerText      = currentActor.EGN;
            schoolLbl.InnerText   = currentActor.School.SchooName;
            devisionLbl.InnerText = "";
            classLbl.InnerText    = "";
            statusLbl.InnerText   = "";
            if (currentActor.ClassDivisionID != null && UserMasterPage.getCurrUser().UserTypeID == 1)
            {
                int divClassId = (int)currentActor.ClassDivisionID;
                int divId      = db.ClassDevisionDetails.FirstOrDefault(x => x.ClassDevisionDetailsID == divClassId).DivID;
                devisionLbl.InnerText = db.Divisions.FirstOrDefault(x => x.DivisionID == divId).Division1;
                int classId = db.ClassDevisionDetails.FirstOrDefault(x => x.ClassDevisionDetailsID == divClassId).ClassID;
                classLbl.InnerText  = db.Classes.FirstOrDefault(x => x.ClassID == classId).Class1.ToString();
                statusLbl.InnerText = getStudentStatus(currentActor.Status ?? false);
            }

            schoolAdressLbl.InnerText = currentActor.School.Address;

            if (UserMasterPage.getCurrUser().UserTypeID == 1 && currentActor.ParentlID != null)
            {
                int   parId   = (int)currentActor.ParentlID;
                Actor parrent = db.Actors.FirstOrDefault(x => x.ActorID == parId);
                lblParName.InnerText   = parrent.FirstName + " " + parrent.MiddleName + " " + parrent.LastName;
                lblParNumber.InnerText = parrent.PhoneNumber;
                h3Parrent.Visible      = true;
                lblParName.Visible     = true;
                lblParNumber.Visible   = true;
                lblPName.Visible       = true;
                lblPNumber.Visible     = true;
            }
        }
    protected void btn_1000_Click(object sender, EventArgs e)
    {
        int cost       = 100;
        int userPoints = Convert.ToInt32(lbl_balance.Text);
        var results    = Coupon.checkPoints(userPoints, 100);

        if (results)
        {
            string code        = Coupon.generateReward(10);
            bool   noDuplicate = Coupon.checkDuplicate(code);
            if (noDuplicate)
            {
                Coupon.storeCoupon(code, "10", "unused", Session["UserId"].ToString());
                Coupon.deductPoints(cost, Session["UserId"].ToString());
                tb_1000.Text     = code;
                lbl_1000.Text    = "Success!";
                lbl_balance.Text = (userPoints - cost).ToString();
                UserMasterPage site = this.Master as UserMasterPage;
                if (site != null)
                {
                    Label header = site.FindControl("lbl_points") as Label;
                    int   points = Convert.ToInt32(header.Text);
                    header.Text = (points - cost).ToString();
                    if (points - cost < 50)
                    {
                        Image notifications = site.FindControl("img_notification") as Image;
                        notifications.Visible = false;
                    }
                }
            }
            else
            {
                tb_1000.Text  = "ERROR";
                lbl_1000.Text = "Sorry, an Error Occured, Please try again.";
            }
        }
        else
        {
            lbl_1000.Text = "You have insufficient points !";
            tb_1000.Text  = "";
        }
    }
Ejemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserMasterPage.getCurrUser() != null)
     {
         if (Convert.ToInt32(Session["userid"]) == UserMasterPage.getCurrUser().UserID)
         {
             LoadPage();
         }
         else
         {
             Session.Abandon();
             Response.Redirect("~/UserWebForms/LogInForm.aspx");
         }
     }
     else
     {
         Session.Abandon();
         Response.Redirect("~/UserWebForms/LogInForm.aspx");
     }
 }
Ejemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserMasterPage.getCurrUser().UserTypeID == 4)
     {
         btnChoose.Visible = true;
     }
     if (UserMasterPage.getCurrUser().UserTypeID == 2)
     {
         btnProfile.Visible = false;
         btnScores.Visible  = false;
     }
     else
     {
         btnAdminPage.Visible = false;
     }
     if (UserMasterPage.getCurrUser().UserTypeID != 1)
     {
         btnScores.Visible = false;
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public MainViewModel()
 {
     masterPage     = new UserMasterPage();
     userDetailPage = new UserDetailPage();
 }