Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.DoType == "Print")
            {
                Bill b = new Bill(this.MyPK);
                b.DoOpen();
                return;
            }

            if (this.Request.QueryString["PageIdx"] == null)
            {
                this.PageIdx = 1;
            }
            else
            {
                this.PageIdx = int.Parse(this.Request.QueryString["PageIdx"]);
            }

            #region 处理查询设的默认.
            if (this.DoType == "My")
            {
                Entity      en      = this.HisEns.GetNewEntity;
                Map         map     = en.EnMap;
                AttrSearchs searchs = map.SearchAttrs;
            }
            else
            {
                #region 处理查询权限
                Entity en  = this.HisEns.GetNewEntity;
                Map    map = en.EnMap;
                this.ToolBar1.InitByMapV2(map, 1, this.EnsName);
                this.ToolBar1.AddBtn(BP.Web.Controls.NamesOfBtn.Export);
                AttrSearchs           searchs = map.SearchAttrs;
                string                defVal  = "";
                System.Data.DataTable dt      = null;
                foreach (AttrSearch attr in searchs)
                {
                    DDL mydll = this.ToolBar1.GetDDLByKey("DDL_" + attr.Key);
                    if (mydll == null)
                    {
                        continue;
                    }
                    defVal = mydll.SelectedItemStringVal;
                    mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + this.EnsName + "','" + attr.Key + "')";
                    switch (attr.Key)
                    {
                    case "FK_Emp":
                        dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_Emp FROM WF_Bill WHERE FK_Emp!='' AND FK_Flow='" + this.FK_Flow + "' ORDER BY FK_Emp");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>打印人", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    case "FK_NY":
                        dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_NY FROM WF_Bill WHERE FK_NY!='' AND FK_Flow='" + this.FK_Flow + "' ORDER BY FK_NY");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>月份", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            //  BP.WF.Bill
                            mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    case "FlowStarter":
                        dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM WF_Emp WHERE  FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM WF_Bill WHERE FlowStarter!='')");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>发起人", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'ND" + int.Parse(this.FK_Flow) + "Rpt','" + attr.Key + "')";
                        break;

                    case "FK_Dept":
                        if (WebUser.No != "admin")
                        {
                            dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')");
                            if (dt.Rows.Count == 0)
                            {
                                BP.WF.Port.DeptFlowSearch dfs = new BP.WF.Port.DeptFlowSearch();
                                dfs.FK_Dept = WebUser.FK_Dept;
                                dfs.FK_Emp  = WebUser.No;
                                dfs.FK_Flow = this.FK_Flow;
                                dfs.MyPK    = WebUser.FK_Dept + "_" + WebUser.No + "_" + this.FK_Flow;
                                dfs.Insert();
                                dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')");
                            }
                            mydll.Items.Clear();
                            foreach (DataRow dr in dt.Rows)
                            {
                                mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                            }
                        }

                        if (mydll.Items.Count >= 2)
                        {
                            ListItem liMvals = new ListItem("*多项组合..", "mvals");
                            liMvals.Attributes.CssStyle.Add("style", "color:green");
                            liMvals.Attributes.Add("color", "green");
                            liMvals.Attributes.Add("style", "color:green");
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    default:
                        break;
                    }
                }
                #endregion 处理查询权限
                this.ToolBar1.GetBtnByID("Btn_Search").Click += new System.EventHandler(this.ToolBar1_ButtonClick);
                this.ToolBar1.GetBtnByID(BP.Web.Controls.NamesOfBtn.Export).Click += new System.EventHandler(this.ToolBar1_ButtonClick);
            }
            #endregion 处理查询设的默认。

            this.SetDGData();
        }
        public void InitToolbarOfMapRpt(BP.WF.Flow fl, BP.WF.Rpt.MapRpt currMapRpt, string RptNo, Entity en, int pageidx)
        {
            Map map = en.EnMap;

            this.InitByMapV2(map, 1, RptNo);

            //特殊处理权限.
            AttrSearchs searchs = map.SearchAttrs;
            string      defVal  = "";

            System.Data.DataTable dt = null;
            foreach (AttrSearch attr in searchs)
            {
                DDL mydll = this.GetDDLByKey("DDL_" + attr.Key);
                if (mydll == null)
                {
                    continue;
                }
                defVal = mydll.SelectedItemStringVal;
                mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + RptNo + "','" + attr.Key + "')";

                switch (attr.HisAttr.Key)
                {
                case "FK_NY":
                    dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_NY FROM " + currMapRpt.PTable + " WHERE FK_NY!='' ORDER BY FK_NY");
                    mydll.Items.Clear();
                    mydll.Items.Add(new ListItem("=>月份", "all"));
                    foreach (DataRow dr in dt.Rows)
                    {
                        mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                    }
                    mydll.SetSelectItem(defVal);
                    break;

                case "FlowStarter":
                case "FlowEnder":
                    string sql = "";
                    switch (fl.HisFlowDeptDataRightCtrlType)
                    {
                    case FlowDeptDataRightCtrlType.MyDeptOnly:         // 我的部门.
                        sql = "SELECT No,Name FROM WF_Emp WHERE FK_Dept='" + WebUser.FK_Dept + "' AND No IN (SELECT DISTINCT FlowStarter FROM " + currMapRpt.PTable + " WHERE FlowStarter!='')";
                        break;

                    case FlowDeptDataRightCtrlType.MyDeptAndBeloneToMyDeptOnly:         //我的部门,或者隶属我部门下面的部门.
#warning 这里有错误,怎么递归循环出来?
                        sql = "SELECT No,Name FROM WF_Emp WHERE FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + currMapRpt.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM " + currMapRpt.PTable + " WHERE FlowStarter!='')";
                        break;

                    case FlowDeptDataRightCtrlType.BySpecFlowDept:         // 指定权限.
                        sql = "SELECT No,Name FROM WF_Emp WHERE FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + currMapRpt.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM " + currMapRpt.PTable + " WHERE FlowStarter!='')";
                        break;

                    case FlowDeptDataRightCtrlType.AnyoneAndAnydept:          // 任何部门.
                        sql = "SELECT No,Name FROM WF_Emp WHERE No IN (SELECT DISTINCT FlowStarter FROM " + currMapRpt.PTable + " WHERE FlowStarter!='')";
                        break;

                    default:
                        break;
                    }
                    dt = DBAccess.RunSQLReturnTable(sql);

                    mydll.Items.Clear();
                    if (attr.Key == NDXRptBaseAttr.FlowStarter)
                    {
                        mydll.Items.Add(new ListItem("=>发起人", "all"));
                    }
                    else
                    {
                        mydll.Items.Add(new ListItem("=>结束人", "all"));
                    }

                    foreach (DataRow dr in dt.Rows)
                    {
                        mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                    }
                    mydll.SetSelectItem(defVal);
                    mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + RptNo + "','" + attr.Key + "')";
                    break;

                case "FK_Dept":
                    if (WebUser.No != "admin")
                    {
                        dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + currMapRpt.FK_Flow + "')");
                        if (dt.Rows.Count == 0)
                        {
                            BP.WF.Port.DeptFlowSearch dfs = new BP.WF.Port.DeptFlowSearch();
                            dfs.FK_Dept = WebUser.FK_Dept;
                            dfs.FK_Emp  = WebUser.No;
                            dfs.FK_Flow = currMapRpt.FK_Flow;
                            dfs.MyPK    = WebUser.FK_Dept + "_" + WebUser.No + "_" + currMapRpt.FK_Flow;
                            dfs.Insert();
                            dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + currMapRpt.FK_Flow + "')");
                        }
                        mydll.Items.Clear();
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                        }
                    }

                    if (mydll.Items.Count >= 2)
                    {
                        ListItem liMvals = new ListItem("*多项组合..", "mvals");
                        liMvals.Attributes.CssStyle.Add("style", "color:green");
                        liMvals.Attributes.Add("color", "green");
                        liMvals.Attributes.Add("style", "color:green");
                    }
                    mydll.SetSelectItem(defVal);
                    break;

                default:
                    break;
                }
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 处理风格
            this.Page.RegisterClientScriptBlock("sds",
                                                "<link href='/WF/Comm/Style/Table" + BP.Web.WebUser.Style + ".css' rel='stylesheet' type='text/css' />");

            if (this.Request.QueryString["PageIdx"] == null)
            {
                this.PageIdx = 1;
            }
            else
            {
                this.PageIdx = int.Parse(this.Request.QueryString["PageIdx"]);
            }
            #endregion 处理风格

            //if (WebUser.IsWap)
            //{
            //    this.Pub1.Add("<a href='./../WAP/Home.aspx' ><img src='./../WAP/Img/Home.gif' />Home</a>");
            //    this.Pub1.Add("-<a href='./../WAP/FlowSearch.aspx' >查询</a>");
            //    this.Pub1.Add(" - <a href='Search.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName + "&DoType=My' ><img src='/WF/Img/Btn/Authorize.gif' />我参与的流程</a>");
            //    this.Pub1.Add(" - <a href='Search.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName + "&DoType=Dept' ><img src='/WF/Img/Btn/CC.gif' />我部门的流程</a><br>");
            //}
            //else
            //{
            //    this.Pub1.Add("<a href='Search.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName + "&DoType=My' ><img src='/WF/Img/Btn/Authorize.gif' />我参与的流程</a>");
            //    this.Pub1.Add(" - <a href='Search.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName + "&DoType=Dept' ><img src='/WF/Img/Btn/CC.gif' />我部门的流程</a><br>");
            //}


            #region 处理查询设的默认.
            if (this.DoType == "My")
            {
                Entity      en      = this.HisEns.GetNewEntity;
                Map         map     = en.EnMap;
                AttrSearchs searchs = map.SearchAttrs;
            }
            else
            {
                #region 处理查询权限
                Entity en  = this.HisEns.GetNewEntity;
                Map    map = en.EnMap;
                this.ToolBar1.InitByMapV2(map, 1, this.EnsName);

                this.ToolBar1.AddBtn(BP.Web.Controls.NamesOfBtn.Export);
                AttrSearchs           searchs = map.SearchAttrs;
                string                defVal  = "";
                System.Data.DataTable dt      = null;
                foreach (AttrSearch attr in searchs)
                {
                    DDL mydll = this.ToolBar1.GetDDLByKey("DDL_" + attr.Key);
                    if (mydll == null)
                    {
                        continue;
                    }
                    defVal = mydll.SelectedItemStringVal;
                    mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + this.EnsName + "','" + attr.Key + "')";
                    switch (attr.Key)
                    {
                    case "FK_NY":
                        dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_NY FROM " + this.EnsName + " WHERE FK_NY!='' ORDER BY FK_NY");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>月份", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    case "FlowStarter":
                        dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM WF_Emp WHERE  FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + this.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM " + this.EnsName + " WHERE FlowStarter!='')");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>发起人", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'ND" + int.Parse(this.FK_Flow) + "Rpt','" + attr.Key + "')";
                        break;

                    case "FK_Dept":
                        if (WebUser.No != "admin")
                        {
                            dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')");
                            if (dt.Rows.Count == 0)
                            {
                                BP.WF.Port.DeptFlowSearch dfs = new BP.WF.Port.DeptFlowSearch();
                                dfs.FK_Dept = WebUser.FK_Dept;
                                dfs.FK_Emp  = WebUser.No;
                                dfs.FK_Flow = this.FK_Flow;
                                dfs.MyPK    = WebUser.FK_Dept + "_" + WebUser.No + "_" + this.FK_Flow;
                                dfs.Insert();
                                dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')");
                            }
                            mydll.Items.Clear();
                            foreach (DataRow dr in dt.Rows)
                            {
                                mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                            }
                        }

                        if (mydll.Items.Count >= 2)
                        {
                            ListItem liMvals = new ListItem("*多项组合..", "mvals");
                            liMvals.Attributes.CssStyle.Add("style", "color:green");
                            liMvals.Attributes.Add("color", "green");
                            liMvals.Attributes.Add("style", "color:green");
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    default:
                        break;
                    }
                }
                #endregion 处理查询权限

                this.ToolBar1.GetBtnByID("Btn_Search").Click += new System.EventHandler(this.ToolBar1_ButtonClick);
                this.ToolBar1.GetBtnByID(BP.Web.Controls.NamesOfBtn.Export).Click += new System.EventHandler(this.ToolBar1_ButtonClick);
            }
            #endregion 处理查询设的默认。

            //处理按钮.
            this.SetDGData();
        }