⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 activityinfodlg.cs

📁 这个是自己制作的工作流设计器,可以可视化的拖拉
💻 CS
📖 第 1 页 / 共 3 页
字号:
                if (vo is WfTransition)
                {
                    WfTransition trans = vo as WfTransition;
                    if (trans.EndActivity == act)
                    {
                        //如果前一个节点是普通节点类型

                        if (trans.StartActivity is WfActivity)
                        {
                            if (!al.Contains(trans.StartActivity))
                                al.Add(trans.StartActivity);
                            GetBeforeActivity(trans.StartActivity as WfActivity, ref al);
                        }
                    }
                }
            }

        }
        #endregion
  
        #region 时限事件
        private void checkBoxIsWorkday_CheckedChanged(object sender, EventArgs e)
        {
            this.textBoxMustTime.Text = "0.00";
            this.checkBoxIsWorkday.Checked = this.checkBoxIsWorkday.Checked;
            this.textBoxMustTime.Enabled = this.checkBoxIsWorkday.Checked;
            this.checkBoxIsWarningDay.Enabled = this.checkBoxIsWorkday.Checked;
            if (!this.checkBoxIsWorkday.Checked)
            {
                this.textBoxWarningTime.Text = "0.00";
                this.checkBoxIsWarningDay.Checked = false;
                this.textBoxWarningTime.Enabled = false;
            }
            
        }

        private void checkBoxIsWarningDay_CheckedChanged(object sender, EventArgs e)
        {
            this.textBoxWarningTime.Text = "0.00";
            this.checkBoxIsWarningDay.Checked = this.checkBoxIsWarningDay.Checked;
            this.textBoxWarningTime.Enabled = this.checkBoxIsWarningDay.Checked;
        }
        #endregion

        #region 通用事件

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }


        private void buttonOk_Click(object sender, EventArgs e)
        {
            //判断并保存该流程信息
            if (this.IsVaild())
            {
                this.Save();

            }
        }

        private bool IsVaild()
        {
            if (!this.IsVaildWorkDay())
            {
                return false;
            }
            if (!this.IsVaildSelectUser())
            { return false; }
            return true;
        }

        private void Save()
        {

            //保存填写的信息
            try
            {
               // Program.WorkflowControl.UpdateFlow(_flow, this.textBoxName.Text, Convert.ToDouble(this.textBoxMustTime.Text), Convert.ToDouble(this.textBoxWarningTime.Text));
                //更新系统
                //得到属性信息

                this._wfActivity.Name = this.textBoxName.Text;
                this._wfActivity.Workday = Convert.ToDouble(this.textBoxMustTime.Text);
                this._wfActivity.Warning_time = Convert.ToDouble(this.textBoxWarningTime.Text);

                
                if (this.checkBoxIsEnableSendBack.Checked)
                {
                    this._wfActivity.IsSendBack = 1;
                }
                else
                {
                    this._wfActivity.IsSendBack = 0;
                }
                if (this.checkBoxIsSendSelf.Checked)
                {
                    this._wfActivity.IsSendSelf = 1;
                }
                else
                {
                    this._wfActivity.IsSendSelf = 0;
                }

                if (this.radioButtonSelectRole.Checked)
                {

                    if (this.comboBoxRole.SelectedValue.ToString() != "")
                    {
                        this._wfActivity.Role = this.GetRoleInfoByRoleName(this.comboBoxRole.SelectedValue.ToString());
                    }
                    else
                    {
                        this._wfActivity.Role = null;
                    }
                    this._wfActivity.IsSelectUser = 0;

                }

                if (this.radioButtonBeforActiv.Checked)
                {
                    WfActivity activ = null ;
                    if (this.comboBoxPrevActive.SelectedValue.ToString() != "")
                    {
                        this._wfActivity.Before_ActiveInfo = this.GetActivityByName(this.comboBoxPrevActive.SelectedValue.ToString());
                    }
                    else
                    {
                        this._wfActivity.Before_ActiveInfo = null;
                    }
                    this._wfActivity.IsSelectUser = 1;
                }
                
                this._wfActivity.AfterSend_Event=this.textBoxAfterSend.Text;
                this._wfActivity.BeforeRecive_Event=this.textBoxBeforRecive.Text ;

                IList<WfApplication> Applist = new List<WfApplication>();
                //保存应用信息
                foreach (WfApplication app in listBoxSlectedAppInfo.Items)
                {
                    Applist.Add(app);
                }

                this._wfActivity.AppList = Applist;



                IList<WfParam> paramlist = new List<WfParam>();
                //保存应用信息
                foreach (WfParam param in this.listBoxSelectedParam.Items)
                {
                    paramlist.Add(param);
                }

                this._wfActivity.ParamsInfo = paramlist;


                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }



        }
#endregion

        #region 用户选择事件
       
        private void radioButtonSelectRole_CheckedChanged(object sender, EventArgs e)
        {
          
            if (this.radioButtonSelectRole.Checked)
            {
                this.radioButtonSelectRole.Checked = true;
                this.comboBoxRole.Enabled = true;
                this.radioButtonBeforActiv.Checked = false;
                this.comboBoxPrevActive.Enabled = false;
                this.comboBoxPrevActive.Text = "";
                this.comboBoxPrevActive.SelectedValue = "";
            }
            
        }

        private void radioButtonBeforActiv_CheckedChanged(object sender, EventArgs e)
        {

           
            if (this.radioButtonBeforActiv.Checked)
            {
                this.radioButtonSelectRole.Checked = false;
                this.comboBoxRole.Enabled = false;
                this.radioButtonBeforActiv.Checked = true;
                this.comboBoxPrevActive.Enabled = true;
                this.comboBoxRole.Text = "";
                this.comboBoxRole.SelectedValue = "";
            }
        }
        #endregion

        #region 应用按钮事件

        private void buttonTop_Click(object sender, EventArgs e)
        {
            //将选中的项位置上移一格
            ArrayList al = new ArrayList();
            //得到选中的最小pos
            int fistPos = GetMaxMinPos(out al, false);

            this.SortTopButtom(fistPos, al, 1, true);
            SetListBoxFouces(al);
        }

        private void buttonButtom_Click(object sender, EventArgs e)
        {
            //将选中的项位置上移一格
            ArrayList al = new ArrayList();
            //得到选中的最大pos
            int fistPos = GetMaxMinPos(out al, true);
            //根据最大的排序


            //fistPos = fistPos + 1;

            this.SortTopButtom(fistPos, al, 1, false);
            SetListBoxFouces(al);
        }

        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (this.listBoxAppInfo.SelectedItems.Count > 0)
            {
                this.AddAppInfo();
            }
            else
            {
                MessageBox.Show("没有应用信息可以添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            this.BindAppsInfo();
        }

        private void buttonDelete_Click(object sender, EventArgs e)
        {
            if (this.listBoxSlectedAppInfo.SelectedItems.Count > 0)
            {
                this.DeleteSelectAppInfoBySelectApp();
            }
            else
            {
                MessageBox.Show("请选择要删除的应用信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            BindAppsInfo();
        }

        private void buttonAddAll_Click(object sender, EventArgs e)
        {

            if (this.listBoxAppInfo.Items.Count > 0)
            {
                this.AddAllAppInfo();
            }
            else
            {
                MessageBox.Show("没有应用信息可以添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            BindAppsInfo();
        }

        private void buttonDeleteAll_Click(object sender, EventArgs e)
        {
            if (this.listBoxSlectedAppInfo.Items.Count > 0)
            {
                this.DeleteAllSelectAppInfo();
            }
            else
            {
                MessageBox.Show("请选择要删除的应用信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            BindAppsInfo();
        }
        #endregion

        #region 列表操作
        
        private bool IsExistsAppInfo(String AppName)
        {

            foreach (WfApplication drv in this.listBoxSlectedAppInfo.Items)
            {
                String Name = drv.Name;

                if (Name == AppName)
                {
                    return true;
                }
            }

            return false;
        }
        private void AddAppInfo()
        {
            foreach (WfApplication drv in this.listBoxAppInfo.SelectedItems)
            {
                String AppName = drv.Name;
                
                if (!IsExistsAppInfo(AppName))
                {

                    this.listBoxSlectedAppInfo.Items.Add((object)drv);
                }


            }
        }
        private void AddAllAppInfo()
        {
            //this.listBoxAppInfo.Items.Clear();
            foreach (WfApplication drv in this.listBoxAppInfo.Items)
            {
                String AppName = drv.Name;
                
                if (!IsExistsAppInfo(AppName))
                {

                    this.listBoxSlectedAppInfo.Items.Add((object)drv);
                }


            }
        }
        private void DeleteAllSelectAppInfo()
        {
            ArrayList al = new ArrayList();
            foreach (WfApplication drv in listBoxSlectedAppInfo.Items)
            {
                al.Add(drv);
            }
            foreach (WfApplication drv in al)
            {
                listBoxSlectedAppInfo.Items.Remove((object)drv);
            }
        }

        private void DeleteSelectAppInfoBySelectApp()
        {

            ArrayList al = new ArrayList();
            foreach (WfApplication drv in listBoxSlectedAppInfo.SelectedItems)
            {
                al.Add(drv);
            }
            foreach (WfApplication drv in al)
            {
                listBoxSlectedAppInfo.Items.Remove((object)drv);
            }
            //
            //al.CopyTo(alTemp);
        }
        #endregion

        #region 列表排序

        private int GetMaxMinPos(out ArrayList al, bool IsMax)
        {
            al = new ArrayList();
            ArrayList alpos = new ArrayList(); 
            int pos = this.listBoxSlectedAppInfo.SelectedIndex;
            foreach (WfApplication drv in this.listBoxSlectedAppInfo.SelectedItems)
            {
                alpos.Add(this.listBoxSlectedAppInfo.Items.IndexOf(drv));
                int temppos = this.listBoxSlectedAppInfo.Items.IndexOf(drv);
                if (IsMax)
                {
                    if (temppos > pos)
                        pos = temppos;

                }
                else
                {
                    if (temppos < pos)
                        pos = temppos;
                }
            }

            for (int x = 0; x < alpos.Count; x++)
            {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -