public static TaskActivityDC TaskActivityGet(TaskActivityDC request)
        {
            TaskActivityDC reply = new TaskActivityDC();
            try
            {
                reply = TaskActivityRepositoryService.TaskActivityGet(request);
            }
            catch (Exception e)
            {
                throw new BusinessException(-1, e.Message);
            }

            return reply;
        }
 public static TaskActivityDC TaskActivity_SetStatus(TaskActivityDC request)
 {
     TaskActivityDC reply = new TaskActivityDC();
     StatusReplyDC status = new StatusReplyDC();
     string outErrorString = string.Empty;
     Database db = null;
     DbCommand cmd = null;
     int retValue = 0;
     try
     {
         db = DatabaseFactory.CreateDatabase();
         cmd = db.GetStoredProcCommand(StoredProcNames.TaskActivityUpdateStatus);
         db.AddParameter(cmd, "@inCaller", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.Incaller);
         db.AddParameter(cmd, "@inCallerVersion", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.IncallerVersion);
         db.AddParameter(cmd, "@InTaskActivityGUID", DbType.Guid, ParameterDirection.Input, null, DataRowVersion.Default, request.Guid);
         db.AddParameter(cmd, "@InId", DbType.Int32, ParameterDirection.Input, null, DataRowVersion.Default, request.Id);
         db.AddParameter(cmd, "@InStatus", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.Status.ToString());
         db.AddParameter(cmd, "@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null, DataRowVersion.Default, 0);
         db.AddOutParameter(cmd, "@outErrorString", DbType.String, 300);
         db.ExecuteNonQuery(cmd);
         retValue = Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value);
         outErrorString = Convert.ToString(cmd.Parameters["@outErrorString"].Value);
         if (retValue != 0)
         {
             status.ErrorMessage = outErrorString;
             status.Errorcode = retValue;
             Logging.Log(retValue,
                         EventLogEntryType.Error,
                         "Update TaskActivity Status Error",
                         outErrorString);
         }
     }
     catch (Exception ex)
     {
         status.ErrorMessage = "Update TaskActivity Status Error: " + ex.Message;
         status.Errorcode = SprocValues.GENERIC_CATCH_ID;
         status = Logging.Log(SprocValues.GENERIC_CATCH_ID,
                              EventLogEntryType.Error,
                              "TaskActivity_UpdateStatus_ERROR_MSG",
                              ex);
     }
     reply.StatusReply = status;
     return reply;
 }
        public static TaskActivityDC TaskActivityGet(TaskActivityDC request)
        {
            TaskActivityDC reply = new TaskActivityDC();
            StatusReplyDC status = new StatusReplyDC();
            string outErrorString = string.Empty;
            Database db = null;
            DbCommand cmd = null;
            int retValue = 0;
            try
            {
                db = DatabaseFactory.CreateDatabase();
                cmd = db.GetStoredProcCommand(StoredProcNames.TaskActivityGet);
                db.AddParameter(cmd, "@inCaller", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.Incaller);
                db.AddParameter(cmd, "@inCallerVersion", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.IncallerVersion);
                db.AddParameter(cmd, "@InId", DbType.Int32, ParameterDirection.Input, null, DataRowVersion.Default, request.Id);
                db.AddParameter(cmd, "@InTaskActivityGUID", DbType.Guid, ParameterDirection.Input, null, DataRowVersion.Default, request.Guid);
                db.AddParameter(cmd, "@InActivityId", DbType.Int32, ParameterDirection.Input, null, DataRowVersion.Default, request.ActivityId);
                db.AddParameter(cmd, "@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null, DataRowVersion.Default, 0);
                db.AddOutParameter(cmd, "@outErrorString", DbType.String, 300);
                using (IDataReader reader = db.ExecuteReader(cmd))
                {
                    while (reader.Read())
                    {
                        reply = new TaskActivityDC();
                        StoreActivitiesDC sab = new StoreActivitiesDC();
                        sab.ActivityCategoryName = Convert.ToString(reader["ActivityCategoryName"]);

                        if (reader["ActivityLibraryName"] == DBNull.Value)
                            sab.ActivityLibraryName = string.Empty;
                        else
                            sab.ActivityLibraryName = Convert.ToString(reader["ActivityLibraryName"]);

                        if (reader["ActivityLibraryId"] == DBNull.Value)
                            sab.ActivityLibraryId = 0;
                        else
                            sab.ActivityLibraryId = Convert.ToInt32(reader["ActivityLibraryId"]);
                        sab.ActivityLibraryVersion = Convert.ToString(reader["ActivityLibraryVersion"]);
                        sab.AuthGroupName = Convert.ToString(reader["AuthgroupName"]);
                        sab.Name = Convert.ToString(reader["Name"]);
                        sab.ShortName = Convert.ToString(reader["ShortName"]);
                        sab.Description = Convert.ToString(reader["Description"]);
                        sab.DeveloperNotes = Convert.ToString(reader["DeveloperNotes"]);
                        sab.Id = Convert.ToInt32(reader["Id"]);
                        if (reader["IsCodeBeside"] == DBNull.Value)
                            sab.IsCodeBeside = false;
                        else
                            sab.IsCodeBeside = Convert.ToBoolean(reader["IsCodeBeside"]);
                        sab.IsService = Convert.ToBoolean(reader["IsService"]);
                        if (reader["Locked"] == DBNull.Value)
                            sab.Locked = false;
                        else
                            sab.Locked = Convert.ToBoolean(reader["Locked"]);
                        sab.LockedBy = Convert.ToString(reader["LockedBy"]) ?? string.Empty;
                        sab.MetaTags = Convert.ToString(reader["MetaTags"]) ?? string.Empty;
                        sab.Xaml = Convert.ToString(reader["XAML"]) ?? string.Empty;
                        sab.Name = Convert.ToString(reader["Name"]);
                        sab.Namespace = Convert.ToString(reader["Namespace"]) ?? string.Empty;
                        sab.Guid = new Guid(Convert.ToString(reader["Guid"]));
                        sab.ToolBoxtab = reader["ToolBoxtab"] == DBNull.Value ? 0 : Convert.ToInt32(reader["ToolBoxtab"]);
                        sab.Version = Convert.ToString(reader["Version"]);
                        sab.WorkflowTypeName = Convert.ToString(reader["WorkFlowTypeName"]);
                        sab.InsertedByUserAlias = Convert.ToString(reader["InsertedByUserAlias"]);
                        sab.InsertedDateTime = Convert.ToDateTime(reader["InsertedDateTime"]);
                        sab.UpdatedByUserAlias = Convert.ToString(reader["UpdatedByUserAlias"]);
                        sab.UpdatedDateTime = Convert.ToDateTime(reader["UpdatedDateTime"]);
                        sab.StatusCodeName = Convert.ToString(reader["StatusCodeName"]);
                        reply.Id = Convert.ToInt32(reader["TaskActivityId"]);
                        reply.ActivityId = Convert.ToInt32(reader["ActivityId"]);
                        if (reader["AssignedTo"] != DBNull.Value)
                            reply.AssignedTo = Convert.ToString(reader["AssignedTo"]);
                        if (reader["Status"] != DBNull.Value)
                            reply.Status = (TaskActivityStatus)Enum.Parse(typeof(TaskActivityStatus), Convert.ToString(reader["Status"]));
                        reply.Guid = new Guid(Convert.ToString(reader["TaskActivityGuid"]));
                        reply.Activity = sab;
                    }

                    retValue = Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value);
                    outErrorString = Convert.ToString(cmd.Parameters["@outErrorString"].Value);
                    if (retValue != 0)
                    {
                        status.ErrorMessage = Convert.ToString(cmd.Parameters["@outErrorString"].Value);
                        status.Errorcode = retValue;
                        Logging.Log(retValue,
                                    EventLogEntryType.Error,
                                    "TaskActivity_Get_ERROR_MSG",
                                    outErrorString);
                    }
                }
            }
            catch (Exception ex)
            {
                status = Logging.Log(SprocValues.GENERIC_CATCH_ID,
                                     EventLogEntryType.Error,
                                     "TaskActivity_Get_ERROR_MSG",
                                     ex);
            }
            reply.StatusReply = status;
            return reply;
        }
        public static void MyClassInitialize(TestContext testContext)
        {
            string nameModifier = "Test_" + Guid.NewGuid().ToString();
            CWF.DataContracts.StoreLibraryAndActivitiesRequestDC request = new CWF.DataContracts.StoreLibraryAndActivitiesRequestDC();
            List<CWF.DataContracts.StoreActivitiesDC> reply = null;

            request.IncallerVersion = INCALLERVERSION;
            request.Incaller = INCALLER;
            request.InInsertedByUserAlias = INCALLER;
            request.InUpdatedByUserAlias = INCALLER;
            request.EnforceVersionRules = true;

            // Create ActivityLibrary object and add to request object
            CWF.DataContracts.ActivityLibraryDC activityLibraryDC = new CWF.DataContracts.ActivityLibraryDC();

            // create storeActivitiesDC list and individual objects and add to request
            List<CWF.DataContracts.StoreActivitiesDC> storeActivitiesDCList = new List<CWF.DataContracts.StoreActivitiesDC>();
            CWF.DataContracts.StoreActivitiesDC storeActivitiesDC = new CWF.DataContracts.StoreActivitiesDC();
            DALUnitTest.CreateActivityLibraryAndStoreActivities(out activityLibraryDC, out storeActivitiesDCList);
            request.ActivityLibrary = activityLibraryDC;
            request.StoreActivitiesList = storeActivitiesDCList;
            request.StoreActivitiesList.ForEach(record =>
            {
                record.Name += nameModifier;
                record.ActivityLibraryName += nameModifier;
                record.ShortName += nameModifier;

            });

            activityLibraryDC.Name += nameModifier;

            request.StoreActivityLibraryDependenciesGroupsRequestDC = new StoreActivityLibraryDependenciesGroupsRequestDC()
            {
                Name = activityLibraryDC.Name,
                Version = activityLibraryDC.VersionNumber,
                List = new List<StoreActivityLibraryDependenciesGroupsRequestDC>
                {
                    new StoreActivityLibraryDependenciesGroupsRequestDC
                    {
                        IncallerVersion = INCALLERVERSION,
                        Incaller = INCALLER,
                        Name = "PublishingInfo",
                        Version = "1.0.0.1"
                    },
                }
            };
            reply = CWF.BAL.Services.UploadActivityLibraryAndDependentActivities(request);
            Assert.IsNotNull(reply);
            activityId = reply[0].Id;
            Assert.IsTrue(activityId > 0);

            //Test Create or Update
            Guid taskGuid = Guid.NewGuid();
            TaskActivityDC reply1 = null;
            TaskActivityDC request1 = new TaskActivityDC()
            {
                ActivityId = activityId,
                Guid = taskGuid,
                Incaller = INCALLER,
                IncallerVersion = INCALLERVERSION,
                AssignedTo = OWNER
            };
            try
            {
                reply1 = TaskActivityRepositoryService.TaskActivitiesCreateOrUpdate(request1);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch exception in reply = TaskActivityRepository.CreateOrUpdate(request)");
            }
            Assert.IsNotNull(reply1);
            Assert.IsTrue(reply1.Id > 0);
            Assert.AreEqual(SprocValues.REPLY_ERRORCODE_VALUE_OK, reply1.StatusReply.Errorcode);
        }
 public void TestTaskActivity_UpdateStatus()
 {
     TaskActivityDC request = new TaskActivityDC();
     request.ActivityId = activityId;
     request.Incaller = INCALLER;
     request.IncallerVersion = INCALLERVERSION;
     TaskActivityDC reply = null;
     try
     {
         reply = TaskActivityRepositoryService.TaskActivityGet(request);
         request.Id = reply.Id;
         request.Status = TaskActivityStatus.CheckedIn;
         reply = TaskActivityRepositoryService.TaskActivity_SetStatus(request);
         Assert.AreEqual(reply.StatusReply.Errorcode, 0);
         reply = TaskActivityRepositoryService.TaskActivityGet(request);
         Assert.AreEqual(reply.Status, TaskActivityStatus.CheckedIn);
     }
     catch (Exception ex)
     {
         string faultMessage = ex.Message;
         Assert.Fail(faultMessage + "-catch exception in reply = TaskActivityRepository.SearchTaskActivities(request)");
     }
     Assert.IsNotNull(reply);
     Assert.IsTrue(reply.Id >= 1);
 }
 public void TestGetTaskActivity()
 {
     TaskActivityDC request = new TaskActivityDC();
     request.ActivityId = activityId;
     request.Incaller = INCALLER;
     request.IncallerVersion = INCALLERVERSION;
     TaskActivityDC reply = null;
     try
     {
         reply = TaskActivityRepositoryService.TaskActivityGet(request);
     }
     catch (Exception ex)
     {
         string faultMessage = ex.Message;
         Assert.Fail(faultMessage + "-catch exception in reply = TaskActivityRepository.SearchTaskActivities(request)");
     }
     Assert.IsNotNull(reply);
     Assert.IsTrue(reply.Id >= 1);
 }
Esempio n. 7
0
 public void DownloadTaskDependency(TaskActivityDC taskActivityDC)
 {
     this.GetTaskLastVersionChanged(
         this,
         new GetTaskEventArgs(
             taskActivityDC.Activity.ActivityLibraryName,
             taskActivityDC.Activity.ActivityLibraryVersion));
 }
 private void GetSelectedActivity()
 {
     if (this.SelectedActivity != null)
     {
         using (var client = WorkflowsQueryServiceUtility.GetWorkflowQueryServiceClient())
         {
             var taskActivity = new TaskActivityDC();
             taskActivity.Incaller = Assembly.GetExecutingAssembly().GetName().Name;
             taskActivity.IncallerVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
             taskActivity.Id = this.SelectedActivity.Id;
             var result = client.TaskActivityGet(taskActivity);
             if (result.StatusReply.Errorcode == 0)
                 this.SelectedActivity = result;
             else
                 MessageBoxService.ShowError(result.StatusReply.ErrorMessage);
         }
     }
 }
Esempio n. 9
0
 private void OpenTaskActivitiesCommandExecute()
 {
     var viewModel = new SearchTaskActivityViewModel();
     viewModel.LoadData();
     var dialogResult = DialogService.ShowDialog(viewModel);
     if (dialogResult.GetValueOrDefault())
     {
         var result = viewModel.SelectedActivity;
         if (result != null && result.Activity != null)
         {
             //Set TaskActivity Status = Editing
             try
             {
                 this.OpenActivityFromServer(result.Activity, true, true);
                 if (this.FocusedWorkflowItem.Name == result.Activity.Name && this.FocusedWorkflowItem.Version == result.Activity.Version)
                 {
                     this.FocusedWorkflowItem.TaskActivityGuid = result.Guid;
                     if (!this.FocusedWorkflowItem.IsReadOnly)
                     {
                         this.FocusedWorkflowItem.TaskActivityStatus = TaskActivityStatus.Editing;
                         Utility.DoTaskWithBusyCaption("UI may not respond. Please wait...",
                         () =>
                         {
                             using (var client = WorkflowsQueryServiceUtility.GetWorkflowQueryServiceClient())
                             {
                                 TaskActivityDC request = new TaskActivityDC()
                                 {
                                     Incaller = Utility.GetCallerName(),
                                     IncallerVersion = Utility.GetCallerVersion(),
                                     Id = viewModel.SelectedActivity.Id,
                                     Status = TaskActivityStatus.Editing
                                 };
                                 TaskActivityDC reply = client.TaskActivityUpdateStatus(request);
                                 if (reply.StatusReply.Errorcode != 0)
                                 {
                                     throw new UserFacingException(reply.StatusReply.ErrorMessage);
                                 }
                             }
                         });
                     }
                 }
             }
             catch (Exception ex)
             {
                 MessageBoxService.ShowError(ex.Message);
             }
         }
     }
 }