Esempio n. 1
0
        /// <summary>
        /// 完成当前结点,并判断下一节点的前续节点是否都已经完成
        /// </summary>
        /// <param name="task_code">任务号</param>
        /// <param name="node_definition_id">当前节点的node类id</param>
        /// <param name="note">备注</param>
        /// <returns>true:可以激活下一节点;false:不能激活下一节点</returns>
        public static bool completeCurrentNode(string task_code, string node_definition_id, string note)
        {
            //完成当前节点的结束时间、状态、备注更新
            DBCallCommon.ExeSqlText(string.Format(@"UPDATE {0} SET end_time=GETDATE(),state=2,note='{1}' 
WHERE node_definition_id={2} AND task_code='{3}';", TABLE_NODE_INSTANCE, note, node_definition_id, task_code));

            //判断当前节点的类型,1:开始节点;2:中间节点;3:结束节点
            string type = getFirstCellStringByDR(string.Format(@"SELECT node_definition_type FROM {0} WHERE node_definition_id={1};", TABLE_NODE_DEFINITION, node_definition_id));

            if (type.Equals("3"))//如果是结束节点
            {
                //在任务预算表中更新预算编制结束时间,预算编制状态
                //DBCallCommon.ExeSqlText(string.Format("UPDATE {0} SET end_time=GETDATE(),state=5 WHERE task_code='{1}';", TABLE_TASK_BUDGET, task_code));
                return(false);
            }
            else//如果不是结束节点,还有后续节点
            {
                //判断后续节点的逻辑,2:and-join
                string logic = getFirstCellStringByDR(string.Format(@"SELECT TOP 1 to_node_definition_logic 
FROM {0} WHERE node_definition_id={1};", VIEW_TO_NODE, node_definition_id));

                //如果后续节点是and-joi,且后续节点还有没有完成的前续节点
                if (logic.Equals("2") && (!getFirstCellStringByDR(string.Format(@"SELECT COUNT(1) FROM (SELECT from_node_definition_id 
FROM dbo.YS_LINE WHERE to_node_definition_id=(SELECT TOP 1 to_node_definition_id FROM dbo.YS_LINE WHERE from_node_definition_id={0}) 
EXCEPT SELECT node_definition_id FROM dbo.YS_NODE_INSTANCE WHERE task_code='{1}' AND state=2 AND node_definition_id IN 
(SELECT from_node_definition_id FROM dbo.YS_LINE WHERE to_node_definition_id=(SELECT TOP 1 to_node_definition_id FROM 
dbo.YS_LINE WHERE from_node_definition_id={0})))t;", node_definition_id, task_code)).Equals("0")))
                {
                    return(false);
                }
                else//如果后续节点不是and-join,或后续节点的前续节点全部完成,删除当前节点的所有后续节点(被驳回重新提交时有用、或防止程序错误,重复插入系节点),激活下一个节点
                {
                    DBCallCommon.ExeSqlText(string.Format(@"DELETE FROM {0} WHERE node_definition_id IN (SELECT to_node_definition_id 
FROM {1} WHERE from_node_definition_id={2}) AND task_code='{3}';", TABLE_NODE_INSTANCE, TABLE_LINE, node_definition_id, task_code));

                    return(true);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///  级联删除    </summary>
        /// <param name="tabName">数据表名</param>
        /// <param name="keyName">主键名</param>
        /// <param name="repeater">Repeater控件</param>
        public static void delMult(string tabName, string keyName, Repeater repeater)
        {
            string sqlText = "";
            string strID   = "";

            foreach (RepeaterItem repItem in repeater.Items)
            {
                CheckBox chk = (CheckBox)repItem.FindControl("chkDel");
                if (chk.Checked)
                {
                    //查找该CheckBox所对应纪录的id号,在labID中
                    strID += "'" + ((Label)repItem.FindControl("lblID")).Text + "',";
                }
            }

            if (strID.Length > 1)
            {
                //去掉最后的一个逗号
                strID   = strID.Substring(0, strID.Length - 1);
                sqlText = "delete from " + tabName + " where " + keyName + " in (" + strID + ")";
                DBCallCommon.ExeSqlText(sqlText);
            }
        }
Esempio n. 3
0
        protected void btnSubmit_onserverclick(object sender, EventArgs e)
        {
            if (asd.action == "add" || asd.action == "alter")
            {
                string    sql1 = "select count(SPID) from OM_SP where SPFATHERID='" + asd.sjid + "' and SPLX='NDPXJH'";
                DataTable dt   = DBCallCommon.GetDTUsingSqlText(sql1);
                if (dt.Rows[0][0].ToString() == "0")
                {
                    Response.Write("<script>alert('请先点击”保存“再提交审批!!!')</script>");
                    return;
                }
                string sql = "update OM_SP set SPZT='1',SPJB='" + rblSPJB.SelectedValue + "'";
                if (rblSPJB.SelectedValue == "1")
                {
                    if (txtSPR1.Text.Trim() == "")
                    {
                        Response.Write("<script>alert('请先选择审批人再提交审批!!!')</script>");
                        return;
                    }
                    sql += ",SPR1='" + txtSPR1.Text.Trim() + "',SPR1ID='" + hidSPR1ID.Value + "'";
                }
                else if (rblSPJB.SelectedValue == "2")
                {
                    if (txtSPR2.Text.Trim() == "" || txtSPR1.Text.Trim() == "")
                    {
                        Response.Write("<script>alert('请先选择审批人再提交审批!!!')</script>");
                        return;
                    }
                    sql += ",SPR1='" + txtSPR1.Text.Trim() + "',SPR1ID='" + hidSPR1ID.Value + "'";
                    sql += ",SPR2='" + txtSPR2.Text.Trim() + "',SPR2ID='" + hidSPR2ID.Value + "'";
                }
                else if (rblSPJB.SelectedValue == "3")
                {
                    if (txtSPR2.Text.Trim() == "" || txtSPR1.Text.Trim() == "" || txtSPR3.Text.Trim() == "")
                    {
                        Response.Write("<script>alert('请先选择审批人再提交审批!!!')</script>");
                        return;
                    }
                    sql += ",SPR1='" + txtSPR1.Text.Trim() + "',SPR1ID='" + hidSPR1ID.Value + "'";
                    sql += ",SPR2='" + txtSPR2.Text.Trim() + "',SPR2ID='" + hidSPR2ID.Value + "'";
                    sql += ",SPR3='" + txtSPR3.Text.Trim() + "',SPR3ID='" + hidSPR3ID.Value + "'";
                }
                sql += " where SPFATHERID='" + asd.sjid + "' and SPLX='NDPXJH'";
                try
                {
                    DBCallCommon.ExeSqlText(sql);

                    //邮件提醒
                    string sprid     = "";
                    string sptitle   = "";
                    string spcontent = "";
                    sprid     = hidSPR1ID.Value.Trim();
                    sptitle   = "年度培训计划审批";
                    spcontent = "有年度培训计划需要您审批,请登录查看!";
                    DBCallCommon.SendEmail(DBCallCommon.GetEmailAddressByUserID(sprid), new List <string>(), new List <string>(), sptitle, spcontent);
                }
                catch
                {
                    Response.Write("<script>alert('提交审批的sql语句出现问题,请与管理员联系!!!')</script>");
                    return;
                }
                Response.Redirect("OM_NDPXJH_GL.aspx");
            }
        }