private void ImportData()
 {
     //Retreive document details from database
     try
     {
         using (var dc = new DBAuditDataContext())
         {
             if (ComboDocNo.SelectedIndex != -1 && ComboName.SelectedIndex != -1)
             {
                 DateTime?varDatePay     = null;
                 int?     intLocationId  = null;
                 string   strLocation    = null;
                 string   strDestination = null;
                 string   strPeriod      = null;
                 decimal? doubleTrans    = null;
                 decimal? doubleTravel   = null;
                 string   strNotes       = null;
                 dc.ProSelectTransFee(ComboDocNo.SelectedValue.ToString(), ref varDatePay, ref intLocationId,
                                      int.Parse(ComboName.SelectedValue.ToString()), ref strDestination, ref strPeriod,
                                      ref doubleTrans, ref doubleTravel, ref strNotes);
                 if (varDatePay != null)
                 {
                     DatePay.Value = varDatePay.Value;
                 }
                 dc.ProGetLocationByID(intLocationId, ref strLocation);
                 ComboLocation.Text  = strLocation;
                 TxtDestination.Text = strDestination;
                 TxtPeriod.Text      = strPeriod;
                 TxtTrans.Text       = doubleTrans.ToString();
                 TxtTravel.Text      = doubleTravel.ToString();
                 TxtNotes.Text       = strNotes;
             }
             else
             {
                 DatePay.Text = null;
                 ComboLocation.SelectedIndex = -1;
                 TxtDestination.Clear();
                 TxtPeriod.Clear();
                 TxtTrans.Clear();
                 TxtTravel.Clear();
                 TxtNotes.Clear();
             }
         }
     }
     catch (InvalidOperationException)
     {
         DatePay.Value       = DateTime.Now;
         ComboLocation.Text  = "";
         TxtDestination.Text = "";
         TxtPeriod.Text      = "";
         TxtTrans.Text       = "";
         TxtTravel.Text      = "";
         TxtNotes.Text       = "";
         BtnDelete.Enabled   = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
    protected void TxtPeriod_TextChanged(object sender, EventArgs e)
    {
        if (TxtPeriod.Text == "")
        {
            return;
        }

        if (TxtDepoAmt.Text == "")
        {
            WebMsgBox.Show("Please enter amount", this.Page);
            TxtDepoAmt.Focus();
            return;
        }
        // Check Duration
        string IsPvalid = "0";

        IsPvalid = CurrentCls.CheckPeriod(TxtProcode.Text.ToString(), TxtPeriod.Text.ToString(), ddlduration.SelectedValue.ToString(), Session["BRCD"].ToString(), ddlAccType.SelectedValue);
        if (Convert.ToInt32(IsPvalid) > 0)
        {
        }
        else
        {
            WebMsgBox.Show("Invalid Period...", this.Page);
            TxtPeriod.Text   = "";
            TxtRate.Text     = "";
            TxtIntrest.Text  = "";
            TxtMaturity.Text = "";
            DtDueDate.Text   = "";
            TxtPeriod.Focus();
            return;
        }

        // Get rates for Product Code
        float rate = CurrentCls.GetIntrestRate(TxtProcode.Text.ToString(), TxtPeriod.Text.ToString(), Session["BRCD"].ToString(), ddlduration.SelectedValue.ToString(), false);

        if (rate == 0)
        {
            WebMsgBox.Show(" Invalid Value... ", this.Page);
            TxtPeriod.Text = "";
            TxtPeriod.Focus();
            return;
        }
        else
        {
            TxtRate.Text = rate.ToString();
        }
        // Calculate Due date
        CalDueDate(Convert.ToDateTime(dtDeposDate.Text.ToString()), ddlduration.SelectedItem.Text.ToString(), Convert.ToInt32(TxtPeriod.Text));

        // Calculate Interest
        float amt     = (float)Convert.ToDouble(TxtDepoAmt.Text);
        float intrate = (float)Convert.ToDouble(TxtRate.Text);

        CalculatedepositINT(amt, TxtProcode.Text.ToString(), intrate, Convert.ToInt32(TxtPeriod.Text), ddlIntrestPay.SelectedItem.Text.ToString(), ddlduration.SelectedItem.Text.ToString());
        TxtProcode1.Focus();
    }
Beispiel #3
0
 protected void TxtPeriod_TextChanged(object sender, EventArgs e)
 {
     try
     {
         string RT = "";
         string RR = FDR.Getrate(TxtPeriod.Text, TxtProcode.Text, ddlduration.SelectedValue, ViewState["ACCTYPE"].ToString(), Session["BRCD"].ToString(), Session["EntryDate"].ToString());
         if (RR != null)
         {
             TxtRate.Text = RR;
             RT           = TxtRate.Text;
             string PT = ddlduration.SelectedItem.Text;
             if (PT == "Days" || PT == "DAYS")
             {
                 PT = "D";
             }
             else if (PT == "Months" || PT == "MONTHS")
             {
                 PT = "M";
             }
             if (RT != "")
             {
                 // TxtDepoAmt.Text = TxtTotalAmount.Text;
                 double RATE = Convert.ToDouble(RT);
                 DtDueDate.Text = conn.AddMonthDay(dtDeposDate.Text, TxtPeriod.Text, PT).Replace("12:00:00", "");
                 CalculatedepositINT(float.Parse(TxtDepoAmt.Text), TxtProcode.Text, float.Parse(RATE.ToString()), Convert.ToInt32(TxtPeriod.Text), ddlIntrestPay.SelectedItem.Text, ddlduration.SelectedValue);
             }
             BtnSubmit.Focus();
         }
         else
         {
             WebMsgBox.Show("Invalid Period, Add from Interest Master....!", this.Page);
             TxtPeriod.Text = "";
             TxtPeriod.Focus();
         }
     }
     catch (Exception Ex)
     {
         ExceptionLogging.SendErrorToText(Ex);
     }
 }
Beispiel #4
0
    protected void TxtPeriod_TextChanged(object sender, EventArgs e)
    {
        try
        {
            if (TxtPeriod.Text == "")
            {
                return;
            }

            if (TxtDepoAmt.Text == "")
            {
                WebMsgBox.Show("Please enter amount", this.Page);
                TxtDepoAmt.Focus();
                return;
            }
            // Check Duration
            string IsPvalid = "0";
            IsPvalid = CurrentCls.CheckPeriod(ddlAccType.SelectedValue.ToString(), ddlProdCode.SelectedValue.ToString(), TxtPeriod.Text.ToString(), ddlduration.SelectedValue.ToString(), Session["BRCD"].ToString());
            if (Convert.ToInt32(IsPvalid) > 0)
            {
            }
            else
            {
                WebMsgBox.Show("Invalid Period...", this.Page);
                TxtPeriod.Text   = "";
                TxtRate.Text     = "";
                TxtIntrest.Text  = "";
                TxtMaturity.Text = "";
                DtDueDate.Text   = "";
                TxtPeriod.Focus();
                return;
            }
            // Get rates for Product Code
            float rate = CurrentCls.GetIntrestRate(ddlProdCode.SelectedValue.ToString(), TxtPeriod.Text.ToString(), Session["BRCD"].ToString(), ddlduration.SelectedValue.ToString(), false);
            if (rate == 0)
            {
                WebMsgBox.Show(" Invalid Value... ", this.Page);
                TxtPeriod.Text = "";
                TxtPeriod.Focus();
                return;
            }
            else
            {
                TxtRate.Text = rate.ToString();
            }
            if (ddlduration.SelectedValue == "M")
            {
                DtDueDate.Text = conn.AddMonthDay(dtDeposDate.Text, TxtPeriod.Text, "M").Replace("12:00:00", "");
                DtDueDate.Text = conn.AddMonthDay(dtDeposDate.Text, TxtPeriod.Text, "M").Replace("12:00:00", "");
            }
            else if (ddlduration.SelectedValue == "D")
            {
                DtDueDate.Text = conn.AddMonthDay(dtDeposDate.Text, TxtPeriod.Text, "D").Replace("12:00:00", "");
                DtDueDate.Text = conn.AddMonthDay(dtDeposDate.Text, TxtPeriod.Text, "D").Replace("12:00:00", "");
            }
            // Calculate Interest
            float amt     = (float)Convert.ToDouble(TxtDepoAmt.Text);
            float intrate = (float)Convert.ToDouble(TxtRate.Text);
            CalculatedepositINT(amt, ddlProdCode.SelectedValue.ToString(), intrate, Convert.ToInt32(TxtPeriod.Text), ddlIntrestPay.SelectedItem.Text.ToString(), ddlduration.SelectedItem.Text.ToString());
        }
        catch (Exception Ex)
        {
            WebMsgBox.Show(Ex.Message, this.Page);
        }
    }