Beispiel #1
0
        protected void lvMDDesignation_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 DesignationID;

            Int64.TryParse(e.CommandArgument.ToString(), out DesignationID);

            if (DesignationID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _DesignationID = DesignationID;

                    PrepareEditView();
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDDesignationEntity.FLD_NAME_DesignationID, DesignationID.ToString(), SQLMatchType.Equal);

                        MDDesignationEntity mDDesignationEntity = new MDDesignationEntity();


                        result = FCCMDDesignation.GetFacadeCreate().Delete(mDDesignationEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _DesignationID       = 0;
                            _MDDesignationEntity = new MDDesignationEntity();
                            PrepareInitialView();


                            MiscUtil.ShowMessage(lblMessage, "Designation has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Designation.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Beispiel #2
0
        private void DeleteDesignation()
        {
            Int64 DesignationID;

            Int64.TryParse(treeDesignation.SelectedValue, out DesignationID);

            if (DesignationID > 0)
            {
                try
                {
                    Int64 result = -1;

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDDesignationEntity.FLD_NAME_DesignationID, DesignationID.ToString(), SQLMatchType.Equal);

                    MDDesignationEntity mDDesignationEntity = new MDDesignationEntity();


                    result = FCCMDDesignation.GetFacadeCreate().Delete(mDDesignationEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _DesignationID       = 0;
                        _MDDesignationEntity = new MDDesignationEntity();

                        // clearing cache
                        FCCMDDesignation.GetFacadeCreate().RemoveCache();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Designation has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Designation.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }