protected void LinkButtonNewOrder_Click(object sender, EventArgs e) { if (Session["LabId"] != null) { string testid, testname, testprice; DataTable dtselectedtest = new DataTable(); dtselectedtest.Columns.AddRange(new DataColumn[3] { new DataColumn("TestID", typeof(string)), new DataColumn("TestName", typeof(string)), new DataColumn("TestPrice", typeof(string)) }); DataTable dtselectedclubtest = new DataTable(); dtselectedclubtest.Columns.AddRange(new DataColumn[3] { new DataColumn("ClubTestID", typeof(string)), new DataColumn("ClubTestName", typeof(string)), new DataColumn("ClubTestPrice", typeof(string)) }); foreach (RepeaterItem LabTestitem in this.RepeaterTest.Items) { HiddenField HiddenTestId = LabTestitem.FindControl("HiddenTestId") as HiddenField; testid = HiddenTestId.Value; HiddenField HiddenIsClubTest = LabTestitem.FindControl("HiddenIsClubTest") as HiddenField; Label LabelTestName = LabTestitem.FindControl("LabelTestName") as Label; testname = LabelTestName.Text; TextBox TextBoxTestPrice = LabTestitem.FindControl("TextBoxTestPrice") as TextBox; testprice = TextBoxTestPrice.Text; HtmlInputCheckBox CheckBoxTest = LabTestitem.FindControl("CheckBoxTest") as HtmlInputCheckBox; if (CheckBoxTest.Checked) { if (HiddenIsClubTest.Value == "True") { DataTable dtclubtest = operation.GetClubTest(testid); foreach (DataRow clubtestname in dtclubtest.Rows) { dtselectedtest.Rows.Add(clubtestname["TestID"].ToString(), clubtestname["TestName"].ToString(), 0); } dtselectedclubtest.Rows.Add(testid, testname, testprice); } else { dtselectedtest.Rows.Add(testid, testname, testprice); } } } if (dtselectedtest.Rows.Count > 0) { string totalamount = (String.Format("{0}", Request.Form["TextBoxTotalAmount"])).Count() > 0 ? (String.Format("{0}", Request.Form["TextBoxTotalAmount"])) : null; string paidamount = (String.Format("{0}", Request.Form["TextBoxPaid"])).Count() > 0 ? (String.Format("{0}", Request.Form["TextBoxPaid"])) : null; string duesamount = (String.Format("{0}", Request.Form["TextBoxDues"])).Count() > 0 ? (String.Format("{0}", Request.Form["TextBoxDues"])) : null; string discount = (String.Format("{0}", Request.Form["TextBoxDiscount"])).Count() > 0 ? (String.Format("{0}", Request.Form["TextBoxDiscount"])) : null; string responsemsg = operation.AddOrder(Session["LabId"].ToString(), DropDownListPatient.SelectedValue, DropDownListDoctor.SelectedValue, totalamount, paidamount, duesamount, dtselectedtest, dtselectedclubtest, DropDownListTestCenter.SelectedValue, discount); string response = responsemsg.Split(',')[0]; if (response == "SUCCESS") { Response.Redirect("Invoice.aspx?oid=" + responsemsg.Split(',')[1]); } else if (response == "ERROR") { messagediv.Visible = true; messagediv.Attributes["class"] = "fixed-message rounded alert bg-danger alert-dismissible animated fadeIn text-center text-white"; mesaagetxt.InnerHtml = "Error! something went wrong please try again later."; } } else { messagediv.Visible = true; messagediv.Attributes["class"] = "fixed-message rounded alert bg-danger alert-dismissible animated fadeIn text-center text-white"; mesaagetxt.InnerHtml = "Error! Please select test."; } } else { messagediv.Visible = true; messagediv.Attributes["class"] = "fixed-message rounded alert bg-warning alert-dismissible animated fadeIn text-center text-white"; mesaagetxt.InnerHtml = "session out!"; } }