Esempio n. 1
0
        /// <summary>
        /// 重新产生标题,根据新的规则.
        /// </summary>
        public string DoGenerTitle()
        {
            if (WebUser.No != "admin")
            {
                return("非admin用户不能执行。");
            }
            Flow  fl  = new Flow(this.No);
            Node  nd  = fl.HisStartNode;
            Works wks = nd.HisWorks;

            wks.RetrieveAllFromDBSource(WorkAttr.Rec);
            string table    = nd.HisWork.EnMap.PhysicsTable;
            string tableRpt = "ND" + int.Parse(this.No) + "Rpt";

            Sys.MapData md = new Sys.MapData(tableRpt);
            foreach (Work wk in wks)
            {
                if (wk.Rec != WebUser.No)
                {
                    BP.Web.WebUser.Exit();
                    try
                    {
                        Emp emp = new Emp(wk.Rec);
                        BP.Web.WebUser.SignInOfGener(emp);
                    }
                    catch
                    {
                        continue;
                    }
                }
                string sql   = "";
                string title = WorkNode.GenerTitle(fl, wk);
                Paras  ps    = new Paras();
                ps.Add("Title", title);
                ps.Add("OID", wk.OID);
                ps.SQL = "UPDATE " + table + " SET Title=" + SystemConfig.AppCenterDBVarStr + "Title WHERE OID=" + SystemConfig.AppCenterDBVarStr + "OID";
                DBAccess.RunSQL(ps);

                ps.SQL = "UPDATE " + md.PTable + " SET Title=" + SystemConfig.AppCenterDBVarStr + "Title WHERE OID=" + SystemConfig.AppCenterDBVarStr + "OID";
                DBAccess.RunSQL(ps);

                ps.SQL = "UPDATE WF_GenerWorkFlow SET Title=" + SystemConfig.AppCenterDBVarStr + "Title WHERE WorkID=" + SystemConfig.AppCenterDBVarStr + "OID";
                DBAccess.RunSQL(ps);

                ps.SQL = "UPDATE WF_GenerFH SET Title=" + SystemConfig.AppCenterDBVarStr + "Title WHERE FID=" + SystemConfig.AppCenterDBVarStr + "OID";
                DBAccess.RunSQLs(sql);
            }
            Emp emp1 = new Emp("admin");

            BP.Web.WebUser.SignInOfGener(emp1);

            return("全部生成成功,影响数据(" + wks.Count + ")条");
        }
Esempio n. 2
0
        protected override void afterInsertUpdateAction()
        {
            //同步流程数据表.
            string ndxxRpt = "ND" + int.Parse(this.No) + "Rpt";
            Flow   fl      = new Flow(this.No);

            if (fl.PTable != "ND" + int.Parse(this.No) + "Rpt")
            {
                BP.Sys.MapData md = new Sys.MapData(ndxxRpt);
                if (md.PTable != fl.PTable)
                {
                    md.Update();
                }
            }
            base.afterInsertUpdateAction();
        }
Esempio n. 3
0
        /// <summary>
        /// 重置当前用户编号
        /// </summary>
        /// <param name="userNo">当前用户编号</param>
        /// <returns>返回重置信息</returns>
        public string DoChangeUserNo(string userNo)
        {
            if (BP.Web.WebUser.No != "admin")
            {
                return("非超级管理员,不能执行。");
            }

            string msg = "";
            int    i   = 0;
            //更新待办.
            string sql = "update wf_generworkerlist set fk_emp='" + userNo + "' where fk_emp='" + this.No + "'";

            i = BP.DA.DBAccess.RunSQL(sql);
            if (i != 0)
            {
                msg += "@待办更新[" + i + "]个。";
            }

            sql = "UPDATE WF_GENERWORKFLOW  SET STARTER='" + userNo + "'  WHERE STARTER='" + this.No + "'";
            i   = BP.DA.DBAccess.RunSQL(sql);
            if (i != 0)
            {
                msg += "@流程注册更新[" + i + "]个。";
            }


            //更换流程信息的数据表
            BP.WF.Flows fls = new Flows();
            fls.RetrieveAll();
            foreach (Flow fl in fls)
            {
                sql = "UPDATE " + fl.PTable + " SET FlowEnder='" + userNo + "' WHERE FlowEnder='" + this.No + "'";
                i   = DBAccess.RunSQL(sql);

                if (i != 0)
                {
                    msg += "@流程注册更新[" + i + "]个。";
                }

                sql = "UPDATE  " + fl.PTable + "  SET FlowStarter='" + userNo + "' WHERE FlowStarter='" + this.No + "'";
                i   = DBAccess.RunSQL(sql);
                if (i != 0)
                {
                    msg += "@流程业务表发起人,更新了[" + i + "]个。";
                }


                sql = "UPDATE  " + fl.PTable + "  SET Rec='" + userNo + "' WHERE Rec='" + this.No + "'";
                i   = DBAccess.RunSQL(sql);
                if (i != 0)
                {
                    msg += "@流程业务表记录人,更新了[" + i + "]个。";
                }

                string trackTable = "ND" + int.Parse(fl.No) + "Track";
                sql = "UPDATE  " + trackTable + "  SET EmpFrom='" + userNo + "' WHERE EmpFrom='" + this.No + "'";
                i   = DBAccess.RunSQL(sql);
                if (i != 0)
                {
                    msg += "@轨迹表 EmpFrom,更新了[" + i + "]个。";
                }


                sql = "UPDATE  " + trackTable + "  SET EmpTo='" + userNo + "' WHERE EmpTo='" + this.No + "'";
                i   = DBAccess.RunSQL(sql);
                if (i != 0)
                {
                    msg += "@轨迹表 EmpTo,更新了[" + i + "]个。";
                }


                sql = "UPDATE  " + trackTable + "  SET Exer='" + userNo + "' WHERE Exer='" + this.No + "'";
                i   = DBAccess.RunSQL(sql);
                if (i != 0)
                {
                    msg += "@轨迹表 Exer,更新了[" + i + "]个。";
                }
            }


            //更新其他字段.
            BP.Sys.MapAttrs attrs = new Sys.MapAttrs();
            attrs.RetrieveAll();
            foreach (BP.Sys.MapAttr attr in attrs)
            {
                if (attr.DefValReal.Contains("@WebUser.No") == true)
                {
                    try
                    {
                        BP.Sys.MapData md = new Sys.MapData(attr.FK_MapData);
                        sql = "UPDATE " + md.PTable + " SET " + attr.KeyOfEn + "='" + userNo + "' WHERE " + attr.KeyOfEn + "='" + this.No + "'";
                        i   = DBAccess.RunSQL(sql);
                        if (i != 0)
                        {
                            msg += "@表[" + md.Name + "],[" + md.PTable + "] [" + attr.KeyOfEn + "],更新了[" + i + "]个。";
                        }
                    }
                    catch
                    {
                    }
                }
            }
            //人员主表信息-手动修改

            return(msg);
        }
Esempio n. 4
0
        /// <summary>
        /// 重新产生标题,根据新的规则.
        /// </summary>
        public string DoGenerFlowEmps()
        {
            if (WebUser.No != "admin")
            {
                return("非admin用户不能执行。");
            }

            Flow fl = new Flow(this.No);

            GenerWorkFlows gwfs = new GenerWorkFlows();

            gwfs.Retrieve(GenerWorkFlowAttr.FK_Flow, this.No);

            foreach (GenerWorkFlow gwf in gwfs)
            {
                string emps = "";
                string sql  = "SELECT EmpFrom FROM ND" + int.Parse(this.No) + "Track  WHERE WorkID=" + gwf.WorkID;

                DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql);
                foreach (DataRow dr in dt.Rows)
                {
                    if (emps.Contains("," + dr[0].ToString() + ","))
                    {
                        continue;
                    }
                }

                sql = "UPDATE " + fl.PTable + " SET FlowEmps='" + emps + "' WHERE OID=" + gwf.WorkID;
                DBAccess.RunSQL(sql);

                sql = "UPDATE WF_GenerWorkFlow SET Emps='" + emps + "' WHERE WorkID=" + gwf.WorkID;
                DBAccess.RunSQL(sql);
            }

            Node  nd  = fl.HisStartNode;
            Works wks = nd.HisWorks;

            wks.RetrieveAllFromDBSource(WorkAttr.Rec);
            string table    = nd.HisWork.EnMap.PhysicsTable;
            string tableRpt = "ND" + int.Parse(this.No) + "Rpt";

            Sys.MapData md = new Sys.MapData(tableRpt);
            foreach (Work wk in wks)
            {
                if (wk.Rec != WebUser.No)
                {
                    BP.Web.WebUser.Exit();
                    try
                    {
                        Emp emp = new Emp(wk.Rec);
                        BP.Web.WebUser.SignInOfGener(emp);
                    }
                    catch
                    {
                        continue;
                    }
                }
                string sql   = "";
                string title = BP.WF.WorkFlowBuessRole.GenerTitle(fl, wk);
                Paras  ps    = new Paras();
                ps.Add("Title", title);
                ps.Add("OID", wk.OID);
                ps.SQL = "UPDATE " + table + " SET Title=" + SystemConfig.AppCenterDBVarStr + "Title WHERE OID=" + SystemConfig.AppCenterDBVarStr + "OID";
                DBAccess.RunSQL(ps);

                ps.SQL = "UPDATE " + md.PTable + " SET Title=" + SystemConfig.AppCenterDBVarStr + "Title WHERE OID=" + SystemConfig.AppCenterDBVarStr + "OID";
                DBAccess.RunSQL(ps);

                ps.SQL = "UPDATE WF_GenerWorkFlow SET Title=" + SystemConfig.AppCenterDBVarStr + "Title WHERE WorkID=" + SystemConfig.AppCenterDBVarStr + "OID";
                DBAccess.RunSQL(ps);
            }
            Emp emp1 = new Emp("admin");

            BP.Web.WebUser.SignInOfGener(emp1);

            return("全部生成成功,影响数据(" + wks.Count + ")条");
        }