예제 #1
0
 private void selectListItems(InsPtn[] rels)
 {
     foreach (GridViewRowInfo gi in lstIns.Rows)
     {
         gi.Cells[0].Value = rels.Any(x => x.InsuranceId == (gi.DataBoundItem as Insurance).Id);
     }
 }
예제 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the InsPtns EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToInsPtns(InsPtn insPtn)
 {
     base.AddObject("InsPtns", insPtn);
 }
예제 #3
0
        private void lstIns_CellValueChanged(object sender, GridViewCellEventArgs e)
        {
            if (e.ColumnIndex != 0) return;

            Patient patient = patientBindingSource.DataSource as Patient;
            if (patient == null/*|| string.IsNullOrEmpty(patient.Code)*/) return;
            Insurance sc = lstIns.Rows[e.RowIndex].DataBoundItem as Insurance;
            if ((bool)e.Value)
            {
                if (patient.InsPtns.FirstOrDefault(item => item.InsuranceId == sc.Id) == null)
                {
                    InsPtn rel = new InsPtn();
                    rel.Patient = patient;
                    rel.InsuranceId = sc.Id;

                }
            }
            else
            {
                InsPtn i = patient.InsPtns.FirstOrDefault(item => item.Patient == patient && item.InsuranceId == sc.Id);
                if (i != null)
                    patient.InsPtns.Remove(i);

            }
        }
예제 #4
0
 /// <summary>
 /// Create a new InsPtn object.
 /// </summary>
 /// <param name="insuranceId">Initial value of the InsuranceId property.</param>
 /// <param name="patientId">Initial value of the PatientId property.</param>
 public static InsPtn CreateInsPtn(global::System.Int32 insuranceId, global::System.Int32 patientId)
 {
     InsPtn insPtn = new InsPtn();
     insPtn.InsuranceId = insuranceId;
     insPtn.PatientId = patientId;
     return insPtn;
 }