Пример #1
0
        public static DataTable GetUsers(WorkflowDynamicSecurityGroup group, Workflow workflow, WorkflowStep step, string EntityID, string UserName)
        {
            DataTable retVal = null;


            DataCommandService dataCommandDB = DataCommandService.GetInstance();


            DataCommand command = Core.DataCommand.GetDataCommand(group.DataCommand);

            if (command == null)
            {
                throw new ApplicationException(String.Format("DataCommand {0} could not be found in configuration", group.DataCommand));
            }


            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        parameter  = null;

            if (!String.IsNullOrEmpty(group.WorkflowCodeParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = group.WorkflowCodeParameter;
                parameter.Value = workflow.Code;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(group.CurrentWorkflowStepCodeParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = group.CurrentWorkflowStepCodeParameter;
                parameter.Value = step.Code;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(group.EntityIDParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = group.EntityIDParameter;
                parameter.Value = EntityID;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(group.UsernameParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = group.UsernameParameter;
                parameter.Value = UserName;
                parameters.Add(parameter);
            }

            //execute command with transaction
            //CommandType type = (command.Type == DataCommandCommandType.StoredProcedure) ? CommandType.StoredProcedure : CommandType.Text;
            retVal = dataCommandDB.GetDataForDataCommand(command.Name, parameters);


            return(retVal);
        }
Пример #2
0
        private DataTable GetData(System.Data.Common.DbTransaction tran,
                                  string CommandName,
                                  string WorkflowCode,
                                  string FromWorkflowStepCode,
                                  string ToWorkflowStepCode,
                                  string EntityID,
                                  string Comment,
                                  string UserName,

                                  string WorkflowCodeParameter,
                                  string FromWorkflowStepCodeParameter,
                                  string ToWorkflowStepCodeParameter,
                                  string EntityIDParameter,
                                  string CommentParameter,
                                  string UsernameParameter
                                  )
        {
            DataCommandService dataCommandDB = DataCommandService.GetInstance();

            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        parameter  = null;

            DataCommand command = DataCommand.GetDataCommand(CommandName);

            if (command == null)
            {
                throw new ApplicationException(String.Format("DataCommand {0} could not be found in configuration", CommandName));
            }

            if (!String.IsNullOrEmpty(WorkflowCodeParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = WorkflowCodeParameter;
                parameter.Value = WorkflowCode;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(FromWorkflowStepCodeParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = FromWorkflowStepCodeParameter;
                parameter.Value = FromWorkflowStepCode;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(ToWorkflowStepCodeParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = ToWorkflowStepCodeParameter;
                parameter.Value = ToWorkflowStepCode;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(EntityIDParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = EntityIDParameter;
                parameter.Value = EntityID;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(CommentParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = CommentParameter;
                parameter.Value = Comment;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(UsernameParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = UsernameParameter;
                parameter.Value = UserName;
                parameters.Add(parameter);
            }

            //execute command with transaction
            // CommandType type = (command.Type == DataCommandCommandType.StoredProcedure) ? CommandType.StoredProcedure : CommandType.Text;
            DataTable data = dataCommandDB.GetData(tran, command, parameters, command.Text);

            return(data);
        }
Пример #3
0
        public override void Execute(System.Data.Common.DbTransaction tran, string WorkflowCode, string FromWorkflowStepCode, string ToWorkflowStepCode, string EntityID, string Comment, string UserName)
        {
            //base.Execute(tran);


            DataCommandService dataCommandDB = DataCommandService.GetInstance();

            DataCommand command = DataCommand.GetDataCommand(this.ExecuteCommand);

            if (command == null)
            {
                throw new ApplicationException(String.Format("DataCommand {0} could not be found in configuration", this.ExecuteCommand));
            }


            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        parameter  = null;

            if (!String.IsNullOrEmpty(this.WorkflowCodeParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = this.WorkflowCodeParameter;
                parameter.Value = WorkflowCode;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(this.FromWorkflowStepCodeParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = this.FromWorkflowStepCodeParameter;
                parameter.Value = FromWorkflowStepCode;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(this.ToWorkflowStepCodeParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = this.ToWorkflowStepCodeParameter;
                parameter.Value = ToWorkflowStepCode;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(this.EntityIDParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = this.EntityIDParameter;
                parameter.Value = EntityID;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(this.CommentParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = this.CommentParameter;
                parameter.Value = Comment;
                parameters.Add(parameter);
            }

            if (!String.IsNullOrEmpty(this.UsernameParameter))
            {
                parameter       = new ScreenDataCommandParameter();
                parameter.Name  = this.UsernameParameter;
                parameter.Value = UserName;
                parameters.Add(parameter);
            }

            //execute command with transaction
            //CommandType type = (command.Type == DataCommandCommandType.StoredProcedure) ? CommandType.StoredProcedure : CommandType.Text;
            object retVal = dataCommandDB.ExecuteCommand(tran, command, parameters, command.Text);
        }