Exemplo n.º 1
0
    //--------------------------------------------------------
    #endregion

    #region --------------dgUsersData_DeleteCommand--------------
    //---------------------------------------------------------
    //dgUsersData_DeleteCommand
    //---------------------------------------------------------
    protected void dgUsersData_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        //-------------------------------------------------------------------------------

        Guid            userID          = (Guid)dgUsersData.DataKeys[e.Item.ItemIndex];
        UsersDataEntity usersDataObject = UsersDataFactory.GetUsersDataObject(userID, OwnerID);

        if (UsersDataFactory.Delete(userID))
        {
            //------------------------------------------------
            //RegisterInMailList
            if ((currentModule.MailListAutomaticRegistration || (usersDataObject.HasEmailService)) && !string.IsNullOrEmpty(usersDataObject.Email))
            {
                UsersDataFactory.UnRegisterInMailList(usersDataObject);
            }
            //------------------------------------------------
            //------------------------------------------------
            //RegisterInSms
            if ((currentModule.SmsAutomaticRegistration || (usersDataObject.HasSmsService)) && !string.IsNullOrEmpty(usersDataObject.Mobile))
            {
                UsersDataFactory.UnRegisterInSms(usersDataObject);
            }
            //------------------------------------------------
            lblResult.CssClass = "operation_done";
            lblResult.Text     = Resources.AdminText.DeletingOprationDone;
            //if one item in datagrid
            if (dgUsersData.Items.Count == 1)
            {
                --pager.CurrentPage;
            }
            LoadData();

            /*
             * UserControl Users1 = (UserControl)this.Page.FindControl("Users1");
             * Label lblUserCounts = (Label)Users1.FindControl("lblUserCounts");
             * lblUserCounts.Text = UsersDataFactory.GetCount().ToString();*/
        }
        else
        {
            lblResult.CssClass = "operation_error";
            lblResult.Text     = Resources.AdminText.DeletingOprationFaild;
        }
    }