Exemplo n.º 1
0
 private void LoadAllDocs(BackgroundWorker bw)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new System.Action <BackgroundWorker>(LoadAllDocs), bw);
     }
     else
     {
         List <DocObject> docs = null;
         if (allDocs)
         {
             docs = DocObjectLogic.GetInstance().GetAllDocObjects();
             bw.ReportProgress(50);
         }
         else
         {
             docs = new List <DocObject>();
             List <DocObject> doc = DocObjectLogic.GetInstance().GetDocObjectsByOwner(this.User);
             docs.AddRange(doc);
             bw.ReportProgress(30);
             List <int> tempIds = FlowTemplateLogic.GetInstance().GetTepmIdsByExecOrAppr(this.User.ID.ToString());
             bw.ReportProgress(50);
             List <DocObject> doc2 = DocObjectLogic.GetInstance().GetDocObjectsByTemplateId(tempIds);
             docs.AddRange(doc2);
             bw.ReportProgress(70);
         }
         LoadDocObjects(docs);
         if (owner != null)
         {
             owner.RefreshMsg("载入完毕");
         }
     }
 }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (alert != null)
            {
                switch (alert.提醒方式)
                {
                case 提醒方式.系统提示:
                    bool f = AlertLogic.GetInstance().SetFlag(alert.ID, 1);
                    if (!f)
                    {
                        MessageBox.Show("已阅置位失败!");
                    }
                    else
                    {
                        this.Close();
                    }
                    break;

                case 提醒方式.执行流程:
                    DocObject doc = DocObjectLogic.GetInstance().GetDocObject(Convert.ToInt32(alert.备注));
                    if (doc != null)
                    {
                        TaskInfo task = TaskInfoLogic.GetInstance().GetTaskInfoByEntityId(doc.ID);
                        if (task != null)
                        {
                            TaskStageLogic.GetInstance().SetReceiveToExec(task.Flow.Current.ID);
                        }
                        DocEditForm def = new DocEditForm(this.User, this.owner, doc.Form, doc, alert.ID);
                        if (def.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            this.Close();
                        }
                    }
                    break;

                case 提醒方式.审批流程:
                    DocObject doc2 = DocObjectLogic.GetInstance().GetDocObject(Convert.ToInt32(alert.备注));
                    if (doc2 != null)
                    {
                        TaskInfo task = TaskInfoLogic.GetInstance().GetTaskInfoByEntityId(doc2.ID);
                        if (task != null)
                        {
                            TaskStageLogic.GetInstance().SetReceiveToExec(task.Flow.Current.ID);
                        }
                        DocEditForm def = new DocEditForm(this.User, this.owner, doc2.Form, doc2, alert.ID);
                        if (def.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            this.Close();
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 3
0
 public DocInfoForm(User user, MainForm owner, DocObject doc)
 {
     this.User = user;
     InitializeComponent();
     this.owner = owner;
     this.doc   = doc;
     if (doc != null)
     {
         DocObjectLogic.GetInstance().Increase(doc.ID);
         this.Text = doc.DocInfo;
     }
 }
Exemplo n.º 4
0
        private void DelDoc()
        {
            DocObject doc = listBox1.SelectedItem as DocObject;

            if (doc != null)
            {
                if (MessageBox.Show("确定要删除该文档[" + doc.Name + "]吗?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
                {
                    if (DocObjectLogic.GetInstance().DeleteDocObject(doc, this.User))
                    {
                        MessageBox.Show("删除文档成功!");
                        listBox1.Items.RemoveAt(listBox1.SelectedIndex);
                    }
                    else
                    {
                        MessageBox.Show("删除失败或者您没有权限删除别人的文档!");
                    }
                }
            }
            else
            {
                MessageBox.Show("请先选定要删除的文档!");
            }
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            DocObjectLogic dol = DocObjectLogic.GetInstance();

            if (doc != null)
            {
                if (dol.UpdateDocObject(Document, this.User))
                {
                    MessageBox.Show("保存文档成功!");
                    if (appr > 0)
                    {
                        TaskInfo task = TaskInfoLogic.GetInstance().GetTaskInfoByEntityId(doc.ID);
                        if (task != null)
                        {
                            bool   flag = false;
                            string err  = "";
                            if (exeORapp == 0)
                            {
                                if (task.Flow.Execute())
                                {
                                    if (FlowLogic.GetInstance().UpdateFlow(task.Flow))
                                    {
                                        if (TaskStageLogic.GetInstance().SetActualExec(task.Flow.Current.ID, this.User))
                                        {
                                            flag = true;
                                        }
                                        else
                                        {
                                            err = "SetActualExec失败";
                                        }
                                    }
                                    else
                                    {
                                        err = "UpdateFlow失败";
                                    }
                                }
                                else
                                {
                                    err = "Execute失败";
                                }
                            }
                            else if (exeORapp == 1)
                            {
                                if (task.Flow.Approve())
                                {
                                    if (FlowLogic.GetInstance().UpdateFlow(task.Flow))
                                    {
                                        if (TaskStageLogic.GetInstance().SetActualAppr(task.Flow.Current.ID, this.User))
                                        {
                                            flag = true;
                                        }
                                        else
                                        {
                                            err = "SetActualAppr失败";
                                        }
                                    }
                                    else
                                    {
                                        err = "UpdateFlow失败";
                                    }
                                }
                                else
                                {
                                    err = "Approve失败";
                                }
                            }
                            if (flag)
                            {
                                AlertLogic.GetInstance().SetFlag(appr, 1);
                                MessageBox.Show("执行审批成功!");
                                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                            }
                            else
                            {
                                MessageBox.Show("执行审批失败。[exeORapp=" + exeORapp + ", err=" + err + "]");
                            }
                        }
                        else
                        {
                            MessageBox.Show("执行审批失败。");
                        }
                    }
                    else
                    {
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    }
                }
                else
                {
                    MessageBox.Show("保存文档失败或者您没有权限修改别人的文档!");
                }
            }
            else
            {
                int id = dol.AddDocObject(Document);
                if (id > 0)
                {
                    doc.ID = id;
                    MessageBox.Show("新建文档成功!如果需要对该文档做流程,请在右下角点击【设置审批】来生成流程!");
                }
                else
                {
                    MessageBox.Show("新建文档失败!");
                }
            }
        }