protected void BtnApply_Click(object sender, EventArgs e) { string code = DropdownListDiscount.Text; DiscountDAO dao = new DiscountDAO(); decimal number = dao.CheckDiscountCode(code); if (number != -1) { bool checkAlreadyUsed = dao.CheckAlreadyUsedDiscount(code, 1); if (checkAlreadyUsed == false) { PriceDiscount.Text = (CalculatePrice() * ((double)number / 100)).ToString(); lblTotalAmount.Text = (CalculatePrice() * ((double)(100 - number)) / 100).ToString(); litDiscount.Text = ""; } else { litDiscount.Text = "Your code is already used "; } } else { litDiscount.Text = "Your code is not valid"; } }