當前位置: 首頁>>代碼示例>>C#>>正文


C# entities.User類代碼示例

本文整理匯總了C#中evmsService.entities.User的典型用法代碼示例。如果您正苦於以下問題:C# User類的具體用法?C# User怎麽用?C# User使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


User類屬於evmsService.entities命名空間,在下文中一共展示了User類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CancelRequest

        public static void CancelRequest(User user, int requestID)
        {
            Events evnt = EventController.GetEvent(GetRequest(requestID).EventID);
            if (!user.isAuthorized(evnt, EnumFunctions.Manage_Requests))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Cancel Request!"));

            DAL dalDataContext = new DAL();

            Request request = (from requests in dalDataContext.requests
                               where requests.RequestID == requestID
                               select requests).FirstOrDefault();

            if (request == null)
            {
                throw new FaultException<SException>(new SException(),
                    new FaultReason("Invalid Request"));
            }
            else
            {
                Events e = EventController.GetEvent(request.EventID);

                if (e.Organizerid != user.UserID) // Manage Requests, View Requests User.isAuthorized(
                    throw new FaultException<SException>(new SException(),
                        new FaultReason("Invalid User, User Does Not Have Rights To Edit This Request!"));

                request.Status = RequestStatus.Cancelled;
                dalDataContext.SubmitChanges();

                RequestLogController.InsertRequestLog(request);
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:32,代碼來源:RequestController.cs

示例2: DeleteParticipant

        public static void DeleteParticipant(User user, int ParticipantID)
        {
            try
            {
                DAL dalDataContext = new DAL();

                // Participant p = GetParticipant(ParticipantID);
                Participant p = (from participants in dalDataContext.participants
                                 where participants.ParticipantID == ParticipantID
                                 select participants).SingleOrDefault<Participant>();
                //chk if user can do this anot
                if (!user.isAuthorized(EventController.GetEvent(p.EventID), EnumFunctions.Manage_Participant))
                    goto Error;

                dalDataContext.participants.DeleteOnSubmit(p);
                dalDataContext.SubmitChanges();
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Deleting Participant, Please Try Again!"));
            }

            return;

            Error:
            throw new FaultException<SException>(new SException(),
                       new FaultReason("Invalid User, User Does Not Have Rights To Delete Participant!"));
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:29,代碼來源:ParticipantController.cs

示例3: DeleteProgram

        public static void DeleteProgram(User user, int ProgramID)
        {
            //chk if user got rights or is organizer

            Program P = GetPrograms(ProgramID);

            if (!user.isAuthorized(EventController.GetEvent(P.EventID), EnumFunctions.Delete_Programmes))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Delete Programs!"));

            DAL dalDataContext = new DAL();
            try
            {
                Program matchedprograms = (from programs in dalDataContext.programs
                                           where programs.ProgramID == P.ProgramID
                                           select programs).FirstOrDefault();

                dalDataContext.programs.DeleteOnSubmit(matchedprograms);
                dalDataContext.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(ex.Message),
                   new FaultReason("An Error occured While Adding Deleting Program, Please Try Again!"));
                //throw exception here
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:27,代碼來源:ProgramController.cs

示例4: DeleteGuest

        public static void DeleteGuest(User user, int GuestID)
        {
            //chk if user can do this anot
            Guest g = GetGuest(GuestID);

            if (!user.isAuthorized(EventController.GetEvent(g.EventID), EnumFunctions.Delete_Guest))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Delete Guest!"));

            DAL dalDataContext = new DAL();

            try
            {
                Guest matchedguest = (from guests in dalDataContext.guests
                                      where guests.GuestId == g.GuestId
                                      select guests).FirstOrDefault();

                dalDataContext.guests.DeleteOnSubmit(matchedguest);
                dalDataContext.SubmitChanges();
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Deleting Guest, Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:26,代碼來源:GuestController.cs

示例5: AddRightsTemplate

        public static int AddRightsTemplate(User user, Events evnt, string RoleTemplatePost, string RoleTemplateDescription, List<EnumFunctions> functionID)
        {
            if (!user.isSystemAdmin)
            {
                if (!user.isAuthorized(evnt, EnumFunctions.Add_Role))
                    throw new FaultException<SException>(new SException(),
                       new FaultReason("Invalid User, User Does Not Have Rights To Add New Role Template!"));
            }
            try
            {

                using (TransactionScope t = new TransactionScope(TransactionScopeOption.Required))
                {
                    DAL dalDataContext = new DAL();

                    RoleTemplate role = RoleTemplateController.AddRoleTemplate(evnt, RoleTemplatePost, RoleTemplateDescription, dalDataContext);
                    int roleid = role.RoleTemplateID;
                    role = null;

                    RightTemplateController.AddRight(roleid, functionID, dalDataContext);
                    t.Complete();
                    return roleid;
                }
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Role Template, Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:30,代碼來源:RoleTemplateLogicController.cs

示例6: GetLastNotification

        public static string GetLastNotification(User user, string rid)
        {
            if (String.Compare(user.UserID, rid, true) != 0)
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, You cannot read messages not in your inbox"));

            DAL dalDataContext = new DAL();
            Notifications msg = (from notifs in dalDataContext.notifications
                               where notifs.Receiver == user.UserID
                               orderby notifs.SendDateTime descending
                               select notifs).FirstOrDefault<Notifications>();

            if (msg != null)
            {
                TimeSpan t = DateTime.Now - msg.SendDateTime;
                if (t > TimeSpan.FromTicks(0) && t <= TimeSpan.FromSeconds(15))
                {
                    return msg.Sender;
                }
                else
                {
                    return "";
                }
            }
            else
                return "";
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:27,代碼來源:NotificationController.cs

示例7: frmViewUsers

 public frmViewUsers(User u, frmMain mainFrame)
     : this()
 {
     this.user = u;
     this.mainFrame = mainFrame;
     this.cboRole.ItemsSource = System.Enum.GetValues(typeof(EnumRoles));
 }
開發者ID:allanckw,項目名稱:GEMS-Client,代碼行數:7,代碼來源:frmViewUsers.xaml.cs

示例8: DeleteEvent

        public static void DeleteEvent(User user, int EventID)
        {
            //chk if user can do this anot
            Events evnt = GetEvent(EventID);

            if (!user.isAuthorized(evnt))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Delete this Events!"));

            DAL dalDataContext = new DAL();

            try
            {
                Events matchedevent = (from events in dalDataContext.events
                                       where events.EventID == evnt.EventID
                                       //events.Organizerid == user.userID
                                       select events).FirstOrDefault();

                dalDataContext.events.DeleteOnSubmit(matchedevent);
                dalDataContext.SubmitChanges();
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Deleting Event, Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:27,代碼來源:EventController.cs

示例9: deleteItem

        public static void deleteItem(User user, Items iten)
        {
            if (!user.isAuthorized( EventController.GetEvent(iten.EventID), EnumFunctions.Manage_Items))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Delete Item!"));

            DAL dalDataContext = new DAL();

            try
            {
                Items matchedItem = (from item in dalDataContext.items
                                     where item.typeString == iten.typeString
                                     && item.EventID == iten.EventID
                                     && item.ItemName == iten.ItemName
                                     select item).FirstOrDefault<Items>();

                dalDataContext.items.DeleteOnSubmit(matchedItem);
                dalDataContext.SubmitChanges();
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Deleting Item , Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:25,代碼來源:ItemsController.cs

示例10: AddPointOfContact

        public static void AddPointOfContact(User user, int EventID, int serviceID, string name, string position, string phone, string email)
        {
            bool allow = false;
            if (user.isSystemAdmin || user.isEventOrganizer)
            {
                allow = true;
            }

            if (!allow)
            {
                if (!user.isAuthorized(EventController.GetEvent(EventID), EnumFunctions.Manage_Items))
                    throw new FaultException<SException>(new SException(),
                       new FaultReason("Invalid User, User Does Not Have Rights To Edit this Service!"));

            }
            try
            {
                DAL dalDataContext = new DAL();
                Table<PointOfContact> pointOfContact = dalDataContext.pointOfContacts;
                PointOfContact creatingPointOfContact = new PointOfContact(serviceID, name, position, phone, email);

                pointOfContact.InsertOnSubmit(creatingPointOfContact);
                pointOfContact.Context.SubmitChanges();
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Point of Contact, Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:30,代碼來源:PointOfContactController.cs

示例11: AddService

        public static void AddService(User user, int EventID, string Address, string name, string url, string notes)
        {
            bool allow = false;
            if (user.isSystemAdmin || user.isEventOrganizer)
            {
                allow = true;
            }

            if (!allow)
            {
                if (!user.isAuthorized(EventController.GetEvent(EventID), EnumFunctions.Manage_Items))
                    throw new FaultException<SException>(new SException(),
                       new FaultReason("Invalid User, User Does Not Have Rights To Edit this Service!"));

            }

            try
            {
                DAL dalDataContext = new DAL();
                Table<Service> services = dalDataContext.services;

                Service creatingService = new Service(Address, name, url, notes);

                services.InsertOnSubmit(creatingService);
                services.Context.SubmitChanges();
                dalDataContext.SubmitChanges();
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Service, Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:33,代碼來源:ServiceController.cs

示例12: SetBought

        public static void SetBought(User user, Items iten)
        {
            //if (!user.isAuthorized(user, EventController.GetEvent(iten.EventID), EnumFunctions.Manage_Items))
            //    throw new FaultException<SException>(new SException(),
            //       new FaultReason("Invalid User, User Does Not Have Rights To Update Items properties!"));
            try
            {
                DAL dalDataContext = new DAL();

                OptimizedBudgetItemsDetails matchedItem = (from item in dalDataContext.optimizedBudgetItemDetails
                                     where item.typeString == iten.typeString
                                     && item.EventID == iten.EventID
                                    && item.ItemName == iten.ItemName
                                     select item).FirstOrDefault<OptimizedBudgetItemsDetails>();

                if (matchedItem == null)
                {
                    throw new FaultException<SException>(new SException(),
                       new FaultReason("Invalid Item "));
                }
                else
                {
                    matchedItem.IsBought = true;
                    dalDataContext.SubmitChanges();
                }
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Updating Item, Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:32,代碼來源:BudgetDetailsController.cs

示例13: AddRoleAndRights

        public static int AddRoleAndRights(User user, string RoleUserID, int EventID, string RolePost, string RoleDescription, List<EnumFunctions> functionID)
        {
            if (!user.isAuthorized(EventController.GetEvent(EventID), EnumFunctions.Add_Role))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Add New Role!"));

            try
            {

                using (TransactionScope t = new TransactionScope(TransactionScopeOption.Required))
                {
                    DAL dalDataContext = new DAL();

                    Role role = RoleController.AddRole(RoleUserID, EventID, RolePost, RoleDescription, dalDataContext);
                    int roleid = role.RoleID;
                    role = null;

                    RightController.AddRight(roleid, functionID, dalDataContext);

                    NotificationController.sendNotification(user.UserID, RoleUserID, "Rights changed",
                        "Your Rights Have been changed for the Event " + EventController.GetEvent(EventID).Name);

                    t.Complete();
                    return roleid;
                }
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Role, Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:32,代碼來源:RoleLogicController.cs

示例14: User

 public User(User user)
 {
     this.name = user.name;
     this.email = user.email;
     this.u_password = user.u_password;
     this.uid = user.UserID;
 }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:7,代碼來源:User.cs

示例15: DeleteFolder

        public static void DeleteFolder(User user, int eventID, string folderName)
        {
            Events evnt = EventController.GetEvent(eventID);

            //TODO: Add Enum CreateArtefactFolder in functions - Nick
            if (!RoleLogicController.HaveRights(evnt, user, EnumFunctions.Manage_Artefacts)) //user.isAuthorized(evnt, ManageArtefact) after enum f(x) up
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User does not have rights to Delete Folder!"));

            DAL dalDataContext = new DAL();

            try
            {
                WorkspaceFolders matchedWS = (from ws in dalDataContext.ArtefactWSFolders
                                              where ws.EventID == eventID &&
                                              ws.FolderName.ToLower() == folderName.ToLower()
                                              select ws).FirstOrDefault();

                if (matchedWS != null)
                {
                    dalDataContext.ArtefactWSFolders.DeleteOnSubmit(matchedWS);
                    dalDataContext.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(ex.Message),
                   new FaultReason("An Error occured While Deleting Workspace, Please Try Again!"));
            }
        }
開發者ID:allanckw,項目名稱:GEMS-Web,代碼行數:30,代碼來源:ArtefactWorkspaceController.cs


注:本文中的evmsService.entities.User類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。