Esempio n. 1
0
        public void Delete()
        {
            try
            {
                if (DeleteCommand.Connection.State == ConnectionState.Closed)
                {
                    DeleteCommand.Connection.Open();
                    InitialiseDelete();
                }
                DeleteCommand.Parameters["@StoryTypeID"].Value = this.StoryTypeID;
                try
                {
                    DeleteCommand.ExecuteNonQuery();
                }
                catch (System.Data.SqlClient.SqlException SQLex) { }

                this._StoryTypeID  = 0;
                this.StoryTypeName = null;
            }
            finally
            {
                DeleteCommand.Parameters.Clear();
                DeleteCommand.Connection.Close();
            }
        }
Esempio n. 2
0
        public void Delete()
        {
            try
            {
                if (DeleteCommand.Connection.State == ConnectionState.Closed)
                {
                    DeleteCommand.Connection.Open();
                    InitialiseDelete();
                }
                DeleteCommand.Parameters["@IterationTimePeriodID"].Value = this.IterationTimePeriodID;
                try
                {
                    DeleteCommand.ExecuteNonQuery();
                }
                catch (System.Data.SqlClient.SqlException SQLex) { }

                this._IterationTimePeriodID       = 0;
                this.IterationID                  = 0;
                this.IterationTimePeriodStartDate = DateTime.MinValue;
                this.IterationTimePeriodEndDate   = DateTime.MinValue;
            }
            finally
            {
                DeleteCommand.Parameters.Clear();
                DeleteCommand.Connection.Close();
            }
        }
Esempio n. 3
0
        public void Delete()
        {
            try
            {
                if (DeleteCommand.Connection.State == ConnectionState.Closed)
                {
                    DeleteCommand.Connection.Open();
                    InitialiseDelete();
                }
                DeleteCommand.Parameters["@IterationID"].Value = this.IterationID;
                try
                {
                    DeleteCommand.ExecuteNonQuery();
                }
                catch (System.Data.SqlClient.SqlException SQLex) { }

                this._IterationID               = 0;
                this.IterationDescription       = null;
                this.IterationTypeID            = 0;
                this.DefaultIterationTimePeriod = 0;
                this.IterationOwner             = 0;
            }
            finally
            {
                DeleteCommand.Parameters.Clear();
                DeleteCommand.Connection.Close();
            }
        }
Esempio n. 4
0
        public void Delete()
        {
            try
            {
                if (DeleteCommand.Connection.State == ConnectionState.Closed)
                {
                    DeleteCommand.Connection.Open();
                    InitialiseDelete();
                }
                DeleteCommand.Parameters["@TaskID"].Value = this.TaskID;
                try
                {
                    DeleteCommand.ExecuteNonQuery();
                }
                catch (System.Data.SqlClient.SqlException SQLex) { }

                this._TaskID           = 0;
                this.StoryID           = 0;
                this.TaskDescription   = null;
                this.TaskStartDate     = null;
                this.TaskEndDate       = null;
                this.TaskEstimatedTime = null;
                this.TaskClockedTime   = null;
                this.TaskStatusID      = 0;
                this.TaskAssignedUser  = 0;
            }
            finally
            {
                DeleteCommand.Parameters.Clear();
                DeleteCommand.Connection.Close();
            }
        }
Esempio n. 5
0
        public void Delete()
        {
            try
            {
                if (DeleteCommand.Connection.State == ConnectionState.Closed)
                {
                    DeleteCommand.Connection.Open();
                    InitialiseDelete();
                }
                DeleteCommand.Parameters["@UserID"].Value = this.UserID;
                try
                {
                    DeleteCommand.ExecuteNonQuery();
                }
                catch (System.Data.SqlClient.SqlException SQLex) { }

                this._UserID              = 0;
                this.UserFirstName        = null;
                this.UserLastName         = null;
                this.UserName             = null;
                this.UserEmail            = null;
                this.UserThemeID          = 0;
                this.UserAspNetMembership = null;
                this.UserPicture          = null;
            }
            finally
            {
                DeleteCommand.Parameters.Clear();
                DeleteCommand.Connection.Close();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 将指定主键的对象从数据库删除
        /// </summary>
        /// <param name="keys">待删除的对象的主键</param>
        /// <returns>是否成功删除</returns>
        public virtual bool DeleteByKeys(params object[] keys)
        {
            ThrowExceptionIfWrongKeys(keys);
            int i = 0;

            foreach (IDataParameter param in DeleteCommand.Parameters)
            {
                param.Value = ConvertToDBValue(keys[i], TableDefinition.Keys[i]);
                i++;
            }
            return(DeleteCommand.ExecuteNonQuery() > 0);
        }
Esempio n. 7
0
        public void Delete(int id)
        {
            ConnectionCheck();
            SqlTransaction transaction = connection.BeginTransaction();

            DeleteCommand.Connection  = connection;
            DeleteCommand.Transaction = transaction;
            DeleteCommand.Parameters.AddWithValue(IdParameterName, id);
            try
            {
                DeleteCommand.ExecuteNonQuery();
                transaction.Commit();
            }
            catch (Exception e)
            {
                transaction.Rollback();
                throw e;
            }
            finally
            {
                DeleteCommand.Parameters.Clear();
            }
        }