Exemple #1
0
        private void BindBranchDict(bool lazyLoad = true)
        {
            comboBoxCurrentBranch.SelectedIndexChanged -= comboBoxCurrentBranch_SelectedIndexChanged;
            CommonFunc.BindBranchListToComboBox(comboBoxCurrentBranch, null, false, lazyLoad, true);
            List <Branch> branches = comboBoxCurrentBranch.DataSource as List <Branch>;

            if (branches == null)
            {
                MessageBox.Show("绑定的当前分支数据源错误", "提示");
                return;
            }
            string currentBranchID = CommonData.IniHelper.Read("Common", "CurrentBranchID");

            if (currentBranchID.NotNullOrWhiteSpace())
            {
                comboBoxCurrentBranch.SelectedItem = branches.FirstOrDefault(u => u.ID.ToString() == currentBranchID);
            }
            else
            {
                string currentBranchName = CommonData.IniHelper.Read("Common", "CurrentBranchName");
                if (currentBranchName.NotNullOrWhiteSpace())
                {
                    comboBoxCurrentBranch.SelectedItem = branches.FirstOrDefault(u => u.Name == currentBranchName);
                }
            }
            comboBoxCurrentBranch.SelectedIndexChanged += comboBoxCurrentBranch_SelectedIndexChanged;
        }
Exemple #2
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;
 }
Exemple #3
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);
 }
Exemple #4
0
        private void comboBoxOperateProject_SelectedIndexChanged(object sender, EventArgs e)
        {
            Project project = null;

            if (comboBoxOperateProject.SelectedItem is Project)
            {
                project = comboBoxOperateProject.SelectedItem as Project;
            }
            comboBoxOperateBranch.SelectedIndexChanged -= comboBoxOperateBranch_SelectedIndexChanged;
            if (project != null && project.ID != CommonData.ItemAllValue)
            {
                CommonFunc.BindBranchListToComboBoxByProjectID(comboBoxOperateBranch, project.ID, null, true);
            }
            else
            {
                CommonFunc.BindBranchListToComboBox(comboBoxOperateBranch, null, true);
            }
            comboBoxOperateBranch.SelectedIndexChanged += comboBoxOperateBranch_SelectedIndexChanged;
        }
Exemple #5
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;
            }
        }