コード例 #1
0
ファイル: TaskInfoLogic.cs プロジェクト: zanderzhg/TopFashion
        public int AddTaskInfo(TaskInfo element)
        {
            string sql = "insert into TaskInfo (EntityId, FlowID, Sponsor, Remark) values (" + element.EntityId + ", " + element.Flow.ID + ", '" + element.Sponsor + "', '" + element.Remark + "'); select SCOPE_IDENTITY()";
            object obj = sqlHelper.ExecuteSqlReturn(sql);
            int    R;

            if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R))
            {
                Flow flow = FlowLogic.GetInstance().GetFlow(element.Flow.ID);
                if (flow != null)
                {
                    FlowTemplate temp = FlowTemplateLogic.GetInstance().GetFlowTemplate(flow.Template.ID);
                    if (temp != null)
                    {
                        Alert alert = new Alert();
                        alert.提醒对象 = string.Join(",", temp.Stages[flow.CurrentIndex].Executors.ToArray());
                        alert.提醒方式 = 提醒方式.执行流程;
                        alert.提醒时间 = DateTime.Now;
                        alert.提醒项目 = flow.Name;
                        alert.备注   = flow.ID.ToString();
                        AlertLogic.GetInstance().AddAlert(alert);
                        Alert alert2 = new Alert();
                        alert2.提醒对象 = string.Join(",", temp.Stages[flow.CurrentIndex].Approvers.ToArray());
                        alert2.提醒方式 = 提醒方式.审批流程;
                        alert2.提醒时间 = DateTime.Now;
                        alert2.提醒项目 = flow.Name;
                        alert.备注    = flow.ID.ToString();
                        AlertLogic.GetInstance().AddAlert(alert2);
                        return(R);
                    }
                }
            }
            return(0);
        }
コード例 #2
0
ファイル: AlertLogic.cs プロジェクト: zanderzhg/TopFashion
        public static AlertLogic GetInstance()
        {
            if (instance == null)
            {
                instance = new AlertLogic();
            }

            return(instance);
        }
コード例 #3
0
ファイル: AlertMyForm.cs プロジェクト: zanderzhg/TopFashion
        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;
                }
            }
        }
コード例 #4
0
        private void LoadAlerts()
        {
            List <Alert> elements = AlertLogic.GetInstance().GetAllAlerts();

            comboBox1.Items.Clear();
            foreach (Alert element in elements)
            {
                comboBox1.Items.Add(element);
            }
        }
コード例 #5
0
        private void LoadAlerts()
        {
            List <Alert> elements = AlertLogic.GetInstance().GetAllAlerts();

            comboBox1.Items.Clear();
            foreach (Alert element in elements)
            {
                comboBox1.Items.Add(element);
            }
            dataGridView1.DataSource = AlertLogic.GetInstance().GetAlerts(string.Empty);
        }
コード例 #6
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            List <Alert> alerts = AlertLogic.GetInstance().GetSysAlertsByUser(this.User);

            foreach (Alert a in alerts)
            {
                if (a.提醒时间 < DateTime.Now)
                {
                    AlertMyForm amf = AlertMyForm.Instance(this.User, this, a);
                    amf.Show();
                }
            }
        }
コード例 #7
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         Alert alert = (Alert)comboBox1.SelectedItem;
         alert.提醒项目 = textBox1.Text.Trim();
         alert.提醒方式 = (提醒方式)comboBox3.SelectedItem;
         if (alert.提醒方式 == 提醒方式.系统提示 || alert.提醒方式 == 提醒方式.员工短信)
         {
             alert.提醒对象 = Commons.GetStaffIdStr(selectStaffControl1.SelectedStaffs);
         }
         else if (alert.提醒方式 == 提醒方式.会员短信)
         {
             alert.提醒对象 = Commons.GetMemberIdStr(selectMemberControl1.SelectedMembers);
         }
         alert.提醒时间 = dateTimePicker1.Value;
         alert.Flag = checkBox1.Checked ? 1 : 0;
         alert.备注   = textBox3.Text;
         AlertLogic al = AlertLogic.GetInstance();
         if (al.ExistsNameOther(alert.提醒项目, alert.ID))
         {
             if (MessageBox.Show("系统中已经存在该提醒,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
             {
                 if (al.UpdateAlert(alert))
                 {
                     LoadAlerts();
                     MessageBox.Show("修改成功!");
                 }
             }
             else
             {
                 textBox1.Focus();
                 textBox1.SelectAll();
             }
         }
         else
         {
             if (al.UpdateAlert(alert))
             {
                 LoadAlerts();
                 MessageBox.Show("修改成功!");
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的提醒!");
     }
 }
コード例 #8
0
ファイル: SMSForm.cs プロジェクト: zanderzhg/TopFashion
 private void button4_Click(object sender, EventArgs e)
 {
     if (radioButton1.Checked)
     {
         StringBuilder sb      = new StringBuilder();
         List <Member> members = selectMemberControl1.SelectedMembers;
         foreach (Member m in members)
         {
             if (sb.Length == 0)
             {
                 sb.Append(m.ID);
             }
             else
             {
                 sb.Append("," + m.ID);
             }
         }
         Alert alert = new Alert();
         alert.提醒对象 = sb.ToString();
         alert.提醒方式 = 提醒方式.会员短信;
         alert.提醒时间 = dateTimePicker2.Value;
         alert.提醒项目 = textBox3.Text;
         AlertLogic.GetInstance().AddAlert(alert);
     }
     else
     {
         StringBuilder sb     = new StringBuilder();
         List <Staff>  staffs = selectStaffControl1.SelectedStaffs;
         foreach (Staff s in staffs)
         {
             if (sb.Length == 0)
             {
                 sb.Append(s.ID);
             }
             else
             {
                 sb.Append("," + s.ID);
             }
         }
         Alert alert = new Alert();
         alert.提醒对象 = sb.ToString();
         alert.提醒方式 = 提醒方式.员工短信;
         alert.提醒时间 = dateTimePicker2.Value;
         alert.提醒项目 = textBox3.Text;
         AlertLogic.GetInstance().AddAlert(alert);
     }
 }
コード例 #9
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         if (MessageBox.Show("确定要删除该提醒?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
         {
             Alert alert = (Alert)comboBox1.SelectedItem;
             if (AlertLogic.GetInstance().DeleteAlert(alert))
             {
                 LoadAlerts();
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要删除的提醒!");
     }
 }
コード例 #10
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         Alert alert = new Alert();
         alert.ID   = ((Alert)comboBox1.SelectedItem).ID;
         alert.提醒项目 = textBox1.Text.Trim();
         alert.提醒对象 = textBox2.Text.Trim();
         alert.提醒时间 = dateTimePicker1.Value;
         alert.提醒方式 = comboBox3.SelectedItem as AlertType;
         alert.备注   = textBox3.Text.Trim();
         AlertLogic al = AlertLogic.GetInstance();
         if (al.ExistsNameOther(alert.提醒项目, alert.ID))
         {
             if (MessageBox.Show("系统中已经存在该提醒,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
             {
                 if (al.UpdateAlert(alert))
                 {
                     LoadAlerts();
                     MessageBox.Show("修改成功!");
                 }
             }
             else
             {
                 textBox1.Focus();
                 textBox1.SelectAll();
             }
         }
         else
         {
             if (al.UpdateAlert(alert))
             {
                 LoadAlerts();
                 MessageBox.Show("修改成功!");
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的提醒!");
     }
 }
コード例 #11
0
        private DataTable Search(string name, object alertType, string subject)
        {
            string nm = "";

            if (!string.IsNullOrEmpty(name) && name.Trim() != "")
            {
                nm = " and 提醒项目 like '%" + name.Trim() + "%'";
            }
            string at = "";
            string sb = "";

            if (alertType is 提醒方式)
            {
                提醒方式 type = (提醒方式)alertType;
                at = " and 提醒方式='" + type.ToString();
                if (!string.IsNullOrEmpty(subject) && subject.Trim() != "")
                {
                    int id = 0;
                    if (type == 提醒方式.系统提示 || type == 提醒方式.员工短信)
                    {
                        Staff staff = StaffLogic.GetInstance().GetStaffByName(subject.Trim());
                        if (staff != null)
                        {
                            id = staff.ID;
                        }
                    }
                    else if (type == 提醒方式.会员短信)
                    {
                        Member member = MemberLogic.GetInstance().GetMemberByName(subject.Trim());
                        if (member != null)
                        {
                            id = member.ID;
                        }
                    }
                    sb = " and ','+提醒对象+',' like '%," + id + ",%'";
                }
            }
            string where = "(1=1)" + nm + sb + at;
            return(AlertLogic.GetInstance().GetAlerts(where));
        }
コード例 #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            Alert alert = new Alert();

            alert.提醒项目 = textBox1.Text.Trim();
            alert.提醒对象 = textBox2.Text.Trim();
            alert.提醒时间 = dateTimePicker1.Value;
            alert.提醒方式 = comboBox3.SelectedItem as AlertType;
            alert.备注   = textBox3.Text.Trim();
            AlertLogic al = AlertLogic.GetInstance();

            if (al.ExistsName(alert.提醒项目))
            {
                if (MessageBox.Show("系统中已经存在该提醒,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
                {
                    int id = al.AddAlert(alert);
                    if (id > 0)
                    {
                        alert.ID = id;
                        LoadAlerts();
                        MessageBox.Show("添加成功!");
                    }
                }
                else
                {
                    textBox1.Focus();
                    textBox1.SelectAll();
                }
            }
            else
            {
                int id = al.AddAlert(alert);
                if (id > 0)
                {
                    alert.ID = id;
                    LoadAlerts();
                    MessageBox.Show("添加成功!");
                }
            }
        }
コード例 #13
0
        private DataTable Search(string name = null, string subject = null, AlertType alertType = null)
        {
            string nm = "";

            if (!string.IsNullOrEmpty(name) && name.Trim() != "")
            {
                nm = " and 提醒项目 like '%" + name + "%'";
            }
            string sb = "";

            if (!string.IsNullOrEmpty(subject) && subject.Trim() != "")
            {
                sb = " and 提醒对象 like '%" + subject + "%'";
            }
            string at = "";

            if (alertType != null)
            {
                at = " and 提醒方式=" + alertType.ID;
            }
            string where = "(1=1)" + nm + sb + at + " order by ID desc";
            return(AlertLogic.GetInstance().GetAlerts(where));
        }
コード例 #14
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("新建文档失败!");
                }
            }
        }