Beispiel #1
0
        /// <summary>
        /// 按流程查询
        /// </summary>
        /// <param name="fk_flow">流程编号</param>
        public BillTemplates(string fk_flow)
        {
            QueryObject qo = new QueryObject(this);

            qo.AddWhereInSQL(BillTemplateAttr.NodeID, "SELECT NodeID FROM WF_Node WHERE fk_flow='" + fk_flow + "'");
            qo.DoQuery();
        }
Beispiel #2
0
        public Frms(int fk_node)
        {
            QueryObject qo = new QueryObject(this);

            qo.AddWhereInSQL(FrmAttr.No, "SELECT FK_Frm FROM WF_FrmNode WHERE FK_Node=" + fk_node);
            qo.DoQuery();
        }
Beispiel #3
0
        /// <summary>
        /// 项目
        /// </summary>
        /// <param name="fk_flow"></param>
        public Projects(string fk_flow)
        {
            QueryObject qo = new QueryObject(this);

            qo.AddWhereInSQL(ProjectAttr.FK_Node, "SELECT NodeID FROM WF_Node WHERE FK_Flow='" + fk_flow + "'");
            qo.DoQuery();
        }
Beispiel #4
0
        public void BindMyWork(int FK_Node)
        {
            Node nd = new Node(FK_Node);
            //Works wks = nd.HisWorks;
            //Work wk =wks.GetNewEntity;
            GenerWorkFlows gwfs = new GenerWorkFlows();
            QueryObject    qo   = new QueryObject(gwfs);

            qo.AddWhereInSQL(GenerWorkFlowAttr.WorkID, "SELECT WorkID FROM WF_GenerWorkerlist WHERE FK_Node=" + FK_Node + " AND FK_Emp='" + WebUser.No + "'");
            qo.DoQuery();

            this._Text = "<table class='MyWork' id='strs'  cellSpacing='0' cellPadding='0' >";
            this.Text += "<TR>";
            this.Text += "<TD class='MyWorkTitle' nowrap >标题</TD>";
            this.Text += "<TD class='MyWorkTitle' nowrap >记录时间</TD>";
            this.Text += "<TD class='MyWorkTitle' nowrap >记录人</TD>";
            this.Text += "</TR>";

            foreach (GenerWorkFlow gwf in gwfs)
            {
                this.Text += "<TR class='MyWorkTR' >";
                this.Text += "<TD class='MyWorkTD' nowrap  ><a href='FlowSV2.aspx?FK_Flow=" + gwf.FK_Flow + "&WorkID=" + gwf.WorkID + "&FK_Node=" + gwf.FK_Node + "' >" + gwf.Title + "</a></TD>";
                this.Text += "<TD class='MyWorkTD' nowrap >" + gwf.RDT + "</TD>";
                this.Text += "<TD class='MyWorkTD' nowrap >" + gwf.Starter + "</TD>";
                this.Text += "<TR>";
            }

            this.Text += "</TABLE>";
            this.ParseControl();
        }
Beispiel #5
0
        /// <summary>
        /// 此节点的转向方向集合
        /// </summary>
        /// <param name="nodeID">此节点的ID</param>
        /// <param name="isLifecyle">是不是判断在节点的生存期内</param>
        /// <returns>转向方向集合(ToNodes)</returns>
        public Nodes GetHisToNodes(int nodeID, bool isLifecyle)
        {
            Nodes       nds = new Nodes();
            QueryObject qo  = new QueryObject(nds);

            qo.AddWhereInSQL(NodeAttr.NodeID, "SELECT ToNode FROM WF_Direction WHERE Node=" + nodeID);
            qo.DoQuery();
            return(nds);

            /*
             * QueryObject qo = new QueryObject(this);
             * qo.AddWhere(DirectionAttr.Node,nodeID);
             * qo.DoQuery();
             *
             * Nodes ens = new Nodes();
             * foreach(Direction en in this)
             * {
             *      Node nd = new Node(en.ToNode);
             *      //				if (isLifecyle==false)
             *      //				{
             *      ens.AddEntity(nd);
             *      //				}
             *      //				else
             *      //				{
             *      //					if (nd.IsInLifeCycle)
             *      //						ens.AddEntity(nd);
             *      //				}
             * }
             * return ens;
             */
        }
        /// <summary>
        /// 此节点的转向方向集合
        /// </summary>
        /// <param name="nodeID">此节点的ID</param>
        /// <param name="isLifecyle">是不是判断在节点的生存期内</param>
        /// <returns>转向方向集合(ToNodes)</returns>
        public Nodes GetHisToNodes(int nodeID, bool isLifecyle)
        {
            Nodes       nds = new Nodes();
            QueryObject qo  = new QueryObject(nds);

            qo.AddWhereInSQL(NodeAttr.NodeID, "SELECT ToNode FROM WF_Direction WHERE Node=" + nodeID);
            qo.DoQuery();
            return(nds);
        }
Beispiel #7
0
        /// <summary>
        /// 流程
        /// </summary>
        /// <param name="fl"></param>
        public void BindIt(BP.WF.Flow fl)
        {
            GenerWorkFlows gwfs = new GenerWorkFlows();
            QueryObject    qo   = new QueryObject(gwfs);

            qo.AddWhereInSQL(GenerWorkFlowAttr.WorkID, " SELECT WorkID FROM WF_GenerWorkFlow WHERE FK_Node IN ( SELECT FK_Node FROM WF_GenerWorkerlist WHERE FK_Emp='" + Web.WebUser.No + "' AND FK_Flow='" + fl.No + "' AND WORKID=WF_GenerWorkFlow.WORKID AND ISENABLE=1 ) ");
            qo.addOrderBy(GenerWorkFlowAttr.FK_Node, GenerWorkFlowAttr.WorkID);
            qo.DoQuery();


            if (gwfs.Count == 0)
            {
                this.UCFlow1.AddMsgOfInfo("流程" + fl.Name, "没有您[" + WebUser.No + WebUser.Name + "]的当前待办工作.");
            }

            if (gwfs.Count == 1)
            {
                this.Response.Redirect("MyFlow.aspx?FK_Flow=" + fl.No + "&WorkID=" + gwfs[0].GetValByKey(GenerWorkFlowAttr.WorkID).ToString(), true);
                return;
            }

            this.UCFlow1.AddTable();
            this.UCFlow1.AddCaptionLeft(fl.Name);
            this.UCFlow1.AddTR();
            this.UCFlow1.AddTDTitle("IDX");
            this.UCFlow1.AddTDTitle("标题");
            this.UCFlow1.AddTDTitle("停留节点");
            this.UCFlow1.AddTDTitle("发起日期");
            // this.UCFlow1.AddTDTitle("预先警日期");
            this.UCFlow1.AddTDTitle("应完成日期");
            this.UCFlow1.AddTDTitle("记录人");
            this.UCFlow1.AddTDTitle("工作序号");
            this.UCFlow1.AddTREnd();
            int i = 0;

            foreach (GenerWorkFlow gwf in gwfs)
            {
                i++;
                //this.AddTR("onmouseover='TROver(this)' onmouseout='TROut(this)' onclick=\"WinOpen('MyFlow.aspx?FK_Flow="+fl.No+"&WorkID="+dr[WorkAttr.OID ].ToString()+"' )\" " );
                this.UCFlow1.AddTR("title='在列表中根据标题选择您的代办工作' onmouseover='TROver(this)' onmouseout='TROut(this)' onclick=\"javascript:window.location.href='MyFlow.aspx?FK_Flow=" + fl.No + "&WorkID=" + gwf.WorkID + "'\" ");
                this.UCFlow1.AddTDIdx(i);
                this.UCFlow1.AddTD(gwf.Title);
                this.UCFlow1.AddTD(gwf.NodeName);
                this.UCFlow1.AddTD(gwf.RDT);
                this.UCFlow1.AddTD("");

                // this.UCFlow1.AddTD(gwf.w);
                // this.UCFlow1.AddTD(gwf.RDT);

                this.UCFlow1.AddTD(gwf.StarterName);
                //this.UCFlow1.AddTD(gwf.FK_Taxpayer);
                //this.UCFlow1.AddTD(gwf.TaxpayerName);
                this.UCFlow1.AddTD(gwf.WorkID);
                this.UCFlow1.AddTREnd();
            }
            this.UCFlow1.AddTableEnd();
        }
Beispiel #8
0
    /// <summary>
    /// Entities 的基本应用.
    /// </summary>
    public void EntitiesBaseApp()
    {
        #region 查询全部
        /* 查询全部分为两种方式,1 从缓存里查询全部。2,从数据库查询全部。  */
        Emps emps = new Emps();
        int  num  = emps.RetrieveAll(); //从缓存里查询全部数据.

        this.Response.Write("RetrieveAll查询出来(" + num + ")个");
        foreach (Emp emp in emps)
        {
            this.Response.Write("<hr>人员名称:" + emp.Name);
            this.Response.Write("<br>人员编号:" + emp.No);
            this.Response.Write("<br>部门编号:" + emp.FK_Dept);
            this.Response.Write("<br>部门名称:" + emp.FK_DeptText);
        }

        //把entities 数据转入到DataTable里。
        DataTable empsDTfield = emps.ToDataTableField(); //以英文字段做为列名。
        DataTable empsDTDesc  = emps.ToDataTableDesc();  //以中文字段做为列名。

        // 从数据库里查询全部。
        emps = new Emps();
        num  = emps.RetrieveAllFromDBSource();
        this.Response.Write("RetrieveAllFromDBSource查询出来(" + num + ")个");
        foreach (Emp emp in emps)
        {
            this.Response.Write("<hr>人员名称:" + emp.Name);
            this.Response.Write("<br>人员编号:" + emp.No);
            this.Response.Write("<br>部门编号:" + emp.FK_Dept);
            this.Response.Write("<br>部门名称:" + emp.FK_DeptText);
        }
        #endregion 查询全部

        #region  条件查询
        // 单个条件查询。
        Emps        myEmps = new Emps();
        QueryObject qo     = new QueryObject(myEmps);
        qo.AddWhere(EmpAttr.FK_Dept, "01");
        qo.addOrderBy(EmpAttr.No); // 增加排序规则,Order  OrderByDesc, addOrderByDesc addOrderByRandom.
        num = qo.DoQuery();        // 返回查询的个数.
        this.Response.Write("查询出来(" + num + ")个,部门编号=01的人员。");
        foreach (Emp emp in myEmps)
        {
            this.Response.Write("<hr>人员名称:" + emp.Name);
            this.Response.Write("<br>人员编号:" + emp.No);
            this.Response.Write("<br>部门编号:" + emp.FK_Dept);
            this.Response.Write("<br>部门名称:" + emp.FK_DeptText);
        }

        //   DataTable mydt = qo.DoQueryToTable();  // 查询出来的数据转入到datatable里。.

        Emps myEmp1s = new Emps();
        myEmp1s.Retrieve(EmpAttr.FK_Dept, "01");
        foreach (Emp item in myEmp1s)
        {
            this.Response.Write("<hr>人员名称:" + item.Name);
            this.Response.Write("<br>人员编号:" + item.No);
            this.Response.Write("<br>部门编号:" + item.FK_Dept);
            this.Response.Write("<br>部门名称:" + item.FK_DeptText);
        }

        // 多个条件查询。
        myEmps = new Emps();
        qo     = new QueryObject(myEmps);
        qo.AddWhere(EmpAttr.FK_Dept, "01");
        qo.addAnd();
        qo.AddWhere(EmpAttr.No, "guobaogen");
        num = qo.DoQuery();  // 返回查询的个数.
        this.Response.Write("查询出来(" + num + ")个,部门编号=01并且编号=guobaogen的人员。");
        foreach (Emp emp in myEmps)
        {
            this.Response.Write("<hr>人员名称:" + emp.Name);
            this.Response.Write("<br>人员编号:" + emp.No);
            this.Response.Write("<br>部门编号:" + emp.FK_Dept);
            this.Response.Write("<br>部门名称:" + emp.FK_DeptText);
        }
        // 具有括号表达式的查询。
        myEmps = new Emps();
        qo     = new QueryObject(myEmps);
        qo.addLeftBracket(); // 加上左括号.
        qo.AddWhere(EmpAttr.FK_Dept, "01");
        qo.addAnd();
        qo.AddWhere(EmpAttr.No, "guobaogen");
        qo.addRightBracket(); // 加上右括号.
        num = qo.DoQuery();   // 返回查询的个数.
        this.Response.Write("查询出来(" + num + ")个,部门编号=01并且编号=guobaogen的人员。");
        foreach (Emp emp in myEmps)
        {
            this.Response.Write("<hr>人员名称:" + emp.Name);
            this.Response.Write("<br>人员编号:" + emp.No);
            this.Response.Write("<br>部门编号:" + emp.FK_Dept);
            this.Response.Write("<br>部门名称:" + emp.FK_DeptText);
        }
        // 具有where in 方式的查询。
        myEmps = new Emps();
        qo     = new QueryObject(myEmps);
        qo.AddWhereInSQL(EmpAttr.No, "SELECT No FROM Port_Emp WHERE FK_Dept='02'");
        num = qo.DoQuery();  // 返回查询的个数.
        this.Response.Write("查询出来(" + num + ")个,WHERE IN (SELECT No FROM Port_Emp WHERE FK_Dept='02')人员。");
        foreach (Emp emp in myEmps)
        {
            this.Response.Write("<hr>人员名称:" + emp.Name);
            this.Response.Write("<br>人员编号:" + emp.No);
            this.Response.Write("<br>部门编号:" + emp.FK_Dept);
            this.Response.Write("<br>部门名称:" + emp.FK_DeptText);
        }

        // 具有LIKE 方式的查询。
        myEmps = new Emps();
        qo     = new QueryObject(myEmps);
        qo.AddWhere(EmpAttr.No, " LIKE ", "guo");
        num = qo.DoQuery();  // 返回查询的个数.
        this.Response.Write("查询出来(" + num + ")个,人员编号包含guo的人员。");
        foreach (Emp emp in myEmps)
        {
            this.Response.Write("<hr>人员名称:" + emp.Name);
            this.Response.Write("<br>人员编号:" + emp.No);
            this.Response.Write("<br>部门编号:" + emp.FK_Dept);
            this.Response.Write("<br>部门名称:" + emp.FK_DeptText);
        }
        #endregion  条件查询

        #region 集合业务处理.
        myEmps = new Emps();
        myEmps.RetrieveAll(); // 查询全部出来.
        // 遍历集合是常用的处理方法。
        foreach (Emp emp in myEmps)
        {
            this.Response.Write("<hr>人员名称:" + emp.Name);
            this.Response.Write("<br>人员编号:" + emp.No);
            this.Response.Write("<br>部门编号:" + emp.FK_Dept);
            this.Response.Write("<br>部门名称:" + emp.FK_DeptText);
        }
        // 判断是否包含是指定的主键值.
        bool isHave  = myEmps.Contains("Name", "郭宝庚"); //判断是否集合里面包含Name=郭宝庚的实体.
        bool isHave1 = myEmps.Contains("guobaogeng");  //判断是否集合里面主键No=guobaogeng的实体.

        // 获取Name=郭宝庚的实体,如果没有就返回空。
        Emp empFind = myEmps.GetEntityByKey("Name", "郭宝庚") as Emp;
        if (empFind == null)
        {
            this.Response.Write("<br>没有找到: Name =郭宝庚 的实体.");
        }
        else
        {
            this.Response.Write("<br>已经找到了: Name =郭宝庚 的实体. 他的部门编号=" + empFind.FK_Dept + ",部门名称=" + empFind.FK_DeptText);
        }
        // 批量更新实体。
        myEmps.Update(); // 等同于下一个循环。
        foreach (Emp emp in myEmps)
        {
            emp.Update();
        }
        // 删除实体.
        myEmps.Delete(); // 等同于下一个循环。
        foreach (Emp emp in myEmps)
        {
            emp.Delete();
        }
        // 执行数据库删除,类于执行 DELETE Port_Emp WHERE FK_Dept='01' 的sql.
        myEmps.Delete("FK_Dept", "01");
        #endregion
    }