private void btnChoseEstate_Click(object sender, RoutedEventArgs e) { try { Chose_Estate_Object _Chose_Estate_Object = new Chose_Estate_Object(); _Chose_Estate_Object.Owner = Window.GetWindow(this); _Chose_Estate_Object.ShowDialog(); if (_Chose_Estate_Object.c_ok == 1) { c_Estate_Object_Info_Search = _Chose_Estate_Object.c_Estate_Object_Info_Search; txtChose_Estate_Object.Text = c_Estate_Object_Info_Search.Estate_Code; lbl_Estate_Name.Content = c_Estate_Object_Info_Search.Estate_Name; lbl_Estate_Type_Name.Content = c_Estate_Object_Info_Search.Estate_Type_Name; lbl_Estate_Code.Content = c_Estate_Object_Info_Search.Estate_Code; lbl_Estate_Area.Content = c_Estate_Object_Info_Search.Area; lbl_Address.Content = c_Estate_Object_Info_Search.Address; } } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
void Accept() { try { if (Estate_Checkvalidate() == false) { return; } Estate_Object_Info _Estate_Object_Info = new Estate_Object_Info(); _Estate_Object_Info.Estate_Name = txt_Estate_Name.Text; _Estate_Object_Info.Note = txtNote.Text; _Estate_Object_Info.Area = txt_Estate_Area.Text; _Estate_Object_Info.Estate_Type = Convert.ToDecimal(cboType.SelectedValue); _Estate_Object_Info.Status = Convert.ToDecimal(cboStatus.SelectedValue); _Estate_Object_Info.Building_Id = c_Building_Info_Search.Building_Id; _Estate_Object_Info.Estate_Code = txt_Estate_Code.Text; decimal _estate_id = c_Estate_Object_Controller.Estate_Object_Insert(_Estate_Object_Info); if (_estate_id == -1) { NoteBox.Show("Lỗi thêm mới đối tượng bất động sản", "", NoteBoxLevel.Error); return; } c_id_insert = _estate_id; NoteBox.Show("Thêm mới dữ liệu thành công", ""); this.Close(); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
void View() { try { c_row_select = dgrEstate.SelectedIndex; Estate_Object_Info _Estate_Object_Info = (Estate_Object_Info)dgrEstate.SelectedItem; if (_Estate_Object_Info == null) { return; } View_Estate_Object _View_Estate_Object = new View_Estate_Object(); _View_Estate_Object.Owner = Window.GetWindow(this); _View_Estate_Object.c_Estate_Object_Info = _Estate_Object_Info; _View_Estate_Object.ShowDialog(); DataGridHelper.NVSFocus(dgrEstate, c_row_select, 0); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
void Accept() { try { if (Estate_Checkvalidate() == false) { return; } Estate_Object_Info _Estate_Object_Info = new Estate_Object_Info(); _Estate_Object_Info.Estate_Name = txt_Estate_Name.Text; _Estate_Object_Info.Note = txtNote.Text; _Estate_Object_Info.Area = txt_Estate_Area.Text; _Estate_Object_Info.Estate_Type = Convert.ToDecimal(cboType.SelectedValue); _Estate_Object_Info.Status = Convert.ToDecimal(cboStatus.SelectedValue); if (c_Estate_Object_Controller.Estate_Object_Update(c_Estate_Object_Info.Estate_Id, _Estate_Object_Info) == false) { NoteBox.Show("Lỗi sửa đối tượng bất động sản", "", NoteBoxLevel.Error); return; } NoteBox.Show("Cập nhật dữ liệu thành công", ""); this.Close(); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
void Insert() { try { Create_Estate_Object _Create_Estate_Object = new Create_Estate_Object(); _Create_Estate_Object.Owner = Window.GetWindow(this); _Create_Estate_Object.ShowDialog(); if (_Create_Estate_Object.c_id_insert != 0) { LoadData(); for (int i = 0; i < c_lst.Count; i++) { Estate_Object_Info ui = (Estate_Object_Info)c_lst[i]; if (ui.Estate_Id == _Create_Estate_Object.c_id_insert) { c_row_select = i; _Create_Estate_Object.c_id_insert = 0; break; } } } DataGridHelper.NVSFocus(dgrEstate, c_row_select, 0); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
public decimal Estate_Object_Insert(Estate_Object_Info p_Estate_Object_Info) { try { return(CommonData.c_serviceWCF.Estate_Object_Insert(p_Estate_Object_Info.Estate_Name, p_Estate_Object_Info.Estate_Type, p_Estate_Object_Info.Area, p_Estate_Object_Info.Status, p_Estate_Object_Info.Note, p_Estate_Object_Info.Estate_Code, p_Estate_Object_Info.Building_Id)); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); return(-1); } }
public bool Estate_Object_Update(decimal p_Estate_Id, Estate_Object_Info p_Estate_Object_Info) { try { return(CommonData.c_serviceWCF.Estate_Object_Update(p_Estate_Id, p_Estate_Object_Info.Estate_Name, p_Estate_Object_Info.Estate_Type, p_Estate_Object_Info.Area, p_Estate_Object_Info.Status, p_Estate_Object_Info.Note)); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); return(false); } }
void DoubleClick(object sender, RoutedEventArgs e) { try { Estate_Object_Info _Estate_Object_Info = (Estate_Object_Info)dgrEstate.SelectedItem; if (_Estate_Object_Info != null) { c_Estate_Object_Info_Search = _Estate_Object_Info; c_ok = 1; this.Close(); } e.Handled = true; } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
void Export_Payment() { try { c_row_select = dgrContract.SelectedIndex; Contract_Info _Contract_Info = (Contract_Info)dgrContract.SelectedItem; if (_Contract_Info == null) { return; } List <Fees_Revenue_Info> _lst = _Fees_Revenue_Controller.Fees_Revenue_GetByContract(_Contract_Info.Contract_Id); Fees_Revenue_Info _Fees_Revenue_Info = new Fees_Revenue_Info(); bool _is_not_pay = false; // kiểm tra xem đã thanh toán hết chưa foreach (Fees_Revenue_Info item in _lst) { if (item.Pay_Status == (decimal)Enum_Fee_Status.No_Pay) { _is_not_pay = true; _Fees_Revenue_Info = item; break; } } if (_is_not_pay == false) { NoteBox.Show("Đã thanh toán hết, không thể yêu cầu thanh toán", "", NoteBoxLevel.Error); return; } Estate_Object_Info _Estate_Object_Info = _Estate_Object_Controller.Estate_Object_GetById(_Contract_Info.Estate_Id, (decimal)Enum_Contract_Type.Renter); Customer_Info _Customer_Info = _Customer_Controller.Customer_GetById(_Contract_Info.Object_Id); CommonFunction.Export_payment(_Contract_Info, _Customer_Info, _Estate_Object_Info, _Fees_Revenue_Info); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
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()); } }
void LoadCombobox() { try { AllCode_Info _AllCode_Info = new AllCode_Info(); _AllCode_Info.Content = CommonData.c_All_Content; _AllCode_Info.CdValue = CommonData.c_All_Value; Estate_Object_Controller _Estate_Object_Controller = new Estate_Object_Controller(); List <Estate_Object_Info> _lst_eb = _Estate_Object_Controller.Estate_Object_GetAll(); Estate_Object_Info _Estate_Object_Info = new Estate_Object_Info(); _Estate_Object_Info.Estate_Code = CommonData.c_All_Value; _Estate_Object_Info.Estate_Name = CommonData.c_All_Value; _lst_eb.Insert(0, _Estate_Object_Info); cboEsateCode.ItemsSource = _lst_eb; cboEsateCode.DisplayMemberPath = "Estate_Name"; cboEsateCode.SelectedValuePath = "Estate_Code"; cboEsateCode.SelectedIndex = 0; User_Controller c_User_Controller = new User_Controller(); List <User_Info> _lst_us = c_User_Controller.User_Get_All(); User_Info _User_Info = new User_Info(); _User_Info.User_Name = CommonData.c_All_Value; _User_Info.User_Name = CommonData.c_All_Value; _lst_us.Insert(0, _User_Info); cboCreatedBy.ItemsSource = _lst_us; cboCreatedBy.DisplayMemberPath = "User_Name"; cboCreatedBy.SelectedValuePath = "User_Name"; cboCreatedBy.SelectedIndex = 0; } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
void Export_Payment() { try { Fee_Report_Info _Fees_Revenue_Info = (Fee_Report_Info)dgrContract.SelectedItem; if (_Fees_Revenue_Info == null) { return; } Customer_Info _Customer_Info = _Customer_Controller.Customer_GetById(_Fees_Revenue_Info.Object_Id); Estate_Object_Info _Estate_Object_Info = _Estate_Object_Controller.Estate_Object_GetById(_Fees_Revenue_Info.Estate_Id, _Fees_Revenue_Info.Contract_Type); #region Kết xuất FlexCel.Report.FlexCelReport flcReport = new FlexCel.Report.FlexCelReport(); string _path = CommonData.ExcelDesignFilePath; string _fileExcelName = "Payment_Request_VND.xls"; if (_Fees_Revenue_Info.Currency == (decimal)Enum_Contract_Currency.USD) { _fileExcelName = "Payment_Request_USD.xls"; } _path += _fileExcelName; CommonFunction.SetValueExportByString(ref flcReport, "CurrentDate", DateTime.Now.ToString("dd/MM/yyyy")); CommonFunction.SetValueExportByString(ref flcReport, "Tenat_Name", _Customer_Info.Customer_Name); CommonFunction.SetValueExportByString(ref flcReport, "Address", _Customer_Info.Address); CommonFunction.SetValueExportByString(ref flcReport, "Users", _Fees_Revenue_Info.Users); CommonFunction.SetValueExportByString(ref flcReport, "TaxCode", _Customer_Info.Tax_Code); CommonFunction.SetValueExportByString(ref flcReport, "Estate_Name", _Estate_Object_Info.Estate_Name); CommonFunction.SetValueExportByString(ref flcReport, "Contract_FromDate", _Fees_Revenue_Info.Contract_FromDate.ToString("dd/MM/yyyy")); CommonFunction.SetValueExportByString(ref flcReport, "Contract_ToDate", _Fees_Revenue_Info.Contract_ToDate.ToString("dd/MM/yyyy")); //decimal _VAT_Fee = Math.Round(_Fees_Revenue_Info.Fee_Expected * 10 / 100); //decimal _Fee = _Fees_Revenue_Info.Fee_Expected - _VAT_Fee; //decimal _p = 110 / 100; //decimal _Fee = _Fees_Revenue_Info.Fee_Expected / _p; //decimal _VAT_Fee = Math.Round(_Fee * 10 / 100); decimal _Fee = (_Fees_Revenue_Info.Fee_Expected / 110) * 100; decimal _VAT_Fee = Math.Round(_Fee * 10 / 100); CommonFunction.SetValueExportByString(ref flcReport, "Fee", _Fee.ToString("###,##0")); CommonFunction.SetValueExportByString(ref flcReport, "VAT_Fee", _VAT_Fee.ToString("###,##0")); CommonFunction.SetValueExportByString(ref flcReport, "Total_Fee", _Fees_Revenue_Info.Fee_Expected.ToString("###,##0")); if (_Fees_Revenue_Info.Contract_Type == (decimal)Enum_Contract_Type.Tenant) { #region Kỳ thanh toán string _Kytt = "Thanh toán phí MG lần " + _Fees_Revenue_Info.Number_Payment + " từ ngày " + _Fees_Revenue_Info.HanChuyenTien.ToString("dd/MM/yyyy") + " đến ngày " + _Fees_Revenue_Info.HanChuyenTien.AddDays(30).ToString("dd/MM/yyyy"); if (_Fees_Revenue_Info.Term == (decimal)Enum_Fee_Maturity.One) { _Kytt = "Thanh toán phí MG lần " + _Fees_Revenue_Info.Number_Payment + " từ ngày " + _Fees_Revenue_Info.HanChuyenTien.ToString("dd/MM/yyyy") + " đến ngày " + _Fees_Revenue_Info.HanChuyenTien.AddDays(30).ToString("dd/MM/yyyy"); } else if (_Fees_Revenue_Info.Term == (decimal)Enum_Fee_Maturity.One_Month) { _Kytt = "Thanh toán phí MG lần " + _Fees_Revenue_Info.Number_Payment + " từ ngày " + _Fees_Revenue_Info.HanChuyenTien.ToString("dd/MM/yyyy") + " đến ngày " + _Fees_Revenue_Info.HanChuyenTien.AddMonths(1).ToString("dd/MM/yyyy"); } else if (_Fees_Revenue_Info.Term == (decimal)Enum_Fee_Maturity.Three_Month) { _Kytt = "Thanh toán phí MG lần " + _Fees_Revenue_Info.Number_Payment + " từ ngày " + _Fees_Revenue_Info.HanChuyenTien.ToString("dd/MM/yyyy") + " đến ngày " + _Fees_Revenue_Info.HanChuyenTien.AddMonths(3).ToString("dd/MM/yyyy"); } else if (_Fees_Revenue_Info.Term == (decimal)Enum_Fee_Maturity.Six_Month) { _Kytt = "Thanh toán phí MG lần " + _Fees_Revenue_Info.Number_Payment + " từ ngày " + _Fees_Revenue_Info.HanChuyenTien.ToString("dd/MM/yyyy") + " đến ngày " + _Fees_Revenue_Info.HanChuyenTien.AddMonths(6).ToString("dd/MM/yyyy"); } else if (_Fees_Revenue_Info.Term == (decimal)Enum_Fee_Maturity.One_Year) { _Kytt = "Thanh toán phí MG lần " + _Fees_Revenue_Info.Number_Payment + " từ ngày " + _Fees_Revenue_Info.HanChuyenTien.ToString("dd/MM/yyyy") + " đến ngày " + _Fees_Revenue_Info.HanChuyenTien.AddYears(1).ToString("dd/MM/yyyy"); } CommonFunction.SetValueExportByString(ref flcReport, "KyThanhToan", _Kytt); #endregion } else { CommonFunction.SetValueExportByString(ref flcReport, "KyThanhToan", ""); } DateTime _dt_from = DateTime.Now; DateTime _dt_To = _dt_from.AddDays(30); CommonFunction.SetValueExportByString(ref flcReport, "From", _dt_from.ToString("dd/MM/yyyy")); CommonFunction.SetValueExportByString(ref flcReport, "To", _dt_To.ToString("dd/MM/yyyy")); //CommonFunction.SetValueExportByString(ref flcReport, "From", _Fees_Revenue_Info.HanChuyenTien.ToString("dd/MM/yyyy")); //CommonFunction.SetValueExportByString(ref flcReport, "To", _Fees_Revenue_Info.HanChuyenTien.AddDays(30).ToString("dd/MM/yyyy")); if (_Fees_Revenue_Info.Price != 0) { CommonFunction.SetValueExportByString(ref flcReport, "Price", _Fees_Revenue_Info.Price.ToString("###,##0")); } else { CommonFunction.SetValueExportByString(ref flcReport, "Price", ""); } string _tienBangChu = ConvertData.ConvertMoneyToStr(Convert.ToDouble(_Fees_Revenue_Info.Fee_Expected)); if (_Fees_Revenue_Info.Currency == (decimal)Enum_Contract_Currency.USD) { _tienBangChu = c_Contract_Controller.Convert_Dola(_Fees_Revenue_Info.Fee_Expected); } if (_Fees_Revenue_Info.Currency == (decimal)Enum_Contract_Currency.USD) { CommonFunction.SetValueExportByString(ref flcReport, "VND", _Fees_Revenue_Info.Fee_Vnd.ToString("###,##0")); } CommonFunction.SetValueExportByString(ref flcReport, "BangChu", _tienBangChu.ToLower()); System.Windows.Forms.SaveFileDialog saveReport = new System.Windows.Forms.SaveFileDialog(); saveReport.Filter = "Excel files (*.xls)|*.xls"; if (saveReport.ShowDialog() == System.Windows.Forms.DialogResult.OK) { CommonFunction.ExportExcel(flcReport, _path, saveReport); } #endregion } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
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()); } }
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()); } }