Пример #1
0
        protected override bool DoAddItem(IDataItem item)
        {
            string command = "select ID from {0} WHERE Name='{1}'";

            string name = item.Name;

            if (name.Contains("'"))
            {
                name = name.Replace("'", "''");
            }

            command = String.Format(command, ItemsTable, name);

            bool shouldAdd = sqlWrapper.ExecuteSelect(command).Rows.Count == 0;

            if (shouldAdd)
            {
                command = LoadCommandFT("InsertItem", ItemsTable, item.Name, item.SourceId, SQLUtils.ToSQLDateTime(item.AddedDate), 1, item.ActionContent);

                sqlWrapper.ExecuteNonQuery(command);

                item.SetId(GetLastInsertRow());

                return(true);
            }
            else
            {
                return(false);
            }
        }