public void loadfv()
 {
     LoanDSTableAdapters.FinalVoucherTableAdapter finalv = new LoanDSTableAdapters.FinalVoucherTableAdapter();
     LoanDS.FinalVoucherDataTable tblfinalv = finalv.GetFinalVoucher(MySessionManager.ClientID, MySessionManager.AppID);
     if (tblfinalv.Rows.Count > 0)
     {
         try
         {
             this.editskip1.Value = "2";
             FVID.Value           = tblfinalv[0].datID.ToString();
             txtVoucherNo.Value   = tblfinalv[0].datVoucherName.ToString();
             txtAmtWords.Value    = tblfinalv[0].datAmountInWords.ToString();
             txtDate.Text         = tblfinalv[0].datVoucherDate.ToShortDateString();
             txtTotalAmount.Text  = tblfinalv[0].datVoucherTotalAmount.ToString();
         }
         catch (Exception ex)
         { Console.Write(ex.Message); }
     }
 }
    protected void btnFinalVoucher_Click(object sender, EventArgs e)
    {
        // fetch the en-GB culture
        CultureInfo ukCulture = new CultureInfo("en-GB");
        // pass the DateTimeFormat information to DateTime.Parse
        DateTime myDateTime = DateTime.Parse(txtDate.Text, ukCulture.DateTimeFormat);

        //ShowMessageBox(myDateTime.ToShortDateString());

        LoanDSTableAdapters.FinalVoucherTableAdapter finalv = new LoanDSTableAdapters.FinalVoucherTableAdapter();
        LoanDS.FinalVoucherDataTable tblfinalv = finalv.GetFinalVoucher(MySessionManager.ClientID, MySessionManager.AppID);
        if (!(tblfinalv.Rows.Count > 0))
        {
            finalv.InsertFinalVoucher(MySessionManager.ClientID,
                                      MySessionManager.AppID,
                                      txtVoucherNo.Value,
                                      myDateTime,
                                      Convert.ToDecimal(txtTotalAmount.Text),
                                      txtAmtWords.Value.Trim(),
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now
                                      );
        }
        else
        {
            finalv.UpdateFinalVoucher(txtVoucherNo.Value,
                                      myDateTime,
                                      Convert.ToDecimal(txtTotalAmount.Text),
                                      txtAmtWords.Value.Trim(),
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      Convert.ToInt32(FVID.Value));
            this.editskip1.Value = "1";
        }
    }
    protected void btnFinalVoucher_Click(object sender, EventArgs e)
    {
        LoanDSTableAdapters.FinalVoucherTableAdapter finalv = new LoanDSTableAdapters.FinalVoucherTableAdapter();

        // fetch the en-GB culture
        CultureInfo ukCulture = new CultureInfo("en-GB");
        // pass the DateTimeFormat information to DateTime.Parse
        DateTime dt = DateTime.Parse(txtDate.Text, ukCulture.DateTimeFormat);


        if (!(typefv == "update"))
        {
            finalv.UpdateFinalVoucher1(txtVoucherNo.Value,
                                       dt,
                                       Convert.ToDecimal(txtTotalAmount.Text),
                                       txtAmtWords.Value.Trim(),
                                       MySessionManager.CurrentUser.UserID,
                                       DateTime.Now,
                                       MySessionManager.CurrentUser.UserID,
                                       DateTime.Now,
                                       Convert.ToInt32(FVID.Value));
            this.editskip1.Value = "1";
        }
        else
        {
            finalv.UpdateFinalVoucher1(txtVoucherNo.Value,
                                       dt,
                                       Convert.ToDecimal(txtTotalAmount.Text),
                                       txtAmtWords.Value.Trim(),
                                       MySessionManager.CurrentUser.UserID,
                                       DateTime.Now,
                                       MySessionManager.CurrentUser.UserID,
                                       DateTime.Now,
                                       Convert.ToInt32(FVID.Value));
            this.editskip1.Value = "1";
        }
    }
    public void loadfv()
    {
        LoanDSTableAdapters.FinalVoucherTableAdapter finalv = new LoanDSTableAdapters.FinalVoucherTableAdapter();
        LoanDS.FinalVoucherDataTable tblfinalv =finalv.GetFinalVoucher(MySessionManager.ClientID, MySessionManager.AppID );
        if(tblfinalv .Rows.Count>0)
        {
            try
            {
                this.editskip1.Value = "2";
                FVID.Value = tblfinalv[0].datID.ToString();
                txtVoucherNo.Value = tblfinalv[0].datVoucherName.ToString();
                txtAmtWords.Value = tblfinalv[0].datAmountInWords.ToString();
                txtDate.Text = tblfinalv[0].datVoucherDate.ToShortDateString();
                txtTotalAmount.Text = tblfinalv[0].datVoucherTotalAmount.ToString();
            }
            catch (Exception ex)
            { Console.Write(ex.Message); }

        }

    }
    protected void btnFinalVoucher_Click(object sender, EventArgs e)
    {
        // fetch the en-GB culture
        CultureInfo ukCulture = new CultureInfo("en-GB");
        // pass the DateTimeFormat information to DateTime.Parse
        DateTime myDateTime = DateTime.Parse(txtDate.Text, ukCulture.DateTimeFormat);
        //ShowMessageBox(myDateTime.ToShortDateString());

        LoanDSTableAdapters.FinalVoucherTableAdapter finalv = new LoanDSTableAdapters.FinalVoucherTableAdapter();
        LoanDS.FinalVoucherDataTable tblfinalv = finalv.GetFinalVoucher(MySessionManager.ClientID, MySessionManager.AppID);
        if (!(tblfinalv.Rows.Count > 0))
        {
            finalv.InsertFinalVoucher(MySessionManager.ClientID,
                                      MySessionManager.AppID,
                                      txtVoucherNo.Value,
                                      myDateTime,
                                      Convert.ToDecimal(txtTotalAmount.Text),
                                      txtAmtWords.Value.Trim(),
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now
                                      );
        }
        else 
        {
            finalv.UpdateFinalVoucher(txtVoucherNo.Value,
                                      myDateTime,
                                      Convert.ToDecimal(txtTotalAmount.Text),
                                      txtAmtWords.Value.Trim(),
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      Convert.ToInt32(FVID.Value));
            this.editskip1.Value = "1";
   
        }
    }
    protected void btnFinalVoucher_Click(object sender, EventArgs e)
    {
        LoanDSTableAdapters.FinalVoucherTableAdapter finalv = new LoanDSTableAdapters.FinalVoucherTableAdapter();

        // fetch the en-GB culture
        CultureInfo ukCulture = new CultureInfo("en-GB");
        // pass the DateTimeFormat information to DateTime.Parse
        DateTime dt = DateTime.Parse(txtDate.Text, ukCulture.DateTimeFormat);


        if (!(typefv == "update"))
        {
           finalv.UpdateFinalVoucher1(txtVoucherNo.Value,
                                      dt,
                                      Convert.ToDecimal(txtTotalAmount.Text),
                                      txtAmtWords.Value.Trim(),
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      Convert.ToInt32(FVID.Value));
            this.editskip1.Value = "1";
        }
        else 
        {
           finalv.UpdateFinalVoucher1(txtVoucherNo.Value,
                                      dt,
                                      Convert.ToDecimal(txtTotalAmount.Text),
                                      txtAmtWords.Value.Trim(),
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      MySessionManager.CurrentUser.UserID,
                                      DateTime.Now,
                                      Convert.ToInt32(FVID.Value));
            this.editskip1.Value = "1";
   
        }
    }