Esempio n. 1
0
        private void BindStep1()
        {
            tbTitle.Text = String.Empty;

            ddlManager.Attributes.Add("onchange", "SaveManagerId();");

            ddPriority.DataValueField = "PriorityId";
            ddPriority.DataTextField  = "PriorityName";
            ddPriority.DataSource     = ToDo.GetListPriorities();
            ddPriority.DataBind();

            ddProject.DataTextField  = "Title";
            ddProject.DataValueField = "ProjectId";
            s4OnlyForMe.Text         = LocRM.GetString("s4OnlyForMe");
            chbMustBeConfirmed.Text  = LocRM.GetString("s4MustBeConfirmed");

            switch (sUnit)
            {
            case "Entry":
                s2ToDoManager.Style.Add("display", "none");
                ddEntryType.DataTextField  = "TypeName";
                ddEntryType.DataValueField = "TypeId";
                ddEntryType.DataSource     = CalendarEntry.GetListEventTypes();
                ddEntryType.DataBind();
                CommonHelper.SafeSelect(ddEntryType, "2");
                ddProject.DataSource = CalendarEntry.GetListProjects(Security.CurrentUser.UserID);

                s4AssignTeam.Text        = LocRM.GetString("s4AssignParticipants");
                s1ToDoProperties.Visible = false;
                //	DateTimeCommentForToDo.Visible = false;
                dtcStartDate.SelectedDate = UserDateTime.UserNow;
                dtcEndDate.SelectedDate   = dtcStartDate.SelectedDate.AddMinutes(30);

                CommonHelper.SafeSelect(ddPriority, PortalConfig.CEntryDefaultValuePriorityField);
                divPriority.Visible = PortalConfig.CommonCEntryAllowEditPriorityField;
                break;

            case "ToDo":
                s2ToDoManager.Style.Add("display", "inline");
                ddToDoCompletionType.DataTextField  = "CompletionTypeName";
                ddToDoCompletionType.DataValueField = "CompletionTypeId";
                ddToDoCompletionType.DataSource     = ToDo.GetListCompletionTypes();
                ddProject.DataSource = Project.GetListActiveProjectsByManager();
                ddToDoCompletionType.DataBind();
                s4AssignTeam.Text         = LocRM.GetString("s4AssignResources");
                s1EntryProperties.Visible = false;
                break;
            }
            ddProject.DataBind();
            ListItem liDefault = new ListItem(LocRM.GetString("s4NotSet"), "-1");

            ddProject.Items.Insert(0, liDefault);

            ArrayList alManagers = new ArrayList();

            using (IDataReader rManagers = SecureGroup.GetListAllUsersInGroup((int)InternalSecureGroups.ProjectManager, false))
            {
                while (rManagers.Read())
                {
                    ListItem li = new ListItem(rManagers["LastName"].ToString() + " " + rManagers["FirstName"].ToString(), rManagers["UserId"].ToString());
                    alManagers.Add(li);
                }
            }

            if (Security.IsUserInGroup(InternalSecureGroups.PowerProjectManager))
            {
                for (int i = 0; i < alManagers.Count; i++)
                {
                    ddlManager.Items.Add((ListItem)alManagers[i]);
                }
                Util.CommonHelper.SafeSelect(ddlManager, Security.CurrentUser.UserID.ToString());
            }
            else
            {
                lblManager.Visible = true;
                ddlManager.Enabled = false;
                ddlManager.Visible = false;
                lblManager.Text    = CommonHelper.GetUserStatusUL((Security.CurrentUser.UserID));
                txtManagerId.Value = Security.CurrentUser.UserID.ToString();
            }
        }