Esempio n. 1
0
 public decimal Customer_Insert(Customer_Info p_Customer_Info)
 {
     try
     {
         return(CommonData.c_serviceWCF.Customer_Insert(p_Customer_Info.Customer_Name, p_Customer_Info.Phone, p_Customer_Info.Fax, p_Customer_Info.Identity_Card,
                                                        p_Customer_Info.Address, p_Customer_Info.Tax_Code, p_Customer_Info.Customer_Type, p_Customer_Info.Is_Person, p_Customer_Info.Position));
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
         return(-1);
     }
 }
Esempio n. 2
0
        // GET: Customer_Info/Edit/5
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer_Info customer_Info = await db.Customer_Info.FindAsync(id);

            if (customer_Info == null)
            {
                return(HttpNotFound());
            }
            return(View(customer_Info));
        }
Esempio n. 3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     using (projectEntities1 context = new projectEntities1())
     {
         Customer_Info _insert = new Customer_Info();
         _insert.Customer_Name     = TextBox1.Text;
         _insert.Email             = TextBox2.Text;
         _insert.Customer_Password = TextBox3.Text;
         _insert.Phone_No          = Decimal.Parse(TextBox4.Text);
         context.Customer_Info.Add(_insert);
         context.SaveChanges();
     }
     Response.Redirect("Log-In.aspx");
 }
Esempio n. 4
0
        // GET: Customer_Info/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer_Info customer_Info = db.Customer_Info.Find(id);

            if (customer_Info == null)
            {
                return(HttpNotFound());
            }
            return(View(customer_Info));
        }
Esempio n. 5
0
        public decimal Customer_Insert(Customer_Info p_Customer_Info)
        {
            try
            {
                Traces_Log_Controllers _traceControler = new Traces_Log_Controllers();
                _traceControler.Trace_Insert("CUSTOMER", "INSERT", p_Customer_Info.Created_By, p_Customer_Info);

                return(CommonData.c_serviceWCF.Customer_Insert(p_Customer_Info.Customer_Name, p_Customer_Info.Phone, p_Customer_Info.Fax, p_Customer_Info.Identity_Card,
                                                               p_Customer_Info.Address, p_Customer_Info.Tax_Code, p_Customer_Info.Customer_Type, p_Customer_Info.Is_Person, p_Customer_Info.Position));
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(-1);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Tạo khách hàng mới theo tên, địa chỉ và số CMT
        /// </summary>
        /// <param name="custName">Tên đầy đủ khách hàng</param>
        /// <param name="custAdd">Địa chỉ khách hàng</param>
        /// <param name="custCert">số CMT hoặc hộ chiếu</param>
        /// <returns>=0 nếu không thành công
        /// #0 nếu thành công</returns>
        protected int Insert(string branch, string userlogin, string custName, string custAdd, string custCert)
        {
            var ci = new Customer_Info
            {
                ID           = GenerateNewCustId(),
                Name         = custName,
                Address      = custAdd,
                Cust_Cert    = custCert,
                Approved     = true,
                ApprovedTime = DateTime.Now,
                UserCreate   = userlogin,
                Branch_ID    = branch
            };

            return(Insert(ci));
        }
Esempio n. 7
0
        public int Insert_Auth(Customer_Info custInfo)
        {
            SetError(0, String.Empty);

            if (custInfo == null)
            {
                SetError(98, "Invalid data input");
                return(Error_Number);
            }
            if (string.IsNullOrEmpty(custInfo.ID))
            {
                SetError(98, "Customer Id is null or empty");
                return(Error_Number);
            }
            if (string.IsNullOrEmpty(custInfo.Name))
            {
                SetError(98, "Customer name is null or empty");
                return(Error_Number);
            }
            if (string.IsNullOrEmpty(custInfo.Cust_Cert))
            {
                SetError(98, "Customer identity card number is null or empty");
                return(Error_Number);
            }
            if (string.IsNullOrEmpty(custInfo.UserCreate))
            {
                SetError(98, "User Create is null or empty");
                return(Error_Number);
            }
            if (custInfo.Approved == true && custInfo.ApprovedTime < custInfo.DateCreated)
            {
                SetError(98, "Invalid ApprovedTime");
                return(Error_Number);
            }
            if (custInfo.DateCreated > custInfo.LastUpdate)
            {
                SetError(98, "Invalid DateCreated");
                return(Error_Number);
            }
            // Kiểm tra sự tồn tại của chứng minh nhân dân.
            if (base.GetCustomerByCert(custInfo.Cust_Cert) != null)
            {
                SetError(4, "Identity card number of duplicate");
                return(Error_Number);
            }
            return(Error_Number);
        }
Esempio n. 8
0
        public int Approved_Auth(string custId)
        {
            SetError(0, String.Empty);
            Customer_Info custInfo = base.GetCustomerById(custId);

            if (custInfo == null)
            {
                SetError(1, "Customer not find");
                return(Error_Number);
            }
            if (custInfo.Approved == true)
            {
                SetError(5, "Customer approved");
                return(Error_Number);
            }
            return(Error_Number);
        }
Esempio n. 9
0
        public bool Customer_Update(decimal Customer_Id, Customer_Info p_Customer_Info, Customer_Info p_old)
        {
            try
            {
                Traces_Log_Controllers _traceControler = new Traces_Log_Controllers();
                _traceControler.Trace_Insert("CUSTOMER", "UPDATE", p_Customer_Info.Modifi_By, p_Customer_Info, p_old);


                return(CommonData.c_serviceWCF.Customer_Update(Customer_Id, p_Customer_Info.Customer_Name, p_Customer_Info.Phone, p_Customer_Info.Fax, p_Customer_Info.Identity_Card,
                                                               p_Customer_Info.Address, p_Customer_Info.Tax_Code, p_Customer_Info.Customer_Type, p_Customer_Info.Is_Person, p_Customer_Info.Position));
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(false);
            }
        }
Esempio n. 10
0
        public new int Insert(Customer_Info custInfo)
        {
            int result = Insert_Auth(custInfo);

            if (result != 0)
            {
                return(result);
            }
            if (base.Insert(custInfo) != 0)
            {
                SetError(0, String.Empty);
            }
            else
            {
                SetError(99, _dalCust.GetException.Message);
            }
            return(Error_Number);
        }
Esempio n. 11
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
     {
         Customer_Info _Customer_Info = (Customer_Info)dgrProduct.SelectedItem;
         if (_Customer_Info != null)
         {
             c_Customer_Info_Search = _Customer_Info;
             c_ok = 1;
             this.Close();
         }
         e.Handled = true;
     }
     catch (Exception ex)
     {
         CommonData.log.Error(ex.ToString());
     }
 }
Esempio n. 12
0
        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());
            }
        }
Esempio n. 13
0
        private void btnSearchCustomer_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                frmSearch_Customer _frmSearch_Customer = new frmSearch_Customer();
                _frmSearch_Customer.Owner = Window.GetWindow(this);
                _frmSearch_Customer.ShowDialog();
                if (_frmSearch_Customer.c_ok == 1)
                {
                    c_Customer_Info       = _frmSearch_Customer.c_Customer_Info_Search;
                    txtCustomer_Name.Text = c_Customer_Info.Customer_Name;

                    txtPhone.Text   = c_Customer_Info.Phone;
                    txtAddress.Text = c_Customer_Info.Address;
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 14
0
 Customer_Info Get_Customer_Info()
 {
     try
     {
         Customer_Info _Customer_Info = new Customer_Info();
         _Customer_Info.Customer_Name = txtCustomer_Name.Text;
         _Customer_Info.Address       = txtAddress.Text;
         _Customer_Info.Phone         = txtPhone.Text;
         _Customer_Info.Identity_Card = txtIdentity_Card.Text;
         _Customer_Info.Fax           = txtFax.Text;
         _Customer_Info.Is_Person     = Convert.ToDecimal(cboType.SelectedValue);
         _Customer_Info.Tax_Code      = txtTaxCode.Text;
         _Customer_Info.Position      = txtPosition.Text;
         return(_Customer_Info);
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
         return(null);
     }
 }
Esempio n. 15
0
        int Insert_Customer()
        {
            try
            {
                decimal _kq = 0;

                Customer_Controller  _Customer_Controller = new Customer_Controller();
                List <Customer_Info> _lst = _Customer_Controller.Search_Customer(txtCustomer_Name.Text, txtPhone.Text);

                if (_lst.Count == 0)
                {
                    Customer_Info _Customer_Info = new Customer_Info();
                    _Customer_Info.Customer_Name = txtCustomer_Name.Text;
                    _Customer_Info.Phone         = txtPhone.Text;
                    _Customer_Info.Address       = txtAddress.Text;

                    if (!_Customer_Controller.Customer_Insert(_Customer_Info, ref _kq))
                    {
                        // Thêm mới
                        NoteBox.Show("Lỗi rồi Nắng. Thêm mới khách hàng ko thành công", "", NoteBoxLevel.Error);
                        return(-1);
                    }
                    else
                    {
                        return(Convert.ToInt32(_kq));
                    }
                }
                else if (_lst.Count == 1)
                {
                    return(_lst[0].Customer_Id);
                }

                return(Convert.ToInt32(_kq));
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(-1);
            }
        }
Esempio n. 16
0
 Customer_Info Get_Customer_Info()
 {
     try
     {
         Customer_Info _Customer_Info = new Customer_Info();
         _Customer_Info.Customer_Name = txtRenter_Name.Text;
         _Customer_Info.Address       = txtAddress.Text;
         _Customer_Info.Phone         = txtPhone.Text;
         _Customer_Info.Identity_Card = txtIdentity_Card.Text;
         _Customer_Info.Fax           = txtFax.Text;
         _Customer_Info.Customer_Type = (decimal)Enum_Contract_Type.Tenant;
         _Customer_Info.Is_Person     = 0;
         _Customer_Info.Tax_Code      = txtTaxCode.Text;
         _Customer_Info.Position      = txtPosition.Text;
         return(_Customer_Info);
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
         return(null);
     }
 }
Esempio n. 17
0
        void Accept()
        {
            try
            {
                if (Customer_CheckValidate() == false)
                {
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn có muốn thêm khách hàng này hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes != result)
                {
                    return;
                }


                Customer_Info _Customer_Info = Get_Customer_Info();
                if (_Customer_Info == null)
                {
                    NoteBox.Show("Lỗi khởi tạo khách thuê nhà", "", NoteBoxLevel.Error);
                    return;
                }

                if (c_Customer_Controller.Customer_Update(c_Customer_Info.Customer_Id, _Customer_Info, c_Customer_Info) == false)
                {
                    NoteBox.Show("Lỗi cập nhật mới khách thuê nhà", "", NoteBoxLevel.Error);
                    return;
                }

                c_id_insert = c_Customer_Info.Customer_Id;
                NoteBox.Show("Sửa dữ liệu thành công", "");

                this.Close();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 18
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. 19
0
        void Customer_Update()
        {
            c_row_select = dgrCustomer.SelectedIndex;
            Customer_Info _Customer_Info = (Customer_Info)dgrCustomer.SelectedItem;

            if (_Customer_Info == null)
            {
                return;
            }
            frmCreate_Customer _frmCreate_Customer = new frmCreate_Customer();

            _frmCreate_Customer.c_type          = Convert.ToInt16(Form_Type.Update);
            _frmCreate_Customer.c_Customer_Info = _Customer_Info;
            _frmCreate_Customer.Owner           = Window.GetWindow(this);
            _frmCreate_Customer.ShowDialog();

            if (_frmCreate_Customer.c_id_insert != 0)
            {
                LoadData();
            }

            DataGridHelper.NVSFocus(dgrCustomer, c_row_select, 0);
        }
Esempio n. 20
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. 21
0
        void Customer_View()
        {
            try
            {
                c_row_select = dgrCustomer.SelectedIndex;
                Customer_Info _Customer_Info = (Customer_Info)dgrCustomer.SelectedItem;

                if (_Customer_Info == null)
                {
                    return;
                }

                View_Customer_Product _View_Customer_Product = new View_Customer_Product();
                _View_Customer_Product.c_Customer_Info = _Customer_Info;
                _View_Customer_Product.Owner           = Window.GetWindow(this);
                _View_Customer_Product.ShowDialog();

                DataGridHelper.NVSFocus(dgrCustomer, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 22
0
 public static int Update(Customer_Info obj)
 {
     return(dal_cust.Update(obj));
 }
Esempio n. 23
0
 public static int Insert(Customer_Info obj)
 {
     return(dal_cust.Insert(obj));
 }
Esempio n. 24
0
        void Accept()
        {
            try
            {
                if (Tenat_CheckValidate() == false)
                {
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn có muốn thêm hợp đồng này hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes != result)
                {
                    return;
                }

                #region Thêm mới khách hàng
                Customer_Info _Customer_Info = Get_Customer_Info();
                if (_Customer_Info == null)
                {
                    NoteBox.Show("Lỗi khởi tạo khách cho thuê nhà", "", NoteBoxLevel.Error);
                    return;
                }
                decimal _customer_id = -1;

                // kiểm tra xem thằng tên khách hàng đó và số đt đó đã có trong db chưa
                // nếu có rồi thì ko insert nữa
                string _name = txtRenter_Name.Text.ToUpper();
                if (_name == "")
                {
                    _name = CommonData.c_All_Value;
                }

                string _phone = txtPhone.Text.ToUpper();
                if (_phone == "")
                {
                    _phone = CommonData.c_All_Value;
                }

                List <Customer_Info> _lst = c_Customer_Controller.Customer_Search(_name, _phone);

                if (_lst.Count > 0)
                {
                    // có rồi thì sử dụng luôn
                    // update ngược thông tin lại
                    if (c_Customer_Controller.Customer_Update(_lst[0].Customer_Id, _Customer_Info) == false)
                    {
                        NoteBox.Show("Lỗi cập nhật mới khách thuê nhà", "", NoteBoxLevel.Error);
                        return;
                    }

                    _customer_id = _lst[0].Customer_Id;
                }
                else
                {
                    // không có thì thêm mới
                    _customer_id = c_Customer_Controller.Customer_Insert(_Customer_Info);
                    if (_customer_id == -1)
                    {
                        NoteBox.Show("Lỗi thêm mới khách thuê nhà", "", NoteBoxLevel.Error);
                        return;
                    }
                }

                #endregion

                #region Hợp đồng
                Contract_Info _Contract_Info = Get_Contract_Info(_customer_id);
                if (_Contract_Info == null)
                {
                    NoteBox.Show("Lỗi khởi tạo hợp đồng thuê nhà", "", NoteBoxLevel.Error);
                    return;
                }

                decimal _contract_id = _Contract_Controller.Contract_Insert(_Contract_Info);
                if (_contract_id == -1)
                {
                    NoteBox.Show("Lỗi thêm mới hợp đồng cho thuê nhà", "", NoteBoxLevel.Error);
                    c_Customer_Controller.Customer_Delete(_customer_id);
                    return;
                }

                #endregion

                #region Phí môi giới
                foreach (Fees_Revenue_Info _Fees_Revenue_Info in c_lst_Fee)
                {
                    _Fees_Revenue_Info.Contract_Id  = _contract_id;
                    _Fees_Revenue_Info.Object_Id    = _customer_id;
                    _Fees_Revenue_Info.Object_Type  = (decimal)Enum_Contract_Type.Tenant;
                    _Fees_Revenue_Info.Currency     = Convert.ToDecimal(cboCurrency.SelectedValue);
                    _Fees_Revenue_Info.Fee          = 0;
                    _Fees_Revenue_Info.Debit_Amount = _Fees_Revenue_Info.Fee_Expected - _Fees_Revenue_Info.Fee;
                    _Fees_Revenue_Info.Is_Extend    = 0;
                    _Fees_Revenue_Info.Fee_Vnd      = 0;

                    if (_Fees_Revenue_Info.Fee != 0)
                    {
                        _Fees_Revenue_Info.Pay_Status = (decimal)Enum_Fee_Status.Payed;
                    }

                    if (_Fees_Revenue_Controller.Fees_Revenue_Insert(_Fees_Revenue_Info) == false)
                    {
                        NoteBox.Show("Lỗi thanh toán", "", NoteBoxLevel.Error);
                        c_Customer_Controller.Customer_Delete(_customer_id);
                        _Contract_Controller.Contract_Delete(_contract_id);
                        _Fees_Revenue_Controller.Fees_Revenue_DeleteByContract(_contract_id);
                        return;
                    }
                }
                #endregion

                c_id_insert = _contract_id;

                NoteBox.Show("Thêm mới dữ liệu thành công", "");
                this.Close();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Mở tài khoản theo Categories và mã khách hàng
        /// </summary>
        /// <param name="categories">Mã sản phẩm</param>
        /// <param name="custId">Mã khách hàng</param>
        /// <returns>chuỗi ký tự thông tin tài khoản chi tiết được mở theo định dạng
        /// xml hoặc chuối ký tự lỗi định dạng xml</returns>
        public xml_response Insert(string categories, string custId)
        {
            try
            {
                _res = new xml_response();
                _res.function_name = this.ToString() + string.Format(".Insert({0},{1})", categories, custId);
                Customer      bcust    = new Customer();
                Customer_Info custInfo = bcust.GetCustomerByID(custId);
                if (custInfo == null)
                {
                    _res.SetError("01", "Customer can not find");
                    if (logger.IsErrorEnabled)
                    {
                        logger.Error(string.Format("{0}\t{1}", _res.error_code, _res.error_msg));
                    }
                    return(_res);
                }
                else
                {
                    if (custInfo.Active == false)
                    {
                        _res.SetError("03", "Customers have not been approved");
                        if (logger.IsErrorEnabled)
                        {
                            logger.Error(string.Format("{0}\t{1}", _res.error_code, _res.error_msg));
                        }
                        return(_res);
                    }
                }
                Categories      dalCat  = new Categories();
                Categories_Info catInfo = dalCat.GetCategoriesByID(categories);
                if (catInfo == null)
                {
                    _res.SetError("98", string.Format("Categories Id {0} can not find", categories));
                    if (logger.IsErrorEnabled)
                    {
                        logger.Error(string.Format("{0}\t{1}", _res.error_code, _res.error_msg));
                    }
                    return(_res);
                }

                Account_Info acInfo = GetAccountBy(_channel.Branch, categories, custId);
                if (acInfo == null)
                {
                    // Khởi tạo thông tin mở tài khoản.
                    acInfo              = new Account_Info();
                    acInfo.Name         = custInfo.Name; // tên tài khoản.
                    acInfo.Customer_ID  = custInfo.ID;   // Mã khách hàng.
                    acInfo.Branch_ID    = _channel.Branch;
                    acInfo.Categories   = categories;
                    acInfo.Ccy          = _channel.Currency_Code;
                    acInfo.Account_GL   = catInfo.Account_GL.Account_ID;
                    acInfo.CreditDebit  = catInfo.Account_GL.CreditDebit;
                    acInfo.Approved     = true;
                    acInfo.ApprovedTime = DateTime.Now;
                    acInfo.UserCreate   = _channel.UserLogin;
                    acInfo.Account_ID   = GenerateNewAccountId(acInfo.Branch_ID, acInfo.Categories);
                    acInfo.Open_Date    = DateTime.Now;
                    acInfo.Last_Date    = DateTime.Now;
                    // thực hiện mở tài khoản.
                    if (Insert(acInfo) == 0)
                    {
                        _res.Accounts = acInfo.RenderXML();
                    }
                    else
                    {
                        // Lấy nội dung lỗi
                        _res.SetError("99", dalAc.GetException.Message);
                        if (logger.IsErrorEnabled)
                        {
                            logger.Error(string.Format("{0}\t{1}", _res.error_code, _res.error_msg));
                        }
                        return(_res);
                    }
                }
                else
                {
                    // tài khoản đã được mở
                    _res.SetError("12", "Account opened");
                    if (logger.IsErrorEnabled)
                    {
                        logger.Error(string.Format("{0}\t{1}", _res.error_code, _res.error_msg));
                    }
                }
            }
            catch (Exception ex)
            {
                _res.SetError("99", ex.Message);
                if (logger.IsErrorEnabled)
                {
                    logger.Error(string.Format("{0}\t{1}", _res.error_code, _res.error_msg));
                }
            }
            return(_res);
        }
Esempio n. 26
0
        void Accept()
        {
            try
            {
                if (Customer_CheckValidate() == false)
                {
                    return;
                }

                MessageBoxResult result = NoteBox.Show("Bạn có muốn thêm khách hàng này hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes != result)
                {
                    return;
                }

                #region Thêm mới khách hàng
                Customer_Info _Customer_Info = Get_Customer_Info();
                if (_Customer_Info == null)
                {
                    NoteBox.Show("Lỗi khởi tạo khách thuê nhà", "", NoteBoxLevel.Error);
                    return;
                }
                decimal _customer_id = -1;

                // kiểm tra xem thằng tên khách hàng đó và số đt đó đã có trong db chưa
                // nếu có rồi thì ko insert nữa

                string _name = txtCustomer_Name.Text.ToUpper();
                if (_name == "")
                {
                    _name = CommonData.c_All_Value;
                }

                string _phone = txtPhone.Text.ToUpper();
                if (_phone == "")
                {
                    _phone = CommonData.c_All_Value;
                }

                List <Customer_Info> _lst = c_Customer_Controller.Customer_Search(_name, _phone);

                if (_lst.Count > 0)
                {
                    NoteBox.Show("Đã tồn tại khách hàng", "", NoteBoxLevel.Error);
                    return;
                }
                else
                {
                    // không có thì thêm mới
                    _customer_id = c_Customer_Controller.Customer_Insert(_Customer_Info);

                    if (_customer_id == -1)
                    {
                        NoteBox.Show("Lỗi thêm mới khách thuê nhà", "", NoteBoxLevel.Error);
                        return;
                    }
                }

                #endregion

                c_id_insert = _customer_id;
                NoteBox.Show("Thêm mới dữ liệu thành công", "");

                this.Close();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Esempio n. 27
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());
            }
        }
Esempio n. 28
0
        void Accept()
        {
            try
            {
                if (!CheckValidate_F())
                {
                    return;
                }
                Customer_Controller _Customer_Controller = new Customer_Controller();

                if (c_type == Convert.ToInt16(Form_Type.Insert))
                {
                    MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn thêm mới khách hàng " + txtName.Text + " hay không?", "Thông báo", NoteBoxLevel.Question);
                    if (MessageBoxResult.Yes == result)
                    {
                        Customer_Info _Customer_Info = new Customer_Info();
                        _Customer_Info.Customer_Name = txtName.Text;
                        _Customer_Info.Phone         = txtPhone.Text;
                        _Customer_Info.Address       = txtAddress.Text;

                        decimal _id = 0;
                        if (_Customer_Controller.Customer_Insert(_Customer_Info, ref _id))
                        {
                            NoteBox.Show("Thêm mới thành công");
                            c_id_insert = _id;
                            this.Close();
                        }
                        else
                        {
                            NoteBox.Show("Có lỗi trong quá trình thêm mới", "", NoteBoxLevel.Error);
                        }
                    }
                }
                else
                {
                    MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn cập nhật hay không?", "Thông báo", NoteBoxLevel.Question);
                    if (MessageBoxResult.Yes == result)
                    {
                        Customer_Info _Customer_Info = new Customer_Info();
                        _Customer_Info.Customer_Name = txtName.Text;
                        _Customer_Info.Phone         = txtPhone.Text;
                        _Customer_Info.Address       = txtAddress.Text;

                        if (_Customer_Controller.Customer_Update(c_Customer_Info.Customer_Id, _Customer_Info))
                        {
                            NoteBox.Show("Cập nhật dữ liệu thành công");
                            c_id_insert = 1;
                            this.Close();
                        }
                        else
                        {
                            NoteBox.Show("Có lỗi trong quá trình cập nhật dữ liệu", "", NoteBoxLevel.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Esempio n. 29
0
        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());
            }
        }
Esempio n. 30
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());
            }
        }