Exemple #1
0
        private int GetNextValidId(int tempId)
        {
            var dt = RiskDataManager.GetList(SessionVariables.RequestProfile);

            foreach (DataRow dr in dt.Rows)
            {
                if (dr[RiskDataModel.DataColumns.RiskId].ToString().Equals(tempId.ToString()))
                {
                    tempId -= 1;
                    return(GetNextValidId(tempId));
                }
            }

            return(tempId);
        }
Exemple #2
0
        public override void LoadDropDownListSources(string fieldName, DropDownList dropDownListControl)
        {
            base.LoadDropDownListSources(fieldName, dropDownListControl);

            if (fieldName.Equals("RiskId"))
            {
                var riskData = RiskDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(riskData, dropDownListControl,
                                      StandardDataModel.StandardDataColumns.Name,
                                      RiskDataModel.DataColumns.RiskId);
            }

            if (fieldName.Equals("RewardId"))
            {
                var rewardData = RewardDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(rewardData, dropDownListControl,
                                      StandardDataModel.StandardDataColumns.Name,
                                      RewardDataModel.DataColumns.RewardId);
            }

            if (fieldName.Equals("TaskId"))
            {
                var taskData = TaskDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(taskData, dropDownListControl,
                                      StandardDataModel.StandardDataColumns.Name,
                                      TaskDataModel.DataColumns.TaskId);
            }

            if (fieldName.Equals("PersonId"))
            {
                var applicationUserdata = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(applicationUserdata, dropDownListControl,
                                      ApplicationUserDataModel.DataColumns.FirstName,
                                      ApplicationUserDataModel.DataColumns.ApplicationUserId);
            }
        }
Exemple #3
0
        private void SetupDropdown()
        {
            var isTesting = SessionVariables.IsTesting;

            var rewardData = RewardDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(rewardData, drpRewardList, StandardDataModel.StandardDataColumns.Name,
                                  RewardDataModel.DataColumns.RewardId);


            var riskData = RiskDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(riskData, drpRiskList, StandardDataModel.StandardDataColumns.Name,
                                  RiskDataModel.DataColumns.RiskId);


            var taskData = TaskTimeTracker.Components.BusinessLayer.Task.TaskDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(taskData, drpTaskList, StandardDataModel.StandardDataColumns.Name,
                                  TaskDataModel.DataColumns.TaskId);


            var personData = Framework.Components.ApplicationUser.ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(personData, drpPersonList, ApplicationUserDataModel.DataColumns.FirstName, ApplicationUserDataModel.DataColumns.ApplicationUserId);

            if (isTesting)
            {
                drpTaskList.AutoPostBack   = true;
                drpRewardList.AutoPostBack = true;
                drpPersonList.AutoPostBack = true;
                drpRiskList.AutoPostBack   = true;
                if (drpRiskList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtRiskId.Text.Trim()))
                    {
                        drpRiskList.SelectedValue = txtRiskId.Text;
                    }
                    else
                    {
                        txtRiskId.Text = drpRiskList.SelectedItem.Value;
                    }
                }
                if (drpRewardList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtRewardId.Text.Trim()))
                    {
                        drpRewardList.SelectedValue = txtRewardId.Text;
                    }
                    else
                    {
                        txtRewardId.Text = drpRewardList.SelectedItem.Value;
                    }
                }
                if (drpTaskList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtTaskId.Text.Trim()))
                    {
                        drpTaskList.SelectedValue = txtTaskId.Text;
                    }
                    else
                    {
                        txtTaskId.Text = drpTaskList.SelectedItem.Value;
                    }
                }
                if (drpPersonList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtPersonId.Text.Trim()))
                    {
                        drpPersonList.SelectedValue = txtPersonId.Text;
                    }
                    else
                    {
                        txtPersonId.Text = drpPersonList.SelectedItem.Value;
                    }
                }
                txtRiskId.Visible   = true;
                txtRewardId.Visible = true;
                txtTaskId.Visible   = true;
                txtPersonId.Visible = true;
            }
            else
            {
                if (!string.IsNullOrEmpty(txtRiskId.Text.Trim()))
                {
                    drpRiskList.SelectedValue = txtRiskId.Text;
                }
                if (!string.IsNullOrEmpty(txtRewardId.Text.Trim()))
                {
                    drpRewardList.SelectedValue = txtRewardId.Text;
                }
                if (!string.IsNullOrEmpty(txtTaskId.Text.Trim()))
                {
                    drpTaskList.SelectedValue = txtTaskId.Text;
                }
                if (!string.IsNullOrEmpty(txtPersonId.Text.Trim()))
                {
                    drpPersonList.SelectedValue = txtPersonId.Text;
                }
            }
        }