protected void addButton_Click(object sender, EventArgs e) { TestRequestManager aRequestManager = new TestRequestManager(); TestRequestClass aRequestClass = new TestRequestClass(); aRequestClass.MobileNo = mobileNoTextBox.Text; if (patientNameTextBox.Text == string.Empty || dateTextBox.Text == string.Empty || mobileNoTextBox.Text == string.Empty || feeTextBox.Text == string.Empty) { messageLabel.Text = "Insert All Values !"; } else { if (aRequestManager.GetAllInfoByMobileNo(aRequestClass.MobileNo) == true) { messageLabel.Text = "This Mobile No Already Exist"; } else { messageLabel.Text = string.Empty; TestRequestClass aTestRequestClass = new TestRequestClass(); aTestRequestClass.Fee = Convert.ToDouble(feeTextBox.Text); aTestRequestClass.MobileNo = mobileNoTextBox.Text; TestSetupManger aTestSetupManger = new TestSetupManger(); TestClass adropClass = aTestSetupManger.GetAllInfoByTestId(selectTestDropDownList.SelectedValue); DataTable dt = (DataTable)ViewState["TestEntry"]; dt.Rows.Add(adropClass.Name.Trim(), feeTextBox.Text.Trim()); ViewState["TestEntry"] = dt; this.BindGrid(); selectTestDropDownList.SelectedValue = null; double i; if (totalTextBox.Text.Length != 0) { i = int.Parse(totalTextBox.Text); i = i + aTestRequestClass.GetFullFee(aTestRequestClass.Fee); } else { i = int.Parse(feeTextBox.Text); } totalTextBox.Text = i.ToString(); feeTextBox.Text = string.Empty; if (aRequestManager.SaveTestGridview(adropClass, aTestRequestClass) > 0) { messageLabel.Text = "Added"; } else { messageLabel.Text = "Failed to Insert"; } } } }
protected void selectTestDropDownList_SelectedIndexChanged(object sender, EventArgs e) { messageLabel.Text = string.Empty; TestSetupManger abSetupManger = new TestSetupManger(); TestClass adropClass = abSetupManger.GetAllInfoByTestId(selectTestDropDownList.SelectedValue); feeTextBox.Text = adropClass.Fee.ToString(); }