//Submit Add Form
        protected void AddLabOrderGroupButton_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            String btnId = btn.ID;

            if (btnId.Equals("AddLabOrderButton"))
            {
                if (IsValid)
                {
                    System.Threading.Thread.Sleep(3000);
                    var doctorName = NameTextBox.Text;
                    var doctorId = GetGroupId(doctorName)[0];
                    var dateVisited = Convert.ToDateTime(VisitedDateTextBox.Text);

                    var labOrder = new LabOrder() { doctorId = doctorId, dateVisit = dateVisited };
                    _dataContext.LabOrders.InsertOnSubmit(labOrder);
                    _dataContext.SubmitChanges();
                    LabOrderList.DataBind();

                    //USe for Testing
                    //Debug.WriteLine("Doctor Name: " + doctorId);
                    //Debug.WriteLine("Date Visisted: " + dateVisited);

                    ResetInputField();
                }
            }
            else if (btnId.Equals("ResetLabOrderGroupButton"))
            {
                ResetInputField();
            }
        }
        //Control Update Process
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                System.Threading.Thread.Sleep(3000);
                var editedRowIndex = LabOrderList.EditIndex;
                var lblId = LabOrderList.Rows[editedRowIndex].FindControl("EditId") as Label;
                var txtbDName = LabOrderList.Rows[editedRowIndex].FindControl("EditDName") as TextBox;
                var txtbDate = LabOrderList.Rows[editedRowIndex].FindControl("EditDate") as TextBox;

                var id = long.Parse(lblId.Text);
                var doctorId = GetGroupId(txtbDName.Text)[0];
                var date = Convert.ToDateTime(txtbDate.Text);

                var labOrder = new LabOrder() { labOrderId = id, doctorId = doctorId, dateVisit = date };
                _dataContext.LabOrders.Attach(labOrder);
                _dataContext.Refresh(RefreshMode.KeepCurrentValues, labOrder);
                _dataContext.SubmitChanges();
                LabOrderList.EditIndex = -1;

                //Use For Debug passed value
                //Debug.WriteLine("id: " + id);
                //Debug.WriteLine("DName: " + doctorId);
                //Debug.WriteLine("Date: " + date);
            }
        }
예제 #3
0
 partial void DeleteLabOrder(LabOrder instance);
예제 #4
0
 partial void UpdateLabOrder(LabOrder instance);
예제 #5
0
 partial void InsertLabOrder(LabOrder instance);
예제 #6
0
		private void detach_LabOrders(LabOrder entity)
		{
			this.SendPropertyChanging();
			entity.Doctor = null;
		}
예제 #7
0
		private void attach_LabOrders(LabOrder entity)
		{
			this.SendPropertyChanging();
			entity.Doctor = this;
		}