コード例 #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;
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
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;
        }
コード例 #4
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");
            }
        }