Ejemplo n.º 1
0
        void Delete()
        {
            try
            {
                c_row_select = dgrEstate.SelectedIndex;
                Estate_Object_Info _Estate_Object_Info = (Estate_Object_Info)dgrEstate.SelectedItem;

                if (_Estate_Object_Info == null)
                {
                    return;
                }

                bool _ck = c_Estate_Object_Controller.Check_Exit_EstateInContract(_Estate_Object_Info.Estate_Id);
                if (_ck == true)
                {
                    NoteBox.Show("Đối tượng bất động sản đã cho thuê hoặc đã thuê, không thể xóa", "", NoteBoxLevel.Error);
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn xóa đối tượng BĐS này hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes == result)
                {
                    if (c_Estate_Object_Controller.Estate_Object_Delete(_Estate_Object_Info.Estate_Id))
                    {
                        NoteBox.Show("Xóa dữ liệu thành công");
                        LoadData();
                    }
                }
                else
                {
                    DataGridHelper.NVSFocus(dgrEstate, c_row_select, 0);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }