public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formType, SubscriptionWrapper subscriptionWrapper)
        {
            try
            {
                InitializeComponent();
                Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
                {
                    if (t.IsFaulted && t.Exception != null)
                    {
                        WriteToLog(t.Exception.Message);
                    }
                });
                this.mainForm        = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                if (formType == FormTypeEnum.Listener)
                {
                    var listenerControl = new ListenerControl(WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), subscriptionWrapper.SubscriptionDescription)
                    {
                        Location = new Point(1, panelMain.HeaderHeight + 1),
                        Size     = new Size(panelMain.Size.Width - 3, subscriptionWrapper.SubscriptionDescription.RequiresSession ? 544 : 520),
                        Anchor   = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                    };
                    listenerControl.Focus();

                    Text = string.Format(SubscriptionListenerFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    mainSplitContainer.SplitterDistance = subscriptionWrapper.SubscriptionDescription.RequiresSession ? 570 : listenerControl.Size.Height + 26;
                    panelMain.HeaderText = string.Format(HeaderTextSubscriptionListenerFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    panelMain.Controls.Add(listenerControl);
                }
                else
                {
                    testSubscriptionControl = new TestSubscriptionControl(mainForm, WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), subscriptionWrapper)
                    {
                        Location = new Point(1, panelMain.HeaderHeight + 1),
                        Size     = new Size(panelMain.Size.Width - 3, panelMain.Size.Height - 26),
                        Anchor   = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                    };

                    testSubscriptionControl.btnCancel.Click -= testSubscriptionControl.btnCancel_Click;
                    testSubscriptionControl.btnCancel.Click += BtnCancelOnClick;
                    testSubscriptionControl.Focus();

                    Text = string.Format(TestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);

                    panelMain.HeaderText = string.Format(HeaderTextTestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    panelMain.Controls.Add(testSubscriptionControl);
                }
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
示例#2
0
 /// <summary>
 /// 表单数据处理
 /// </summary>
 /// <param name="t">对象</param>
 /// <param name="formType">表单类型</param>
 /// <param name="currUser">当前用户</param>
 public void FormDataHandle(OrgM_Emp t, FormTypeEnum formType, UserInfo currUser = null)
 {
     if (t != null)
     {
         OrgM_EmpDeptDuty empPosition = OrgMOperate.GetEmpMainPosition(t.Id);
         if (empPosition != null)
         {
             if (empPosition.OrgM_DeptId.HasValue && empPosition.OrgM_DeptId.Value != Guid.Empty &&
                 empPosition.OrgM_DutyId.HasValue && empPosition.OrgM_DutyId.Value != Guid.Empty)
             {
                 OrgM_Dept dept = OrgMOperate.GetDeptById(empPosition.OrgM_DeptId.Value);
                 if (dept != null)
                 {
                     t.DeptId   = dept.Id;
                     t.DeptName = string.IsNullOrEmpty(dept.Alias) ? dept.Name : dept.Alias;
                 }
                 OrgM_Duty duty = OrgMOperate.GetDuty(empPosition.OrgM_DutyId.Value);
                 if (duty != null)
                 {
                     t.DutyId   = duty.Id;
                     t.DutyName = duty.Name;
                 }
             }
         }
     }
 }
示例#3
0
        private static ItemChoiceType TranslateFromFormFieldType(FormTypeEnum formType)
        {
            switch (formType)
            {
            case FormTypeEnum.Date:
                return(ItemChoiceType.Date);

            case FormTypeEnum.DateTime:
                return(ItemChoiceType.DateTime);

            case FormTypeEnum.Decimal:
                return(ItemChoiceType.Decimal);

            case FormTypeEnum.Description:
                return(ItemChoiceType.Memo);

            case FormTypeEnum.Password:
                return(ItemChoiceType.String);

            case FormTypeEnum.Table:
                return(ItemChoiceType.Table);

            case FormTypeEnum.Text:
                return(ItemChoiceType.String);

            case FormTypeEnum.SubstitutionRule:
            case FormTypeEnum.Role:
            case FormTypeEnum.User:
            case FormTypeEnum.Keyword:
                return(ItemChoiceType.Keywords);
            }
            return(ItemChoiceType.String);
        }
        public override async Task OnInvocation(AspectContext aspectContext, AspectDelegate _next)
        {
            var startTime = DateTime.Now;
            var stopwatch = new System.Diagnostics.Stopwatch();

            stopwatch.Start();
            await _next(aspectContext);

            KStarFormModel response = (KStarFormModel)aspectContext.InvocationContext.ReturnValue;

            if (aspectContext.ComponentContext.IsRegisteredWithName <IFormLogicService>(response.FormInstance.ProcessCode))
            {
                var service = aspectContext.ComponentContext.ResolveNamed <IFormLogicService>(response.FormInstance.ProcessCode);

                FormTypeEnum formType = (FormTypeEnum)Enum.Parse(typeof(FormTypeEnum), response.FormType);
                switch (formType)
                {
                case FormTypeEnum.Application:
                    service.OnKStarFormStartupAfter(response);
                    break;

                case FormTypeEnum.Draft:
                    service.OnKStarFormDraftAfter(response);
                    break;

                case FormTypeEnum.Approval:
                    service.OnKStarFormApprovalAfter(response);
                    break;

                case FormTypeEnum.View:
                    service.OnKStarFormViewAfter(response);
                    break;

                default:
                    break;
                }
            }
            stopwatch.Stop();
            Domain.Logger.DbLogManager.Post(System.Web.HttpContext.Current, new Domain.Logger.PrcServer_UserOperationLog()
            {
                ActivityName      = response.Operation.ActivityName,
                ApprovalType      = null,
                StartTime         = startTime,
                Message           = response.FormType,
                Folio             = response.FormInstance.Folio,
                ProcessCode       = response.FormInstance.ProcessCode,
                ProcessName       = response.FormInstance.ProcessName,
                Type              = (byte)Domain.Logger.UserOperationEnum.OpenForm,
                ResponseTime      = stopwatch.Elapsed.TotalMilliseconds,
                FormId            = response.FormInstance.Id,
                CreateDisplayName = response.Operation.CurrentUserDisplayName
            });
        }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formTypeType, TopicDescription topicDescription, List <SubscriptionDescription> subscriptionList)
        {
            try
            {
                InitializeComponent();
                this.mainForm        = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                testTopicControl = new TestTopicControl(mainForm, WriteToLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), topicDescription, subscriptionList)
                {
                    Location = new Point(1, panelMain.HeaderHeight + 1)
                };


                if (formTypeType == FormTypeEnum.Send)
                {
                    testTopicControl.mainTabControl.TabPages.RemoveAt(2);
                    testTopicControl.receiverEnabledCheckBox.Checked = false;
                    Text = string.Format(SendMessagesFormat, topicDescription.Path);
                }
                else
                {
                    Text             = string.Format(TestTopicFormat, topicDescription.Path);
                    logTraceListener = new LogTraceListener(WriteToLog);
                    Trace.Listeners.Add(logTraceListener);
                }

                testTopicControl.btnCancel.Text   = CloseLabel;
                testTopicControl.btnCancel.Click -= testTopicControl.btnCancel_Click;
                testTopicControl.btnCancel.Click += BtnCancelOnClick;
                testTopicControl.Focus();

                panelMain.HeaderText = string.Format(HeaderTextTestTopicFormat, topicDescription.Path);
                panelMain.Controls.Add(testTopicControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formType, SubscriptionWrapper subscriptionWrapper)
        {
            try
            {
                InitializeComponent();
                Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
                {
                    if (t.IsFaulted && t.Exception != null)
                    {
                        WriteToLog(t.Exception.Message);
                    }
                });
                this.mainForm = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                if (formType == FormTypeEnum.Listener)
                {
                    var listenerControl = new ListenerControl(WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), subscriptionWrapper.SubscriptionDescription)
                    {
                        Location = new Point(1, panelMain.HeaderHeight + 1),
                        Size = new Size(panelMain.Size.Width - 3, subscriptionWrapper.SubscriptionDescription.RequiresSession ? 544 : 520),
                        Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                    };
                    listenerControl.Focus();

                    Text = string.Format(SubscriptionListenerFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    mainSplitContainer.SplitterDistance = subscriptionWrapper.SubscriptionDescription.RequiresSession ? 570 : listenerControl.Size.Height + 26;
                    panelMain.HeaderText = string.Format(HeaderTextSubscriptionListenerFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    panelMain.Controls.Add(listenerControl);
                }
                else
                {
                    testSubscriptionControl = new TestSubscriptionControl(mainForm, WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), subscriptionWrapper)
                    {
                        Location = new Point(1, panelMain.HeaderHeight + 1),
                        Size = new Size(panelMain.Size.Width - 3, panelMain.Size.Height - 26),
                        Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                    };

                    testSubscriptionControl.btnCancel.Click -= testSubscriptionControl.btnCancel_Click;
                    testSubscriptionControl.btnCancel.Click += BtnCancelOnClick;
                    testSubscriptionControl.Focus();

                    Text = string.Format(TestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);

                    panelMain.HeaderText = string.Format(HeaderTextTestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);
                    panelMain.Controls.Add(testSubscriptionControl);
                }
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formType, TopicDescription topicDescription, List<SubscriptionDescription> subscriptionList)
        {
            try
            {
                InitializeComponent();
                Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
                {
                    if (t.IsFaulted && t.Exception != null)
                    {
                        WriteToLog(t.Exception.Message);
                    }
                });
                this.mainForm = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                testTopicControl = new TestTopicControl(mainForm, WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), topicDescription, subscriptionList)
                                       {
                                           Location = new Point(1, panelMain.HeaderHeight + 1),
                                           Size = new Size(panelMain.Size.Width - 3, panelMain.Size.Height - 26),
                                           Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                                       };


                if (formType == FormTypeEnum.Send)
                {
                    testTopicControl.mainTabControl.TabPages.RemoveAt(2);
                    testTopicControl.receiverEnabledCheckBox.Checked = false;
                    testTopicControl.senderEnabledCheckBox.Checked = true;
                    testTopicControl.senderEnabledCheckBox.Visible = false;
                    testTopicControl.grouperMessage.Location = new Point(testTopicControl.grouperMessage.Location.X, 8);
                    testTopicControl.grouperMessage.Size = new Size(testTopicControl.grouperMessage.Size.Width,
                                                                    testTopicControl.grouperMessage.Size.Height + 16);
                    testTopicControl.grouperSender.Location = new Point(testTopicControl.grouperSender.Location.X, 8);
                    testTopicControl.grouperSender.Size = new Size(testTopicControl.grouperSender.Size.Width,
                                                                   testTopicControl.grouperSender.Size.Height + 16);
                    Text = string.Format(SendMessagesFormat, topicDescription.Path);
                }
                else
                {
                    Text = string.Format(TestTopicFormat, topicDescription.Path);
                    logTraceListener = new LogTraceListener(WriteToLog);
                    Trace.Listeners.Add(logTraceListener);
                }

                testTopicControl.btnCancel.Text = CloseLabel;
                testTopicControl.btnCancel.Click -= testTopicControl.btnCancel_Click;
                testTopicControl.btnCancel.Click += BtnCancelOnClick;
                testTopicControl.Focus();

                panelMain.HeaderText = string.Format(HeaderTextTestTopicFormat, topicDescription.Path);
                panelMain.Controls.Add(testTopicControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formType, TopicDescription topicDescription, List <SubscriptionDescription> subscriptionList)
        {
            try
            {
                InitializeComponent();
                Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
                {
                    if (t.IsFaulted && t.Exception != null)
                    {
                        WriteToLog(t.Exception.Message);
                    }
                });
                this.mainForm        = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                testTopicControl = new TestTopicControl(mainForm, WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), topicDescription, subscriptionList)
                {
                    Location = new Point(1, panelMain.HeaderHeight + 1),
                    Size     = new Size(panelMain.Size.Width - 3, panelMain.Size.Height - 26),
                    Anchor   = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                };


                if (formType == FormTypeEnum.Send)
                {
                    testTopicControl.mainTabControl.TabPages.RemoveAt(2);
                    testTopicControl.receiverEnabledCheckBox.Checked = false;
                    testTopicControl.senderEnabledCheckBox.Checked   = true;
                    testTopicControl.senderEnabledCheckBox.Visible   = false;
                    testTopicControl.grouperMessage.Location         = new Point(testTopicControl.grouperMessage.Location.X, 8);
                    testTopicControl.grouperMessage.Size             = new Size(testTopicControl.grouperMessage.Size.Width,
                                                                                testTopicControl.grouperMessage.Size.Height + 16);
                    testTopicControl.grouperSender.Location = new Point(testTopicControl.grouperSender.Location.X, 8);
                    testTopicControl.grouperSender.Size     = new Size(testTopicControl.grouperSender.Size.Width,
                                                                       testTopicControl.grouperSender.Size.Height + 16);
                    Text = string.Format(SendMessagesFormat, topicDescription.Path);
                }
                else
                {
                    Text             = string.Format(TestTopicFormat, topicDescription.Path);
                    logTraceListener = new LogTraceListener(WriteToLog);
                    Trace.Listeners.Add(logTraceListener);
                }

                testTopicControl.btnCancel.Text   = CloseLabel;
                testTopicControl.btnCancel.Click -= testTopicControl.btnCancel_Click;
                testTopicControl.btnCancel.Click += BtnCancelOnClick;
                testTopicControl.Focus();

                panelMain.HeaderText = string.Format(HeaderTextTestTopicFormat, topicDescription.Path);
                panelMain.Controls.Add(testTopicControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formTypeType, QueueDescription queueDescription)
        {
            try
            {
                InitializeComponent();
                this.mainForm = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;
                testQueueControl = new TestQueueControl(mainForm, WriteToLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), queueDescription)
                                       {
                                           Location = new Point(1, panelMain.HeaderHeight + 1)
                                       };

                if (formTypeType == FormTypeEnum.Send)
                {
                    testQueueControl.mainTabControl.TabPages.RemoveAt(2);
                    testQueueControl.receiverEnabledCheckBox.Checked = false;
                    Text = string.Format(SendMessagesFormat, queueDescription.Path);
                }
                else
                {
                    Text = string.Format(TestQueueFormat, queueDescription.Path);
                    logTraceListener = new LogTraceListener(WriteToLog);
                    Trace.Listeners.Add(logTraceListener);
                }

                testQueueControl.btnCancel.Text = CloseLabel;
                testQueueControl.btnCancel.Click -= testQueueControl.btnCancel_Click;
                testQueueControl.btnCancel.Click += BtnCancelOnClick;
                testQueueControl.Focus();

                panelMain.HeaderText = string.Format(HeaderTextTestQueueFormat, queueDescription.Path);
                panelMain.Controls.Add(testQueueControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
示例#10
0
 /// <summary>
 /// 获取表单tags
 /// </summary>
 /// <param name="formType"></param>
 /// <param name="tags"></param>
 /// <param name="isAdd"></param>
 /// <param name="currUser"></param>
 /// <returns></returns>
 public List <FormToolTag> GetFormToolTags(FormTypeEnum formType, List <FormToolTag> tags, bool isAdd = false, UserInfo currUser = null)
 {
     return(tags);
 }
示例#11
0
 /// <summary>
 /// 获取表单按钮
 /// </summary>
 /// <param name="formType"></param>
 /// <param name="buttons"></param>
 /// <param name="isAdd"></param>
 /// <param name="isDraft"></param>
 /// <param name="currUser"></param>
 /// <returns></returns>
 public List <FormButton> GetFormButtons(FormTypeEnum formType, List <FormButton> buttons, bool isAdd = false, bool isDraft = false, UserInfo currUser = null)
 {
     return(buttons);
 }
        public FamilyGeometryForm(Autodesk.Revit.DB.GenericForm form)
        {
            Id = form.Id.IntegerValue;
            this.geomVisibility = new GeometryVisibility(form.GetVisibility());

            //Autodesk.Revit.DB.Parameter sketchPlaneParam = form.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.SKETCH_PLANE_PARAM);
            //if(sketchPlaneParam != null)
            //{
            //    this.
            //}

            IsSolidGeometry = form.IsSolid;
            if (form.Subcategory == null)
            {
                SubcategoryName = "";
            }
            else
            {
                SubcategoryName = form.Subcategory.Name;
            }



            if (form is Extrusion)
            {
                FormType = FormTypeEnum.Extrusion;
                Extrusion      ex = form as Extrusion;
                Sketch         extrusionProfile = ex.Sketch;
                GeometrySketch gs = new GeometrySketch(extrusionProfile);
                List_Profiles = new List <GeometrySketch> {
                    gs
                };
            }
            else if (form is Blend)
            {
                FormType = FormTypeEnum.Blend;
                Blend          bl            = form as Blend;
                GeometrySketch TopProfile    = new GeometrySketch(bl.TopSketch);
                GeometrySketch BottomProfile = new GeometrySketch(bl.BottomSketch);
                List_Profiles = new List <GeometrySketch> {
                    TopProfile, BottomProfile
                };
            }
            else if (form is Revolution)
            {
                FormType = FormTypeEnum.Revolution;
                Revolution     rev        = form as Revolution;
                Sketch         revProfile = rev.Sketch;
                GeometrySketch gs         = new GeometrySketch(revProfile);

                GeometrySketch axis = new GeometrySketch(rev.Axis.Id.IntegerValue, -1, null);
                List_Profiles = new List <GeometrySketch> {
                    gs, axis
                };
            }
            else if (form is Sweep)
            {
                FormType = FormTypeEnum.Sweep;
                Sweep sw = form as Sweep;
                List_Profiles = new List <GeometrySketch>();
                if (sw.Path3d != null)
                {
                    GeometrySketch gs = new GeometrySketch(sw.Path3d);
                    List_Profiles.Add(gs);
                }
                else if (sw.PathSketch != null)
                {
                    GeometrySketch gs = new GeometrySketch(sw.PathSketch);
                    List_Profiles.Add(gs);
                }

                if (sw.ProfileSymbol != null)
                {
                    GeometrySketch gs = new GeometrySketch(sw.ProfileSymbol.Profile.Id.IntegerValue, -1, null);
                }
                else if (sw.ProfileSketch != null)
                {
                    GeometrySketch gs = new GeometrySketch(sw.ProfileSketch);
                    List_Profiles.Add(gs);
                }
            }
            else if (form is SweptBlend)
            {
                FormType = FormTypeEnum.SweptBlend;
                SweptBlend sb = form as SweptBlend;
                List_Profiles = new List <GeometrySketch>();
                if (sb.SelectedPath != null)
                {
                    Curve          path = sb.SelectedPath;
                    GeometrySketch gs   = new GeometrySketch(path.Reference.ElementId.IntegerValue, -1, null);
                    List_Profiles.Add(gs);
                }
                else if (sb.PathSketch != null)
                {
                    GeometrySketch gs = new GeometrySketch(sb.PathSketch);
                    List_Profiles.Add(gs);
                }

                GeometrySketch gs1 = new GeometrySketch(sb.TopProfile);
                GeometrySketch gs2 = new GeometrySketch(sb.BottomProfile);
                List_Profiles.Add(gs1);
                List_Profiles.Add(gs2);
            }
        }