Beispiel #1
0
        void View()
        {
            try
            {
                c_row_select = dgrRenter.SelectedIndex;
                Building_Info _Building_Info = (Building_Info)dgrRenter.SelectedItem;

                if (_Building_Info == null)
                {
                    return;
                }

                View_Building _View_Building = new View_Building();
                _View_Building.Owner = Window.GetWindow(this);

                _View_Building.c_Building_Info = _Building_Info;
                _View_Building.ShowDialog();

                DataGridHelper.NVSFocus(dgrRenter, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Beispiel #2
0
        void Update()
        {
            try
            {
                c_row_select = dgrRenter.SelectedIndex;
                Building_Info _Building_Info = (Building_Info)dgrRenter.SelectedItem;

                if (_Building_Info == null)
                {
                    return;
                }
                Update_Building _Update_Building = new Update_Building();
                _Update_Building.c_Building_Info = _Building_Info;
                _Update_Building.Owner           = Window.GetWindow(this);
                _Update_Building.ShowDialog();

                if (_Update_Building.c_id_insert != 0)
                {
                    Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
                    LoadData();

                    Mouse.OverrideCursor = null;
                }


                DataGridHelper.NVSFocus(dgrRenter, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Beispiel #3
0
        void Insert()
        {
            try
            {
                Create_Building _Create_Building = new Create_Building();
                _Create_Building.Owner = Window.GetWindow(this);
                _Create_Building.ShowDialog();

                if (_Create_Building.c_id_insert != 0)
                {
                    LoadData();

                    for (int i = 0; i < c_lst.Count; i++)
                    {
                        Building_Info ui = (Building_Info)c_lst[i];
                        if (ui.Building_Id == _Create_Building.c_id_insert)
                        {
                            c_row_select = i;
                            _Create_Building.c_id_insert = 0;
                            break;
                        }
                    }
                }

                DataGridHelper.NVSFocus(dgrRenter, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Beispiel #4
0
 public decimal Building_Update(decimal p_id, Building_Info Building_Info)
 {
     try
     {
         return(CommonData.c_serviceWCF.Building_Update(p_id, Building_Info.Building_Name, Building_Info.Address, Building_Info.Notes));
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
         return(-1);
     }
 }
Beispiel #5
0
 /// <summary>
 /// hàm dùng cho EventsSetter trong form display
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void DoubleClick(object sender, RoutedEventArgs e)
 {
     try
     {
         Building_Info _Building_Info = (Building_Info)dgrRenter.SelectedItem;
         if (_Building_Info != null)
         {
             c_Building_Info_Search = _Building_Info;
             c_ok = 1;
             this.Close();
         }
         e.Handled = true;
     }
     catch (Exception ex)
     {
         CommonData.log.Error(ex.ToString());
     }
 }
Beispiel #6
0
        void LoadCombobox()
        {
            try
            {
                AllCode_Info _AllCode_Info = new AllCode_Info();
                _AllCode_Info.Content = CommonData.c_All_Content;
                _AllCode_Info.CdValue = CommonData.c_All_Value;

                List <AllCode_Info> _lst_PayStatus = DBMemory.AllCode_GetBy_CdNameCdType("FEE", "STATUS");
                _lst_PayStatus.Insert(0, _AllCode_Info);
                cboStatusPay.ItemsSource       = _lst_PayStatus;
                cboStatusPay.DisplayMemberPath = "Content";
                cboStatusPay.SelectedValuePath = "CdValue";
                cboStatusPay.SelectedIndex     = 0;

                List <AllCode_Info> _lst_c_Status = DBMemory.AllCode_GetBy_CdNameCdType("CONTRACT", "STATUS");
                _lst_c_Status.Insert(0, _AllCode_Info);
                cboStatus.ItemsSource       = _lst_c_Status;
                cboStatus.DisplayMemberPath = "Content";
                cboStatus.SelectedValuePath = "CdValue";
                cboStatus.SelectedIndex     = 0;

                Building_Info _Building_Info_All = new Building_Info();
                _Building_Info_All.Building_Id   = -1;
                _Building_Info_All.Building_Name = CommonData.c_All_Content;

                BuildingController   _BuildingController = new BuildingController();
                List <Building_Info> _lst_B = _BuildingController.Building_GetAll();
                _lst_B.Insert(0, _Building_Info_All);
                cboBuilding.ItemsSource       = _lst_B;
                cboBuilding.DisplayMemberPath = "Building_Name";
                cboBuilding.SelectedValuePath = "Building_Id";
                cboBuilding.SelectedIndex     = 0;

                //List<Contract_Info> _lst_contract = new List<Contract_Info>();
                //_lst_contract = c_Contract_Controller.Contract_GetBy_Type((decimal)Enum_Contract_Type.Renter);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Beispiel #7
0
        void LoadCombobox()
        {
            try
            {
                AllCode_Info _AllCode_Info = new AllCode_Info();
                _AllCode_Info.Content = CommonData.c_All_Content;
                _AllCode_Info.CdValue = CommonData.c_All_Value;

                List <AllCode_Info> _lst_c_Status = DBMemory.AllCode_GetBy_CdNameCdType("CONTRACT", "STATUS");
                _lst_c_Status.Insert(0, _AllCode_Info);
                cboStatus.ItemsSource       = _lst_c_Status;
                cboStatus.DisplayMemberPath = "Content";
                cboStatus.SelectedValuePath = "CdValue";
                cboStatus.SelectedIndex     = 0;


                Building_Info _Building_Info_All = new Building_Info();
                _Building_Info_All.Building_Id   = -1;
                _Building_Info_All.Building_Name = CommonData.c_All_Content;

                BuildingController   _BuildingController = new BuildingController();
                List <Building_Info> _lst_B = _BuildingController.Building_GetAll();
                _lst_B.Insert(0, _Building_Info_All);
                cboBuilding.ItemsSource       = _lst_B;
                cboBuilding.DisplayMemberPath = "Building_Name";
                cboBuilding.SelectedValuePath = "Building_Id";
                cboBuilding.SelectedIndex     = 0;

                List <Contract_Info> _lst_contract = new List <Contract_Info>();
                _lst_contract = c_Contract_Controller.Contract_GetBy_Type((decimal)Enum_Contract_Type.Tenant);

                //dangtq sửa lại
                System.Data.DataTable temp = Common.ConvertData.ConvertToDatatable <Contract_Info>(_lst_contract);
                CommonFunction.NVS_BindTextboxComplete(txtCode, temp, "Contract_Code");
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Beispiel #8
0
        private void btnChose_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SearchBuilding _SearchBuilding = new SearchBuilding();
                _SearchBuilding.Owner = Window.GetWindow(this);
                _SearchBuilding.ShowDialog();

                if (_SearchBuilding.c_ok == 1)
                {
                    Building_Info _Building_Info = _SearchBuilding.c_Building_Info_Search;

                    txtBuilding.Text = _Building_Info.Building_Code;

                    c_Building_Info_Search = _SearchBuilding.c_Building_Info_Search;
                }
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Beispiel #9
0
        void Accept()
        {
            try
            {
                if (Building_Checkvalidate() == false)
                {
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn thêm mới tòa nhà hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes != result)
                {
                    return;
                }

                Building_Info _Building_Info = new Building_Info();
                _Building_Info.Building_Code = txt_Building_Code.Text;
                _Building_Info.Building_Name = txt_Building_Code.Text;
                _Building_Info.Address       = txtAddress.Text;
                _Building_Info.Notes         = txtNote.Text;
                decimal _building_id = c_BuildingController.Building_Insert(_Building_Info);

                if (_building_id == -1)
                {
                    NoteBox.Show("Lỗi thêm mới tòa nhà", "", NoteBoxLevel.Error);
                    return;
                }

                c_id_insert = _building_id;

                NoteBox.Show("Thêm mới dữ liệu thành công", "");
                this.Close();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Beispiel #10
0
        void Delete()
        {
            try
            {
                c_row_select = dgrRenter.SelectedIndex;
                Building_Info _Building_Info = (Building_Info)dgrRenter.SelectedItem;

                if (_Building_Info == null)
                {
                    return;
                }

                bool _ck = c_BuildingController.Check_Exit_EstateInBuilding(_Building_Info.Building_Id);
                if (_ck == true)
                {
                    NoteBox.Show("Đối tượng BĐS thuộc toà nhà không thể xóa", "", NoteBoxLevel.Error);
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn xóa tòa nhà này hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes == result)
                {
                    if (c_BuildingController.Building_Delete(_Building_Info.Building_Id))
                    {
                        NoteBox.Show("Xóa dữ liệu thành công");
                        LoadData();
                    }
                }
                else
                {
                    DataGridHelper.NVSFocus(dgrRenter, c_row_select, 0);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }