Beispiel #1
0
        public string updateEntryOperator(EntryOp entryOp, string uname)
        {
            try
            {
                using (var context = new Vehicle_Reervation_DatabaseEntities())
                {
                    EntryOperator entryOperator = context.EntryOperators.Where(x => x.UNAME == uname).FirstOrDefault <EntryOperator>();
                    //context.Entry(manager).CurrentValues.SetValues(boss);

                    //manager.MANAGER_UNAME = boss.getManagerUname();
                    entryOperator.ENTRYOP_NAME = entryOp.getEntryOpName();
                    entryOperator.PWORD        = entryOp.getEntryOpPword();


                    //var manager = new Manager()
                    //{
                    //    MANAGER_NAME = boss.getManagerName(),
                    //    MANAGER_UNAME = boss.getManagerUname(),
                    //    MANAGER_PWORD = boss.getManagerPword()
                    //};

                    context.SaveChanges();

                    return(entryOperator.ENTRYOP_NAME);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #2
0
        public EntryOp entryOperatorCredentials(string uname)
        {
            try
            {
                using (var context = new Vehicle_Reervation_DatabaseEntities())
                {
                    EntryOperator entryOperator = context.EntryOperators.Where(a => a.UNAME == uname).FirstOrDefault <EntryOperator>();

                    if (entryOperator == null)
                    {
                        return(null);
                    }
                    else
                    {
                        EntryOp entryOp = new EntryOp(entryOperator.UNAME, entryOperator.ENTRYOP_NAME, entryOperator.PWORD);

                        return(entryOp);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #3
0
        public string addEntryOperator(EntryOp entryOp)
        {
            try
            {
                using (var context = new Vehicle_Reervation_DatabaseEntities())
                {
                    var entryOperator = new EntryOperator()
                    {
                        ENTRYOP_NAME = entryOp.getEntryOpName(),
                        UNAME        = entryOp.getEntryOpUname(),
                        PWORD        = entryOp.getEntryOpPword()
                    };

                    if (context.EntryOperators.Any(x => x.UNAME == entryOperator.UNAME))
                    {
                        return(null);
                    }
                    else
                    {
                        context.EntryOperators.Add(entryOperator);
                        context.SaveChanges();

                        return(entryOperator.ENTRYOP_NAME);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #4
0
        private void btnInsert_Click(object sender, RoutedEventArgs e)
        {
            name         = txtEntryOpName.Text;
            uname        = txtEntryOpUname.Text;
            pword        = txtEntryOpPword.Password;
            confirmPword = txtEntryOpConfirmPword.Password;

            if (pword != confirmPword)
            {
                notification.MessageDialog(this, "Error", "Passwords do not match");
            }
            else
            {
                EntryOp tempEntryOp = new EntryOp(uname, name, pword);

                name = controller.addEntryOperator(tempEntryOp);

                if (name != null)
                {
                    notification.successNotifier(name + " Successfully Registered");
                }
                else
                {
                    notification.MessageDialog(this, "Error", "Username already exists");
                }
            }
        }
Beispiel #5
0
        private void cmbxEntryOpUname_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            EntryOp entryOp = controller.getEntryOperatorCredentials(cmbxEntryOpUname.SelectedValue.ToString());

            txtEntryOpName1.Text             = entryOp.getEntryOpName();
            txtEntryOpPword1.Password        = entryOp.getEntryOpPword();
            txtEntryOpConfirmPword1.Password = txtEntryOpPword1.Password;
        }
Beispiel #6
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            uname        = cmbxEntryOpUname.Text;
            name         = txtEntryOpName1.Text;
            pword        = txtEntryOpPword1.Password;
            confirmPword = txtEntryOpConfirmPword1.Password;

            if (pword != confirmPword)
            {
                notification.MessageDialog(this, "Error", "Passwords dont match");
            }
            else
            {
                EntryOp tempEntryOp = new EntryOp(uname, name, pword);

                name = controller.updateEntryOperator(tempEntryOp, tempEntryOp.getEntryOpName());

                notification.successNotifier(name + "'s Credentials Successfully Updated");
            }
        }
Beispiel #7
0
 private void cmbxEntryOpName_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     EntryOp entryOp = controller.getEntryOperatorCredentials(cmbxEntryOpName.SelectedValue.ToString());
 }