protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //EditUpdatePanel.Update();
        if (!Page.IsValid)
        {
            return;
        }
        try
        {
            if (txtBasePoint.Text.Trim() == "" && txtSNIPSJRPoint.Text.Trim() == "")
            {
                string CloseWindow1 = "alert('Please enter atleast one point')";
                ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                return;
            }

            bool result = B.CheckPublcationId(txtReferenceId.Text.Trim(), txtboxMemberId.Text.Trim());
            if (result == false)
            {
                string CloseWindow1 = "alert('Invalid reference id')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                return;
            }
            obj.MemberId       = txtboxMemberId.Text.Trim();
            obj.CurrentBalance = Convert.ToDouble(txtcurbal.Text.Trim());
            if (txtBasePoint.Text.Trim() != "")
            {
                obj.BasePoint = Convert.ToDouble(txtBasePoint.Text.Trim());
            }
            if (txtSNIPSJRPoint.Text.Trim() != "")
            {
                obj.SNIPSJRPoint = Convert.ToDouble(txtSNIPSJRPoint.Text.Trim());
            }
            //point 3 (crosses 6 publication) is awarded once in a year
            //if (txtThresholdPoint.Text.Trim() != "")
            //{
            //    obj.ThresholdPoint = Convert.ToDouble(txtThresholdPoint.Text.Trim());
            //}
            obj.TotalPoint      = (obj.BasePoint + obj.SNIPSJRPoint + obj.ThresholdPoint);
            obj.ReferenceNumber = txtReferenceId.Text.Trim();
            obj.Remarks         = txtRemarks.Text.Trim();
            obj.CurrentBalance  = obj.CurrentBalance + obj.TotalPoint;
            obj.TransactionType = "ADJ";
            if (obj.TotalPoint > 0)
            {
                obj.NumberType        = "Added";
                Session["Numbertype"] = "Added";
            }
            else
            {
                obj.NumberType        = "Removed";
                Session["Numbertype"] = "Removed";
            }
            bool result1 = B.UpdateCurBal(obj);     //Business layer

            if (result1 == true)
            {
                string CloseWindow1 = "alert('Incentive Point Saved successfully')";
                //ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
                btnUpdate.Enabled = false;
                txtcurbal.Text    = obj.CurrentBalance.ToString();
                SendMail();
                txtBasePoint.Text    = "";
                txtSNIPSJRPoint.Text = "";
                txtRemarks.Text      = "";
                txtTotalPoint.Text   = "";
            }
            else
            {
                string CloseWindow1 = "alert('Problem while updating the Incentive point')";
                ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
                btnUpdate.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.StackTrace);
            log.Error(ex.Message);
            ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Error')</script>");
        }
    }