Esempio n. 1
0
        void Contract_Update()
        {
            try
            {
                c_row_select = dgrContract.SelectedIndex;
                Contract_Info _Contract_Info = (Contract_Info)dgrContract.SelectedItem;

                if (_Contract_Info == null)
                {
                    return;
                }
                Update_Contract_Insert_Renter _Update_Contract_Insert_Renter = new Update_Contract_Insert_Renter();
                _Update_Contract_Insert_Renter.c_Contract_Info = _Contract_Info;
                _Update_Contract_Insert_Renter.Owner           = Window.GetWindow(this);
                _Update_Contract_Insert_Renter.ShowDialog();
                if (_Update_Contract_Insert_Renter.c_id_insert != 0)
                {
                    Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
                    Search();
                    DBMemory.LoadFeeRender();
                    Mouse.OverrideCursor = null;
                }

                DataGridHelper.NVSFocus(dgrContract, c_row_select, 0);
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = null;
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 2
0
        private void frmChose_Estate_Object_Loaded(object sender, RoutedEventArgs e)
        {
            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("ESTATE", "STATUS");
                _lst_c_Status.Insert(0, _AllCode_Info);
                cboStatus.ItemsSource       = _lst_c_Status;
                cboStatus.DisplayMemberPath = "Content";
                cboStatus.SelectedValuePath = "CdValue";
                cboStatus.SelectedIndex     = 0;

                List <AllCode_Info> _lst_c_type = DBMemory.AllCode_GetBy_CdNameCdType("ESTATE", "TYPE");
                _lst_c_type.Insert(0, _AllCode_Info);
                cboType.ItemsSource       = _lst_c_type;
                cboType.DisplayMemberPath = "Content";
                cboType.SelectedValuePath = "CdValue";
                cboType.SelectedIndex     = 0;

                //c_lst = c_Estate_Object_Controller.Estate_Object_GetAll();
                //dgrEstate.ItemsSource = c_lst;
                //DataGridHelper.NVSFocus(dgrEstate, 0, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 3
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("ESTATE", "STATUS");
                _lst_c_Status.Insert(0, _AllCode_Info);
                cboStatus.ItemsSource       = _lst_c_Status;
                cboStatus.DisplayMemberPath = "Content";
                cboStatus.SelectedValuePath = "CdValue";
                cboStatus.SelectedIndex     = 0;

                List <AllCode_Info> _lst_c_type = DBMemory.AllCode_GetBy_CdNameCdType("ESTATE", "TYPE");
                _lst_c_type.Insert(0, _AllCode_Info);
                cboType.ItemsSource       = _lst_c_type;
                cboType.DisplayMemberPath = "Content";
                cboType.SelectedValuePath = "CdValue";
                cboType.SelectedIndex     = 0;
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 4
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;

                AllCode_Info _AllCode_Info1 = new AllCode_Info();
                _AllCode_Info1.Content = "HĐ sắp hết hạn (thông báo)";
                _AllCode_Info1.CdValue = ((decimal)Enum_Contract_Status.Den_Han_Thong_Bao).ToString();

                List <AllCode_Info> _lst_c_Status = DBMemory.AllCode_GetBy_CdNameCdType("CONTRACT", "STATUS");
                _lst_c_Status.Insert(0, _AllCode_Info);
                _lst_c_Status.Add(_AllCode_Info1);

                cboStatus.ItemsSource       = _lst_c_Status;
                cboStatus.DisplayMemberPath = "Content";
                cboStatus.SelectedValuePath = "CdValue";
                cboStatus.SelectedIndex     = 0;
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 5
0
        void Search()
        {
            try
            {
                Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

                c_lst = c_Contract_Controller.Contract_Search_ByContract_Type(((decimal)Enum_Contract_Type.Tenant).ToString(), CommonData.c_All_Value,
                                                                              CommonData.c_All_Value, CommonData.c_All_Value, "-1");

                #region Tìm theo trạng thái thanh toán phí

                if (cboFee.SelectedValue.ToString() != CommonData.c_All_Value)
                {
                    List <Contract_Info> _tem = new List <Contract_Info>();

                    if (cboFee.SelectedValue.ToString() == ((decimal)Enum_HanFee.QuaHan).ToString())
                    {
                        foreach (Contract_Info item in c_lst)
                        {
                            if (DBMemory.KiemTra_QuaHan_ThanhToan(item.Contract_Id))
                            {
                                _tem.Add(item);
                            }
                        }
                    }
                    else
                    {
                        foreach (Contract_Info item in c_lst)
                        {
                            if (DBMemory.KiemTra_SapDenHan_ThanhToan(item.Contract_Id))
                            {
                                _tem.Add(item);
                            }
                        }
                    }

                    c_lst = _tem;
                }

                #endregion

                Mouse.OverrideCursor    = null;
                dgrContract.ItemsSource = c_lst;
                DataGridHelper.NVSFocus(dgrContract, 0, 0);
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = null;
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 6
0
 void LoadData()
 {
     try
     {
         List <AllCode_Info> _lst_Currency = DBMemory.AllCode_GetBy_CdNameCdType("CUSTOMER", "TYPE");
         cboType.ItemsSource       = _lst_Currency;
         cboType.DisplayMemberPath = "Content";
         cboType.SelectedValuePath = "CdValue";
         cboType.SelectedIndex     = 0;
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
     }
 }
        void LoadData()
        {
            try
            {
                //List<Estate_Object_Info> _lst = _Estate_Object_Controller.Estate_Object_GetCbo((decimal)Enum_Contract_Type.Renter);

                //cboChose_Estate_Object.ItemsSource = _lst;
                //cboChose_Estate_Object.DisplayMemberPath = "Estate_Name";
                //cboChose_Estate_Object.SelectedValuePath = "Estate_Id";
                //cboChose_Estate_Object.SelectedIndex = 0;

                List <AllCode_Info> _lst_Currency = DBMemory.AllCode_GetBy_CdNameCdType("CONTRACT", "CURENCY");
                cboCurrency.ItemsSource       = _lst_Currency;
                cboCurrency.DisplayMemberPath = "Content";
                cboCurrency.SelectedValuePath = "CdValue";
                cboCurrency.SelectedIndex     = 0;

                //decimal _contract_id = _Contract_Controller.Get_Max_Contract_Id();
                //string _str_contract_id = "";
                ////00001
                //if (_contract_id < 10)
                //{
                //    _str_contract_id = "0000" + _contract_id.ToString();
                //}
                //else if (_contract_id <= 99)
                //{
                //    _str_contract_id = "000" + _contract_id.ToString();
                //}
                //else if (_contract_id <= 999)
                //{
                //    _str_contract_id = "00" + _contract_id.ToString();
                //}
                //else if (_contract_id <= 9999)
                //{
                //    _str_contract_id = "0" + _contract_id.ToString();
                //}
                //else
                //{
                //    _str_contract_id = _contract_id.ToString();
                //}

                txtContract_Code.Text = "SIVN/HDMG_";
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 8
0
        private void UserLogin()
        {
            try
            {
                tblError.Visibility = Visibility.Collapsed;
                if (c_LoadCommonDataStatus != 2)
                {
                    return;
                }

                User_Controller _User_Controller = new User_Controller();

                User_Info _User_Info = _User_Controller.User_Login(txtUsername.Text, txtPassword.Text);

                if (_User_Info == null)
                {
                    NoteBox.Show("Sai tên đăng nhập hoặc mật khẩu", "", NoteBoxLevel.Error);
                    txtPassword.Focus();
                    return;
                }

                _User_Controller.User_Update_Last_Login(_User_Info.User_Id, DateTime.Now);

                System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
                config.AppSettings.Settings.Remove("LastestUser");
                config.AppSettings.Settings.Add("LastestUser", _User_Info.User_Name);

                config.AppSettings.Settings.Remove("Password");
                config.AppSettings.Settings.Add("Password", txtPassword.Text);

                config.Save(System.Configuration.ConfigurationSaveMode.Modified);
                System.Configuration.ConfigurationManager.RefreshSection("appSettings");

                CommonData.c_Urser_Info = _User_Info;

                DBMemory.LoadFunctionUsers();

                this.DialogResult = true;
                this.Close();
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                NoteBox.Show("Đăng nhập thất bại", "Thông báo");
            }
        }
Esempio n. 9
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());
            }
        }
Esempio n. 10
0
        void LoadCombobox()
        {
            try
            {
                List <AllCode_Info> _lst_Status = DBMemory.AllCode_GetBy_CdNameCdType("ESTATE", "STATUS");
                cboStatus.ItemsSource       = _lst_Status;
                cboStatus.DisplayMemberPath = "Content";
                cboStatus.SelectedValuePath = "CdValue";
                cboStatus.SelectedIndex     = 0;

                List <AllCode_Info> _lst_Type = DBMemory.AllCode_GetBy_CdNameCdType("ESTATE", "TYPE");
                cboType.ItemsSource       = _lst_Type;
                cboType.DisplayMemberPath = "Content";
                cboType.SelectedValuePath = "CdValue";
                cboType.SelectedIndex     = 0;
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 11
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());
            }
        }
Esempio n. 12
0
        void Delete_Contract()
        {
            try
            {
                c_row_select = dgrRenter.SelectedIndex;
                Customer_Info _Customer_Info = (Customer_Info)dgrRenter.SelectedItem;

                if (_Customer_Info == null)
                {
                    return;
                }

                if (c_Customer_Controller.Customer_Check_In_Contract(_Customer_Info.Customer_Id) == false)
                {
                    NoteBox.Show("Tồn tại khách hàng trong hợp đồng, không thể xóa", "", NoteBoxLevel.Error);
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn xóa khách hàng này hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes == result)
                {
                    if (c_Customer_Controller.Customer_Delete(_Customer_Info.Customer_Id))
                    {
                        NoteBox.Show("Xóa dữ liệu thành công");
                        Search();
                        DBMemory.LoadFeeRender();
                    }
                }
                else
                {
                    DataGridHelper.NVSFocus(dgrRenter, c_row_select, 0);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 13
0
        void Insert_Customer()
        {
            try
            {
                Customer_Insert _Customer_Insert = new Customer_Insert();
                _Customer_Insert.Owner = Window.GetWindow(this);
                _Customer_Insert.ShowDialog();

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

                    Search();

                    DBMemory.LoadFeeRender();

                    for (int i = 0; i < c_lst.Count; i++)
                    {
                        Customer_Info ui = (Customer_Info)c_lst[i];
                        if (ui.Customer_Id == _Customer_Insert.c_id_insert)
                        {
                            c_row_select = i;
                            _Customer_Insert.c_id_insert = 0;
                            break;
                        }
                    }
                }

                Mouse.OverrideCursor = null;
                DataGridHelper.NVSFocus(dgrRenter, c_row_select, 0);
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = null;
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 14
0
        void Payment_Contract()
        {
            try
            {
                c_row_select = dgrContract.SelectedIndex;
                Contract_Info _Contract_Info = (Contract_Info)dgrContract.SelectedItem;

                if (_Contract_Info == null)
                {
                    return;
                }

                Tenant_Payment _Tenant_Payment = new Tenant_Payment();
                _Tenant_Payment.Owner = Window.GetWindow(this);

                _Tenant_Payment.c_Contract_Info = _Contract_Info;
                _Tenant_Payment.ShowDialog();

                if (_Tenant_Payment.c_ok == true)
                {
                    Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

                    Search();

                    DBMemory.LoadFeeTenant();

                    Mouse.OverrideCursor = null;
                }

                DataGridHelper.NVSFocus(dgrContract, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 15
0
        void LoadData()
        {
            try
            {
                List <AllCode_Info> _lst_Currency = DBMemory.AllCode_GetBy_CdNameCdType("CUSTOMER", "TYPE");
                cboType.ItemsSource       = _lst_Currency;
                cboType.DisplayMemberPath = "Content";
                cboType.SelectedValuePath = "CdValue";
                cboType.SelectedIndex     = 0;

                txtCustomer_Name.Text = c_Customer_Info.Customer_Name;
                txtAddress.Text       = c_Customer_Info.Address;
                txtPhone.Text         = c_Customer_Info.Phone;
                txtFax.Text           = c_Customer_Info.Fax;
                txtTaxCode.Text       = c_Customer_Info.Tax_Code;
                txtIdentity_Card.Text = c_Customer_Info.Identity_Card;

                cboType.SelectedValue = c_Customer_Info.Is_Person;
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 16
0
        void Search()
        {
            try
            {
                Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

                string _code = txtCode.Text.ToUpper();

                if (_code == "")
                {
                    _code = CommonData.c_All_Value;
                }

                string _Building = "-1";
                if (cboBuilding.Text != CommonData.c_All_Content)
                {
                    _Building = cboBuilding.SelectedValue.ToString();
                }

                c_lst = c_Contract_Controller.Contract_Search_ByContract_Type(_tenant, _code, cboStatus.SelectedValue.ToString(), CommonData.c_All_Value, _Building);

                #region Tìm theo tên bên YC môi giới
                if (txtObject_Name.Text != "")
                {
                    List <Contract_Info> _tem = new List <Contract_Info>();
                    foreach (Contract_Info item in c_lst)
                    {
                        if (item.Object_Name.ToUpper().Contains(txtObject_Name.Text.ToUpper()))
                        {
                            _tem.Add(item);
                        }
                    }

                    c_lst = _tem;
                }
                #endregion

                #region Tìm theo trạng thái thanh toán phí

                if (cboFee.SelectedValue.ToString() != CommonData.c_All_Value)
                {
                    List <Contract_Info> _tem = new List <Contract_Info>();

                    if (cboFee.SelectedValue.ToString() == ((decimal)Enum_HanFee.QuaHan).ToString())
                    {
                        foreach (Contract_Info item in c_lst)
                        {
                            if (DBMemory.KiemTra_QuaHan_ThanhToan(item.Contract_Id))
                            {
                                _tem.Add(item);
                            }
                        }
                    }
                    else
                    {
                        foreach (Contract_Info item in c_lst)
                        {
                            if (DBMemory.KiemTra_SapDenHan_ThanhToan(item.Contract_Id))
                            {
                                _tem.Add(item);
                            }
                        }
                    }

                    c_lst = _tem;
                }

                #endregion

                Mouse.OverrideCursor = null;

                dgrContract.ItemsSource = c_lst;
                DataGridHelper.NVSFocus(dgrContract, 0, 0);
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = null;
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 17
0
        void LoadData()
        {
            try
            {
                List <AllCode_Info> _lst_C_T = DBMemory.AllCode_GetBy_CdNameCdType("CONTRACT", "STATUS");

                cboStatus.ItemsSource       = _lst_C_T;
                cboStatus.DisplayMemberPath = "Content";
                cboStatus.SelectedValuePath = "CdValue";

                List <AllCode_Info> _lst_Currency = DBMemory.AllCode_GetBy_CdNameCdType("CONTRACT", "CURENCY");
                cboCurrency.ItemsSource       = _lst_Currency;
                cboCurrency.DisplayMemberPath = "Content";
                cboCurrency.SelectedValuePath = "CdValue";

                Estate_Object_Info _Estate_Object_Info = _Estate_Object_Controller.Estate_Object_GetById(c_Contract_Info.Estate_Id, (decimal)Enum_Contract_Type.Renter);
                lbl_Estate_Name.Content      = _Estate_Object_Info.Estate_Name;
                lbl_Estate_Code.Content      = _Estate_Object_Info.Estate_Code;
                lbl_Estate_Type_Name.Content = _Estate_Object_Info.Estate_Type_Name;
                lbl_Estate_Area.Content      = _Estate_Object_Info.Area;
                lbl_Address.Content          = _Estate_Object_Info.Address;

                Customer_Info _Customer_Info = c_Customer_Controller.Customer_GetById(c_Contract_Info.Object_Id);
                if (_Customer_Info != null)
                {
                    txtRenter_Name.Text   = _Customer_Info.Customer_Name;
                    txtAddress.Text       = _Customer_Info.Address;
                    txtPhone.Text         = _Customer_Info.Phone;
                    txtFax.Text           = _Customer_Info.Fax;
                    txtRepresentive.Text  = c_Contract_Info.Representive;
                    txtUsers.Text         = c_Contract_Info.Users;
                    txtTaxCode.Text       = _Customer_Info.Tax_Code;
                    txtIdentity_Card.Text = _Customer_Info.Identity_Card;
                }

                txtContract_Code.Text     = c_Contract_Info.Contract_Code;
                txtContract_Name.Text     = c_Contract_Info.Contract_Name;
                dpContractDate.Text       = c_Contract_Info.Contract_Date.ToString("dd/MM/yyyy");
                txtPrice.Text             = c_Contract_Info.Price.ToString("#,##0.#");
                cboCurrency.SelectedValue = c_Contract_Info.Currency;

                #region Fee VND
                if (c_Contract_Info.Currency == (decimal)Enum_Contract_Currency.USD)
                {
                    if (c_Contract_Info.Status == (decimal)Enum_Contract_Status.Gia_Han)
                    {
                        lblThanhTien_Extend.Visibility = Visibility.Visible;
                        txtFee_Vnd_Extend.Visibility   = Visibility.Visible;
                        lblVND_Extend.Visibility       = Visibility.Visible;

                        lblThanhTien.Visibility = Visibility.Collapsed;
                        txtFee_Vnd.Visibility   = Visibility.Collapsed;
                        lblVND.Visibility       = Visibility.Collapsed;
                    }
                    else
                    {
                        lblThanhTien.Visibility = Visibility.Visible;
                        txtFee_Vnd.Visibility   = Visibility.Visible;
                        lblVND.Visibility       = Visibility.Visible;

                        lblThanhTien_Extend.Visibility = Visibility.Collapsed;
                        txtFee_Vnd_Extend.Visibility   = Visibility.Collapsed;
                        lblVND_Extend.Visibility       = Visibility.Collapsed;
                    }
                }
                else
                {
                    lblThanhTien.Visibility = Visibility.Collapsed;
                    txtFee_Vnd.Visibility   = Visibility.Collapsed;
                    lblVND.Visibility       = Visibility.Collapsed;

                    lblThanhTien_Extend.Visibility = Visibility.Collapsed;
                    txtFee_Vnd_Extend.Visibility   = Visibility.Collapsed;
                    lblVND_Extend.Visibility       = Visibility.Collapsed;
                }
                #endregion

                dpFromDate.Text         = c_Contract_Info.Contract_FromDate.ToString("dd/MM/yyyy");
                dpToDate.Text           = c_Contract_Info.Contract_ToDate.ToString("dd/MM/yyyy");
                cboStatus.SelectedValue = c_Contract_Info.Status;

                txtFee.Text = c_Contract_Info.Fee.ToString("#,##0.#");

                List <Fees_Revenue_Info> c_lst_Fee        = new List <Fees_Revenue_Info>();
                List <Fees_Revenue_Info> c_lst_Fee_Extend = new List <Fees_Revenue_Info>();

                if (c_Contract_Info.Status == (decimal)Enum_Contract_Status.Gia_Han)
                {
                    Extend_Contract_Controller  _Extend_Contract_Controller = new Extend_Contract_Controller();
                    List <Extend_Contract_Info> _lst_ex = _Extend_Contract_Controller.Extend_Contract_GetByContractId(c_Contract_Info.Contract_Id);
                    if (_lst_ex.Count > 0)
                    {
                        txtFeeOnePay_Extend.Text = _lst_ex[0].FeeOnePay.ToString("#,##0.#");
                        txtFee_Extend.Text       = _lst_ex[0].Fee.ToString("#,##0.#");
                        dpFromDate_Extend.Text   = _lst_ex[0].Contract_FromDate.ToString("dd/MM/yyyy");
                        dpToDate_Extend.Text     = _lst_ex[0].Contract_ToDate.ToString("dd/MM/yyyy");
                    }

                    tabExtend.Visibility = Visibility.Visible;
                    List <Fees_Revenue_Info> _lst = _Fees_Revenue_Controller.Fees_Revenue_GetByContract(c_Contract_Info.Contract_Id);

                    foreach (Fees_Revenue_Info item in _lst)
                    {
                        if (item.Is_Extend == 1)
                        {
                            c_lst_Fee_Extend.Add(item);
                        }
                        else
                        {
                            c_lst_Fee.Add(item);
                        }
                    }

                    txtFee_Vnd_Extend.Text             = c_lst_Fee_Extend[c_lst_Fee_Extend.Count - 1].Fee_Vnd.ToString("#,##0.#");
                    txtFee_Vnd_Extend.Focusable        = false;
                    txtFee_Vnd_Extend.IsHitTestVisible = false;
                }
                else
                {
                    tabExtend.Visibility = Visibility.Collapsed;
                    c_lst_Fee            = _Fees_Revenue_Controller.Fees_Revenue_GetByContract(c_Contract_Info.Contract_Id);
                    txtFee_Vnd.Text      = c_lst_Fee[c_lst_Fee.Count - 1].Fee_Vnd.ToString("#,##0.#");

                    txtFee_Vnd.Focusable        = false;
                    txtFee_Vnd.IsHitTestVisible = false;
                }

                dgrFee.ItemsSource        = c_lst_Fee;
                dgrFee_Extend.ItemsSource = c_lst_Fee_Extend;
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 18
0
        void LoadData()
        {
            try
            {
                List <AllCode_Info> _lst_Currency = DBMemory.AllCode_GetBy_CdNameCdType("CONTRACT", "CURENCY");
                cboCurrency.ItemsSource       = _lst_Currency;
                cboCurrency.DisplayMemberPath = "Content";
                cboCurrency.SelectedValuePath = "CdValue";

                List <AllCode_Info> _lst_Term = DBMemory.AllCode_GetBy_CdNameCdType("FEE", "TERM");
                cboTerm.ItemsSource       = _lst_Term;
                cboTerm.DisplayMemberPath = "Content";
                cboTerm.SelectedValuePath = "CdValue";

                cboTerm_Extend.ItemsSource       = _lst_Term;
                cboTerm_Extend.DisplayMemberPath = "Content";
                cboTerm_Extend.SelectedValuePath = "CdValue";

                List <AllCode_Info> _lst_C_T = DBMemory.AllCode_GetBy_CdNameCdType("CONTRACT", "STATUS");

                cboStatus.ItemsSource       = _lst_C_T;
                cboStatus.DisplayMemberPath = "Content";
                cboStatus.SelectedValuePath = "CdValue";

                Estate_Object_Info _Estate_Object_Info = _Estate_Object_Controller.Estate_Object_GetById(c_Contract_Info.Estate_Id, (decimal)Enum_Contract_Type.Tenant);
                if (_Estate_Object_Info != null)
                {
                    lbl_Estate_Name.Content      = _Estate_Object_Info.Estate_Name;
                    lbl_Estate_Code.Content      = _Estate_Object_Info.Estate_Code;
                    lbl_Estate_Type_Name.Content = _Estate_Object_Info.Estate_Type_Name;
                    lbl_Estate_Area.Content      = _Estate_Object_Info.Area;
                    lbl_Address.Content          = _Estate_Object_Info.Address;
                }

                Customer_Info _Customer_Info = c_Customer_Controller.Customer_GetById(c_Contract_Info.Object_Id);
                if (_Customer_Info != null)
                {
                    txtRenter_Name.Text   = _Customer_Info.Customer_Name;
                    txtAddress.Text       = _Customer_Info.Address;
                    txtPhone.Text         = _Customer_Info.Phone;
                    txtFax.Text           = _Customer_Info.Fax;
                    txtPosition.Text      = _Customer_Info.Position;
                    txtTaxCode.Text       = _Customer_Info.Tax_Code;
                    txtIdentity_Card.Text = _Customer_Info.Identity_Card;
                }

                txtRepresentive.Text = c_Contract_Info.Representive;
                txtUsers.Text        = c_Contract_Info.Users;

                txtContract_Code.Text     = c_Contract_Info.Contract_Code;
                dpContractDate.Text       = c_Contract_Info.Contract_Date.ToString("dd/MM/yyyy");
                cboCurrency.SelectedValue = c_Contract_Info.Currency;
                dpFromDate.Text           = c_Contract_Info.Contract_FromDate.ToString("dd/MM/yyyy");
                dpToDate.Text             = c_Contract_Info.Contract_ToDate.ToString("dd/MM/yyyy");
                txtFee.Text             = c_Contract_Info.Fee.ToString("#,##0.#");
                txtPrice.Text           = c_Contract_Info.Price.ToString("#,##0.#");
                cboTerm.SelectedValue   = c_Contract_Info.Term;
                cboStatus.SelectedValue = c_Contract_Info.Status;


                c_max_number_extend = _Extend_Contract_Controller.Get_Number_ExtendContract(c_Contract_Info.Contract_Id);

                List <Extend_Contract_Info> _lst_ex = new List <Extend_Contract_Info>();
                if (c_max_number_extend == 0)
                {
                    tabExtendInfo.Visibility = Visibility.Collapsed;
                }
                else
                {
                    tabExtendInfo.Visibility = Visibility.Visible;
                    _lst_ex = _Extend_Contract_Controller.Extend_Contract_GetByContractId(c_Contract_Info.Contract_Id);

                    dgrExtend.ItemsSource = _lst_ex;
                }

                List <Fees_Revenue_Info> c_lst_Fee        = new List <Fees_Revenue_Info>();
                List <Fees_Revenue_Info> c_lst_Fee_Extend = new List <Fees_Revenue_Info>();

                if (c_Contract_Info.Status == (decimal)Enum_Contract_Status.Gia_Han)
                {
                    if (_lst_ex.Count > 0)
                    {
                        txtFeeOnePay_Extend.Text     = _lst_ex[0].FeeOnePay.ToString("#,##0.#");
                        txtFee_Extend.Text           = _lst_ex[0].Fee.ToString("#,##0.#");
                        dpFromDate_Extend.Text       = _lst_ex[0].Contract_FromDate.ToString("dd/MM/yyyy");
                        dpToDate_Extend.Text         = _lst_ex[0].Contract_ToDate.ToString("dd/MM/yyyy");
                        cboTerm_Extend.SelectedValue = _lst_ex[0].Term;
                    }

                    tabExtend.Visibility = Visibility.Visible;
                    List <Fees_Revenue_Info> _lst = _Fees_Revenue_Controller.Fees_Revenue_GetByContract(c_Contract_Info.Contract_Id);

                    foreach (Fees_Revenue_Info item in _lst)
                    {
                        if (item.Is_Extend == c_max_number_extend)
                        {
                            c_lst_Fee_Extend.Add(item);
                        }
                        else
                        {
                            c_lst_Fee.Add(item);
                        }
                    }
                }
                else
                {
                    tabExtend.Visibility = Visibility.Collapsed;
                    c_lst_Fee            = _Fees_Revenue_Controller.Fees_Revenue_GetByContract(c_Contract_Info.Contract_Id);
                }

                dgrFee.ItemsSource        = c_lst_Fee;
                dgrFee_Extend.ItemsSource = c_lst_Fee_Extend;
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }