コード例 #1
0
        /// <summary>
        /// 删除数据方法
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private bool deleteData(decimal setno)
        {
            try
            {
                int               nodeno, workflowno;
                BLL.WORKFLOWSET   workflowsetBll = new BLL.WORKFLOWSET();
                Model.WORKFLOWSET workflowsetMdl = new Model.WORKFLOWSET();

                BLL.STU_WORKFLOW stu_workflowBll = new BLL.STU_WORKFLOW();

                workflowsetMdl = workflowsetBll.GetModel(setno);
                nodeno         = (int)workflowsetMdl.NODENO;
                workflowno     = (int)workflowsetMdl.WORKFLOWNO;

                int recordCount = stu_workflowBll.GetRecordCount("and STU_WORKFLOW.nodeno = " + nodeno.ToString() + " and TEA_STU.workflowno = " + workflowno.ToString());
                if (recordCount > 0)
                {
                    MessageBox.Show("该设置信息已经被使用,不能被删除!", "提示信息");
                    return(false);
                }
                else
                {
                    workflowsetBll.Delete(setno);
                    return(true);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("删除失败!", exception.Message);
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 保存数据方法
        /// </summary>
        /// <returns></returns>
        private bool saveData()
        {
            try
            {
                BLL.WORKFLOWSET   workflowsetbll = new BLL.WORKFLOWSET();
                Model.WORKFLOWSET workflowsetmdl = new Model.WORKFLOWSET();

                BLL.WORKNODE   worknodeBll = new BLL.WORKNODE();
                Model.WORKNODE worknodeMdl = new Model.WORKNODE();

                BLL.WORKFLOW   workflowBll = new BLL.WORKFLOW();
                Model.WORKFLOW workflowMdl = new Model.WORKFLOW();

                if (this.cbb_nodename.Text == "")
                {
                    MessageBox.Show("工作节点不能为空!", "提示信息");
                    return(false);
                }

                if (this.cbb_nodeorder.Text == "")
                {
                    MessageBox.Show("节点顺序不能为空!", "提示信息");
                    return(false);
                }

                if (this.de_begintime.Text == "")
                {
                    MessageBox.Show("开始日期不能为空!", "提示信息");
                    return(false);
                }

                if (this.de_endtime.Text == "")
                {
                    MessageBox.Show("截止日期不能为空!", "提示信息");
                    return(false);
                }
                if (this._enumStatus == StatusClass.AddNew)  //新增工作流节点
                {
                    //获取工作流编号
                    workflowMdl = workflowBll.GetModel(workflowsetaddMdl.WORKFLOWNAME);
                    int workflowno = workflowMdl.WORKFLOWNO;
                    workflowsetmdl.WORKFLOWNO = workflowno;

                    //获取工作节点编号
                    worknodeMdl           = worknodeBll.GetModel(this.cbb_nodename.Text);
                    workflowsetmdl.NODENO = worknodeMdl.NODENO;

                    workflowsetmdl.NODEORDER = ToolHelper.ConvertToInt(this.cbb_nodeorder.Text);
                    workflowsetmdl.BEGINTIME = ToolHelper.ConvertToDateTime(this.de_begintime.Text);
                    workflowsetmdl.ENDTIME   = ToolHelper.ConvertToDateTime(this.de_endtime.Text);

                    workflowsetbll.Add(workflowsetmdl);
                    return(true);
                }
                else if (this._enumStatus == StatusClass.Edit)  //修改工作节点
                {
                    //获取工作流编号
                    workflowMdl = workflowBll.GetModel(workflowsetaddMdl.WORKFLOWNAME);
                    int workflowno = workflowMdl.WORKFLOWNO;
                    workflowsetmdl.WORKFLOWNO = workflowno;
                    worknodeMdl              = worknodeBll.GetModel(this.cbb_nodename.Text);
                    workflowsetmdl.NODENO    = worknodeMdl.NODENO;
                    workflowsetmdl.NODEORDER = ToolHelper.ConvertToInt(this.cbb_nodeorder.Text);
                    workflowsetmdl.BEGINTIME = ToolHelper.ConvertToDateTime(this.de_begintime.Text);
                    workflowsetmdl.ENDTIME   = ToolHelper.ConvertToDateTime(this.de_endtime.Text);
                    workflowsetmdl.SETNO     = setno;

                    workflowsetbll.Update(workflowsetmdl);
                    return(true);
                }
                return(true);
            }
            catch (Exception exception)
            {
                MessageBox.Show("保存失败!", exception.Message);
                return(false);
            }
        }