예제 #1
0
        public DbOperationResult<IssueTypeMilestoneType> AddIssueTypeMilestoneType(IssueType issueType, IssueMilestoneType milestoneType)
        {
            var result = new DbOperationResult<IssueTypeMilestoneType>();

            //guard against duplicate.
            using (var cee = new CmsEntities())
            {
                int k = (from x in cee.IssueTypeMilestoneTypes where x.IssueTypeId == issueType.Id && x.MilestoneTypeId == milestoneType.Id select x.Id).Count();

                if (k > 0)
                {
                    result.ServerErrorMessages.Add(string.Format("Insert Failed. An IssueTypeMilestoneType with the combination IssueType Name: '{0}' and Issue SubType Name: '{1}' already exists.", issueType.Name, milestoneType.Name));
                    return result;
                }

                var issueTypeMilestoneType = new IssueTypeMilestoneType
                {
                    MilestoneTypeId = milestoneType.Id,
                    IssueTypeId = issueType.Id,
                    Ordinal = 0
                };

                cee.IssueTypeMilestoneTypes.Add(issueTypeMilestoneType);
                cee.SaveChanges();
                result.EntityResult = issueTypeMilestoneType;
            }

            return result;
        }
        public EditIssueTypeMilestoneTypeModel(int issueTypeId, int milestoneTypeId)
        {
            var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, CanExecuteOkButtonHandler);

            cmsWebServiceClient.GetIssueTypeMilestoneTypeCompleted += (s1, e1) =>
            {
                mIssueTypeMilestoneType = e1.Result;

                if (mIssueTypeMilestoneType!=null)
                {
                    OnDataLoaded();
                }
            };
            cmsWebServiceClient.GetIssueTypeMilestoneTypeAsync(issueTypeId, milestoneTypeId);
        }
예제 #3
0
        public DbOperationResult<IssueTypeMilestoneType> SaveIssueTypeMilestoneType(IssueTypeMilestoneType issueTypeMilestoneType)
        {
            var result = new DbOperationResult<IssueTypeMilestoneType>();

            using (var cee = new CmsEntities())
            {
                IssueTypeMilestoneType dbMatch = (from x in cee.IssueTypeMilestoneTypes where x.Id == issueTypeMilestoneType.Id select x).FirstOrDefault();

                if (dbMatch != null)
                {
                    result.EntityResult = dbMatch;
                    dbMatch.Ordinal = issueTypeMilestoneType.Ordinal;
                    cee.SaveChanges();
                }
            }

            return result;
        }