Exemplo n.º 1
0
        public APICallingResult mergeTag(ContactTagModel tagModel)
        {
            string outputMessage = null;
            int    idOut         = 0;
            var    tag           = AddressProvider.mergeTag(tagModel, out idOut, out outputMessage);

            return(new APICallingResult
            {
                Status = tag != null,
                Data = tag,
                ProcessMessage = outputMessage,
                Id = idOut
            });
        }
Exemplo n.º 2
0
        public static ContactTagModel mergeTag(ContactTagModel tagModel, out int idOut, out string processMessage)
        {
            processMessage = String.Empty;
            idOut          = 0;
            try
            {
                using (var connection = DBProvider.DatabaseConnection)
                {
                    var command = new SqlCommand("[address].[merge_tag]", connection);
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@TagName", tagModel.name);
                    command.Parameters.Add(new SqlParameter
                    {
                        ParameterName = "@IDOut",
                        DbType        = DbType.Int32,
                        Direction     = ParameterDirection.Output
                    });
                    command.Parameters.Add(new SqlParameter
                    {
                        ParameterName = "@ProcessMessage",
                        DbType        = DbType.String,
                        Size          = 200,
                        Direction     = ParameterDirection.Output
                    });
                    command.ExecuteNonQuery();

                    idOut          = int.Parse(command.Parameters["@IDOut"].Value.ToString());
                    processMessage = command.Parameters["@ProcessMessage"].Value.ToString();
                    tagModel.id    = idOut;
                }
            }
            catch (Exception exp)
            {
                processMessage = exp.Message;
                return(null);
            }
            return(tagModel);
        }