Exemplo n.º 1
0
        private void HelpGrid_DoubleClick(object sender, EventArgs e)
        {
            var row = HelpGridView.GetDataRow(HelpGridView.FocusedRowHandle);

            switch (HelpGrid.Text)
            {
            case "Advance":
                Txt_AdvVoucherNo.Text   = row["AdvVutNo"].ToString();
                DtAdvanceVuDt.EditValue = Convert.ToDateTime(row["AdvVutDate"]);
                Txt_AdvVoucherType.Text = row["AdvVutType"].ToString();
                Txt_AdvAmt.Text         = row["AdvVutAmt"].ToString();
                HelpGrid.Visible        = false;
                BtnRefreshGridData.Focus();
                break;

            case "Dealer":
                Txt_DealerCode.Text = row["DealerCode"].ToString();
                Txt_Dealer.Text     = row["DealerName"].ToString();

                Txt_AdvVoucherNo.Text   = string.Empty;
                Txt_AdvVoucherType.Text = string.Empty;
                Txt_AdvAmt.Text         = string.Empty;

                Txt_AdvVoucherNo.Focus();
                break;
            }
            HelpGrid.Visible = false;
            btnSave.Enabled  = false;
        }
Exemplo n.º 2
0
        private void Txt_DealerCode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                HelpGrid.Text       = "Dealer";
                HelpGrid.DataSource = null;
                HelpGridView.Columns.Clear();

                if (Txt_DealerCode.Text.Length == 0)
                {
                    var ds = ProjectFunctions.GetDataSet(string.Format("sp_LoadAdvPenVouchers @Tag='Dealer' "));
                    HelpGrid.DataSource = ds.Tables[0];
                    HelpGridView.BestFitColumns();
                    HelpGrid.Visible = true;
                    HelpGrid.Focus();
                }
                else
                {
                    var       ds  = ProjectFunctions.GetDataSet(string.Format("sp_LoadAdvPenVouchers @Tag='Dealer' ", Txt_DealerCode.Text));
                    DataRow[] drr = ds.Tables[0].Select(string.Format("DealerCode='{0}'", Txt_DealerCode.Text));
                    if (drr.Count() > 0)
                    {
                        Txt_Dealer.Text         = drr[0]["DealerName"].ToString();
                        Txt_DealerCode.Text     = drr[0]["DealerCode"].ToString();
                        Txt_AdvVoucherNo.Text   = string.Empty;
                        Txt_AdvVoucherType.Text = string.Empty;
                        Txt_AdvAmt.Text         = string.Empty;
                        Txt_AdvVoucherNo.Focus();
                    }
                    else
                    {
                        var ds1 = ProjectFunctions.GetDataSet("sp_LoadAdvPenVouchers @Tag='Dealer' ");
                        HelpGrid.DataSource = ds1.Tables[0];
                        HelpGridView.BestFitColumns();
                        HelpGrid.Visible = true;
                        HelpGrid.Focus();
                    }
                }
            }
            e.Handled = true;
        }