Exemplo n.º 1
0
        void OnButtonClick(object s, EventArgs e)
        {
            CommandButton b = (s as CommandButton);

            if (b.Text == Resources.RequestMaintainance)
            {
                Maintainance maintainance = new Maintainance();
                maintainance.Show(this);
            }
            else if (b.Text == Resources.RequestStudentCard)
            {
                StudentCard studentCard = new StudentCard();
                studentCard.Show(this);
            }
            else if (b.Text == Resources.RequestATMCard)
            {
                ATMCard card = new ATMCard();
                card.Show();
            }
            else if (b.Text == Resources.RequestCarLicense)
            {
                CarBadge car = new CarBadge();
                car.Show();
            }
            else
            {
                Close();
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            StudentCard studentcard = db.StudentCards.Find(id);

            db.StudentCards.Remove(studentcard);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates our Student by reading the RFID and transforming it into a student number.
        /// </summary>
        /// <param name="data">Student Number</param>
        private void setLeave(string data)
        {
            if (this.studentNumberMaskedTextBox.InvokeRequired)
            {
                object[] objArray = new object[] { data };

                SetLeaveCallBack objCallBack = new SetLeaveCallBack(setLeave);

                this.Invoke(objCallBack, objArray);
            }
            else
            {
                try
                {
                    long lastThree  = long.Parse(data.Substring(7));
                    long studentNum = long.Parse(data) * lastThree;

                    string hexaStudentNum = studentNum.ToString("X");

                    int start = hexaStudentNum.Length - 1;
                    int end   = hexaStudentNum.Length - 4;

                    for (int i = start; i > end; i--)
                    {
                        char value = hexaStudentNum[i];


                        if (value == 'A' || value == 'B' || value == 'C' || value == 'D' || value == 'E' || value == 'F')
                        {
                            hexaStudentNum = hexaStudentNum.Substring(0, hexaStudentNum.Length - 3);
                            break;
                        }
                    }



                    long finalStudentNum = long.Parse(hexaStudentNum, System.Globalization.NumberStyles.HexNumber);


                    StudentCard query = db.StudentCards.Where(x => x.CardNumber == finalStudentNum).SingleOrDefault();

                    if (query == null)
                    {
                        throw new Exception("The student card is invalid");
                    }

                    long studentQuery = db.Students.Where(x => x.StudentId == query.StudentId).Select(x => x.StudentNumber).Single();

                    studentNumberMaskedTextBox.Text = studentQuery.ToString();

                    studentNumberMaskedTextBox_Leave(null, null);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        //
        // GET: /StudentCard/Details/5

        public ActionResult Details(int id = 0)
        {
            StudentCard studentcard = db.StudentCards.Find(id);

            if (studentcard == null)
            {
                return(HttpNotFound());
            }
            return(View(studentcard));
        }
        //
        // GET: /StudentCard/Edit/5

        public ActionResult Edit(int id = 0)
        {
            StudentCard studentcard = db.StudentCards.Find(id);

            if (studentcard == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StudentId = new SelectList(db.Students, "StudentID", "FullName", studentcard.StudentId);
            return(View(studentcard));
        }
 public ActionResult Edit(StudentCard studentcard)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentcard).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentId = new SelectList(db.Students, "StudentID", "FullName", studentcard.StudentId);
     return(View(studentcard));
 }
        public ActionResult Create(StudentCard studentcard)
        {
            if (ModelState.IsValid)
            {
                db.StudentCards.Add(studentcard);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudentId = new SelectList(db.Students, "StudentID", "FullName", studentcard.StudentId);
            return(View(studentcard));
        }
        public ActionResult Create([Bind(Include = "StudentCardId,StudentId,CardNumber")] StudentCard studentCard)
        {
            if (ModelState.IsValid)
            {
                db.StudentCards.Add(studentCard);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudentId = new SelectList(db.Students, "StudentId", "FullName", studentCard.StudentId);
            return(View(studentCard));
        }
        // GET: StudentCards/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentCard studentCard = db.StudentCards.Find(id);

            if (studentCard == null)
            {
                return(HttpNotFound());
            }
            return(View(studentCard));
        }
        // GET: StudentCards/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentCard studentCard = db.StudentCards.Find(id);

            if (studentCard == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StudentId = new SelectList(db.Students, "StudentId", "FullName", studentCard.StudentId);
            return(View(studentCard));
        }
Exemplo n.º 11
0
        private void ReadStudentData(StudentCard readData)
        {
            var student = this.LessonStudents.Cast <StudentLessonEntity>()
                          .FirstOrDefault(studentModel => studentModel.Student.CardUid.Equals(readData.CardUid));

            if (student != null)
            {
                UpdateDescription(student.Student);
                if (this.IsAutoRegistrationEnabled)
                {
                    RunInUiThread(() => Register(student));
                }
                return;
            }

            var studentFromDatabase = _db.Students.FirstOrDefault(model => model.CardUid.Equals(readData.CardUid));

            if (studentFromDatabase != null)
            {
                var studentEntity = studentFromDatabase.Clone();
                UpdateDescription(studentEntity);
                if (this.IsAutoRegistrationEnabled)
                {
                    RunInUiThread(() => {
                        RegisterExtStudent(studentEntity);
                        UpdateRegistrationInfo();
                    });
                }

                return;
            }

            var unknownStudent = new StudentEntity {
                CardUid    = readData.CardUid,
                FirstName  = readData.FirstName,
                LastName   = readData.LastName,
                SecondName = readData.SecondName
            };

            if (readData.FullName != null)
            {
                UpdateDescription(unknownStudent);
            }
        }
Exemplo n.º 12
0
        public ActionResult StudentInfo(HttpPostedFileBase Front, HttpPostedFileBase Back)
        {
            var repo       = new StudentCard();
            var latestCard = repo.GetLatest(CurrentUser.ID);

            if (!repo.IsError && (latestCard == null || latestCard.StatusCode != 2 || latestCard.ExpirationDate < DateTime.Now))
            {
                ValidateStudentCardInfo(Front, Back, ModelState);

                if (ModelState.IsValid)
                {
                    var frontFileName = Front.FileName.ToAZ09Dash(true, true);
                    var backFileName  = Back.FileName.ToAZ09Dash(true, true);

                    byte iud        = 0;
                    int? id         = null;
                    var  isEditMode = false;
                    if (latestCard != null && latestCard.StatusCode == 1)
                    {
                        iud        = 1;
                        id         = latestCard.ID;
                        isEditMode = true;
                    }

                    repo.TSP(iud, id, CurrentUser.ID, 1, frontFileName, backFileName);
                    if (!repo.IsError)
                    {
                        Front.SaveAs(Server.MapPath(ConfigAssistant.ImageFolderPath + frontFileName));
                        Back.SaveAs(Server.MapPath(ConfigAssistant.ImageFolderPath + backFileName));

                        if (isEditMode)
                        {
                            CheckDeleteFile(latestCard.FrontPhoto);
                            CheckDeleteFile(latestCard.BackPhoto);
                        }
                    }
                    HandleStandardMessaging(repo.IsError);
                    return(RedirectToAction("StudentInfo", "Account"));
                }
                return(View(latestCard));
            }
            return(HttpNotFound());
        }
    /// <summary>
    /// Actions to perform when student is selected
    /// </summary>
    public void Select()
    {
        if (control.currentStudent != null)
        {
            return;
        }

        card         = FindObjectOfType <StudentCard>();
        card.student = this;
        card.GenerateCard();

        if (room != null)
        {
            room.students.Remove(this);
            room = null;
            bed  = null;
        }

        control.currentStudent = this;
        control.GetComponent <BoxCollider2D>().enabled = true;
        selected = true;
        GetComponent <BoxCollider2D>().enabled = false;
    }
Exemplo n.º 14
0
        public ActionResult StudentInfo()
        {
            var model = new StudentCard().GetLatest(CurrentUser.ID);

            return(View(model));
        }
Exemplo n.º 15
0
 private void Save(StudentCard card)
 {
     this.ReadStudentCards.Add(card);
 }
 void Awake()
 {
     control = FindObjectOfType <GameController>();
     card    = FindObjectOfType <StudentCard>();
 }
Exemplo n.º 17
0
        private void NavigateStudentCard_Click(object sender, RoutedEventArgs e)
        {
            var page = new StudentCard(_studentService);

            MainContent.Navigate(page);
        }