Ejemplo n.º 1
0
        private void BindUserDict(bool lazyLoad = true)
        {
            CommonFunc.BindUserListToComboBox(comboBoxCurrentUser, null, false, lazyLoad);
            List <User> users = comboBoxCurrentUser.DataSource as List <User>;

            if (users == null)
            {
                MessageBox.Show("绑定的当前用户数据源错误", "提示");
                return;
            }
            string currentUserID = CommonData.IniHelper.Read("Common", "CurrentUserID");

            if (currentUserID.NotNullOrWhiteSpace())
            {
                comboBoxCurrentUser.SelectedItem = users.FirstOrDefault(u => u.ID.ToString() == currentUserID);
            }
            else
            {
                string a = string.Empty;
                string currentUserName = string.Empty;
                currentUserName = CommonData.IniHelper.Read("Common", "CurrentUserName");
                if (currentUserName.NotNullOrWhiteSpace())
                {
                    comboBoxCurrentUser.SelectedItem = users.FirstOrDefault(u => u.Name == currentUserName);
                }
            }
        }
Ejemplo n.º 2
0
        private void RelateToToDo_Load(object sender, EventArgs e)
        {
            comboBoxSearchProject.SelectedIndexChanged -= comboBoxSearchProject_SelectedIndexChanged;
            comboBoxSearchBranch.SelectedIndexChanged  -= comboBoxSearchBranch_SelectedIndexChanged;
            CommonFunc.BindProjectListToComboBox(comboBoxSearchProject, null, true);
            if (relatedProjectID != CommonData.ItemNullValue)
            {
                comboBoxSearchProject.SelectedValue = relatedProjectID;
            }
            else if (CommonData.CurrentProject != null && CommonData.CurrentProject.ID != CommonData.ItemNullValue && CommonData.CurrentProject.ID != CommonData.ItemAllValue)
            {
                comboBoxSearchProject.SelectedValue = CommonData.CurrentProject.ID;
            }
            CommonFunc.BindBranchListToComboBox(comboBoxSearchBranch, null, true);
            if (relatedBranchID != CommonData.ItemNullValue)
            {
                comboBoxSearchBranch.SelectedValue = relatedBranchID;
            }
            else if (CommonData.CurrentBranch != null && CommonData.CurrentBranch.ID != CommonData.ItemNullValue && CommonData.CurrentBranch.ID != CommonData.ItemAllValue)
            {
                comboBoxSearchBranch.SelectedValue = CommonData.CurrentBranch.ID;
            }
            comboBoxSearchProject.SelectedIndexChanged += comboBoxSearchProject_SelectedIndexChanged;
            comboBoxSearchBranch.SelectedIndexChanged  += comboBoxSearchBranch_SelectedIndexChanged;
            List <ToDoStatus> toDoList = CommonFunc.GetToDoStatusListForSearch();

            toDoList.Add(CommonData.toDoStatusNotDone);
            CommonFunc.BindToDoStatusListToComboBox(comboBoxSearchStatus, toDoList, true);
            comboBoxSearchStatus.SelectedValue = EnumToDoStatus.Done;
            CommonFunc.GetWeekDateTime(ref weekStartTime, ref weekEndTime);
            dateTimePickerSearchFisnishTimeFrom.Value   = weekStartTime;
            dateTimePickerSearchFinishTimeTo.Value      = weekEndTime;
            dateTimePickerSearchFisnishTimeFrom.Checked = false;
            dateTimePickerSearchFinishTimeTo.Checked    = false;
            CommonFunc.BindUserListToComboBox(comboBoxSearchFinishUser, null, true);
            if (CommonData.CurrentUser != null && CommonData.CurrentUser.ID != CommonData.ItemNullValue && CommonData.CurrentUser.ID != CommonData.ItemAllValue)
            {
                comboBoxSearchFinishUser.SelectedValue = CommonData.CurrentUser.ID;
            }
        }