Exemplo n.º 1
0
        protected void LVLabTestDeleteRecord(object sender, ListViewDeleteEventArgs e)
        {
            int            autoid = int.Parse(ListViewlabtest.DataKeys[e.ItemIndex].Value.ToString());
            List <labtest> lstvst = null;

            lstvst = ViewstateLabTest;
            labtest tst = lstvst.Where(t => t.AutoID == autoid).SingleOrDefault();

            lstvst.Remove(tst);
            ViewstateLabTest = lstvst;
            //lblMessage.Text = "Record delete successfully !";
            // repopulate the data
            this.PopulateLabTest();
        }
Exemplo n.º 2
0
        protected void LVLabTestInsertRecord(object sender, ListViewInsertEventArgs e)
        {
            ListViewItem item           = e.Item;
            TextBox      tresult        = (TextBox)item.FindControl("txtResult");
            DropDownList ddlLabtestName = (DropDownList)item.FindControl("ddlLabtestName");

            List <labtest> lslabtest = null;

            lslabtest = ViewstateLabTest;
            labtest tst = new labtest();

            tst.AutoID      = lslabtest.Count + 1;
            tst.Result      = tresult.Text;
            tst.LabTestName = ddlLabtestName.SelectedItem.ToString();
            tst.MLabTestID  = ddlLabtestName.SelectedValue;
            lslabtest.Add(tst);
            ViewstateLabTest = lslabtest;
            //lblMessage.Text = "Record inserted successfully !";
            this.PopulateLabTest();
        }
Exemplo n.º 3
0
        protected void LVLabTestUpdateRecord(object sender, ListViewUpdateEventArgs e)
        {
            int          autoId     = int.Parse(ListViewlabtest.DataKeys[e.ItemIndex].Value.ToString());
            ListViewItem item       = ListViewlabtest.Items[e.ItemIndex];
            TextBox      tresult    = (TextBox)item.FindControl("txtResult");
            DropDownList ddlLabTest = (DropDownList)item.FindControl("ddlLabtestName");

            List <labtest> lstvst = null;

            lstvst = ViewstateLabTest;

            labtest tst = lstvst.Where(t => t.AutoID == autoId).SingleOrDefault();

            tst.Result       = tresult.Text;
            tst.LabTestName  = ddlLabTest.SelectedItem.ToString();
            tst.MLabTestID   = ddlLabTest.SelectedValue;
            ViewstateLabTest = lstvst;

            //lblMessage.Text = "Record updated successfully !";
            ListViewlabtest.EditIndex = -1;
            // repopulate the data
            this.PopulateLabTest();
        }