Exemplo n.º 1
0
    protected void DdlYear_SelectedIndexChanged1(object sender, EventArgs e)
    {
        IncentiveBusiness obj = new IncentiveBusiness();
        IncentivePoint    j   = new IncentivePoint();
        int    pubCount       = 0;
        string memberid       = txtMemberId.Text.Trim();
        string year           = DdlYear.SelectedValue;

        txtPointsAwarded.Text = "";
        txtRemarks.Text       = "";
        j.MemberId            = memberid;
        j.Year = Convert.ToInt32(year);

        // string currentbalance = obj.SelectMemberCurrentBal(memberid);
        string currentbalance = obj.SelectYearWisePoints(memberid, year);

        j.CurrentBalance = Convert.ToDouble(currentbalance);
        txtcurbal.Text   = j.CurrentBalance.ToString();

        j                = obj.SelectPublicationCount(memberid, year);
        pubCount         = j.TotalNoOfPublications;
        txtPubcount.Text = pubCount.ToString();
        if (Convert.ToInt32(pubCount) >= Convert.ToInt32(ThresholdPubNowebConfig))
        {
            if (j.isAwarded == "Y")
            {
                txtPointsAwarded.Enabled = false;
                txtPointsAwarded.Text    = j.Points.ToString();
                lblNote.Text             = "Note: Point is already awarded.";
                lblNote.Visible          = true;
                btnSave.Enabled          = false;
            }
            else
            {
                txtPointsAwarded.Enabled = true;
                double value = (Convert.ToDouble(currentbalance) * 25) / 100;
                value = Math.Round(value, 2);
                txtPointsAwarded.Text = value.ToString();
                lblNote.Visible       = false;
                lblNote.Text          = "Note: Minimum System awarded point is '0.25'.";
                lblNote.Visible       = true;
                btnSave.Enabled       = true;
            }
        }
        else
        {
            txtPointsAwarded.Enabled = false;
            string CloseWindow1 = "alert('To enter points awarded, publication count must be greater than or euqual to 6')";
            ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "CloseWindow", CloseWindow1, true);
            txtMemberId.Text = "";
            DdlYear.Items.Clear();
            txtcurbal.Text        = "";
            txtPubcount.Text      = "";
            txtPointsAwarded.Text = "";
            btnSave.Enabled       = false;
            lblNote.Visible       = false;
            lblNote1.Visible      = false;
            return;
        }
    }