protected void btnSave_Click(object sender, EventArgs e) { NumberFormatInfo nf = new CultureInfo("en-US", false).NumberFormat; nf.CurrencySymbol = "$"; //nf.CurrencyGroupSizes = 3; nf.CurrencyGroupSeparator = "."; nf.CurrencyDecimalDigits = 2; nf.CurrencyDecimalSeparator = ","; decimal decCurrentLiTotal = 0; int iLiIndex = ddlActivityLineItem.SelectedIndex - 1; decCurrentLiTotal = Convert.ToDecimal(RadGrid1.Items[iLiIndex]["Qtr 1"].Text) + Convert.ToDecimal(RadGrid1.Items[iLiIndex]["Qtr 2"].Text) + Convert.ToDecimal(RadGrid1.Items[iLiIndex]["Qtr 3"].Text) + Convert.ToDecimal(RadGrid1.Items[iLiIndex]["Qtr 4"].Text); decimal decBalance; decimal decAmt; if (!txtAmount.Text.Trim().Equals("") && !lblLITotal.Text.Trim().Equals("")) { decBalance = Decimal.Parse(lblBalance.Text.Remove(0, 1), nf); decAmt = Decimal.Parse(txtAmount.Text, nf); if (decAmt > decBalance) { lblInject.Text = "<script>Err('Value entered exceeds line item balance!')</" + "script>"; } else { act_activity_reimbursement arObj = new act_activity_reimbursement(); arObj.AddNew(); arObj.Key_fiscal_year_quarter_id = Convert.ToInt32(ddlQuarter.SelectedValue); arObj.Key_activity_line_item_id = Convert.ToInt32(ddlActivityLineItem.SelectedValue); arObj.Nbr_amount = Decimal.Parse(txtAmount.Text, nf); arObj.Save(); RadGrid1.DataBind(); RadGrid2.DataBind(); resetFields(); } } }
protected void getLineItemTotal() { //act_activity_line_item aliObj = new act_activity_line_item(); //if (!ddlActivityLineItem.SelectedItem.Value.Equals("-1")) //{ // if (aliObj.LoadByPrimaryKey(Convert.ToInt32(ddlActivityLineItem.SelectedItem.Value))) // lblLITotal.Text = string.Format("{0:c}", aliObj.Amt_amount); // else // lblLITotal.Text = string.Format("{0:c}", 0); //} //else // lblLITotal.Text = ""; act_activity_reimbursement aliObj = new act_activity_reimbursement(); if (!ddlActivityLineItem.SelectedItem.Value.Equals("-1")) { SqlDataReader dr = aliObj.get_Line_Item_Info(Convert.ToInt32(ddlActivityLineItem.SelectedItem.Value)); if (dr.HasRows) while(dr.Read()) { lblLITotal.Text = string.Format("{0:c}", dr["amt_amount"]); lblBalance.Text = string.Format("{0:c}", dr["nbr_line_item_balance"]); } else { lblLITotal.Text = string.Format("{0:c}", 0); lblBalance.Text = string.Format("{0:c}", 0); } } else { lblLITotal.Text = ""; lblBalance.Text = ""; } }