Пример #1
0
    protected void GvCompany_SelectedIndexChanged(object sender, EventArgs e)
    {
        BindPaidTo();

        ViewState["EditId"]  = GvCompany.SelectedRow.Cells[2].Text.Trim();
        Session["VoucherID"] = ViewState["EditId"];
        class1.RecordId      = int.Parse(ViewState["EditId"].ToString());
        DataView MyDv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        MyDv.RowFilter = "VoucherID='" + ViewState["EditId"].ToString() + "' ";
        if (MyDv.Count > 0)
        {
            _VoucherDateText.Text = MyDv[0].Row["VOMVoucherDate"].ToString();
            _TxtDescription.Text  = MyDv[0].Row["VOMDescription"].ToString();
            _VoucherNoText.Text   = MyDv[0].Row["VOMManualVoucherNo"].ToString().Trim();
            _ddReceiptType_SelectedIndexChanged(sender, e);
            BtnSave.Visible         = false;
            BtnChangeStatus.Visible = true;
            BtnUpdate.Visible       = true;
        }

        DataView MyDvDetails = (DataView)SqlDataSourceDetails.Select(DataSourceSelectArguments.Empty);

        MyDvDetails.RowFilter = "VoucherID='" + ViewState["EditId"].ToString() + "' ";
        if (MyDvDetails.Count > 0)
        {
            _TxtAmount.Text   = MyDvDetails[0].Row["Debit"].ToString();
            _TxtCurrency.Text = MyDvDetails[0].Row["ForeignAmount"].ToString();
            _TxtValue.Text    = MyDvDetails[0].Row["ExchangeRate"].ToString();
        }
    }
Пример #2
0
    protected void GvCompany_SelectedIndexChanged(object sender, EventArgs e)
    {
        BindPaidFrom();
        BindPaidTo();
        Label Label1 = (Label)GvCompany.SelectedRow.FindControl("Label1");

        ViewState["EditId"]  = Label1.Text.Trim();
        Session["VoucherID"] = ViewState["EditId"];
        class1.RecordId      = int.Parse(ViewState["EditId"].ToString());
        DataView MyDv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        MyDv.RowFilter = "VoucherID='" + ViewState["EditId"].ToString() + "' ";
        if (MyDv.Count > 0)
        {
            _VoucherDateText.Text  = Convert.ToDateTime(MyDv[0].Row["VOMVoucherDate"]).ToString("dd/MM/yyyy");
            _ReceiverNameText.Text = MyDv[0].Row["VOMPayedReceivedBy"].ToString();

            _ddReceiptType.SelectedValue = MyDv[0].Row["VOMPayRepType"].ToString();
            _TxtDescription.Text         = MyDv[0].Row["VOMDescription"].ToString();
            _ddPaymentType.SelectedValue = MyDv[0].Row["VOMBankType"].ToString();


            _TxtChequeNo.Text     = MyDv[0].Row["VOMChequeNo"].ToString();
            _TxtPlaceOfIssue.Text = MyDv[0].Row["VOMPlaceOfIssue"].ToString();
            _TxtPayeeName.Text    = MyDv[0].Row["VOMChequePayeeName"].ToString();
            if (MyDv[0].Row["VOMBankTransferDate"] != null && MyDv[0].Row["VOMBankTransferDate"].ToString() != "")
            {
                _TransferDateText.Text = Convert.ToDateTime(MyDv[0].Row["VOMBankTransferDate"]).ToString("dd/MM/yyyy");
            }

            _TxtPlaceOfIssue.Text = MyDv[0].Row["VOMPlaceOfIssue"].ToString();
            _VoucherNoText.Text   = MyDv[0].Row["VOMManualVoucherNo"].ToString().Trim();
            _ddReceiptType_SelectedIndexChanged(sender, e);
            _ddBankType_SelectedIndexChanged(sender, e);
            BtnSave.Visible         = false;
            BtnChangeStatus.Visible = true;
            BtnUpdate.Visible       = true;
        }

        DataView MyDvDetails = (DataView)SqlDataSourceDetails.Select(DataSourceSelectArguments.Empty);

        MyDvDetails.RowFilter = "VoucherID='" + ViewState["EditId"].ToString() + "' ";
        if (MyDvDetails.Count > 0)
        {
            _TxtAmount.Text       = MyDvDetails[0].Row["Debit"].ToString();
            _DescriptionText.Text = MyDvDetails[0].Row["Description"].ToString();

            _TxtCurrency.Text = MyDvDetails[0].Row["ForeignAmount"].ToString();
            _TxtValue.Text    = MyDvDetails[0].Row["ExchangeRate"].ToString();
        }
    }