Ejemplo n.º 1
0
        public void SetStep(CodeTorch.Core.Workflow workflow, WorkflowStep step, string entityIDValue, string comment)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterWorkflowStatusID, null);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterWorkflowCode, workflow.Code);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterWorkflowStepCode, step.Code);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityID, entityIDValue);
            parameters.Add(p);

            string userName;

            userName = UserIdentityService.GetInstance().IdentityProvider.GetUserName();
            p        = new ScreenDataCommandParameter(ParameterCreatedBy, userName);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterComment, comment);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterUpdateCurrent, step.UpdateEntityWithStatusCode);
            parameters.Add(p);

            //get data from data command
            ExecuteDataCommand(DataCommandWorkflowSetStep, parameters);
        }
Ejemplo n.º 2
0
        private void ParameterList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ScreenDataCommandParameter item = (ScreenDataCommandParameter)ParameterList.SelectedItem;

            parameterPropertyGrid.SelectedObject = item;
            SelectedParameterLabel.Text          = item.Name + " " + "Parameter";
        }
Ejemplo n.º 3
0
        private void AddDataCommand_Click(object sender, EventArgs e)
        {
            if (AvailableCommandList.SelectedIndex < 0)
            {
                MessageBox.Show("Please select an available data command to move");
                return;
            }

            DataCommand       command = (DataCommand)AvailableCommandList.SelectedItem;
            ScreenDataCommand c       = new ScreenDataCommand();
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();

            c.Name = command.Name;

            foreach (DataCommandParameter parameter in command.Parameters)
            {
                ScreenDataCommandParameter p = new ScreenDataCommandParameter();

                p.InputType = ScreenInputType.Control;
                p.Name      = parameter.Name;
                p.InputKey  = parameter.Name.Replace("@", "").Replace("'", "").Replace(" ", "");

                c.Parameters.Add(p);
            }

            DataCommands.Add(c);


            FillLists();
        }
Ejemplo n.º 4
0
        public static List <ScreenDataCommandParameter> GetPopulatedCommandParameters(string DataCommandName, IMobilePage page, List <ScreenDataCommand> datacommands)
        {
            string ErrorFormat = "Invalid {0} propery for Data Command {1} Parameter {2} - {3}";
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();

            ScreenDataCommand screenCommand = ScreenDataCommand.GetDataCommand(datacommands, DataCommandName);

            if ((screenCommand != null) && (screenCommand.Parameters != null))
            {
                foreach (ScreenDataCommandParameter existingP in screenCommand.Parameters)
                {
                    ScreenDataCommandParameter p = existingP.Clone();
                    try
                    {
                        p.Value = Common.GetParameterInputValue(page, p);

                        parameters.Add(p);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(
                                  String.Format(ErrorFormat, "Value", DataCommandName, p.Name, ex.Message),
                                  ex);
                    }
                }
            }



            return(parameters);
        }
Ejemplo n.º 5
0
        private string GetDatabaseDisplayValue(string value)
        {
            string retVal = null;
            DataCommandService dataCommandDB = DataCommandService.GetInstance();

            if (String.IsNullOrEmpty(Me.PickerObject.DataCommand))
            {
                throw new ApplicationException("Picker does not have a datacommand specified in configuration");
            }

            DataCommand command = DataCommand.GetDataCommand(Me.PickerObject.DataCommand);

            if (command == null)
            {
                throw new ApplicationException(String.Format("DataCommand {0} does not exist in configuration", Me.PickerObject.DataCommand));
            }

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

            parameter.Name = command.Parameters[0].Name;
            parameter.Value = value;

            parameters.Add(parameter);

            DataTable dt = dataCommandDB.GetDataForDataCommand(command.Name, parameters);

            if (dt.Rows.Count > 0)
            {
                retVal = dt.Rows[0][Me.PickerObject.DisplayField].ToString();

            }

            return retVal;
        }
Ejemplo n.º 6
0
        public CodeTorch.Core.Lookup GetActiveLookupItems(string cultureCode, string lookupType, string lookupDescription, string lookupValue)
        {
            Lookup retVal = null;

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

            p = new ScreenDataCommandParameter(ParameterCultureCode, cultureCode);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterLookupType, lookupType);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterLookupDescription, lookupDescription);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterLookupValue, lookupValue);
            parameters.Add(p);

            //get data from data command
            DataTable dt = GetDataForDataCommand(DataCommandLookupGetActiveItemsWithCulture, parameters);

            retVal = PopulateLookup(retVal, dt);

            return(retVal);
        }
        public bool IsInRole(string roleName)
        {
            bool retVal = false;

            UserIdentityService userIdentity = UserIdentityService.GetInstance();
            string userName = userIdentity.IdentityProvider.GetUserName();

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

            p = new ScreenDataCommandParameter(ParameterUserName, userName);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterRoleName, roleName);
            parameters.Add(p);

            //get data from data command
            DataTable dt = sql.GetDataForDataCommand(DataCommandRoleGetByUserAndRoleName, parameters);

            if (dt.Rows.Count > 0)
            {
                retVal = true;
            }


            return(retVal);
        }
Ejemplo n.º 8
0
        private void InsertAddress(EmailMessage message, EmailAddress address, string AddressType)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterMailAddressID, address.ID);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterMailMessageID, message.ID);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterAddressType, AddressType);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEmailAddress, address.Address);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterDisplayName, address.DisplayName);
            parameters.Add(p);



            //get data from data command
            sql.ExecuteDataCommand(DataCommandMailInsertAddress, parameters);
        }
        public void SavePermission(DataConnection connection, Permission permission)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;


            p = new ScreenDataCommandParameter(ParameterPermissionName, permission.Name);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterCategory, permission.Category);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterDescription, permission.Description);
            parameters.Add(p);

            DataCommand command = DataCommand.GetDataCommand(DataCommandPermissionSave);



            if (command == null)
            {
                throw new Exception(String.Format("DataCommand {0} could not be found in configuration", DataCommandPermissionSave));
            }
            //execute command
            sql.ExecuteCommand(null, connection, command, parameters, command.Text);
        }
Ejemplo n.º 10
0
        public bool Save(CodeTorch.Core.ResourceItem item)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            item.ID = Guid.NewGuid().ToString();

            p = new ScreenDataCommandParameter(ParameterResourceID, item.ID);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterResourceSet, item.ResourceSet);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterCultureCode, item.CultureCode);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterResourceKey, item.Key);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterResourceValue, item.Value);
            parameters.Add(p);



            ExecuteDataCommand(DataCommandResourceSave, parameters);



            return(true);
        }
        public bool HasPermission(string permissionName)
        {
            bool retVal = false;

            UserIdentityService userIdentity = UserIdentityService.GetInstance();
            string userName = userIdentity.IdentityProvider.GetUserName();

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

            p = new ScreenDataCommandParameter(ParameterUserName, userName);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterPermissionName, permissionName);
            parameters.Add(p);

            //get data from data command
            DataTable dt = sql.GetDataForDataCommand(DataCommandUserGetPermissions, parameters);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    if (Convert.ToBoolean(row[ColumnHasPermission]))
                    {
                        retVal = true;
                        break;
                    }
                }
            }


            return(retVal);
        }
Ejemplo n.º 12
0
        public WorkflowStep GetCurrentWorkflowStep(CodeTorch.Core.Workflow workflow, string entityIDValue)
        {
            WorkflowStep retVal = null;

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

            p = new ScreenDataCommandParameter(ParameterWorkflowCode, workflow.Code);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityType, workflow.EntityName);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityID, entityIDValue);
            parameters.Add(p);

            //get data from data command
            DataTable data = GetDataForDataCommand(DataCommandWorkflowGetCurrentStep, parameters);


            if (data.Rows.Count > 0)
            {
                string CurrentCode = data.Rows[0][ColumnCurrentStepCode].ToString();

                retVal = workflow.GetStepByCode(CurrentCode);
            }

            return(retVal);
        }
Ejemplo n.º 13
0
        private void InsertWorkflow(CodeTorch.Core.Workflow workflow)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterWorkflowCode, workflow.Code);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterWorkflowName, workflow.EntityName);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterWorkflowDescription, workflow.Description);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityName, workflow.EntityName);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityKeyField, workflow.EntityKeyColumn);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityStatusField, workflow.EntityStatusColumn);
            parameters.Add(p);


            ExecuteDataCommand(DataCommandWorkflowInsert, parameters);
        }
Ejemplo n.º 14
0
        void DataCommandValidator_ServerValidate(object source, ServerValidateEventArgs args)
        {
            bool IsValid = false;
            DataCommandService dataCommand = DataCommandService.GetInstance();
            PageDB             pageDB      = new PageDB();

            try
            {
                CustomDataCommandValidator        validator  = (CustomDataCommandValidator)source;
                List <ScreenDataCommandParameter> parameters = pageDB.GetPopulatedCommandParameters(validator.DataCommand, ((CodeTorch.Web.Templates.BasePage) this.Page));

                if (validator.UseValueParameter)
                {
                    ScreenDataCommandParameter valueParameter = parameters.Where(p =>
                                                                                 (
                                                                                     (p.Name.ToLower() == validator.ValueParameter.ToLower())
                                                                                 )
                                                                                 )
                                                                .SingleOrDefault();

                    if (valueParameter != null)
                    {
                        valueParameter.Value = args.Value;
                    }
                }

                DataTable data = dataCommand.GetDataForDataCommand(validator.DataCommand, parameters);

                if (data.Rows.Count == 1)
                {
                    if (validator.UseErrorMessageField)
                    {
                        if (String.IsNullOrEmpty(validator.ErrorMessageField))
                        {
                            throw new ApplicationException(String.Format("ErrorMessageField for validator {0} is not configured", validator.ID));
                        }
                        else
                        {
                            if (data.Columns.Contains(validator.ErrorMessageField))
                            {
                                validator.ErrorMessage = data.Rows[0][validator.ErrorMessageField].ToString();
                            }
                        }
                    }

                    if (data.Columns.Contains(validator.ValidationField))
                    {
                        IsValid = Convert.ToBoolean(data.Rows[0][validator.ValidationField]);
                    }
                }
            }
            catch (Exception ex)
            {
                args.IsValid = false;
                ((System.Web.UI.WebControls.BaseValidator)source).ErrorMessage = "Validator: " + ex.Message;
            }

            args.IsValid = IsValid;
        }
Ejemplo n.º 15
0
        public void Delete(CodeTorch.Core.Workflow workflow)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterWorkflowCode, workflow.Code);
            parameters.Add(p);

            ExecuteDataCommand(DataCommandWorkflowDelete, parameters);
        }
Ejemplo n.º 16
0
        public void InsertDocument(
            string DocumentID, string StorageType, string EntityID,
            string EntityType, string DocumentName, string DocumentTypeCode,
            string ContentType, int Size, int?status, string DocumentUrl,
            byte[] File, bool IsEntityTypeDefault, string CreatedBy)
        {
            DataCommandService sql = DataCommandService.GetInstance();
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterDocumentID, DocumentID);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterStorageType, StorageType);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityID, EntityID);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityType, EntityType);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterDocumentName, DocumentName);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterDocumentTypeCode, DocumentTypeCode);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterDocumentUrl, DocumentUrl);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterFile, File);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterStatus, status);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterIsEntityTypeDefault, IsEntityTypeDefault);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterContentType, ContentType);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterSize, Size);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterCreatedBy, CreatedBy);
            parameters.Add(p);

            sql.ExecuteDataCommand(DataCommandDocumentInsert, parameters);
        }
Ejemplo n.º 17
0
        public List <CodeTorch.Core.ResourceItem> GetResourceItemsByCulture(string cultureCode)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterCultureCode, cultureCode);
            parameters.Add(p);

            //get data from data command
            DataTable dt = GetDataForDataCommand(DataCommandResourceGetByCulture, parameters);

            List <CodeTorch.Core.ResourceItem> retVal = PopulateResourceItems(dt);

            return(retVal);
        }
Ejemplo n.º 18
0
        public static void SetGridDataKeysScreenDataCommandParameter(List <ScreenDataCommandParameter> parameters, string dataKeyParam, object value)
        {
            if (!String.IsNullOrEmpty(dataKeyParam))
            {
                ScreenDataCommandParameter mappedParam = parameters.Where(p =>
                                                                          (
                                                                              (p.Name.ToLower() == dataKeyParam.ToLower())
                                                                          )
                                                                          ).SingleOrDefault();

                if (mappedParam != null)
                {
                    mappedParam.Value = value;
                }
            }
        }
Ejemplo n.º 19
0
        private void RefreshDataCommandParameters(ScreenDataCommand item)
        {
            //get data command
            DataCommand c = DataCommand.GetDataCommand(item.Name);

            if (c != null)
            {
                //loop through screen data command parameters
                List <ScreenDataCommandParameter> remove = new List <ScreenDataCommandParameter>();
                foreach (ScreenDataCommandParameter p in item.Parameters)
                {
                    ScreenDataCommandParameter localP = p;
                    if (!c.Parameters.Exists(x => x.Name == localP.Name))
                    {
                        remove.Add(localP);
                    }
                }

                //are there any missing from data command - if so remove
                foreach (ScreenDataCommandParameter p in remove)
                {
                    item.Parameters.Remove(p);
                }


                //loop through data command parameters
                foreach (DataCommandParameter p in c.Parameters)
                {
                    DataCommandParameter localP = p;
                    if (!item.Parameters.Exists(x => x.Name == localP.Name))
                    {
                        //are there any missing from screen command parameters - if so add with control as default

                        ScreenDataCommandParameter sp = new ScreenDataCommandParameter();

                        sp.InputType = ScreenInputType.Control;
                        sp.Name      = p.Name;
                        sp.InputKey  = p.Name.Replace("@", "").Replace("'", "").Replace(" ", "");

                        item.Parameters.Add(sp);
                    }
                }
            }
        }
Ejemplo n.º 20
0
        private void InsertAttachment(EmailMessage message, EmailAttachment attachment)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterMailMessageAttachmentID, attachment.ID);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterMailMessageID, message.ID);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterDocumentID, attachment.DocumentID);
            parameters.Add(p);



            //get data from data command
            sql.ExecuteDataCommand(DataCommandMailInsertAttachment, parameters);
        }
        public void AddAllPermissionsToRole(DataConnection connection, string roleName)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;


            p = new ScreenDataCommandParameter(ParameterRoleName, roleName);
            parameters.Add(p);

            DataCommand command = DataCommand.GetDataCommand(DataCommandRoleAddAllPermissions);



            if (command == null)
            {
                throw new Exception(String.Format("DataCommand {0} could not be found in configuration", DataCommandRoleAddAllPermissions));
            }
            //execute command
            sql.ExecuteCommand(null, connection, command, parameters, command.Text);
        }
Ejemplo n.º 22
0
        public void InsertMailMessage(EmailMessage message)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterMailMessageID, message.ID);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterMailSubject, message.Subject);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterMailBody, message.Body);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterPriority, message.Priority);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterIsBodyHtml, message.IsBodyHtml);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterTemplate, message.Template);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityType, message.EntityType);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityID, message.EntityID);
            parameters.Add(p);

            string userName;

            userName = UserIdentityService.GetInstance().IdentityProvider.GetUserName();
            p        = new ScreenDataCommandParameter(ParameterCreatedBy, userName);
            parameters.Add(p);


            //get data from data command
            sql.ExecuteDataCommand(DataCommandWMailInsertMailMessage, parameters);
        }
Ejemplo n.º 23
0
        public void SetEntityStatus(CodeTorch.Core.Workflow workflow, WorkflowStep step, string entityIDValue)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterEntityName, workflow.EntityName);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityStatusField, workflow.EntityStatusColumn);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityID, entityIDValue);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterStatus, step.Code);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterEntityKeyField, workflow.EntityKeyColumn);
            parameters.Add(p);

            //get data from data command
            ExecuteDataCommand(DataCommandWorkflowSetEntityStatus, parameters);
        }
Ejemplo n.º 24
0
        public string GetEntityIDValue(Screen screen, string EntityID, ScreenInputType EntityInputType, Control container)
        {
            string retVal = null;
            ScreenDataCommandParameter p = new ScreenDataCommandParameter(EntityID, EntityInputType);
            object EntityIDValue         = Common.GetParameterInputValue(this, p, container);

            if (EntityIDValue != null)
            {
                retVal = EntityIDValue.ToString();
            }


            //switch (EntityInputType)
            //{
            //    case ScreenInputType.QueryString:
            //        EntityIDValue = Request.QueryString[EntityID];
            //        break;
            //    case ScreenInputType.User:
            //        try
            //        {
            //            List<string> profileProperties = CodeTorch.Core.Configuration.GetInstance().App.ProfileProperties;
            //            int propertyIndex = Enumerable.Range(0, profileProperties.Count).First(i => profileProperties[i].ToLower() == EntityID.ToLower());

            //            FormsIdentity identity = (FormsIdentity)HttpContext.Current.User.Identity;
            //            FormsAuthenticationTicket ticket = identity.Ticket;

            //            EntityIDValue = ticket.UserData.Split('|')[propertyIndex];

            //        }
            //        catch { }
            //        break;
            //}


            return(retVal);
        }
Ejemplo n.º 25
0
        private void InsertWorkflowStep(CodeTorch.Core.Workflow workflow, WorkflowStep step, int stepSequence)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;

            p = new ScreenDataCommandParameter(ParameterWorkflowCode, workflow.Code);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterWorkflowStepCode, step.Code);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterWorkflowStepSequence, stepSequence);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterWorkflowStepName, step.Name);
            parameters.Add(p);

            p = new ScreenDataCommandParameter(ParameterUpdateEntityWithStatusCode, step.UpdateEntityWithStatusCode);
            parameters.Add(p);



            ExecuteDataCommand(DataCommandWorkflowInsertStep, parameters);
        }
Ejemplo n.º 26
0
        public void Save(Sequence sequence)
        {
            int retVal;

            DataCommandService dataCommandDB = DataCommandService.GetInstance();



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



            ScreenDataCommandParameter p = null;

            p       = new ScreenDataCommandParameter();
            p.Name  = "@SequenceName";
            p.Value = sequence.Name;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@SequencePrefix";
            p.Value = sequence.Prefix;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@SeedValue";
            p.Value = sequence.SeedValue;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@Increment";
            p.Value = sequence.Increment;
            parameters.Add(p);

            dataCommandDB.ExecuteDataCommand(Configuration.GetInstance().App.SaveSequenceDataCommand, parameters);
        }
Ejemplo n.º 27
0
        public void Save(CodeTorch.Core.Lookup lookup)
        {
            List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>();
            ScreenDataCommandParameter        p          = null;


            p = new ScreenDataCommandParameter(ParameterLookupType, lookup.Name);
            parameters.Add(p);

            //deactivate all lookup items
            ExecuteDataCommand(DataCommandLookupDeactivate, parameters);

            foreach (LookupItem item in lookup.Items)
            {
                //reactivate lookups items 1 by 1
                parameters = new List <ScreenDataCommandParameter>();
                p          = null;



                p = new ScreenDataCommandParameter(ParameterLookupType, lookup.Name);
                parameters.Add(p);

                p = new ScreenDataCommandParameter(ParameterLookupValue, item.Value);
                parameters.Add(p);

                p = new ScreenDataCommandParameter(ParameterLookupDescription, item.Description);
                parameters.Add(p);

                p = new ScreenDataCommandParameter(ParameterSort, item.Sort);
                parameters.Add(p);

                //save lookups to db
                ExecuteDataCommand(DataCommandLookupSave, parameters);
            }
        }
Ejemplo n.º 28
0
        public string InsertMessage(
            DateMode DateMode, string PhoneNo, string MessageText, string Template,
            string EntityType, string EntityID, string UserName, string Password,
            string ChannelID, string CreatedBy)
        {
            string MessageID = Guid.NewGuid().ToString();

            DataCommandService dataCommandDB = DataCommandService.GetInstance();;



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



            ScreenDataCommandParameter p = null;


            p       = new ScreenDataCommandParameter();
            p.Name  = "@MessageID";
            p.Value = MessageID;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@PhoneNo";
            p.Value = PhoneNo;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@MessageText";
            p.Value = MessageText;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@Template";
            p.Value = Template;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@EntityType";
            p.Value = EntityType;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@EntityID";
            p.Value = EntityID;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@UserName";
            p.Value = UserName;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@Password";
            p.Value = Password;
            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@ChannelID";
            p.Value = ChannelID;
            parameters.Add(p);

            p      = new ScreenDataCommandParameter();
            p.Name = "@CreatedOn";
            switch (DateMode)
            {
            case DateMode.LocalDate:
                p.Value = DateTime.Now;
                break;

            case DateMode.UniversalDate:
                p.Value = DateTime.UtcNow;
                break;
            }

            parameters.Add(p);

            p       = new ScreenDataCommandParameter();
            p.Name  = "@CreatedBy";
            p.Value = CreatedBy;
            parameters.Add(p);

            dataCommandDB.ExecuteDataCommand(Configuration.GetInstance().App.SaveSequenceDataCommand, parameters);



            return(MessageID);
        }
Ejemplo n.º 29
0
        private object Exec(DataConnection connection, DataCommand dataCommand, List <ScreenDataCommandParameter> parameters, CommandType commandType, string commandText)
        {
            object retVal = null;
            bool   hasOutputParameters      = false;
            string firstOutputParameterName = String.Empty;

            Database db = CreateDatabase(connection);

            //create command and specify stored procedure name
            DbCommand command = null;

            switch (commandType)
            {
            case CommandType.Text:
                command = db.GetSqlStringCommand(commandText);
                break;

            case CommandType.StoredProcedure:
                command = db.GetStoredProcCommand(commandText);
                break;
            }

            // specify stored procedure parameters

            if (parameters != null)
            {
                foreach (DataCommandParameter p in dataCommand.Parameters)
                {
                    object value = null;
                    ScreenDataCommandParameter screenParam = parameters.Where(sp => sp.Name.ToLower() == p.Name.ToLower()).SingleOrDefault();

                    if (screenParam != null)
                    {
                        value = screenParam.Value;
                    }

                    switch (p.Direction)
                    {
                    case DataCommandParameterDirection.In:
                        AddInParameter(db, command, p, value);
                        break;

                    case DataCommandParameterDirection.Out:
                        if (!hasOutputParameters)
                        {
                            hasOutputParameters      = true;
                            firstOutputParameterName = p.Name;
                        }

                        //db.
                        db.AddParameter(command, p.Name, (DbType)Enum.Parse(typeof(DbType), p.Type.ToString()), ParameterDirection.InputOutput, p.Name, DataRowVersion.Current, value);
                        DbParameter param = command.Parameters[p.Name];
                        param.Size = p.Size;
                        //db.AddOutParameter(command, p.Name, (DbType)Enum.Parse(typeof(DbType), p.Type.ToString()), p.Size);

                        break;
                    }
                }
            }

            //execute command
            ExecuteNonQuery(db, null, command);

            if (hasOutputParameters)
            {
                retVal = db.GetParameterValue(command, firstOutputParameterName);
            }

            return(retVal);
        }
Ejemplo n.º 30
0
        private RestRequest PrepareRequest(DataConnection connection, DataCommand dataCommand, List <ScreenDataCommandParameter> parameters, string commandText)
        {
            string url = GetUrl(connection, dataCommand, parameters, commandText);

            Method     method = (Method)Enum.Parse(typeof(Method), dataCommand.Type, true);
            DataFormat format = DataFormat.Json;

            if (url.ToLower().Contains(".xml"))
            {
                format = DataFormat.Xml;
            }

            RestRequest request = new RestRequest(url, method, format);

            request.Resource = commandText;



            // specify stored procedure parameters
            //request.

            if (parameters != null)
            {
                foreach (DataCommandParameter p in dataCommand.Parameters)
                {
                    object value = null;
                    ScreenDataCommandParameter screenParam = parameters.Where(sp => sp.Name.ToLower() == p.Name.ToLower()).SingleOrDefault();

                    if (screenParam != null)
                    {
                        value = screenParam.Value;

                        switch (screenParam.InputType)
                        {
                        case ScreenInputType.AppSetting:
                            break;

                        case ScreenInputType.Control:
                            request.AddParameter(screenParam.Name, screenParam.Value.ToString(), ParameterType.GetOrPost);
                            break;

                        case ScreenInputType.ControlText:
                            request.AddParameter(screenParam.Name, screenParam.Value.ToString(), ParameterType.GetOrPost);
                            break;

                        case ScreenInputType.Cookie:
                            request.AddParameter(screenParam.Name, screenParam.Value.ToString(), ParameterType.Cookie);
                            break;

                        case ScreenInputType.File:

                            break;

                        case ScreenInputType.Form:
                            request.AddParameter(screenParam.Name, screenParam.Value.ToString(), ParameterType.GetOrPost);
                            break;

                        case ScreenInputType.Constant:
                            request.AddParameter(screenParam.Name, screenParam.Value.ToString(), ParameterType.GetOrPost);
                            break;

                        case ScreenInputType.QueryString:
                            request.AddParameter(screenParam.Name, screenParam.Value.ToString(), ParameterType.GetOrPost);

                            break;

                        case ScreenInputType.Session:
                            break;

                        case ScreenInputType.Special:
                            if (screenParam.InputKey.ToLower() == "header")
                            {
                                request.AddParameter(screenParam.Name, screenParam.Value.ToString(), ParameterType.HttpHeader);
                            }
                            break;

                        case ScreenInputType.User:
                            break;

                        case ScreenInputType.DashboardSetting:
                            break;

                        case ScreenInputType.ServerVariables:
                            break;
                        }
                    }
                }
            }
            return(request);
        }