コード例 #1
0
        // GET: Starting view for assign or delete delegation.
        public IActionResult changeOrAddDelegation(string searchString)
        {
            if (HttpContext.User.IsInRole("head"))
            {
                MyUser     head       = _context.MyUser.Where(p => p.Email == HttpContext.User.Identity.Name).ToList().FirstOrDefault();
                int?       id         = head.DeptId;
                Delegation delegation = _context.Delegation.Where(m => m.DeptId == id).ToList().FirstOrDefault();

                ViewData["delegation"]    = delegation;
                ViewData["CurrentFilter"] = searchString;
                var employees = _context.MyUser.Where(u => u.DeptId == id && (u.RoleId == 1 || u.RoleId == 6));
                if (!String.IsNullOrEmpty(searchString))
                {
                    employees = employees.Where(e => e.Name.Contains(searchString));
                }
                List <MyUser> ulist = employees.ToList();
                ViewData["User"] = ulist;

                if (delegation == null)
                {
                    return(View(new Delegation()));
                }
                else
                {
                    return(View(delegation));
                }
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #2
0
        public Delegation GetDelegationListItem(SPListItem listItem, SPWeb currentWeb)
        {
            RequisitionOfMeetingRoom requisitionOfMeetingRoom = this.ParseToEntity(listItem);
            Delegation delegation = new Delegation(requisitionOfMeetingRoom, currentWeb);

            return(delegation);
        }
コード例 #3
0
        /// <summary>
        /// Get task list of fromEmployee.
        /// </summary>
        /// <param name="fromEmployee">The employee who has processing task.</param>
        /// <returns>The list of delegation items.</returns>
        public List <Delegation> GetListOfTasks(EmployeeInfo fromEmployee)
        {
            List <Delegation> delegations = null;

            string queryString = $@"<Where>
                                        <Eq>
                                            <FieldRef Name='{RequestForDiplomaSuppliesList.Fields.PendingAtField}' LookupId='TRUE'/>
                                            <Value Type='Lookup'>{fromEmployee.ID}</Value>
                                        </Eq>
                                    </Where>";

            var requestForDiplomaSupplies = GetByQuery(queryString);

            if (requestForDiplomaSupplies != null && requestForDiplomaSupplies.Count > 0)
            {
                delegations = new List <Delegation>();
                foreach (var requestForDiplomaSupply in requestForDiplomaSupplies)
                {
                    var delegation = new Delegation(requestForDiplomaSupply);
                    delegations.Add(delegation);
                }
            }

            return(delegations);
        }
コード例 #4
0
        // GET: Delegations/Edit/5
        public ActionResult EditDelegation(int?id, string sessionId)
        {
            int empId = (int)Session["empId"];

            ViewData["Role"]      = db.Employees.Where(r => r.EmployeeId == empId).Select(r => r.Role).SingleOrDefault();
            ViewData["sessionId"] = sessionId;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Delegation delegation = db.Delegations.Find(id);
            var        deptId     = db.Employees.Where(r => r.EmployeeId == empId).Select(r => r.Department.DeptId).SingleOrDefault();
            Employee   emp        = db.Employees.Find(delegation.EmployeeId);

            if (delegation == null)
            {
                return(HttpNotFound());
            }
            if (emp.DeptId == deptId && !(delegation.EndDate < DateTime.Today))
            {
                ViewBag.EmployeeId = new SelectList(db.Employees.Where(d => d.Department.DeptId == deptId && d.Role == "DEP_STAFF"), "EmployeeId", "EmployeeName", delegation.EmployeeId);
                return(View(delegation));
            }
            else
            {
                return(RedirectToAction("ViewDelegation", new { sessionId = sessionId }));
            }
        }
コード例 #5
0
        // Methods
        public DataSet GetEmployees(Delegation delagation)
        {
            Employees employees = new Employees();

            switch (delagation)
            {
            case Delegation.Madrid:
                employees.DsEmployees.AddDsEmployeesRow("C0001", "Nancy", "Davolio", "*****@*****.**", true);
                employees.DsEmployees.AddDsEmployeesRow("C0002", "Andrew", "Fuller", "*****@*****.**", false);
                employees.DsEmployees.AddDsEmployeesRow("C0003", "Janet", "Leverling", "*****@*****.**", false);
                employees.DsEmployees.AddDsEmployeesRow("C0004", "Margaret", "Margaret", "*****@*****.**", true);
                return(employees);

            case Delegation.Paris:
                employees.DsEmployees.AddDsEmployeesRow("C0007", "Robert", "King", "*****@*****.**", true);
                employees.DsEmployees.AddDsEmployeesRow("C0008", "Laura", "Callahan", "*****@*****.**", false);
                employees.DsEmployees.AddDsEmployeesRow("C0009", "Anne", "Dodsworth", "*****@*****.**", false);
                throw new Exception("This is a TEST exception throw if delegation value is Paris. Can see generated log file in \"c:\\logExceptions.txt\" (default path).");

            case Delegation.London:
                employees.DsEmployees.AddDsEmployeesRow("C0005", "Steven", "Buchanan", "*****@*****.**", true);
                employees.DsEmployees.AddDsEmployeesRow("C0006", "Michael", "Suyama", "*****@*****.**", false);
                return(employees);
            }
            return(employees);
        }
コード例 #6
0
    public void CreateNonGovernmentRole()
    {
        var auth = _context.ConferenceRoleAuthorizations.FirstOrDefault(n => n.Conference == conference && n.RoleAuthName == "Teilnehmende");

        Assert.NotNull(auth);

        var delegation = new Delegation()
        {
            DelegationShort = "ai",
            Conference      = conference,
            FullName        = "Amnesty International",
            Name            = "Amnesty International"
        };

        _context.Delegations.Add(delegation);

        var role = new ConferenceDelegateRole()
        {
            Delegation         = delegation,
            Committee          = null,
            Conference         = conference,
            DelegateCountry    = null,
            IconName           = "ai",
            IsDelegationLeader = true,
            RoleFullName       = "Vertreter Amnesty International",
            RoleName           = "Amnesty International",
            RoleShort          = "Amnesty",
            Title = "Nichtstaatlicher Akteur für Amnesty International",
            ConferenceRoleAuth = auth,
        };

        _context.Delegates.Add(role);
        _context.SaveChanges();
        Assert.AreEqual(3, _context.Delegates.Count());
    }
コード例 #7
0
        public ActionResult CancelDelegation(int Id)
        {
            deptId = GetDeptId();
            DelegationDAO delegationDAO = new DelegationDAO();

            //status = "completed";
            //departmentDAO.UpdateDepartmentDelegation(deptId, delegationDAO.GetDelegationById(Id).EmployeeId, status);
            //delegationDAO.CancelDelegation(Id);
            if (!departmentDAO.CancelDelegation(deptId, Id))
            {
                SetFlash(Enums.FlashMessageType.Error, "Something went wrong!");

                return(RedirectToAction("Delegation", "DepartmentHead"));
            }
            ///// start Email /////
            Delegation delegation = delegationDAO.GetDelegationById(Id);
            EmailDAO   emailDAO   = new EmailDAO();
            Employee   employee   = emailDAO.EmailDelegation(delegation.EmployeeId);
            Email      email      = new Email();

            email.SendEmail(employee.Email, "Delegation", "Dear " + delegation.EmployeeName + ",Please Check delegation status");
            ///////////////////////
            SetFlash(Enums.FlashMessageType.Success, "You've cancelled Authority Delegation!");

            return(RedirectToAction("Delegation", "DepartmentHead"));
        }
コード例 #8
0
        /// <summary>
        /// Get Change Shift Approval List
        /// </summary>
        /// <param name="fromEmployee">Approver</param>
        /// <returns>List of Change Shift Delegation</returns>
        public List <Delegation> GetListOfTasks(EmployeeInfo fromEmployee)
        {
            List <Delegation> delegations = new List <Delegation>();

            var query = $@"<Where>
                                      <And>
	                                     <Eq>
		                                    <FieldRef Name='CommonApprover1' LookupId='TRUE' />
		                                    <Value Type='User'>{fromEmployee.ADAccount.ID}</Value>
	                                     </Eq>
	                                     <IsNull>
		                                    <FieldRef Name='ApprovalStatus' />
	                                     </IsNull>
                                      </And>
                                    </Where>";

            var changeShiftManagementList = GetByQuery(query);

            if (changeShiftManagementList != null && changeShiftManagementList.Count > 0)
            {
                delegations = new List <Delegation>();
                foreach (var changeShiftManagement in changeShiftManagementList)
                {
                    var delegation = new Delegation(changeShiftManagement, fromEmployee);
                    delegations.Add(delegation);
                }
            }

            return(delegations);
        }
コード例 #9
0
    public void MoveWorkerFromQueen(Delegation delTo)
    {
        /*GiveSubjectOrder giveSubjectOrder = new GiveSubjectOrder("Giving Worker", SubjectMorph.Worker, delTo);
         * GiveOrder(giveSubjectOrder, queenDelegation);*/

        // Get path, determine validitry, both dels need nodes, means they are not moving
        Node startLocation = queenDelegation.Location;
        Node endLocation   = delTo.Location;
        Path path          = onNetwork.GetPath(startLocation, endLocation);

        if (path == null)
        {
            return;
        }

        // Get worker
        Worker worker = (Worker)queenDelegation.GetSubject(SubjectMorph.Worker);

        if (worker == null)
        {
            return;
        }

        // Order worker
        StartCoroutine(worker.OrdTranferToDelOnPath(path, delTo, "Transfer From Quuen"));
    }
コード例 #10
0
        public async Task <Delegation> Create(CreateOrUpdateDelegationRequest request)
        {
            var policyJson    = new DelegationPolicyJsonParser(request.Policy);
            var policyIssuer  = policyJson.PolicyIssuer;
            var accessSubject = policyJson.AccessSubject;

            var createdBy = await _usersRepository.GetByIdentity(request.UserId);

            var delegation = new Delegation
            {
                AuthorizationRegistryId = await GenerateId(),
                PolicyIssuer            = policyIssuer,
                AccessSubject           = accessSubject,
                Policy            = request.Policy,
                CreatedById       = createdBy.Id,
                UpdatedById       = createdBy.Id,
                CreatedDate       = DateTime.UtcNow,
                UpdatedDate       = DateTime.UtcNow,
                DelegationHistory = new List <DelegationHistory>()
            };

            _delegationsRepository.Add(delegation);

            await _delegationsRepository.Save();

            return(delegation);
        }
コード例 #11
0
        public DelegationModel(Delegation delegation) : this()
        {
            if (delegation != null)
            {
                ModuleName           = delegation.ModuleName;
                VietnameseModuleName = delegation.VietnameseModuleName;
                FromDate             = delegation.FromDate.ToString(StringConstant.DateFormatddMMyyyyHHmm);
                ToDate = delegation.ToDate.ToString(StringConstant.DateFormatddMMyyyyHHmm);
                if (delegation.ToEmployee != null)
                {
                    ToEmployee.AddRange(delegation.ToEmployee.Select(item => new LookupItemModel {
                        LookupId = item.LookupId, LookupValue = item.LookupValue
                    }));
                }

                Requester = new LookupItemModel {
                    LookupId = (delegation.Requester != null ? delegation.Requester.LookupId : 0), LookupValue = (delegation.Requester != null ? delegation.Requester.LookupValue : string.Empty)
                };
                Department = new LookupItemModel {
                    LookupId = (delegation.Department != null ? delegation.Department.LookupId : 0), LookupValue = (delegation.Department != null ? delegation.Department.LookupValue : string.Empty)
                };

                EmployeeInfoDAL _employeeInfoDAL = new EmployeeInfoDAL(SPContext.Current.Site.Url);
                FromEmployee = _employeeInfoDAL.GetByID(delegation.FromEmployee.LookupId).ADAccount;
            }
        }
コード例 #12
0
        public async Task <IActionResult> AddDelegation(Delegation postDelegation)
        {
            if (ModelState.IsValid)
            {
                var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;

                var assignment = await _context.Assignments.FindAsync(postDelegation.AssignmentId);

                if (assignment == null)
                {
                    return(Forbid());
                }
                if (!await _context.ManagesAgency(userId, assignment.AgencyId))
                {
                    return(Forbid());
                }

                Delegation delegation = new Delegation()
                {
                    AssignmentId = postDelegation.AssignmentId,
                    NameServer   = postDelegation.NameServer
                };
                _context.Delegations.Add(delegation);
                await _context.SaveChangesAsync();

                return(RedirectToAction("EditAssignment", "Manage", new { assignmentId = assignment.AssignmentId }));
            }
            return(View(postDelegation));
        }
コード例 #13
0
        public Delegation GetDelegationListItem(SPListItem listItem, SPWeb currentWeb)
        {
            Request    request    = this.ParseToEntity(listItem);
            Delegation delegation = new Delegation(request, currentWeb);

            return(delegation);
        }
コード例 #14
0
 public DelegationBuilderCommitteeSelector(MunityContext context, string conferenceId, int countryId, Delegation delegation)
 {
     this._dbContext    = context;
     this._conferenceId = conferenceId;
     this.Delegation    = delegation;
     this._countryId    = countryId;
 }
コード例 #15
0
        public IHttpActionResult checkDelegationUser()
        {
            if (!Common.GetAuthorization(Request))
            {
                return(Ok(new { Code = 401, Message = "Unauthorization" }));
            }
            var user = _userBusinessService.GetByToken(Request.Headers.GetValues("AccessToken").First());

            if (user != null)
            {
                Delegation delegationData = _userBusinessService.GetDetailDelegationByUserFrom(user.UserId);
                if (delegationData != null)
                {
                    return(Ok(new { status = _webStatus, result = new object() }));
                }
                else
                {
                    return(Ok(new { status = _webStatus, result = new object() }));
                }
            }
            else
            {
                _webStatus.code        = 403;
                _webStatus.description = "Invalid AccessToken";

                return(Ok(new { status = _webStatus, result = new object() }));
            }
        }
        //Assigning an employee as a delegate for a certain period of time
        public bool delegateEmployee(string employeeID, DateTime start, DateTime end)
        {
            Delegation delg = new Delegation();


            var d = (from x in context.Delegations
                     where x.EmployeeID == employeeID
                     select x.Employee.Department.DeptName);


            delg.EmployeeID    = employeeID;
            delg.StartDate     = start;
            delg.EndDate       = end;
            delg.DelegatedFlag = true;
            context.AddToDelegations(delg);

            // Updating employee Role
            Employee emp = new Employee();

            emp          = context.Employees.First(x => x.EmployeeID == employeeID);
            emp.RoleCode = "DH";
            int i = context.SaveChanges();

            return(i > 0);
        }
        public Delegation getDelegation(String employeeID)
        {
            Delegation dg = new Delegation();

            dg = ent.Delegations.First(x => x.EmployeeID == employeeID);
            return(dg);
        }
コード例 #18
0
        public Delegation GetDelegationListItem(SPListItem listItem, SPWeb currentWeb)
        {
            FreightManagement freightManagement = this.ParseToEntity(listItem);
            Delegation        delegation        = new Delegation(freightManagement, currentWeb);

            return(delegation);
        }
コード例 #19
0
        public async Task <IActionResult> EditDelegation(string delegationId)
        {
            var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;


            Delegation delegation = await _context.Delegations.FindAsync(delegationId);

            if (delegation == null)
            {
                return(Forbid());
            }

            var assignment = await _context.Assignments.FindAsync(delegation.AssignmentId);

            if (assignment == null)
            {
                return(Forbid());
            }
            if (!await _context.ManagesAgency(userId, assignment.AgencyId))
            {
                return(Forbid());
            }

            return(View(delegation));
        }
コード例 #20
0
        public ActionResult DHdelegation(string sessionId, string msg)
        {
            if (sessionId != null && userServices.getUserCountBySessionId(sessionId) == true)
            {
                List <Employee> emps = new List <Employee>();
                Delegation      d    = new Delegation();


                using (var db = new InventoryDbContext())
                {
                    User   user       = db.users.Where(x => x.sessionId == sessionId).FirstOrDefault();
                    string userDeptId = user.employee.departmentId;
                    emps = db.employees.Where(x => x.role == "deptstaff" && x.departmentId == userDeptId).ToList();
                }

                ViewData["emps"]      = emps;
                ViewData["d"]         = d;
                ViewData["sessionId"] = sessionId;
                ViewData["staffname"] = userServices.getUserBySessionId(sessionId).employee.empName;

                if (msg != null)
                {
                    ViewData["msg"] = msg;
                }
                return(View());
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }
コード例 #21
0
        public async Task <IActionResult> DeleteDelegation(Delegation postDelegation)
        {
            var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            Delegation delegation = await _context.Delegations.FindAsync(postDelegation.DelegationId);

            if (delegation == null)
            {
                return(Forbid());
            }

            var assignment = await _context.Assignments.FindAsync(delegation.AssignmentId);

            if (assignment == null)
            {
                return(Forbid());
            }
            if (!await _context.ManagesAgency(userId, assignment.AgencyId))
            {
                return(Forbid());
            }

            _context.Delegations.Remove(delegation);
            await _context.SaveChangesAsync();

            return(RedirectToAction("EditAssignment", "Manage", new { assignmentId = assignment.AssignmentId }));
        }
コード例 #22
0
    // Use this for initialization
    private void Start()
    {
        Node queenNode = new Node(Vector2.zero);

        onNetwork  = new Network(queenNode);
        offNetwork = new Network(null);

        hud = InterfaceManager.GetHUD();

        delagations = transform.GetChild(0);
        if (delagations == null)
        {
            Debug.LogError("Error in Dispatcher object structure");
            Destroy(this);
        }

        // MakeForm Queen Delegation
        queen = (Queen)ObjectManager.CreateFormicant("Queen", queenNode.Location);
        if (queen == null)
        {
            Debug.LogError("Dispatcher: Failed to create queen");
            Destroy(this);
        }
        hud.UpdateEggCount(queen.EggCount);
        queenDelegation = CreateDelegation(queen);
        if (queenDelegation == null)
        {
            Debug.LogError("Dispatcher: Failed to create queen delegation");
            Destroy(this);
        }
        queenDelegation.name = "Queen's Delegation";
        queenDelegation.Deploy(queenNode);
    }
コード例 #23
0
        public Delegation GetDelegationListItem(SPListItem listItem, SPWeb currentWeb)
        {
            RequestForDiplomaSupply requestForDiplomaSupply = this.ParseToEntity(listItem);
            Delegation delegation = new Delegation(requestForDiplomaSupply, currentWeb);

            return(delegation);
        }
コード例 #24
0
 private void AssignDelegation(SPItemEventProperties properties, Delegation validDelegation)
 {
     properties.AfterProperties["OriginalAssignee"] = GetSPUserValue(properties, "AssignedTo");
     properties.AfterProperties["AssignedTo"] = ConvertStringToUser(properties, validDelegation.AssignedTo);
     properties.AfterProperties["IsDelegated"] = true;
     properties.AfterProperties["DelegationType"] = validDelegation.DelegationType.ToString();
 }
コード例 #25
0
        public ActionResult UpdateDelegation(Delegation d, string sessionId)
        {
            if (sessionId != null && userServices.getUserCountBySessionId(sessionId) == true)
            {
                if ((util.IsDateValid(d.startDate, d.endDate)) == true)
                {
                    using (var db = new InventoryDbContext())
                    {
                        User       user = db.users.Where(x => x.employeeId == d.employeeId).FirstOrDefault();
                        Delegation a    = db.delegations.Where(x => x.Department.id == user.employee.Department.id && x.id == d.id).FirstOrDefault();
                        a.id = d.id;
                        //a.delegateToName = d.delegateToName;
                        a.endDate   = d.endDate;
                        a.startDate = d.startDate;
                        db.SaveChanges();
                        return(RedirectToAction("Existdelegation", new { sessionId }));
                    }
                }

                else
                {
                    ViewData["d"] = d;
                    return(RedirectToAction("Editdelegation", new { DN = d.id, sessionId, msg = "*Please enter Valid date*" }));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }
コード例 #26
0
        public Delegation GetDelegatedTaskInfo(string Id)
        {
            Delegation delegation = new Delegation(null);

            int listItemId = 0;

            if (int.TryParse(Id, out listItemId))
            {
                string[] viewFields = new string[] { StringConstant.ChangeShiftList.DHField, StringConstant.CommonSPListField.ApprovalStatusField,
                                                     StringConstant.CommonSPListField.CommonDepartmentField };
                string queryStr = $@"<Where>
                                      <Eq>
                                         <FieldRef Name='ID' />
                                         <Value Type='Counter'>{listItemId}</Value>
                                      </Eq>
                                   </Where>";
                List <Biz.Models.ChangeShiftManagement> changeShiftManagementCollection = this.GetByQuery(queryStr, viewFields);
                if (changeShiftManagementCollection != null && changeShiftManagementCollection.Count > 0)
                {
                    Biz.Models.ChangeShiftManagement changeShiftManagement = changeShiftManagementCollection[0];

                    EmployeeInfoDAL _employeeInfoDAL = new EmployeeInfoDAL(this.SiteUrl);
                    EmployeeInfo    currentApprover  = _employeeInfoDAL.GetByADAccount(changeShiftManagement.DepartmentHead.ID);
                    if (currentApprover != null)
                    {
                        delegation = DelegationPermissionManager.IsDelegation(currentApprover.ID, StringConstant.ChangeShiftList.ListUrl, changeShiftManagement.ID);
                    }
                }
            }

            return(delegation);
        }
コード例 #27
0
        public List <Delegation> GetDelegationStatus(int empId)
        {
            List <Delegation> delegation = new List <Delegation>();
            SqlDataReader     reader     = null;

            try
            {
                string     sql = "select StartDate, EndDate from Delegation where EmpID='" + empId + "'";
                SqlCommand cmd = new SqlCommand(sql, connection);
                connection.Open();
                reader = cmd.ExecuteReader();
                while (reader != null && reader.Read())
                {
                    Delegation del = new Delegation()
                    {
                        StartDate = (DateTime)reader["StartDate"],
                        EndDate   = (DateTime)reader["EndDate"],
                    };

                    delegation.Add(del);
                }
            }
            finally {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }

            return(delegation);
        }
コード例 #28
0
        public Motion(string data, string topic, Delegation Proposer, TimeSpan Duration,
                      TimeSpan SpeakTime, bool isDefault = false) : this(data, topic, Proposer, isDefault)
        {
            var errMsg = "Missing Data: ";

            if (Internal.Duration && Duration == TimeSpan.Zero)
            {
                errMsg += "Total duration\n";
            }
            else
            {
                this.Duration = Duration;
            }

            if (Internal.SpeakTime && Duration == TimeSpan.Zero)
            {
                errMsg += "Speaking Time\n";
            }
            else
            {
                this.SpeakTime = SpeakTime;
            }


            if (errMsg != "Missing Data: ")
            {
                throw new MissingDataException(errMsg);
            }
        }
コード例 #29
0
        public Delegation GetDelegationById(int id)
        {
            Delegation    delegation = new Delegation();
            SqlDataReader reader     = null;
            SqlConnection conn       = connection;

            try
            {
                conn.Open();
                string     sql     = @"select * from Delegation where ID='" + id + "'";
                SqlCommand command = new SqlCommand(sql, conn);
                reader = command.ExecuteReader();
                if (reader.Read())
                {
                    delegation.Id         = (int)reader["ID"];
                    delegation.EmployeeId = (int)reader["EmpID"];
                    delegation.StartDate  = (DateTime)reader["StartDate"];
                    delegation.EndDate    = (DateTime)reader["EndDate"];
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }
            return(delegation);
        }
コード例 #30
0
    /// <summary>
    /// Start coroutine?
    /// </summary>
    public override void StartOrder(Delegation delegation)
    {
        base.StartOrder(delegation);

        _orderRoutine = _delegation.OrdDeploy(_location, _orderName, _orderID);
        _delegation.StartOrderRoutine(_orderRoutine);
    }
コード例 #31
0
        public List <Delegation> GetListOfTasks(EmployeeInfo fromEmployee)
        {
            List <Delegation> delegations = null;

            string queryString = $@"<Where>
                                        <Eq>
                                            <FieldRef Name='{RequisitionOfMeetingRoomList.Fields.PendingAtField}' LookupId='TRUE'/>
                                            <Value Type='Lookup'>{fromEmployee.ID}</Value>
                                        </Eq>
                                    </Where>";

            var requisitionOfMeetingRoomCollection = GetByQuery(queryString);

            if (requisitionOfMeetingRoomCollection != null && requisitionOfMeetingRoomCollection.Count > 0)
            {
                delegations = new List <Delegation>();
                foreach (var requisitionOfMeetingRoom in requisitionOfMeetingRoomCollection)
                {
                    var delegation = new Delegation(requisitionOfMeetingRoom);
                    delegations.Add(delegation);
                }
            }

            return(delegations);
        }
コード例 #32
0
        public void Add(DelegationModel model)
        {
            var doc = new Delegation
            {
                UserName = model.UserName,
                Realm = model.Realm.AbsoluteUri,
                Description = model.Description
            };

            _session.Store(doc);
        }
コード例 #33
0
        void btnSubmit_Click(object sender, EventArgs e)
        {
            string siteURLForDelegationsList = Utility.GetDelegationsListSite();

            if (siteURLForDelegationsList != null)
            {

                using (SPSite delegationSite = new SPSite(siteURLForDelegationsList))
                {
                    DelegationsDataContext dc = new DelegationsDataContext(delegationSite.RootWeb.Url);
                    EntityList<Delegation> delegations = dc.GetList<Delegation>("Delegations");

                    string selectedUser = ddlSubordinates.SelectedValue;

                    SPUser assignedToUser = SPContext.Current.Web.EnsureUser(selectedUser);

                    Delegation delegation = new Delegation()
                    {
                        DelegationFor = SPContext.Current.Web.CurrentUser.LoginName,
                        DelegationForId = SPContext.Current.Web.CurrentUser.ID,
                        StartDate = calDelegateFrom.SelectedDate,
                        EndDate = calDelegateTo.SelectedDate,
                        AssignedTo = assignedToUser.LoginName,
                        AssignedToId = assignedToUser.ID,
                        DelegationType = DelegationType.Self
                    };

                    delegations.InsertOnSubmit(delegation);

                    dc.SubmitChanges();

                }
            }

            //Set value for message
        }
コード例 #34
0
 public void AddToDelegations(Delegation delegation)
 {
     base.AddObject("Delegations", delegation);
 }
コード例 #35
0
 public static Delegation CreateDelegation(long ID, long serviceIdentityId, long relyingPartyId, bool systemReserved)
 {
     Delegation delegation = new Delegation();
     delegation.Id = ID;
     delegation.ServiceIdentityId = serviceIdentityId;
     delegation.RelyingPartyId = relyingPartyId;
     delegation.SystemReserved = systemReserved;
     return delegation;
 }
コード例 #36
0
        private void PopulateDelegation(Delegation delegation)
        {
            delegationID.Value = delegation.Id.ToString();
            btnSubmit.Text = "Update";
            SPUser user = SPContext.Current.Web.Site.RootWeb.AllUsers.GetByID(delegation.AssignedToId.Value);

            ddlSubordinates.Items.FindByValue(user.LoginName).Selected = true;

            calDelegateFrom.SelectedDate = delegation.StartDate.Value;
            calDelegateTo.SelectedDate = delegation.EndDate.Value;
        }
コード例 #37
0
        private void PopulateDelegation(Delegation delegation)
        {
            delegationID.Value = delegation.Id.ToString();
            btnSubmit.Text = "Update";
            SPUser user = SPContext.Current.Web.Site.RootWeb.AllUsers.GetByID(delegation.AssignedToId.Value);

            PickerEntity entity = new PickerEntity();
            entity.Key = user.LoginName;

            ArrayList entityArrayList = new ArrayList();
            entityArrayList.Add(entity);
            spPeoplePicker.UpdateEntities(entityArrayList);
            calDelegateFrom.SelectedDate = delegation.StartDate.Value;
            calDelegateTo.SelectedDate = delegation.EndDate.Value;
        }
コード例 #38
0
        void btnSubmit_Click(object sender, EventArgs e)
        {
            InitializeWebAppProperties();

            if (siteURLForDelegationsList != null)
            {

                using (SPSite delegationSite = new SPSite(siteURLForDelegationsList))
                {
                    DelegationsDataContext dc = new DelegationsDataContext(delegationSite.RootWeb.Url);
                    EntityList<Delegation> delegations = dc.GetList<Delegation>("Delegations");

                    string[] userValues = spPeoplePicker.CommaSeparatedAccounts.Split(',');

                    SPUser assignedToUser = SPContext.Current.Web.EnsureUser(userValues[0]);

                    Delegation delegation;

                    if (string.IsNullOrEmpty(delegationID.Value))
                    {
                        delegation = new Delegation()
                        {
                            DelegationFor = SPContext.Current.Web.CurrentUser.LoginName,
                            DelegationForId = SPContext.Current.Web.CurrentUser.ID,
                            StartDate = calDelegateFrom.SelectedDate,
                            EndDate = calDelegateTo.SelectedDate,
                            AssignedTo = assignedToUser.LoginName,
                            AssignedToId = assignedToUser.ID,
                            DelegationType = DelegationType.Self
                        };

                        delegations.InsertOnSubmit(delegation);
                    }
                    else
                    {
                        delegation = delegations.Where(d => d.Id == int.Parse(delegationID.Value)).FirstOrDefault();

                        if (delegation != null)
                        {
                            delegation.StartDate = calDelegateFrom.SelectedDate;
                            delegation.EndDate = calDelegateTo.SelectedDate;
                            delegation.AssignedTo = assignedToUser.LoginName;
                            delegation.AssignedToId = assignedToUser.ID;
                            delegation.DelegationType = DelegationType.Self;
                        }
                    }

                    dc.SubmitChanges();

                }
            }

            //Reload the delegations
            LoadDelegations();
            ResetNewDelegationPanel();
        }