Exemplo n.º 1
0
        private void cbxContractId_SelectionChangeCommitted(object sender, EventArgs e)
        {
            int contractIndex = cbxContractId.SelectedIndex;

            if (contractIndex > -1)
            {
                dtpTerminalDate.Value    = DateTime.Parse(listContract.Rows[contractIndex]["TerminationDate"].ToString());
                dtpStartTime.Value       = DateTime.Parse(listContract.Rows[contractIndex]["StartTime"].ToString());
                tbxQuantity.Text         = listContract.Rows[contractIndex]["Quantity"].ToString();
                tbxQuantityDiscount.Text = listContract.Rows[contractIndex]["QuantityDiscount"].ToString();
                tbxTotalMoney.Text       = listContract.Rows[contractIndex]["TotalMoney"].ToString();
                updatingContract.Note    = tbxNote.Text = listContract.Rows[contractIndex]["Note"].ToString();
                tbxPayedMoney.Text       = (int.Parse(Utils.eraiseComma(tbxTotalMoney.Text)) * (100 - int.Parse(Utils.eraiseComma(tbxQuantityDiscount.Text))) / 100).ToString();
                tbxDeposit.Text          = listContract.Rows[contractIndex]["Deposit"].ToString();

                contract.ContracId = int.Parse(listContract.Rows[contractIndex]["ContractId"].ToString());
                contract.Deposit   = int.Parse(listContract.Rows[contractIndex]["Deposit"].ToString());
                try
                {
                    GlobalVarialbe.selectedTour       = new Tour();
                    GlobalVarialbe.selectedTour.Price = tourModel.getPriceTourByContractId(contract.ContracId);
                    listMember = memberModel.getMemberByContractId(contract.ContracId);
                    dtgListMember.DataSource = listMember;
                    formatDtgListMember();
                }
                catch (Exception)
                {
                    Utils.showErrorLoadData(Constants.ettMember);
                }
            }
            else
            {
                dtpTerminalDate.Value    = DateTime.Now;
                dtpStartTime.Value       = DateTime.Now;
                tbxQuantity.Text         = "0";
                tbxQuantityDiscount.Text = "0";
                tbxTotalMoney.Text       = "0";
                tbxNote.Text             = "";
                tbxPayedMoney.Text       = "0";
                tbxDeposit.Text          = "0";
                tbxAddedDeposit.Text     = "0";
                dtgListMember.DataSource = null;
            }
        }