public static TaskActivityGetReplyDC GetTaskActivities(TaskActivityGetRequestDC request)
        {
            TaskActivityGetReplyDC reply = new TaskActivityGetReplyDC();
            try
            {
                request.ValidateRequest();
                reply = TaskActivityRepositoryService.SearchTaskActivities(request);
            }
            catch (Exception e)
            {
                throw new BusinessException(-1, e.Message);
            }

            return reply;
        }
        /// <summary>
        /// If the request parameters other than @InCaller & @InCallerversion are null, returns a list of entries, otherwise returns a list of one entry.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static TaskActivityGetReplyDC SearchTaskActivities(TaskActivityGetRequestDC request)
        {
            TaskActivityGetReplyDC reply = new TaskActivityGetReplyDC();
            StatusReplyDC status = new StatusReplyDC();
            string outErrorString = string.Empty;
            TaskActivityDC taskActivity = null;
            Database db = null;
            DbCommand cmd = null;
            int retValue = 0;
            try
            {
                db = DatabaseFactory.CreateDatabase();
                cmd = db.GetStoredProcCommand(StoredProcNames.TaskActivitySearch);
                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.TaskActivityGuid);
                db.AddParameter(cmd, "@InAssignedTo", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.AssignedTo);
                db.AddParameter(cmd, "@InFilterOlder", DbType.Boolean, ParameterDirection.Input, null, DataRowVersion.Default, request.FilterOlder);
                db.AddParameter(cmd, "@SearchText", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.SearchText);
                db.AddParameter(cmd, "@SortColumn", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.SortColumn);
                db.AddParameter(cmd, "@SortAscending", DbType.Boolean, ParameterDirection.Input, null, DataRowVersion.Default, request.SortAscending);
                db.AddParameter(cmd, "@PageSize", DbType.Int32, ParameterDirection.Input, null, DataRowVersion.Default, request.PageSize);
                db.AddParameter(cmd, "@PageNumber", DbType.Int32, ParameterDirection.Input, null, DataRowVersion.Default, request.PageNumber);
                db.AddParameter(cmd, "@HideUnassignedTasks", DbType.Boolean, ParameterDirection.Input, null, DataRowVersion.Default, request.HideUnassignedTasks);

                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))
                {
                    reply.List = new List<TaskActivityDC>();
                    while (reader.Read())
                    {
                        taskActivity = new TaskActivityDC();
                        StoreActivitiesDC sab = new StoreActivitiesDC();
                        sab.Id = Convert.ToInt32(reader["Id"]);
                        sab.Guid = new Guid(Convert.ToString(reader["Guid"]));
                        sab.Name = Convert.ToString(reader["Name"]);
                        sab.Version = Convert.ToString(reader["Version"]);
                        sab.Description = Convert.ToString(reader["Description"]);
                        sab.MetaTags = Convert.ToString(reader["MetaTags"]) ?? string.Empty;
                        sab.InsertedByUserAlias = Convert.ToString(reader["InsertedByUserAlias"]);
                        sab.InsertedDateTime = Convert.ToDateTime(reader["InsertedDateTime"]);

                        if (request.IncludeDetails)
                        {
                            if (reader["Locked"] == DBNull.Value)
                                sab.Locked = false;
                            else
                                sab.Locked = Convert.ToBoolean(reader["Locked"]);
                            sab.LockedBy = Convert.ToString(reader["LockedBy"]) ?? string.Empty;
                            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.Xaml = Convert.ToString(reader["XAML"]) ?? string.Empty;
                            sab.ActivityLibraryVersion = Convert.ToString(reader["ActivityLibraryVersion"]);
                            sab.AuthGroupName = Convert.ToString(reader["AuthgroupName"]);
                            sab.ShortName = Convert.ToString(reader["ShortName"]);
                            sab.DeveloperNotes = Convert.ToString(reader["DeveloperNotes"]);
                            if (reader["IsCodeBeside"] == DBNull.Value)
                                sab.IsCodeBeside = false;
                            else
                                sab.IsCodeBeside = Convert.ToBoolean(reader["IsCodeBeside"]);
                            sab.IsService = Convert.ToBoolean(reader["IsService"]);
                            sab.Namespace = Convert.ToString(reader["Namespace"]) ?? string.Empty;
                            sab.ToolBoxtab = reader["ToolBoxtab"] == DBNull.Value ? 0 : Convert.ToInt32(reader["ToolBoxtab"]);
                            sab.WorkflowTypeName = Convert.ToString(reader["WorkFlowTypeName"]);
                            sab.UpdatedByUserAlias = Convert.ToString(reader["UpdatedByUserAlias"]);
                            sab.UpdatedDateTime = Convert.ToDateTime(reader["UpdatedDateTime"]);
                            sab.StatusCodeName = Convert.ToString(reader["StatusCodeName"]);
                        }
                        taskActivity.Id = Convert.ToInt32(reader["TaskActivityId"]);
                        taskActivity.ActivityId = Convert.ToInt32(reader["ActivityId"]);
                        if (reader["AssignedTo"] != DBNull.Value)
                            taskActivity.AssignedTo = Convert.ToString(reader["AssignedTo"]);
                        if (reader["Status"] != DBNull.Value)
                            taskActivity.Status = (TaskActivityStatus)Enum.Parse(typeof(TaskActivityStatus), Convert.ToString(reader["Status"]));
                        taskActivity.Guid = new Guid(Convert.ToString(reader["TaskActivityGuid"]));
                        taskActivity.Activity = sab;
                        reply.List.Add(taskActivity);
                    }

                    reader.NextResult();
                    if (reader.Read())
                    {
                        reply.ServerResultsLength = Convert.ToInt32(reader["Total"]);
                    }

                    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;
        }