コード例 #1
0
        /// <summary>
        /// Sets the default issue type by project id.
        /// </summary>
        /// <param name="defaultValue">The default value.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentOutOfRangeException">projectId</exception>
        public override bool SetDefaultIssueTypeByProjectId(DefaultValue defaultVal)
        {
            // validate Parameters
            if (defaultVal.ProjectId <= Globals.NEW_ID)
                throw (new ArgumentOutOfRangeException("projectId"));

            // Execute SQL Command
            using (var sqlCmd = new SqlCommand())
            {
                AddParamToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
                AddParamToSqlCmd(sqlCmd, "@ProjectId", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.ProjectId);
                AddParamToSqlCmd(sqlCmd, "@Type", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.IssueTypeId);
                AddParamToSqlCmd(sqlCmd, "@StatusId", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.StatusId);
                AddParamToSqlCmd(sqlCmd, "@IssueOwnerUserName", SqlDbType.NText, 255, ParameterDirection.Input, defaultVal.OwnerUserName);
                AddParamToSqlCmd(sqlCmd, "@IssuePriorityId", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.PriorityId);
                AddParamToSqlCmd(sqlCmd, "@IssueAffectedMilestoneId", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.AffectedMilestoneId);
                AddParamToSqlCmd(sqlCmd, "@IssueAssignedUsername", SqlDbType.NText, 255, ParameterDirection.Input, defaultVal.AssignedUserName);
                AddParamToSqlCmd(sqlCmd, "@IssueVisibility", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.IssueVisibility);
                AddParamToSqlCmd(sqlCmd, "@IssueCategoryId", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.CategoryId);
                AddParamToSqlCmd(sqlCmd, "@IssueDueDate", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.DueDate == null ? DBNull.Value : (object)defaultVal.DueDate);
                AddParamToSqlCmd(sqlCmd, "@IssueProgress", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.Progress);
                AddParamToSqlCmd(sqlCmd, "@IssueMilestoneId", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.MilestoneId);
                AddParamToSqlCmd(sqlCmd, "@IssueEstimation", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.Estimation);
                AddParamToSqlCmd(sqlCmd, "@IssueResolutionId", SqlDbType.Int, 0, ParameterDirection.Input, defaultVal.ResolutionId);
                AddParamToSqlCmd(sqlCmd, "@StatusVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.StatusVisibility);
                AddParamToSqlCmd(sqlCmd, "@OwnedByVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.OwnedByVisibility);
                AddParamToSqlCmd(sqlCmd, "@PriorityVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.PriorityVisibility);
                AddParamToSqlCmd(sqlCmd, "@AssignedToVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.AssignedToVisibility);
                AddParamToSqlCmd(sqlCmd, "@PrivateVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.PrivateVisibility);
                AddParamToSqlCmd(sqlCmd, "@CategoryVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.CategoryVisibility);
                AddParamToSqlCmd(sqlCmd, "@DueDateVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.DueDateVisibility);
                AddParamToSqlCmd(sqlCmd, "@TypeVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.TypeVisibility);
                AddParamToSqlCmd(sqlCmd, "@PercentCompleteVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.PercentCompleteVisibility);
                AddParamToSqlCmd(sqlCmd, "@MilestoneVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.MilestoneVisibility);
                AddParamToSqlCmd(sqlCmd, "@EstimationVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.EstimationVisibility);
                AddParamToSqlCmd(sqlCmd, "@ResolutionVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.ResolutionVisibility);
                AddParamToSqlCmd(sqlCmd, "@AffectedMilestoneVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.AffectedMilestoneVisibility);
                AddParamToSqlCmd(sqlCmd, "@StatusEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.StatusEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@OwnedByEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.OwnedByEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@PriorityEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.PriorityEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@AssignedToEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.AssignedToEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@PrivateEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.PrivateEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@CategoryEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.CategoryEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@DueDateEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.DueDateEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@TypeEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.TypeEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@PercentCompleteEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.PercentCompleteEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@MilestoneEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.MilestoneEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@EstimationEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.EstimationEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@ResolutionEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.ResolutionEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@AffectedMilestoneEditVisibility", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.AffectedMilestoneEditVisibility);
                AddParamToSqlCmd(sqlCmd, "@OwnedByNotify", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.OwnedByNotify);
                AddParamToSqlCmd(sqlCmd, "@AssignedToNotify", SqlDbType.Bit, 0, ParameterDirection.Input, defaultVal.AssignedToNotify);


                SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_DEFAULTVALUES_SET);
                ExecuteScalarCmd(sqlCmd);

                int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
                return (returnValue == 0 ? true : false);
            }
        }
コード例 #2
0
        /// <summary>
        /// Saves the default values.
        /// </summary>
        /// <returns></returns>
        private bool SaveDefaultValues()
        {
            int privateValue = chkPrivate.Checked ? 1 : 0;
            int? date = 0;
            if (!string.IsNullOrWhiteSpace(DueDate.Text))
            {
                date = Int32.Parse(DueDate.Text);
            }
            else
            {
                date = null;
            }

            Decimal estimation = 0;
            if (!string.IsNullOrWhiteSpace(txtEstimation.Text))
            {
                estimation = Convert.ToDecimal(txtEstimation.Text);
            }

            DefaultValue newDefaultValues = new DefaultValue()
            {
                ProjectId = this.ProjectId,
                IssueTypeId = DropIssueType.SelectedValue,
                StatusId = DropStatus.SelectedValue,
                OwnerUserName = DropOwned.SelectedValue,
                PriorityId = DropPriority.SelectedValue,
                AffectedMilestoneId = DropAffectedMilestone.SelectedValue,
                AssignedUserName = DropAssignedTo.SelectedValue,
                PrivateVisibility = chkPrivateVisibility.Checked,
                IssueVisibility = privateValue,
                Progress = Convert.ToInt32(ProgressSlider.Text),
                MilestoneId = DropMilestone.SelectedValue,
                CategoryId = DropCategory.SelectedValue,
                DueDate = date,
                Estimation = estimation,
                ResolutionId = DropResolution.SelectedValue,
                StatusVisibility = chkStatusVisibility.Checked,
                OwnedByVisibility = chkOwnedByVisibility.Checked,
                PriorityVisibility = chkPriorityVisibility.Checked,
                AssignedToVisibility = chkAssignedToVisibility.Checked,
                TypeVisibility = chkTypeVisibility.Checked,
                PercentCompleteVisibility = chkPercentCompleteVisibility.Checked,
                MilestoneVisibility = chkMilestoneVisibility.Checked,
                EstimationVisibility = chkEstimationVisibility.Checked,
                ResolutionVisibility = chkResolutionVisibility.Checked,
                AffectedMilestoneVisibility = chkAffectedMilestoneVisibility.Checked,
                AssignedToNotify = chkNotifyAssignedTo.Checked,
                OwnedByNotify = chkNotifyOwner.Checked,
                CategoryVisibility = chkCategoryVisibility.Checked,
                DueDateVisibility = chkDueDateVisibility.Checked,
                StatusEditVisibility = chkStatusEditVisibility.Checked,
                OwnedByEditVisibility = chkOwnedByEditVisibility.Checked,
                PriorityEditVisibility = chkPriorityEditVisibility.Checked,
                AssignedToEditVisibility = chkAssignedToEditVisibility.Checked,
                TypeEditVisibility = chkTypeEditVisibility.Checked,
                PercentCompleteEditVisibility = chkPercentCompleteEditVisibility.Checked,
                MilestoneEditVisibility = chkMilestoneEditVisibility.Checked,
                EstimationEditVisibility = chkEstimationEditVisibility.Checked,
                ResolutionEditVisibility = chkResolutionEditVisibility.Checked,
                AffectedMilestoneEditVisibility = chkAffectedMilestoneEditVisibility.Checked,
                CategoryEditVisibility = chkCategoryEditVisibility.Checked,
                DueDateEditVisibility = chkDueDateEditVisibility.Checked,
                PrivateEditVisibility = chkPrivateEditVisibility.Checked
            };

            return IssueManager.SaveDefaultValues(newDefaultValues);
        }
コード例 #3
0
ファイル: DataProvider.cs プロジェクト: ChuckLafferty/bugnet
 public abstract bool SetDefaultIssueTypeByProjectId(DefaultValue defaultVal);
コード例 #4
0
ファイル: IssueManager.cs プロジェクト: ChuckLafferty/bugnet
 /// <summary>
 /// Saves the default values.
 /// </summary>
 /// <param name="defaultValues">The default values.</param>
 /// <returns></returns>
 public static bool SaveDefaultValues(DefaultValue defaultValues)
 {
     return DataProviderManager.Provider.SetDefaultIssueTypeByProjectId(defaultValues);
 }