public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     IWindowsFormsEditorService service = null;
     if (((context != null) && (context.Instance != null)) && (provider != null))
     {
         service = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
         if (service != null)
         {
             CUniversalAuth instance = (CUniversalAuth) context.Instance;
             fSelectParticipant dialog = new fSelectParticipant();
             if (!string.IsNullOrEmpty(instance.ParticipantId))
             {
                 dialog.ParticipantID = instance.ParticipantId;
             }
             service.ShowDialog(dialog);
             if (!string.IsNullOrEmpty(dialog.ParticipantID))
             {
                 instance.ParticipantId = dialog.ParticipantID;
                 instance.ParticipantIdValue = dialog.ParticipantIdValue;
                 instance.ParticipantType = dialog.ParticipantType;
                 value = dialog.ParticipantName;
                 return value;
             }
         }
     }
     return value;
 }
 private void ParticipantButtonClick(object sender, ButtonPressedEventArgs e)
 {
     int focusedRowHandle = this.view.FocusedRowHandle;
     if (focusedRowHandle >= 0)
     {
         CUniversalAuth row = this.view.GetRow(focusedRowHandle) as CUniversalAuth;
         fSelectParticipant participant = new fSelectParticipant();
         if (!StringHelper.IsNull(row.ParticipantId))
         {
             participant.ParticipantID = row.ParticipantId;
         }
         participant.ShowDialog();
         if (!StringHelper.IsNull(participant.ParticipantID))
         {
             this.view.BeginUpdate();
             row.ParticipantId = participant.ParticipantID;
             row.ParticipantName = participant.ParticipantName;
             row.ParticipantType = participant.ParticipantType;
             row.ParticipantIdValue = participant.ParticipantIdValue;
             this.view.EndUpdate();
             this.CurrentUnitOfWork.RegisterDirty(row);
         }
         participant.Close();
     }
 }
示例#3
0
 private void propertyGrid_HelpRequested(object sender, HelpEventArgs hlpevent)
 {
     if (LoggingService.IsDebugEnabled)
     {
         LoggingService.DebugFormatted("propertyGrid_DoubleClick-'{0}'", new object[] { this.propertyGrid.SelectedGridItem.PropertyDescriptor.Name });
     }
     Actdef selectedObject = this.propertyGrid.SelectedObject as Actdef;
     string name = this.propertyGrid.SelectedGridItem.PropertyDescriptor.Name;
     if (name != null)
     {
         if (!(name == "SubflowProdefName"))
         {
             if (name == "ParticipantName")
             {
                 fSelectParticipant participant = new fSelectParticipant();
                 participant.ParticipantID = selectedObject.ParticipantId;
                 participant.ShowDialog(this);
                 if ((participant.ParticipantID != null) && (participant.ParticipantName != null))
                 {
                     selectedObject.ParticipantId = participant.ParticipantID;
                     selectedObject.ParticipantName = participant.ParticipantName;
                     this.mProDefDoc.CurrentUnitOfWork.RegisterDirty(selectedObject);
                 }
             }
             else if (name == "ApplicationName")
             {
                 fSelectApplication application = new fSelectApplication();
                 application.ApplicationID = selectedObject.ApplicationId;
                 application.ShowDialog(this);
                 if ((application.ApplicationID != null) && (application.ApplicationName != null))
                 {
                     selectedObject.ApplicationId = application.ApplicationID;
                     selectedObject.ApplicationName = application.ApplicationName;
                     this.mProDefDoc.CurrentUnitOfWork.RegisterDirty(selectedObject);
                 }
             }
             else if (name == "ActdefFormPermission")
             {
                 bool flag = false;
                 if (selectedObject.ActdefFormPermission == null)
                 {
                     selectedObject.ActdefFormPermission = new WfActdefFormPermission(selectedObject);
                     flag = true;
                 }
                 if (selectedObject.ActdefFormPermission != null)
                 {
                     DataFormPermissionSettingForm form = new DataFormPermissionSettingForm();
                     form.FormPermission = selectedObject.ActdefFormPermission;
                     if (form.ShowDialog() == DialogResult.OK)
                     {
                         if ((form.FormPermission == null) && !flag)
                         {
                             this.mProDefDoc.CurrentUnitOfWork.RegisterRemoved(selectedObject.ActdefFormPermission);
                         }
                         selectedObject.ActdefFormPermission = form.FormPermission as WfActdefFormPermission;
                         if (flag && (selectedObject.ActdefFormPermission != null))
                         {
                             this.mProDefDoc.CurrentUnitOfWork.RegisterNew(selectedObject.ActdefFormPermission);
                         }
                         else if (selectedObject.ActdefFormPermission != null)
                         {
                             this.mProDefDoc.CurrentUnitOfWork.RegisterDirty(selectedObject.ActdefFormPermission);
                         }
                     }
                     else if (flag)
                     {
                         selectedObject.ActdefFormPermission = null;
                     }
                     form.Close();
                 }
             }
         }
         else
         {
             fSelectSubflow subflow = new fSelectSubflow();
             subflow.SubFlowProdefID = selectedObject.SubflowProdefId;
             subflow.ShowDialog(this);
             if ((subflow.SubFlowProdefID != null) && (subflow.SubFlowProdefName != null))
             {
                 selectedObject.SubflowProdefId = subflow.SubFlowProdefID;
                 selectedObject.SubflowProdefName = subflow.SubFlowProdefName;
                 this.mProDefDoc.CurrentUnitOfWork.RegisterDirty(selectedObject);
             }
         }
     }
 }