コード例 #1
0
ファイル: IssueCreating.cs プロジェクト: sini87/MApp
        /// <summary>
        /// retuns issueModel by issue id
        /// </summary>
        /// <param name="issueId"></param>
        /// <returns>IssueModel</returns>
        public IssueModel GetIssue(int issueId)
        {
            IssueModel im = new IssueModel();

            im = im.ToModel(IssueOp.GetIssueById(issueId));
            if (im.Parent != null)
            {
                int parrentIssueId = Convert.ToInt32(im.Parent);
                im.ParentTitle = IssueOp.GetIssueById(parrentIssueId).Title;
            }
            else
            {
                im.Parent = -1;
            }
            if (im.DependsOn != null)
            {
                int dependsOnIssueId = Convert.ToInt32(im.DependsOn);
                im.DependsOnTitle = IssueOp.GetIssueById(dependsOnIssueId).Title;
            }
            else
            {
                im.DependsOn = -1;
            }

            TagModel tm = new TagModel();

            im.Tags = tm.ToModelList(TagOp.GetIssueTags(issueId), tm);

            return(im);
        }
コード例 #2
0
ファイル: IssueCreating.cs プロジェクト: sini87/MApp
        /// <summary>
        /// saves issue to DA-layer
        /// preperations are don here
        /// </summary>
        /// <param name="issueModel"></param>
        /// <param name="userId">user who is performing operation (owner)</param>
        /// <param name="selfAssessmentValue">self assessment value of issue creator</param>
        /// <param name="selfAssessmentDescr">self assessment description of isssue creator</param>
        /// <returns></returns>
        public int SaveIssue(IssueModel issueModel, int userId, double selfAssessmentValue, string selfAssessmentDescr)
        {
            Issue issue   = issueModel.ToEntity();
            int   issueId = -1;

            if (issue.Parent == -1)
            {
                issue.Parent = null;
            }
            if (issue.DependsOn == -1)
            {
                issue.DependsOn = null;
            }
            if (issue.Id > 0)
            {
                issueId = IssueOp.UpdateIssue(issue, userId);
                if (issueModel.Status == "CREATING" || issueModel.Status == "BRAINSTORMING1")
                {
                    AccessRightOp.UpdateSelfAssesment(selfAssessmentValue, selfAssessmentDescr, issueModel.Id, userId);
                }
                return(issueId);
            }
            else
            {
                issueId = IssueOp.InsertIssue(issue, userId, selfAssessmentValue, selfAssessmentDescr);
                return(issueId);
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="issueId">issue id</param>
        /// <param name="userId">user who is performing operation</param>
        /// <returns>user issue model by issue id</returns>
        public UserIssueModel GetUserIssueModel(int issueId, int userId)
        {
            IssueModel im = new IssueModel();

            im = im.ToModel(IssueOp.GetIssueById(issueId));
            return(GetUserIssueModelFromIssueModel(im, userId));
        }
コード例 #4
0
ファイル: IssueModel.cs プロジェクト: sini87/MApp
        public IssueModel ToModel(Issue entity)
        {
            IssueModel model = new IssueModel();

            model.Id           = entity.Id;
            model.Title        = entity.Title;
            model.Status       = entity.Status;
            model.Description  = entity.Description;
            model.Setting      = entity.Setting;
            model.Parent       = entity.Parent;
            model.DependsOn    = entity.DependsOn;
            model.GroupThink   = entity.GroupThink;
            model.ReviewRating = entity.ReviewRating;
            if (entity.AnonymousPosting == "false")
            {
                model.AnonymousPosting = false;
            }
            else
            {
                model.AnonymousPosting = true;
            }

            if (model.Parent != null)
            {
                model.ParentTitle = IssueOp.IssueTitle(entity.Parent.Value);
            }
            if (model.DependsOn != null)
            {
                model.ParentTitle = IssueOp.IssueTitle(entity.DependsOn.Value);
            }

            return(model);
        }
コード例 #5
0
ファイル: IssueCreating.cs プロジェクト: sini87/MApp
        /// <summary>
        /// returns list of all issues with short information (issue title and issue id)
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>list of all issues</returns>
        public List <IssueShort> GetUserIssuesShort(int userId)
        {
            List <IssueShort> list = new List <IssueShort>();

            foreach (Issue issue in IssueOp.UserIssues(userId))
            {
                list.Add(new IssueShort(issue.Id, issue.Title));
            }
            return(list);
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId">user id</param>
        /// <returns>list of all issues which the user can access</returns>
        public List <IssueModel> GetUserIssues(int userId)
        {
            IssueModel        im         = new IssueModel();
            List <IssueModel> allIssues  = im.ToModelList(IssueOp.UserIssues(userId), im);
            List <IssueModel> rootIssues = new List <IssueModel>();

            foreach (IssueModel model in allIssues.Where(m => m.Parent == null))
            {
                TagModel tm = new TagModel();
                model.Tags     = tm.ToModelList(TagOp.GetIssueTags(model.Id), tm);
                model.Children = ChildIssues(allIssues, model.Id);
                rootIssues.Add(model);
            }

            List <IssueModel> hlist = new List <IssueModel>();

            foreach (IssueModel m in rootIssues)
            {
                Traverse(m, m.Children, ref hlist);
            }

            return(hlist);
        }
コード例 #7
0
ファイル: IssueCreating.cs プロジェクト: sini87/MApp
 /// <summary>
 /// puts the issue to next stage
 /// </summary>
 /// <param name="issueId"></param>
 /// <param name="userId"></param>
 public void NextStage(int issueId, int userId)
 {
     IssueOp.NextStage(issueId, userId);
 }
コード例 #8
0
ファイル: IssueCreating.cs プロジェクト: sini87/MApp
 /// <summary>
 /// deltetes an issue
 /// </summary>
 /// <param name="issueId"></param>
 /// <returns></returns>
 public bool DeleteIssue(int issueId)
 {
     return(IssueOp.DeleteIssue(issueId));
 }