public void bindData(int taskID) { int clientID = SessionHelper.getClientId(); int userID = SessionHelper.getUserId(); List <UserStaff> owners = null; // load owners for this client owners = SecUserManager.GetStaff(clientID); CollectionManager.FillCollection(ddlOwner, "UserId", "StaffName", owners); // check user can assign user to event bool isAssignUsersToActivities = Core.PermissionHelper.checkAction((int)Globals.Actions.AssignUsersToActivities); if (isAssignUsersToActivities) { ddlOwner.Enabled = true; } else { ddlOwner.Enabled = false; ddlOwner.SelectedValue = userID.ToString(); } fillForm(taskID); }
private void bindData() { List <UserStaff> users = null; // load tasks priorties ddlPriority.DataSource = TasksManager.GetPriorities(clientID); ddlPriority.DataBind(); // load users users = SecUserManager.GetStaff(clientID); CollectionManager.FillCollection(ddlUsers, "UserId", "StaffName", users); // select user ddlUsers.SelectedValue = userID.ToString(); if (roleID == (int)UserRole.Client || roleID == (int)UserRole.SiteAdministrator) { ddlUsers.Enabled = true; } else { // disable dropdown for user ddlUsers.Enabled = false; } // load appointment data if (TaskID > 0) { fillApppointmentForm(TaskID); } }
protected void btnSearch_Click(object sender, ImageClickEventArgs e) { List <LeadView> leads = null; List <UserStaff> users = null; int clientID = 0; var predicate = buildPredicate(); leads = LeadsManager.GetLeads(predicate).ToList(); if (leads != null && leads.Count > 0) { gvUserLeads.DataSource = leads; gvUserLeads.DataBind(); // load users clientID = SessionHelper.getClientId(); users = SecUserManager.GetStaff(clientID); CollectionManager.FillCollection(ddlUsers, "UserId", "StaffName", users); pnlGrid.Visible = true; lblError.Text = string.Empty; pnlSearch.Visible = false; } else { lblError.Text = "No results found."; lblError.Visible = true; } }
private void bindData() { List <UserStaff> owners = null; List <TaskPriority> priorities = null; List <TaskStatus> taskStatuses = null; int taskID = 0; // load task statuses taskStatuses = TasksManager.GetStatuses(); CollectionManager.FillCollection(ddlTaskStatus, "id", "title", taskStatuses.ToList(), false); // load system default priorities priorities = TasksManager.GetPriorities(); CollectionManager.FillCollection(ddlPriority, "PriorityID", "PriorityName", priorities, false); // load owners for this client owners = SecUserManager.GetStaff(clientID); CollectionManager.FillCollection(ddlOwner, "UserId", "StaffName", owners); // disable owner DDL when not Client if (roleID != (int)UserRole.Client) { ddlOwner.Enabled = false; } if (this.TaskID > 0) { fillForm(); } }
private void bindData() { int clientID = SessionHelper.getClientId(); List <UserStaff> staffMembers = SecUserManager.GetStaff(clientID); CollectionManager.FillCollection(ddlUsers, "UserId", "StaffName", staffMembers); }
private void bindResourcesForClient() { //int luserID = 0; List <CRM.Data.Entities.UserStaff> staffMembers = SecUserManager.GetStaff(clientID); if (staffMembers != null && staffMembers.Count > 0) { ActiveResourceKey = staffMembers[0].UserId.ToString(); foreach (UserStaff user in staffMembers) { Resource resource = new Resource(); resource.DataKey = user.UserId.ToString(); resource.Name = user.StaffName; resource.EmailAddress = user.EmailAddress; WebScheduleInfo1.VisibleResources.Add(resource); } //WebScheduleInfo1.VisibleResources[0] == unassigned if (ActiveResourceKey != null) { Resource activeResource = WebScheduleInfo1.VisibleResources.GetResourceFromKey(ActiveResourceKey); WebScheduleInfo1.ActiveResourceName = activeResource.Name; } else { WebScheduleInfo1.ActiveResourceName = WebScheduleInfo1.VisibleResources[1].Name; ActiveResourceKey = WebScheduleInfo1.VisibleResources[1].DataKey.ToString(); } //luserID = Convert.ToInt32(WebScheduleInfo1.VisibleResources[1].DataKey); //DateTime fromDate = SchedulerManager.GetScheduleFromDate(WebScheduleInfo1); //DateTime toDate = SchedulerManager.GetScheduleEndDate(WebScheduleInfo1, this.TypeView); } }
// bind users to scheduler private void bindResources() { List <UserStaff> staffMembers = null; Resource resource = null; CRM.Data.Entities.SecUser secUser = null; WebScheduleInfo1.VisibleResources.Clear(); switch (roleID) { case (int)UserRole.Client: case (int)UserRole.SiteAdministrator: staffMembers = SecUserManager.GetStaff(clientID); if (staffMembers != null && staffMembers.Count > 0) { ActiveResourceKey = staffMembers[0].UserId.ToString(); foreach (UserStaff user in staffMembers) { resource = new Resource(); resource.DataKey = user.UserId.ToString(); resource.Name = user.StaffName; resource.EmailAddress = user.EmailAddress; WebScheduleInfo1.VisibleResources.Add(resource); } } break; default: secUser = SecUserManager.GetByUserId(userID); if (secUser != null) { resource = new Resource(); resource.DataKey = secUser.UserId.ToString(); resource.Name = string.Format("{0} {1}", secUser.FirstName, secUser.LastName); resource.EmailAddress = secUser.Email; WebScheduleInfo1.VisibleResources.Add(resource); } break; } //WebScheduleInfo1.VisibleResources[0] == unassigned if (WebScheduleInfo1 != null && WebScheduleInfo1.VisibleResources != null && WebScheduleInfo1.VisibleResources.Count > 0) { if (!string.IsNullOrEmpty(ActiveResourceKey)) { Resource activeResource = WebScheduleInfo1.VisibleResources.GetResourceFromKey(ActiveResourceKey); if (activeResource != null && !string.IsNullOrEmpty(activeResource.Name)) { WebScheduleInfo1.ActiveResourceName = activeResource.Name; } } else { WebScheduleInfo1.ActiveResourceName = WebScheduleInfo1.VisibleResources[1].Name; ActiveResourceKey = WebScheduleInfo1.VisibleResources[1].DataKey.ToString(); } } }