Example #1
0
    protected void savetButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (unitRepprtObj.CheckDuplicate(refixationDateTextBox.Text))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert('Save Failed: Duplicate Price Refixaton Date');", true);
            }
            else
            {
                Hashtable htInsert   = new Hashtable();
                int       countCheck = 0;
                commonGatewayObj.BeginTransaction();
                foreach (GridViewRow Drv in SurrenderListGridView.Rows)
                {
                    htInsert.Add("NAV_DATE", NAVDateTextBox.Text);
                    htInsert.Add("REFIX_DT", refixationDateTextBox.Text);
                    htInsert.Add("FUND_CD", Drv.Cells[0].Text.ToString());
                    htInsert.Add("FUND_NM", Drv.Cells[1].Text.ToString());

                    TextBox effectDateTextBox     = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("effectDateTextBox");
                    TextBox salePriceTextBox      = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("salePriceTextBox");
                    TextBox surrenderPriceTextBox = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("surrenderPriceTextBox");
                    TextBox navMPTextBox          = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("navMPTextBox");
                    TextBox navCPTextBox          = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("navCPTextBox");

                    htInsert.Add("EFFECTIVE_DATE", Convert.ToDateTime(effectDateTextBox.Text).ToString("dd-MMM-yyyy"));
                    htInsert.Add("REFIX_SL_PR", Convert.ToDecimal(salePriceTextBox.Text.ToString()));
                    htInsert.Add("REFIX_REP_PR", Convert.ToDecimal(surrenderPriceTextBox.Text.ToString()));
                    htInsert.Add("NAV_MP", Convert.ToDecimal(navMPTextBox.Text.ToString()));
                    htInsert.Add("NAV_CP", Convert.ToDecimal(navCPTextBox.Text.ToString()));

                    htInsert.Add("USER_NM", userObj.UserID.ToString());
                    htInsert.Add("ENT_DT", DateTime.Today.ToString("dd-MMM-yyyy"));
                    htInsert.Add("ENT_TM", DateTime.Now.ToShortTimeString());

                    commonGatewayObj.Insert(htInsert, "PRICE_REFIX");
                    commonGatewayObj.CommitTransaction();
                    htInsert = new Hashtable();
                    countCheck++;
                }
            }

            refixationDateTextBox.Text = "";
            NAVDateTextBox.Text        = "";
            dvGridSurrender.Visible    = false;
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert('Save Successfully');", true);
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            throw ex;
        }
    }