Esempio n. 1
0
        /// <summary>
        /// 增加二级子公司人员.
        /// </summary>
        /// <param name="empID"></param>
        /// <returns></returns>
        public string DoAddAdminer(string empID)
        {
            BP.Port.Emp emp = new BP.Port.Emp();
            emp.No = empID;
            if (emp.RetrieveFromDBSources() == 0)
            {
                return("err@子公司人员增加失败,ID=" + empID + "不存在用户表,您增加的子公司人员必须存在与Port_Emp用户表.");
            }

            Emp Emp = new Emp();

            Emp.No = empID;
            if (Emp.RetrieveFromDBSources() == 1)
            {
                return("err@子公司人员【" + Emp.Name + "】已经存在,您不需要在增加.");
            }

            Emp.Copy(emp);
            Emp.FK_Dept    = WebUser.FK_Dept;
            Emp.RootOfDept = WebUser.FK_Dept;
            Emp.UserType   = 1;
            Emp.Save();

            return("增加成功,请关闭当前窗口查询到该子公司人员,设置他的权限。");
        }
Esempio n. 2
0
        /// <summary>
        /// 增加二级管理员.
        /// </summary>
        /// <param name="empID"></param>
        /// <returns></returns>
        public string DoAddAdminer(string empID)
        {
            BP.Port.Emp emp = new BP.Port.Emp();
            emp.No = empID;
            if (emp.RetrieveFromDBSources() == 0)
            {
                return("err@管理员增加失败,ID=" + empID + "不存在用户表,您增加的管理员必须存在与Port_Emp用户表.");
            }

            AdminEmp adminEmp = new AdminEmp();

            adminEmp.No = empID;
            if (adminEmp.RetrieveFromDBSources() == 1)
            {
                return("err@管理员【" + adminEmp.Name + "】已经存在,您不需要在增加.");
            }

            adminEmp.Copy(emp);
            adminEmp.FK_Dept    = WebUser.FK_Dept;
            adminEmp.RootOfDept = WebUser.FK_Dept;
            adminEmp.UserType   = 1;
            adminEmp.Insert();

            return("增加成功,请关闭当前窗口查询到该管理员,设置他的权限。");
        }
Esempio n. 3
0
 /// <summary>
 /// 用户登陆,此方法是在开发者校验好用户名与密码后执行
 /// </summary>
 /// <param name="userNo">用户名</param>
 public static void Port_Login(string userNo)
 {
     BP.Port.Emp emp = new BP.Port.Emp(userNo);
     WebUser.SignInOfGener(emp, true);
     WebUser.IsWap = false;
     return;
 }
Esempio n. 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string user = txtUserName.Text.Trim();
            string pass = txtPassword.Text.Trim();

            try
            {
                if (WebUser.No != null)
                {
                    WebUser.Exit();
                }

                BP.Port.Emp em = new BP.Port.Emp(user);
                if (em.CheckPass(pass))
                {
                    bool bl = this.IsRemember.Checked;
                    WebUser.SignInOfGenerLang(em, WebUser.SysLang, bl);
                    if (this.Request.RawUrl.ToLower().Contains("wap"))
                    {
                        WebUser.IsWap = true;
                    }
                    else
                    {
                        WebUser.IsWap = false;
                    }

                    WebUser.Token = this.Session.SessionID;

                    string s = "";
                    s = BP.Web.WebUser.No;
                    if (string.IsNullOrEmpty(s))
                    {
                        s = BP.Web.WebUser.NoOfRel;
                    }
                    if (string.IsNullOrEmpty(s))
                    {
                        throw new Exception("@编号没有写入:" + s);
                    }

                    this.Response.Redirect("Default.aspx?ss=" + s + "&DDD=" + em.No, false);
                    return;
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "kesy", "<script language=JavaScript>alert('用户名密码错误,注意密码区分大小写,请检查是否按下了CapsLock.。');</script>");
                }
            }
            catch (System.Exception ex)
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "kesy", "<script language=JavaScript>alert('@用户名密码错误!@检查是否按下了CapsLock.@更详细的信息:" + ex.Message + "');</script>");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 打开手机端
        /// </summary>
        /// <returns></returns>
        public string Do_OpenFlow()
        {
            string sid = this.GetRequestVal("SID");

            string[]        strs = sid.Split('_');
            GenerWorkerList wl   = new GenerWorkerList();
            int             i    = wl.Retrieve(GenerWorkerListAttr.FK_Emp, strs[0],
                                               GenerWorkerListAttr.WorkID, strs[1],
                                               GenerWorkerListAttr.IsPass, 0);

            if (i == 0)
            {
                return("err@提示:此工作已经被别人处理或者此流程已删除。");
            }

            BP.Port.Emp empOF = new BP.Port.Emp(wl.FK_Emp);
            Web.WebUser.SignInOfGener(empOF);
            return("MyFlow.htm?FK_Flow=" + wl.FK_Flow + "&WorkID=" + wl.WorkID + "&FK_Node=" + wl.FK_Node + "&FID=" + wl.FID);
        }
Esempio n. 6
0
        public static void DTSData()
        {
            string    sql = "select No from Port_Emp where No not in (select No from WF_Emp)";
            DataTable dt  = BP.DA.DBAccess.RunSQLReturnTable(sql);

            foreach (DataRow dr in dt.Rows)
            {
                BP.Port.Emp      emp1  = new BP.Port.Emp(dr["No"].ToString());
                BP.WF.Port.WFEmp empWF = new BP.WF.Port.WFEmp();
                empWF.Copy(emp1);
                try
                {
                    empWF.UseSta = 1;
                    empWF.DirectInsert();
                }
                catch
                {
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 用户登陆,此方法是在开发者校验好用户名与密码后执行
        /// </summary>
        /// <param name="userNo">用户名</param>
        /// <param name="SID">安全ID,请参考流程设计器操作手册</param>
        public static void Port_Login(string userNo, string sid)
        {
            string    sql = "SELECT SID FROM Port_Emp WHERE No='" + userNo + "'";
            DataTable dt  = BP.DA.DBAccess.RunSQLReturnTable(sql);

            if (dt.Rows.Count == 0)
            {
                throw new Exception("用户不存在或者SID错误。");
            }

            if (dt.Rows[0]["SID"].ToString() != sid)
            {
                throw new Exception("用户不存在或者SID错误。");
            }

            BP.Port.Emp emp = new BP.Port.Emp(userNo);
            WebUser.SignInOfGener(emp, true);
            WebUser.IsWap = false;
            return;
        }
Esempio n. 8
0
        public string ReLoginSubmit()
        {
            string userNo   = this.GetValFromFrmByKey("TB_No");
            string password = this.GetValFromFrmByKey("TB_PW");

            BP.Port.Emp emp = new BP.Port.Emp();
            emp.No = userNo;
            if (emp.RetrieveFromDBSources() == 0)
            {
                return("err@用户名或密码错误.");
            }

            if (emp.CheckPass(password) == false)
            {
                return("err@用户名或密码错误.");
            }

            BP.Web.WebUser.SignInOfGener(emp);

            return("登录成功.");
        }
Esempio n. 9
0
        /// <summary>
        /// 抄送
        /// </summary>
        public void copyToMet()
        {
            string getSaveNo   = getUTF8ToString("getSaveNo");
            string cs_titleV   = getUTF8ToString("cs_titleV");
            string cs_messageV = getUTF8ToString("cs_messageV");

            string[]    emps  = getSaveNo.Split(',');
            BP.WF.Node  nd    = new BP.WF.Node(this.FK_Node);
            BP.Port.Emp myemp = new BP.Port.Emp();


            foreach (string emp in emps)
            {
                if (string.IsNullOrEmpty(emp))
                {
                    continue;
                }

                myemp.No = emp;
                myemp.Retrieve();
                switch (nd.CCWriteTo)
                {
                case BP.WF.CCWriteTo.All:
                    BP.WF.Dev2Interface.Node_CC_WriteTo_CClist(this.FK_Node, this.FK_Node, this.WorkID, emp, myemp.Name, cs_titleV, cs_messageV);
                    BP.WF.Dev2Interface.Node_CC_WriteTo_Todolist(this.FK_Node, this.FK_Node, this.WorkID, emp, myemp.Name);
                    break;

                case BP.WF.CCWriteTo.CCList:
                    BP.WF.Dev2Interface.Node_CC_WriteTo_CClist(this.FK_Node, this.FK_Node, this.WorkID, emp, myemp.Name, cs_titleV, cs_messageV);
                    break;

                case BP.WF.CCWriteTo.Todolist:
                    BP.WF.Dev2Interface.Node_CC_WriteTo_Todolist(this.FK_Node, this.FK_Node, this.WorkID, emp, myemp.Name);
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 执行自动启动流程任务 WF_Task
        /// </summary>
        public void DoTask()
        {
            string    sql = "SELECT * FROM WF_Task WHERE TaskSta=0 ORDER BY Starter";
            DataTable dt  = null;

            try
            {
                dt = DBAccess.RunSQLReturnTable(sql);
            }
            catch
            {
                Task ta = new Task();
                ta.CheckPhysicsTable();
                dt = DBAccess.RunSQLReturnTable(sql);
            }

            if (dt.Rows.Count == 0)
            {
                return;
            }

            #region 自动启动流程
            foreach (DataRow dr in dt.Rows)
            {
                string mypk    = dr["MyPK"].ToString();
                string taskSta = dr["TaskSta"].ToString();
                string paras   = dr["Paras"].ToString();
                string starter = dr["Starter"].ToString();
                string fk_flow = dr["FK_Flow"].ToString();

                string startDT = dr[TaskAttr.StartDT].ToString();
                if (string.IsNullOrEmpty(startDT) == false)
                {
                    /*如果设置了发起时间,就检查当前时间是否与现在的时间匹配.*/
                    if (DateTime.Now.ToString("yyyy-MM-dd HH:mm").Contains(startDT) == false)
                    {
                        continue;
                    }
                }

                Flow fl = new Flow(fk_flow);
                this.SetText("开始执行(" + starter + ")发起(" + fl.Name + ")流程.");
                try
                {
                    string  fTable = "ND" + int.Parse(fl.No + "01").ToString();
                    MapData md     = new MapData(fTable);
                    sql = "";
                    //   sql = "SELECT * FROM " + md.PTable + " WHERE MainPK='" + mypk + "' AND WFState=1";
                    try
                    {
                        if (DBAccess.RunSQLReturnTable(sql).Rows.Count != 0)
                        {
                            continue;
                        }
                    }
                    catch
                    {
                        this.SetText("开始节点表单表:" + fTable + "没有设置的默认字段MainPK. " + sql);
                        continue;
                    }

                    if (BP.Web.WebUser.No != starter)
                    {
                        BP.Web.WebUser.Exit();
                        BP.Port.Emp empadmin = new BP.Port.Emp(starter);
                        BP.Web.WebUser.SignInOfGener(empadmin);
                    }

                    Work     wk   = fl.NewWork();
                    string[] strs = paras.Split('@');
                    foreach (string str in strs)
                    {
                        if (string.IsNullOrEmpty(str))
                        {
                            continue;
                        }

                        if (str.Contains("=") == false)
                        {
                            continue;
                        }

                        string[] kv = str.Split('=');
                        wk.SetValByKey(kv[0], kv[1]);
                    }

                    wk.SetValByKey("MainPK", mypk);
                    wk.Update();

                    WorkNode wn  = new WorkNode(wk, fl.HisStartNode);
                    string   msg = wn.NodeSend().ToMsgOfText();
                    msg = msg.Replace("'", "~");
                    DBAccess.RunSQL("UPDATE WF_Task SET TaskSta=1,Msg='" + msg + "' WHERE MyPK='" + mypk + "'");
                }
                catch (Exception ex)
                {
                    //如果发送错误。
                    this.SetText(ex.Message);
                    string msg = ex.Message;
                    try
                    {
                        DBAccess.RunSQL("UPDATE WF_Task SET TaskSta=2,Msg='" + msg + "' WHERE MyPK='" + mypk + "'");
                    }
                    catch
                    {
                        Task TK = new Task();
                        TK.CheckPhysicsTable();
                    }
                }
            }
            #endregion 自动启动流程
        }
Esempio n. 11
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns>返回执行结果</returns>
        public override object Do()
        {
            string    info = "";
            string    sql  = "SELECT * FROM WF_Task WHERE TaskSta=0 ORDER BY Starter";
            DataTable dt   = null;

            try
            {
                dt = DBAccess.RunSQLReturnTable(sql);
            }
            catch
            {
                Task ta = new Task();
                ta.CheckPhysicsTable();
                dt = DBAccess.RunSQLReturnTable(sql);
            }

            if (dt.Rows.Count == 0)
            {
                return("无任务");
            }

            #region 自动启动流程
            foreach (DataRow dr in dt.Rows)
            {
                string mypk    = dr["MyPK"].ToString();
                string taskSta = dr["TaskSta"].ToString();
                string paras   = dr["Paras"].ToString();
                string starter = dr["Starter"].ToString();
                string fk_flow = dr["FK_Flow"].ToString();

                //获得到达的节点,与接受人。
                string toEmps = dr["ToEmps"].ToString();
                if (DataType.IsNullOrEmpty(toEmps))
                {
                    toEmps = null;
                }

                string toNodeStr = dr["ToNode"].ToString();
                int    toNodeID  = 0;
                if (DataType.IsNullOrEmpty(toNodeStr) == false)
                {
                    toNodeID = int.Parse(toNodeStr);
                }

                string startDT = dr[TaskAttr.StartDT].ToString();
                if (string.IsNullOrEmpty(startDT) == false)
                {
                    /*如果设置了发起时间,就检查当前时间是否与现在的时间匹配.*/
                    if (DateTime.Now < DateTime.Parse(startDT))
                    {
                        continue;
                    }
                }

                Flow fl = new Flow(fk_flow);
                if (fl.HisFlowAppType == FlowAppType.PRJ)
                {
                    if (paras.Contains("PrjNo=") == false || paras.Contains("PrjName=") == false)
                    {
                        info += "err@工程类的流程,没有PrjNo,PrjName参数:" + fl.Name;
                        DBAccess.RunSQL("UPDATE WF_Task SET TaskSta=2,Msg='" + info + "' WHERE MyPK='" + mypk + "'");
                        continue;
                    }
                }

                Int64 workID = 0;
                try
                {
                    string  fTable = "ND" + int.Parse(fl.No + "01").ToString();
                    MapData md     = new MapData(fTable);
                    //sql = "";
                    sql = "SELECT * FROM " + md.PTable + " WHERE MainPK='" + mypk + "' AND WFState=1";
                    try
                    {
                        if (DBAccess.RunSQLReturnTable(sql).Rows.Count != 0)
                        {
                            continue;
                        }
                    }
                    catch
                    {
                        info += "开始节点表单表:" + fTable + "没有设置的默认字段MainPK. " + sql;
                        continue;
                    }

                    if (BP.Web.WebUser.No != starter)
                    {
                        BP.Web.WebUser.Exit();
                        BP.Port.Emp empadmin = new BP.Port.Emp(starter);
                        BP.Web.WebUser.SignInOfGener(empadmin);
                    }

                    Work wk = fl.NewWork();
                    workID = wk.OID;
                    string[] strs = paras.Split('@');
                    foreach (string str in strs)
                    {
                        if (string.IsNullOrEmpty(str))
                        {
                            continue;
                        }

                        if (str.Contains("=") == false)
                        {
                            continue;
                        }

                        string[] kv = str.Split('=');
                        wk.SetValByKey(kv[0], kv[1]);
                    }

                    wk.SetValByKey("MainPK", mypk);
                    wk.Update();

                    if (fl.HisFlowAppType == FlowAppType.PRJ)
                    {
                        string prjNo = wk.GetValStrByKey("PrjNo");
                        if (DataType.IsNullOrEmpty(prjNo) == true)
                        {
                            info += "err@没有找到工程编号:MainPK" + mypk;
                            DBAccess.RunSQL("UPDATE WF_Task SET TaskSta=2,Msg='" + info + "' WHERE MyPK='" + mypk + "'");
                            continue;
                        }
                    }

                    WorkNode wn = new WorkNode(wk, fl.HisStartNode);

                    string msg = "";

                    if (toNodeID == 0)
                    {
                        msg = wn.NodeSend(null, toEmps).ToMsgOfText();
                    }
                    else
                    {
                        msg = wn.NodeSend(new Node(toNodeID), toEmps).ToMsgOfText();
                    }

                    msg = msg.Replace("'", "~");

                    DBAccess.RunSQL("UPDATE WF_Task SET TaskSta=1,Msg='" + msg + "' WHERE MyPK='" + mypk + "'");
                }
                catch (Exception ex)
                {
                    //删除流程数据
                    if (workID != 0)
                    {
                        BP.WF.Dev2Interface.Flow_DoDeleteFlowByReal(fk_flow, workID);
                    }

                    //如果发送错误。
                    info += ex.Message;
                    string msg = ex.Message;
                    try
                    {
                        DBAccess.RunSQL("UPDATE WF_Task SET TaskSta=2,Msg='" + msg + "' WHERE MyPK='" + mypk + "'");
                    }
                    catch
                    {
                        Task TK = new Task();
                        TK.CheckPhysicsTable();
                    }
                }
            }
            #endregion 自动启动流程

            return(info);
        }
Esempio n. 12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.AddHeader("P3P", "CP=CAO PSA OUR");
            if (this.UserNo != null && this.SID != null)
            {
                try
                {
                    string sql = "SELECT SID FROM Port_Emp WHERE No='" + this.UserNo + "'";
                    string sid = BP.DA.DBAccess.RunSQLReturnString(sql);
                    if (sid != this.SID)
                    {
                        this.Response.Write("非法的访问,请与管理员联系。sid=" + sid);
                        return;
                    }
                    else
                    {
                        Emp emL = new Emp(this.UserNo);
                        WebUser.Token = this.Session.SessionID;
                        WebUser.SignInOfGenerLang(emL, SystemConfig.SysLanguage);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("@有可能您没有配置好ccflow的安全验证机制:" + ex.Message);
                }
            }

            //     BP.SystemConfig.DoClearCash();
            Emp em = new Emp(this.UserNo);

            WebUser.Token = this.Session.SessionID;
            WebUser.SignInOfGenerLang(em, SystemConfig.SysLanguage);

            string paras = "";

            foreach (string str in this.Request.QueryString)
            {
                string val = this.Request.QueryString[str];
                if (val.IndexOf('@') != -1)
                {
                    throw new Exception("您没有能参数: [ " + str + " ," + val + " ] 给值 ,URL 将不能被执行。");
                }

                switch (str)
                {
                case DoWhatList.DoNode:
                case DoWhatList.Emps:
                case DoWhatList.EmpWorks:
                case DoWhatList.EmpWorksSmall:
                case DoWhatList.EmpWorksSmallSingle:
                case DoWhatList.FlowSearch:
                case DoWhatList.Login:
                case DoWhatList.MyFlow:
                case DoWhatList.MyWork:
                case DoWhatList.Start:
                case DoWhatList.Start5:
                case DoWhatList.StartSmall:
                case DoWhatList.FlowFX:
                case DoWhatList.DealWork:
                case DoWhatList.DealWorkInSmall:
                //   case DoWhatList.CallMyFlow:
                case "FK_Flow":
                case "WorkID":
                case "FK_Node":
                case "SID":
                    break;

                default:
                    paras += "&" + str + "=" + val;
                    break;
                }
            }

            if (this.IsPostBack == false)
            {
                if (this.IsCanLogin() == false)
                {
                    this.ShowMsg("<fieldset><legend>安全验证错误</legend> 系统无法执行您的请求,可能是您的登陆时间太长,请重新登陆。<br>如果您要取消安全验证请修改web.config 中IsDebug 中的值设置成1。</fieldset>");
                    return;
                }

                BP.Port.Emp emp = new BP.Port.Emp(this.UserNo);
                BP.Web.WebUser.SignInOfGener(emp); //开始执行登陆。


                string nodeID = int.Parse(this.FK_Flow + "01").ToString();
                switch (this.DoWhat)
                {
                //case DoWhatList.CallMyFlow: // 调起指定的工作
                //     this.Response.Redirect("MyFlow.aspx?WorkID="+this.WorkID+"&FK_Flow=" + this.FK_Flow + paras + "&FK_Node="+this.FK_Node, true);
                //    break;
                //case DoWhatList.CallMyFlowSmall: // 调起指定的工作
                //    this.Response.Redirect("MyFlowSmall.aspx?WorkID=" + this.WorkID + "&FK_Flow=" + this.FK_Flow + paras + "&FK_Node=" + this.FK_Node, true);
                //    break;
                case DoWhatList.Start5:     // 发起工作
                    if (this.FK_Flow == null)
                    {
                        this.Response.Redirect("../AppDemo/Default.aspx", true);
                    }
                    else
                    {
                        this.Response.Redirect("../AppDemo/Default.aspx?FK_Flow=" + this.FK_Flow + paras + "&FK_Node=" + nodeID, true);
                    }
                    break;

                case DoWhatList.Start:     // 发起工作
                    if (this.FK_Flow == null)
                    {
                        this.Response.Redirect("Start.aspx", true);
                    }
                    else
                    {
                        this.Response.Redirect("MyFlow.aspx?FK_Flow=" + this.FK_Flow + paras + "&FK_Node=" + nodeID, true);
                    }
                    break;

                case DoWhatList.StartSmall:     // 发起工作 小窗口
                    if (this.FK_Flow == null)
                    {
                        this.Response.Redirect("StartSmall.aspx?FK_Flow=" + this.FK_Flow + paras, true);
                    }
                    else
                    {
                        this.Response.Redirect("MyFlowSmall.aspx?FK_Flow=" + this.FK_Flow + paras, true);
                    }
                    break;

                case DoWhatList.StartSmallSingle:     // 发起工作单独小窗口
                    if (this.FK_Flow == null)
                    {
                        this.Response.Redirect("StartSmall.aspx?FK_Flow=" + this.FK_Flow + paras + "&IsSingle=1&FK_Node=" + nodeID, true);
                    }
                    else
                    {
                        this.Response.Redirect("MyFlowSmallSingle.aspx?FK_Flow=" + this.FK_Flow + paras + "&FK_Node=" + nodeID, true);
                    }
                    break;

                case DoWhatList.RuningSmall:     // 在途中工作
                    this.Response.Redirect("RuningSmall.aspx?FK_Flow=" + this.FK_Flow, true);
                    break;

                case "RuningSmallSingle":     // 在途中工作
                    this.Response.Redirect("RuningSmallSingle.aspx?FK_Flow=" + this.FK_Flow, true);
                    break;

                case DoWhatList.Tools:     // 工具栏目。
                    this.Response.Redirect("Tools.aspx", true);
                    break;

                case DoWhatList.ToolsSmall:     // 小工具栏目。
                    this.Response.Redirect("ToolsSmall.aspx?RefNo=" + this.Request["RefNo"], true);
                    break;

                case DoWhatList.EmpWorksSmall:     // 我的工作小窗口
                    if (this.FK_Flow == null || this.FK_Flow == "")
                    {
                        this.Response.Redirect("EmpWorksSmall.aspx", true);
                    }
                    else
                    {
                        this.Response.Redirect("EmpWorksSmall.aspx?FK_Flow=" + this.FK_Flow, true);
                    }
                    break;

                case DoWhatList.EmpWorksSmallSingle:     // 我的工作小窗口独立的
                    if (this.FK_Flow == null || this.FK_Flow == "")
                    {
                        this.Response.Redirect("EmpWorksSmallSingle.aspx", true);
                    }
                    else
                    {
                        this.Response.Redirect("EmpWorksSmallSingle.aspx?FK_Flow=" + this.FK_Flow, true);
                    }
                    break;

                case DoWhatList.EmpWorks:     // 我的工作。
                case DoWhatList.Login:
                    if (this.FK_Flow == null)
                    {
                        this.Response.Redirect("EmpWorks.aspx", true);
                    }
                    else
                    {
                        this.Response.Redirect("EmpWorks.aspx?FK_Flow=" + this.FK_Flow, true);
                    }
                    break;

                case DoWhatList.Emps:     // 通讯录。
                    this.Response.Redirect("Emps.aspx", true);
                    break;

                case DoWhatList.FlowSearch:     // 流程查询。
                    if (this.FK_Flow == null)
                    {
                        this.Response.Redirect("FlowSearch.aspx", true);
                    }
                    else
                    {
                        this.Response.Redirect("/Rpt/Search.aspx?Endse=s&FK_Flow=001&EnsName=ND" + int.Parse(this.FK_Flow) + "Rpt" + paras, true);
                    }
                    break;

                case DoWhatList.FlowSearchSmall:     // 流程查询。
                    if (this.FK_Flow == null)
                    {
                        this.Response.Redirect("FlowSearchSmall.aspx", true);
                    }
                    else
                    {
                        this.Response.Redirect("/WF/Comm/PanelEns.aspx?EnsName=ND" + int.Parse(this.FK_Flow) + "Rpt" + paras, true);
                    }
                    break;

                case DoWhatList.FlowSearchSmallSingle:     // 流程查询。
                    if (this.FK_Flow == null)
                    {
                        this.Response.Redirect("FlowSearchSmallSingle.aspx", true);
                    }
                    else
                    {
                        this.Response.Redirect("/WF/Comm/PanelEns.aspx?EnsName=ND" + int.Parse(this.FK_Flow) + "Rpt" + paras, true);
                    }
                    break;

                case DoWhatList.FlowFX:     // 流程查询。
                    if (this.FK_Flow == null)
                    {
                        throw new Exception("@没有参数流程编号。");
                    }

                    this.Response.Redirect("/WF/Comm/GroupEnsMNum.aspx?EnsName=ND" + int.Parse(this.FK_Flow) + "Rpt" + paras, true);
                    break;

                case DoWhatList.DealWork:
                    if (this.FK_Flow == null || this.WorkID == null)
                    {
                        throw new Exception("@参数 FK_Flow 或者 WorkID 为Null 。");
                    }
                    this.Response.Redirect("MyFlow.aspx?FK_Flow=" + this.FK_Flow + "&WorkID=" + this.WorkID + "&o2=1" + paras, true);
                    break;

                case DoWhatList.DealWorkInSmall:
                    if (this.FK_Flow == null || this.WorkID == null)
                    {
                        throw new Exception("@参数 FK_Flow 或者 WorkID 为Null 。");
                    }
                    this.Response.Redirect("MyFlowSmall.aspx?FK_Flow=" + this.FK_Flow + "&WorkID=" + this.WorkID + "&o2=1" + paras, true);
                    break;

                default:
                    this.ToErrorPage("没有约定的标记:DoWhat=" + this.DoWhat);
                    break;
                }
            }
        }
Esempio n. 13
0
 public void LetAdminLogin()
 {
     BP.Port.Emp emp = new BP.Port.Emp("admin");
     BP.Web.WebUser.SignInOfGener(emp);
 }
Esempio n. 14
0
    /// <summary>
    /// Entity 的基本应用.
    /// </summary>
    public void EntityBaseApp()
    {
        #region  直接插入一条数据.
        BP.Port.Emp emp = new BP.Port.Emp();
        emp.CheckPhysicsTable();

        /*  检查物理表是否与Map一致
         *  1,如果没有这个物理表则创建。
         *  2,如果缺少字段则创建。
         *  3,如果字段类型不一直则删除创建,比如原来是int类型现在map修改成string类型。
         *  4,map字段减少则不处理。
         *  5,手工的向物理表中增加的字段则不处理。
         *  6,数据源是视图字段不匹配则创建失败。
         * */
        emp.No      = "zhangsan";
        emp.Name    = "张三";
        emp.FK_Dept = "01";
        emp.Pass    = "******";
        emp.Insert();  // 如果主键重复要抛异常。
        #endregion  直接插入一条数据.

        #region  保存的方式插入一条数据.
        emp         = new BP.Port.Emp();
        emp.No      = "zhangsan";
        emp.Name    = "张三";
        emp.FK_Dept = "01";
        emp.Pass    = "******";
        emp.Save();  // 如果主键重复直接更新,不会抛出异常。
        #endregion  保存的方式插入一条数据.

        #region  其他方法.
        BP.Port.Emp myEmp2 = new BP.Port.Emp();
        myEmp2.No = "zhangsan";

        //检查主键数据是否存在 ?
        bool isExit = myEmp2.IsExits;
        if (myEmp2.RetrieveFromDBSources() == 0)
        {
            /*说明没有查询到数据。*/
        }
        #endregion .


        #region  数据复制.

        /*
         * 如果一个实体与另外的一个实体两者的属性大致相同,就可以执行copy.
         *  比如:在创建人员时,张三与李四两者只是编号与名称不同,只是改变不同的属性就可以执行相关的业务操作。
         */
        Emp emp1 = new BP.Port.Emp("zhangsan");
        emp = new BP.Port.Emp();
        emp.Copy(emp1); // 同实体copy, 不同的实体也可以实现copy.
        emp.No   = "lisi";
        emp.Name = "李四";
        emp.Insert();

        // copy 在业务逻辑上会经常应用,比如: 在一个流程中A节点表单与B节点表单字段大致相同,ccflow就是采用的copy方式处理。
        #endregion  数据复制.

        #region 单个实体查询.
        string      msg   = ""; // 查询这条数据.
        BP.Port.Emp myEmp = new BP.Port.Emp();
        myEmp.No = "zhangsan";
        if (myEmp.RetrieveFromDBSources() == 0)  // RetrieveFromDBSources() 返回来的是查询数量.
        {
            this.Response.Write("没有查询到编号等于zhangsan的人员记录.");
            return;
        }
        else
        {
            msg  = "";
            msg += "<BR>编号:" + myEmp.No;
            msg += "<BR>名称:" + myEmp.Name;
            msg += "<BR>密码:" + myEmp.Pass;
            msg += "<BR>部门编号:" + myEmp.FK_Dept;
            msg += "<BR>部门名称:" + myEmp.FK_DeptText;
            this.Response.Write(msg);
        }

        myEmp    = new BP.Port.Emp();
        myEmp.No = "zhangsan";
        myEmp.Retrieve(); // 执行查询,如果查询不到则要抛出异常。

        msg  = "";
        msg += "<BR>编号:" + myEmp.No;
        msg += "<BR>名称:" + myEmp.Name;
        msg += "<BR>密码:" + myEmp.Pass;
        msg += "<BR>部门编号:" + myEmp.FK_Dept;
        msg += "<BR>部门名称:" + myEmp.FK_DeptText;
        this.Response.Write(msg);
        #endregion 查询.

        #region 两种方式的删除。
        // 删除操作。
        emp    = new BP.Port.Emp();
        emp.No = "zhangsan";
        int delNum = emp.Delete(); // 执行删除。
        if (delNum == 0)
        {
            this.Response.Write("删除 zhangsan 失败.");
        }

        if (delNum == 1)
        {
            this.Response.Write("删除 zhangsan 成功..");
        }
        if (delNum > 1)
        {
            this.Response.Write("不应该出现的异常。");
        }
        // 初试化实例后,执行删除,这种方式要执行两个sql.
        emp = new BP.Port.Emp("abc");
        emp.Delete();

        #endregion 两种方式的删除。

        #region 更新。
        emp      = new BP.Port.Emp("zhangyifan"); // 事例化它.
        emp.Name = "张一帆123";                      //改变属性.
        emp.Update();                             // 更新它,这个时间BP将会把所有的属性都要执行更新,UPDATA 语句涉及到各个列。

        emp = new BP.Port.Emp("fuhui");           // 事例化它.
        emp.Update("Name", "福慧123");              //仅仅更新这一个属性。.UPDATA 语句涉及到Name列。
        #endregion 更新。
    }
Esempio n. 15
0
        public string DoAdd(string empNo, string orgNo)
        {
            BP.Port.Emp emp = new BP.Port.Emp();
            emp.No = empNo;
            if (emp.RetrieveFromDBSources() == 0)
            {
                return("err@管理员增加失败,ID=" + empNo + "不存在用户表,您增加的管理员必须存在与Port_Emp用户表.");
            }

            BP.Port.Dept dept = new BP.Port.Dept();
            dept.No = orgNo;
            if (dept.RetrieveFromDBSources() == 0)
            {
                return("err@orgNo错误, 不存在 Port_Dept 里面。");
            }

            BP.WF.Port.Inc inc = new BP.WF.Port.Inc();
            inc.No = orgNo;
            if (inc.RetrieveFromDBSources() == 0)
            {
                return("err@orgNo错误, 不存在 Port_Inc 里面。");
            }

            //求根目录流程树.
            BP.WF.Template.FlowSort fsRoot = new BP.WF.Template.FlowSort();
            fsRoot.Retrieve(BP.WF.Template.FlowSortAttr.ParentNo, "0");


            BP.WF.Template.FlowSort fs = new BP.WF.Template.FlowSort();
            fs.No = "Inc" + orgNo;
            if (fs.RetrieveFromDBSources() == 1)
            {
                return("err@该组织已经初始化过流程树目录.");
            }

            fs.Name     = dept.Name + "-流程树";
            fs.ParentNo = fsRoot.No;
            fs.OrgNo    = dept.No;
            fs.Insert();


            //求根目录流程树.
            BP.Sys.FrmTree frmRoot = new BP.Sys.FrmTree();
            frmRoot.Retrieve(BP.WF.Template.FlowSortAttr.ParentNo, "0");

            BP.Sys.FrmTree frmTree = new BP.Sys.FrmTree();
            frmTree.No = "Inc" + orgNo;
            if (frmTree.RetrieveFromDBSources() == 1)
            {
                return("err@该组织已经初始化过表单树目录.");
            }

            frmTree.ParentNo = frmRoot.No;
            frmTree.Name     = dept.Name + "-表单树";
            frmTree.OrgNo    = dept.No;
            frmTree.Insert();


            AdminEmp ae = new AdminEmp();

            ae.No = empNo;
            if (ae.RetrieveFromDBSources() == 1)
            {
                if (ae.IsAdmin == true)
                {
                    return("err@该管理员已经存在,请删除该管理员重新增加delete from wf_emp where no='" + empNo + "'");
                }
                ae.Delete();
            }

            ae.Copy(emp);
            ae.UserType   = 1;
            ae.UseSta     = 1;
            ae.RootOfDept = orgNo;
            ae.RootOfFlow = "Inc" + orgNo;
            ae.RootOfForm = "Inc" + orgNo;
            ae.Insert();

            return("info@管理员增加成功.");
        }
Esempio n. 16
0
        /// <summary>
        /// 定时任务
        /// </summary>
        /// <param name="fls"></param>
        private void DoAutuFlows(BP.WF.Flows fls)
        {
            #region 自动启动流程
            foreach (BP.WF.Flow fl in fls)
            {
                if (fl.IsOK == false ||
                    fl.HisFlowRunWay == BP.WF.FlowRunWay.HandWork)
                {
                    continue;
                }

                if (DateTime.Now.ToString("HH:mm") == fl.Tag)
                {
                    continue;
                }

                if (fl.RunObj == null || fl.RunObj == "")
                {
                    string msg = "您设置自动运行流程错误,没有设置流程内容,流程编号:" + fl.No;
                    this.SetText(msg);
                    continue;
                }

                #region 判断当前时间是否可以运行它。
                string   nowStr   = DateTime.Now.ToString("yyyy-MM-dd,HH:mm");
                string[] strs     = fl.RunObj.Split('@'); //破开时间串。
                bool     IsCanRun = false;
                foreach (string str in strs)
                {
                    if (string.IsNullOrEmpty(str))
                    {
                        continue;
                    }
                    if (nowStr.Contains(str))
                    {
                        IsCanRun = true;
                    }
                }
                if (IsCanRun == false)
                {
                    continue;
                }

                // 设置时间.
                fl.Tag = DateTime.Now.ToString("HH:mm");
                #endregion 判断当前时间是否可以运行它。

                // 以此用户进入.
                switch (fl.HisFlowRunWay)
                {
                case BP.WF.FlowRunWay.SpecEmp:     //指定人员按时运行。
                    string RunObj = fl.RunObj;
                    string fk_emp = RunObj.Substring(0, RunObj.IndexOf('@'));

                    BP.Port.Emp emp = new BP.Port.Emp();
                    emp.No = fk_emp;
                    if (emp.RetrieveFromDBSources() == 0)
                    {
                        this.SetText("启动自动启动流程错误:发起人(" + fk_emp + ")不存在。");
                        continue;
                    }
                    BP.Web.WebUser.SignInOfGener(emp);
#warning 尚未实现。
                    //string info_send= BP.WF.Dev2Interface.Node_StartWork(fl.No,);
                    //this.SetText(info_send);
                    continue;

                case BP.WF.FlowRunWay.DataModel:     //按数据集合驱动的模式执行。
                    this.SetText("@开始执行数据驱动流程调度:" + fl.Name);
                    this.DTS_Flow(fl);
                    continue;

                default:
                    break;
                }
            }
            if (BP.Web.WebUser.No != "admin")
            {
                BP.Port.Emp empadmin = new BP.Port.Emp("admin");
                BP.Web.WebUser.SignInOfGener(empadmin);
            }
            #endregion 发送消息
        }
Esempio n. 17
0
        public void DTS_Flow(BP.WF.Flow fl)
        {
            #region 读取数据.
            BP.Sys.MapExt me = new MapExt();
            me.MyPK = "ND" + int.Parse(fl.No) + "01" + "_" + MapExtXmlList.StartFlow;
            int i = me.RetrieveFromDBSources();
            if (i == 0)
            {
                BP.DA.Log.DefaultLogWriteLineError("没有为流程(" + fl.Name + ")的开始节点设置发起数据,请参考说明书解决.");
                return;
            }
            if (string.IsNullOrEmpty(me.Tag))
            {
                BP.DA.Log.DefaultLogWriteLineError("没有为流程(" + fl.Name + ")的开始节点设置发起数据,请参考说明书解决.");
                return;
            }

            // 获取从表数据.
            DataSet  ds      = new DataSet();
            string[] dtlSQLs = me.Tag1.Split('*');
            foreach (string sql in dtlSQLs)
            {
                if (string.IsNullOrEmpty(sql))
                {
                    continue;
                }

                string[]  tempStrs = sql.Split('=');
                string    dtlName  = tempStrs[0];
                DataTable dtlTable = BP.DA.DBAccess.RunSQLReturnTable(sql.Replace(dtlName + "=", ""));
                dtlTable.TableName = dtlName;
                ds.Tables.Add(dtlTable);
            }
            #endregion 读取数据.

            #region 检查数据源是否正确.
            string errMsg = "";
            // 获取主表数据.
            DataTable dtMain = BP.DA.DBAccess.RunSQLReturnTable(me.Tag);
            if (dtMain.Rows.Count == 0)
            {
                BP.DA.Log.DefaultLogWriteLineError("流程(" + fl.Name + ")此时无任务.");
                this.SetText("流程(" + fl.Name + ")此时无任务.");
                return;
            }

            this.SetText("@查询到(" + dtMain.Rows.Count + ")条任务.");

            if (dtMain.Columns.Contains("Starter") == false)
            {
                errMsg += "@配值的主表中没有Starter列.";
            }

            if (dtMain.Columns.Contains("MainPK") == false)
            {
                errMsg += "@配值的主表中没有MainPK列.";
            }

            if (errMsg.Length > 2)
            {
                this.SetText(errMsg);
                BP.DA.Log.DefaultLogWriteLineError("流程(" + fl.Name + ")的开始节点设置发起数据,不完整." + errMsg);
                return;
            }
            #endregion 检查数据源是否正确.

            #region 处理流程发起.
            string nodeTable = "ND" + int.Parse(fl.No) + "01";
            int    idx       = 0;
            foreach (DataRow dr in dtMain.Rows)
            {
                idx++;

                string mainPK = dr["MainPK"].ToString();
                string sql    = "SELECT OID FROM " + nodeTable + " WHERE MainPK='" + mainPK + "'";
                if (DBAccess.RunSQLReturnTable(sql).Rows.Count != 0)
                {
                    this.SetText("@" + fl.Name + ",第" + idx + "条,此任务在之前已经完成。");
                    continue; /*说明已经调度过了*/
                }

                string starter = dr["Starter"].ToString();
                if (WebUser.No != starter)
                {
                    BP.Web.WebUser.Exit();
                    BP.Port.Emp emp = new BP.Port.Emp();
                    emp.No = starter;
                    if (emp.RetrieveFromDBSources() == 0)
                    {
                        this.SetText("@" + fl.Name + ",第" + idx + "条,设置的发起人员:" + emp.No + "不存在.");
                        BP.DA.Log.DefaultLogWriteLineInfo("@数据驱动方式发起流程(" + fl.Name + ")设置的发起人员:" + emp.No + "不存在。");
                        continue;
                    }
                    WebUser.SignInOfGener(emp);
                }

                #region  给值.
                //System.Collections.Hashtable ht = new Hashtable();

                Work wk = fl.NewWork();

                string err = "";
                #region 检查用户拼写的sql是否正确?
                foreach (DataColumn dc in dtMain.Columns)
                {
                    string f = dc.ColumnName.ToLower();
                    switch (f)
                    {
                    case "starter":
                    case "mainpk":
                    case "refmainpk":
                    case "tonode":
                        break;

                    default:
                        bool isHave = false;
                        foreach (Attr attr in wk.EnMap.Attrs)
                        {
                            if (attr.Key.ToLower() == f)
                            {
                                isHave = true;
                                break;
                            }
                        }
                        if (isHave == false)
                        {
                            err += " " + f + " ";
                        }
                        break;
                    }
                }
                if (string.IsNullOrEmpty(err) == false)
                {
                    throw new Exception("您设置的字段:" + err + "不存在开始节点的表单中,设置的sql:" + me.Tag);
                }

                #endregion 检查用户拼写的sql是否正确?

                foreach (DataColumn dc in dtMain.Columns)
                {
                    wk.SetValByKey(dc.ColumnName, dr[dc.ColumnName].ToString());
                }

                if (ds.Tables.Count != 0)
                {
                    // MapData md = new MapData(nodeTable);
                    MapDtls dtls = new MapDtls(nodeTable);
                    foreach (MapDtl dtl in dtls)
                    {
                        foreach (DataTable dt in ds.Tables)
                        {
                            if (dt.TableName != dtl.No)
                            {
                                continue;
                            }

                            //删除原来的数据。
                            GEDtl dtlEn = dtl.HisGEDtl;
                            dtlEn.Delete(GEDtlAttr.RefPK, wk.OID.ToString());

                            // 执行数据插入。
                            foreach (DataRow drDtl in dt.Rows)
                            {
                                if (drDtl["RefMainPK"].ToString() != mainPK)
                                {
                                    continue;
                                }

                                dtlEn = dtl.HisGEDtl;
                                foreach (DataColumn dc in dt.Columns)
                                {
                                    dtlEn.SetValByKey(dc.ColumnName, drDtl[dc.ColumnName].ToString());
                                }

                                dtlEn.RefPK = wk.OID.ToString();
                                dtlEn.OID   = 0;
                                dtlEn.Insert();
                            }
                        }
                    }
                }
                #endregion  给值.


                int toNodeID = 0;
                try
                {
                    toNodeID = int.Parse(dr["ToNode"].ToString());
                }
                catch
                {
                    /*有可能在4.5以前的版本中没有tonode这个约定.*/
                }

                // 处理发送信息.
                //  Node nd =new Node();
                string msg = "";
                try
                {
                    if (toNodeID == 0)
                    {
                        WorkNode wn = new WorkNode(wk, fl.HisStartNode);
                        msg = wn.NodeSend().ToMsgOfText();
                    }

                    if (toNodeID == fl.StartNodeID)
                    {
                        /* 发起后让它停留在开始节点上,就是为开始节点创建一个待办。*/
                        Int64 workID = BP.WF.Dev2Interface.Node_CreateStartNodeWork(fl.No, null, null, WebUser.No, null);
                        if (workID != wk.OID)
                        {
                            throw new Exception("@异常信息:不应该不一致的workid.");
                        }
                        else
                        {
                            wk.Update();
                        }
                        msg = "已经为(" + WebUser.No + ") 创建了开始工作节点. ";
                    }

                    BP.DA.Log.DefaultLogWriteLineInfo(msg);
                    this.SetText("@" + fl.Name + ",第" + idx + "条,发起人员:" + WebUser.No + "-" + WebUser.Name + "已完成.\r\n" + msg);
                }
                catch (Exception ex)
                {
                    this.SetText("@" + fl.Name + ",第" + idx + "条,发起人员:" + WebUser.No + "-" + WebUser.Name + "发起时出现错误.\r\n" + ex.Message);
                    BP.DA.Log.DefaultLogWriteLineWarning(ex.Message);
                }
            }
            #endregion 处理流程发起.
        }
Esempio n. 18
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns>返回执行结果</returns>
        public override object Do()
        {
            BP.WF.Flows fls = new Flows();
            fls.RetrieveAll();

            #region 自动启动流程
            foreach (BP.WF.Flow fl in fls)
            {
                if (fl.HisFlowRunWay == BP.WF.FlowRunWay.HandWork)
                {
                    continue;
                }

                if (DateTime.Now.ToString("HH:mm") == fl.Tag)
                {
                    continue;
                }

                if (fl.RunObj == null || fl.RunObj == "")
                {
                    string msg = "您设置自动运行流程错误,没有设置流程内容,流程编号:" + fl.No + ",流程名称:" + fl.Name;
                    BP.DA.Log.DebugWriteError(msg);
                    continue;
                }

                #region 判断当前时间是否可以运行它。
                string   nowStr   = DateTime.Now.ToString("yyyy-MM-dd,HH:mm");
                string[] strs     = fl.RunObj.Split('@'); //破开时间串。
                bool     IsCanRun = false;
                foreach (string str in strs)
                {
                    if (string.IsNullOrEmpty(str))
                    {
                        continue;
                    }
                    if (nowStr.Contains(str))
                    {
                        IsCanRun = true;
                    }
                }

                if (IsCanRun == false)
                {
                    continue;
                }

                // 设置时间.
                fl.Tag = DateTime.Now.ToString("HH:mm");
                #endregion 判断当前时间是否可以运行它。

                // 以此用户进入.
                switch (fl.HisFlowRunWay)
                {
                case BP.WF.FlowRunWay.SpecEmp:     //指定人员按时运行。
                    string RunObj = fl.RunObj;
                    string fk_emp = RunObj.Substring(0, RunObj.IndexOf('@'));

                    BP.Port.Emp emp = new BP.Port.Emp();
                    emp.No = fk_emp;
                    if (emp.RetrieveFromDBSources() == 0)
                    {
                        BP.DA.Log.DebugWriteError("启动自动启动流程错误:发起人(" + fk_emp + ")不存在。");
                        continue;
                    }

                    try
                    {
                        //让 userNo 登录.
                        BP.WF.Dev2Interface.Port_Login(emp.No);

                        //创建空白工作, 发起开始节点.
                        Int64 workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fl.No);

                        //执行发送.
                        SendReturnObjs objs = BP.WF.Dev2Interface.Node_SendWork(fl.No, workID);

                        //string info_send= BP.WF.Dev2Interface.Node_StartWork(fl.No,);
                        BP.DA.Log.DefaultLogWriteLineInfo("流程:" + fl.No + fl.Name + "的定时任务\t\n -------------- \t\n" + objs.ToMsgOfText());
                    }
                    catch (Exception ex)
                    {
                        BP.DA.Log.DebugWriteError("流程:" + fl.No + fl.Name + "自动发起错误:\t\n -------------- \t\n" + ex.Message);
                    }
                    continue;

                case BP.WF.FlowRunWay.DataModel:     //按数据集合驱动的模式执行。
                    this.DTS_Flow(fl);
                    continue;

                case BP.WF.FlowRunWay.InsertModel:     //按数据集合驱动的模式执行。
                    this.InsertModel(fl);
                    continue;

                default:
                    break;
                }
            }
            if (BP.Web.WebUser.No != "admin")
            {
                BP.Port.Emp empadmin = new BP.Port.Emp("admin");
                BP.Web.WebUser.SignInOfGener(empadmin);
            }
            #endregion 发送消息

            return("调度完成..");
        }