public EditIssueTypeSubTypeModel(int issueTypeId, int issueSubTypeId) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, CanExecuteOkButtonHandler); cmsWebServiceClient.GetIssueTypeSubTypeCompleted += (s1, e1) => { mIssueTypeSubType = e1.Result; if (mIssueTypeSubType!=null) { OnDataLoaded(); } }; cmsWebServiceClient.GetIssueTypeSubTypeAsync(issueTypeId, issueSubTypeId); }
public DbOperationResult<IssueTypeSubType> AddIssueTypeSubType(IssueType issueType, IssueSubType issueSubType) { var result = new DbOperationResult<IssueTypeSubType>(); //guard against duplicate. using (var cee = new CmsEntities()) { int k = (from x in cee.IssueTypeSubTypes where x.IssueTypeId == issueType.Id && x.IssueSubTypeId == issueSubType.Id select x.Id).Count(); if (k > 0) { result.ServerErrorMessages.Add(string.Format("Insert Failed. An IssueTypeSubType with the combination IssueType Name: '{0}' and Issue SubType Name: '{1}' already exists.", issueType.Name, issueSubType.Name)); return result; } var typeSubType = new IssueTypeSubType { IssueSubTypeId = issueSubType.Id, IssueTypeId = issueType.Id, Ordinal = 0 }; cee.IssueTypeSubTypes.Add(typeSubType); cee.SaveChanges(); result.EntityResult = typeSubType; } return result; }
public DbOperationResult<IssueTypeSubType> SaveIssueTypeSubType(IssueTypeSubType issueTypeSubType) { var result = new DbOperationResult<IssueTypeSubType>(); using (var cee = new CmsEntities()) { IssueTypeSubType dbMatch = (from x in cee.IssueTypeSubTypes where x.Id == issueTypeSubType.Id select x).FirstOrDefault(); if (dbMatch != null) { result.EntityResult = dbMatch; dbMatch.Ordinal = issueTypeSubType.Ordinal; cee.SaveChanges(); } } return result; }