예제 #1
0
        private void BindProjectDict(bool lazyLoad = true)
        {
            comboBoxProject.SelectedIndexChanged -= comboBoxProject_SelectedIndexChanged;
            CommonFunc.BindProjectListToComboBox(comboBoxProject, null, false, lazyLoad);
            comboBoxProject.SelectedIndexChanged        += comboBoxProject_SelectedIndexChanged;
            comboBoxCurrentProject.SelectedIndexChanged -= comboBoxCurrentProject_SelectedIndexChanged;
            CommonFunc.BindProjectListToComboBox(comboBoxCurrentProject, null, false, lazyLoad, true);
            List <Project> projects = comboBoxCurrentProject.DataSource as List <Project>;

            if (projects == null)
            {
                MessageBox.Show("绑定的当前项目数据源错误", "提示");
                return;
            }
            string currentProjectID = CommonData.IniHelper.Read("Common", "CurrentProjectID");

            if (currentProjectID.NotNullOrWhiteSpace())
            {
                comboBoxCurrentProject.SelectedItem = projects.FirstOrDefault(u => u.ID.ToString() == currentProjectID);
            }
            else
            {
                //comboBoxCurrentProject.Text= CommonData.IniHelper.Read("Common", "CurrentProjectName");
                string currentProjectName = CommonData.IniHelper.Read("Common", "CurrentProjectName");
                //comboBoxCurrentProject.Text = currentProjectName;
                if (currentProjectName.NotNullOrWhiteSpace())
                {
                    comboBoxCurrentProject.SelectedItem = projects.FirstOrDefault(u => u.Name == currentProjectName);
                }
            }
            comboBoxCurrentProject.SelectedIndexChanged += comboBoxCurrentProject_SelectedIndexChanged;
        }
예제 #2
0
 private void AddToReport_Load(object sender, EventArgs e)
 {
     if (toDo == null)
     {
         MessageBox.Show("要添加的待办事项数据错误。", "提示");
         this.Close();
     }
     comboBoxProject.SelectedIndexChanged -= comboBoxProject_SelectedIndexChanged;
     comboBoxBranch.SelectedIndexChanged  -= comboBoxBranch_SelectedIndexChanged;
     CommonFunc.BindProjectListToComboBox(comboBoxProject, null, true);
     CommonFunc.BindBranchListToComboBox(comboBoxBranch, null, true);
     comboBoxProject.SelectedIndexChanged += comboBoxProject_SelectedIndexChanged;
     comboBoxBranch.SelectedIndexChanged  += comboBoxBranch_SelectedIndexChanged;
     if (toDo.Project != null && toDo.Project.ID != CommonData.ItemAllValue)
     {
         comboBoxProject.SelectedValue = toDo.Project.ID;
     }
     else
     {
         comboBoxProject.SelectedValue = CommonData.ItemAllValue;
     }
     if (toDo.Branch != null && toDo.Branch.ID != CommonData.ItemAllValue)
     {
         comboBoxBranch.SelectedValue = toDo.Branch.ID;
     }
     else
     {
         comboBoxBranch.SelectedValue = CommonData.ItemAllValue;
     }
     textBoxRelatedID.Text          = toDo.RelatedID;
     dateTimePickerFinishTime.Value = toDo.FinishTime.HasValue ? toDo.FinishTime.Value : DateTime.Now;
     richTextBoxContent.Text        = toDo.Title + (string.IsNullOrWhiteSpace(toDo.Content) ? string.Empty : ":" + toDo.Content);
 }
예제 #3
0
 private void BindDict()
 {
     //List<Project> projectList = CommonFunc.GetProjectListForSearch();
     //CommonFunc.BindProjectListToComboBox(comboBoxSearchProject, projectList, true);
     //CommonFunc.BindProjectListToComboBox(comboBoxOperateProject, new List<Project>(projectList), true);
     comboBoxSearchProject.SelectedIndexChanged  -= comboBoxSearchProject_SelectedIndexChanged;
     comboBoxOperateProject.SelectedIndexChanged -= comboBoxOperateProject_SelectedIndexChanged;
     comboBoxSearchBranch.SelectedIndexChanged   -= comboBoxSearchBranch_SelectedIndexChanged;
     comboBoxOperateBranch.SelectedIndexChanged  -= comboBoxOperateBranch_SelectedIndexChanged;
     CommonFunc.BindProjectListToComboBox(comboBoxSearchProject, null, true);
     CommonFunc.BindProjectListToComboBox(comboBoxOperateProject, null, true);
     if (CommonData.CurrentProject != null && CommonData.CurrentProject.ID != CommonData.ItemNullValue && CommonData.CurrentProject.ID != CommonData.ItemAllValue)
     {
         comboBoxOperateProject.SelectedValue = CommonData.CurrentProject.ID;
         if (CommonData.ApplyCurrentProjectAndBranchToSearch)
         {
             comboBoxSearchProject.SelectedValue = CommonData.CurrentProject.ID;
         }
     }
     CommonFunc.BindBranchListToComboBox(comboBoxSearchBranch, null, true);
     CommonFunc.BindBranchListToComboBox(comboBoxOperateBranch, null, true);
     if (CommonData.CurrentBranch != null && CommonData.CurrentBranch.ID != CommonData.ItemNullValue && CommonData.CurrentBranch.ID != CommonData.ItemAllValue)
     {
         comboBoxOperateBranch.SelectedValue = CommonData.CurrentBranch.ID;
         if (CommonData.ApplyCurrentProjectAndBranchToSearch)
         {
             comboBoxSearchBranch.SelectedValue = CommonData.CurrentBranch.ID;
         }
     }
     comboBoxSearchProject.SelectedIndexChanged  += comboBoxSearchProject_SelectedIndexChanged;
     comboBoxOperateProject.SelectedIndexChanged += comboBoxOperateProject_SelectedIndexChanged;
     comboBoxSearchBranch.SelectedIndexChanged   += comboBoxSearchBranch_SelectedIndexChanged;
     comboBoxOperateBranch.SelectedIndexChanged  += comboBoxOperateBranch_SelectedIndexChanged;
 }
예제 #4
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;
            }
        }