private void DeleteAllTweetsButton_Click(object sender, EventArgs e)
        {
            if (this.userId == 0)
            {
                return;
            }

            if (MessageBox.Show("User all tweets will be deleted." + Environment.NewLine + "Are You Sure ?", "Sure", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Dac dac = new Dac();
                dac.ExecuteNonQuery("DELETE FROM Tweet WHERE CreatedByUserId=" + this.userId.ToString());
                RefreshList();
            }
        }
예제 #2
0
        /// <summary>
        /// Saves the customer properties back to the database.
        /// </summary>
        public override bool SaveItem()
        {
            bool success = false;

            // If the entity state is added, need to get the CustomerId back.
            bool   isOutput = false;
            string spName   = "CustomerUpdate";

            if (EntityState == EntityStateType.Added)
            {
                isOutput = true;
                spName   = "CustomerInsert";
            }

            // Pass the properties back to the DAC
            // This would not be needed if the base class had code to use Reflection to build
            // the parameters from the object properties.
            int retVal = Dac.ExecuteNonQuery(spName,
                                             Dac.Parameter("CustomerId", CustomerId, isOutput),
                                             Dac.Parameter("LastName", LastName),
                                             Dac.Parameter("FirstName", FirstName),
                                             Dac.Parameter("EmailAddress", EmailAddress),
                                             Dac.Parameter("CustomerType", CustomerType));

            // If it was an add, update the product ID
            if (EntityState == EntityStateType.Added)
            {
                CustomerId = retVal;
            }

            // Reset the entity's state
            this.SetEntityState(EntityStateType.Unchanged);

            // Assume success
            success = true;

            return(success);
        }