Exemplo n.º 1
0
        public int addCustomerGroup(Group group)
        {
            SSGetService    getService    = new SSGetService();
            SSUpdateService updateService = new SSUpdateService();

            Group existingGroup = getService.getGroupByName(group.name);

            if (existingGroup.name == null)
            {
                using (SqlCommand command = new SqlCommand("INSERT INTO ss_customer_groups(name)VALUES(@name)"))
                {
                    command.Parameters.AddWithValue("@name", group.name);

                    int response = service.execute(command);
                    if (response > 0)
                    {
                        this.addLog(new Log()
                        {
                            type        = "Add Group",
                            statement   = command.CommandText,
                            description = "Added new Group" + group.name,
                        });
                    }
                    return(response);
                }
            }
            else
            {
                app.showWarning("Group already exist");
                return(-2);
            }
        }