コード例 #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 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;
            }
        }
コード例 #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;
            }
        }