Exemplo n.º 1
0
    public void FillFormByVendorID(int VendorID)
    {
        MasterData.VendorRow vendorRow = new MasterDataBLL().GetVendorByID(VendorID);
        txtVendorName.Text = vendorRow.VendorName;
        txtVendorAddress.Text = vendorRow.VendorAddress;
        txtCity.Text = vendorRow.City;
        txtPostal.Text = vendorRow.Postal;
        txtContactName.Text = vendorRow.ContactName;
        this.VendorTypeControl.VendorTypeID = vendorRow.VendorTypeID.ToString();
        MasterDataBLL ma = new MasterDataBLL();
        MasterData.VendorTypeRow VendorTypeRow = ma.GetVendorTypeById(vendorRow.VendorTypeID);
        VendorTypeControl.VendorTypeName = VendorTypeRow.VendorTypeName;
        txtCurrency.Text = ma.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName;
        txtCompany.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyName;
        txtCompanyCode.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode;
        if (!vendorRow.IsPhoneNumberNull()) {
            this.txtPhoneNumber.Text = vendorRow.PhoneNumber;
        }
        if (!vendorRow.IsOneTimeVendorNull()) {
            this.ddlOneTimeVendor.SelectedValue = Convert.ToInt32(vendorRow.OneTimeVendor).ToString();
        }
        if (!vendorRow.IsHoldVendorNull()) {
            this.ddlHoldVendor.SelectedValue = Convert.ToInt32(vendorRow.HoldVendor).ToString();
        }
        if (!vendorRow.IsPurchaseingPostalCodeNull()) {
            this.txtPurchaseingPostalCode.Text = vendorRow.PurchaseingPostalCode;
        }
        if (!vendorRow.IsAlphaSearchKeyNull()) {
            this.txtAlphaSearchKey.Text = vendorRow.AlphaSearchKey;
        }
        if (!vendorRow.IsPurchasingCityNull()) {
            this.txtPurchasingCity.Text = vendorRow.PurchasingCity;
        }
        if (!vendorRow.IsPurchasingContactNull()) {
            this.txtPurchasingContact.Text = vendorRow.PurchasingContact;
        }
        if (!vendorRow.IsPurchasingAddressNull()) {
            this.txtPurchasingAddress.Text = vendorRow.PurchasingAddress;
        }
        if (!vendorRow.IsPurchasePhoneNumberNull()) {
            this.txtPurchasePhoneNumber.Text = vendorRow.PurchasePhoneNumber;
        }
        this.ddlPaymentTerm.SelectedValue = vendorRow.PaymentTermID.ToString();
        if (!vendorRow.IsTransTypeIDNull()) {
            this.ddlTransType.SelectedValue = vendorRow.TransTypeID.ToString();
        }
        this.ddlBankCode.DataBind();
        if (!vendorRow.IsBankCodeIDNull()) {
            this.ddlBankCode.SelectedValue = vendorRow.BankCodeID.ToString();
        }
        ddlVatRate.SelectedValue = vendorRow.VATTypeID.ToString();

        txtBankName.Text = vendorRow.BankName.ToString();
        txtAccountNo.Text = vendorRow.AccountNo;
        if (!vendorRow.IsRemarkNull()) {
            this.txtRemark.Text = vendorRow.Remark;
        }
        if (!vendorRow.IsBankNoNull()) {
            this.txtBankNo.Text = vendorRow.BankNo;
        }
        ddlACType.SelectedValue = vendorRow.ACTypeID.ToString();

        if (int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Add) {
            this.trModifyReason.Visible = true;
        }
        if (int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Delete || int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Reactive) {
            DisableWhenDelete();
        }
    }