public AddEditIssueActionStatusModel()
        {
            mIssueActionStatus = new IssueActionStatus();

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, CanExecuteOkButtonHandler);
        }
 void cmsWebServiceClient_GetIssueActionStatusCompleted(object sender, GetIssueActionStatusCompletedEventArgs e)
 {
     mIssueActionStatus = e.Result;
     DataLoaded();
 }
예제 #3
0
        public DbOperationResult<IssueActionStatus> SaveIssueActionStatus(IssueActionStatus issueActionStatus)
        {
            var result = new DbOperationResult<IssueActionStatus>();

            try
            {
                using (var cee = new CmsEntities())
                {
                    //Check if the pipe area exist
                    IssueActionStatus originalObject =
                        (from x in cee.IssueActionStatuses where x.Id == issueActionStatus.Id select x).FirstOrDefault();

                    if (originalObject == null)
                    {
                        //Add new Issue Status
                        cee.IssueActionStatuses.Add(issueActionStatus);
                        issueActionStatus.Code = issueActionStatus.Name.Replace(" ", "");
                        issueActionStatus.IsActive = true;
                        result.EntityResult = issueActionStatus;
                    }
                    else
                    {
                        //Update existing Status
                        originalObject.Name = issueActionStatus.Name;
                        originalObject.Description = issueActionStatus.Description;
                        originalObject.Ordinal = issueActionStatus.Ordinal;
                        result.EntityResult = originalObject;
                    }

                    cee.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                log.Error("", ex, ex.ToString());
                return BuildOperationalErrorResults<IssueActionStatus>(ex);
            }

            return result;
        }