/// <summary> /// Edición /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridView1_DoubleClick(object sender, EventArgs e) { using (frmResouceScheduling frm = new frmResouceScheduling()) { if (currentShiftSheduling.EntityState == Fwk.Bases.EntityState.Changed) { frm.ResourceSchedulingList = resourceSchedulingList; frm.State = Fwk.Bases.EntityUpdateEnum.UPDATED; frm.SchedulerShift = currentShiftSheduling; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (frm.SchedulerShift.EntityState == Fwk.Bases.EntityState.Changed) { try { ServiceCalls.UpdateResourceSheduling(frm.SchedulerShift, ServiceCalls.CurrentHealthInstitution.HealthInstitutionId); } catch (Exception ex) { this.ExceptionViewer.Show(ex); return; } } schedulerShiftBindingSource.DataSource = resourceSchedulingList; gridControl1.RefreshDataSource(); } } if (currentShiftSheduling.EntityState == Fwk.Bases.EntityState.Added) { ///Actualiza uno nuevo : Es desir que todavia no esta en la base de datos CreateResourceScheduling(currentShiftSheduling); } } }
private void CreateResourceScheduling(ResourceSchedulingBE currentShiftSheduling) { using (frmResouceScheduling frm = new frmResouceScheduling(profesionalBE.IdProfesional)) { if (this.resourceSchedulingList == null) { this.resourceSchedulingList = new ResourceSchedulingList(); } if (currentShiftSheduling != null) { frm.SchedulerShift = currentShiftSheduling; frm.State = Fwk.Bases.EntityUpdateEnum.UPDATED; } else { frm.State = Fwk.Bases.EntityUpdateEnum.NEW; } frm.ResourceSchedulingList = resourceSchedulingList; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { frm.SchedulerShift.EntityState = Fwk.Bases.EntityState.Added; if (frm.State == Fwk.Bases.EntityUpdateEnum.NEW) { frm.SchedulerShift.ResourceId = profesionalBE.IdProfesional; resourceSchedulingList.Add(frm.SchedulerShift); schedulerShiftBindingSource.DataSource = resourceSchedulingList; } gridControl1.RefreshDataSource(); } } }