Exemplo n.º 1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns></returns>
        public string CondByStation_Init()
        {
            DataSet ds = new DataSet();

            //岗位类型.
            BP.GPM.StationTypes tps = new BP.GPM.StationTypes();
            tps.RetrieveAll();
            ds.Tables.Add(tps.ToDataTableField("StationTypes"));

            //岗位.
            BP.GPM.Stations sts = new BP.GPM.Stations();
            sts.RetrieveAll();
            ds.Tables.Add(sts.ToDataTableField("Stations"));


            //取有可能存盘的数据.
            int    FK_MainNode = this.GetRequestValInt("FK_MainNode");
            int    ToNodeID    = this.GetRequestValInt("ToNodeID");
            Cond   cond        = new Cond();
            string mypk        = FK_MainNode + "_" + ToNodeID + "_Dir_" + ConnDataFrom.Stas.ToString();

            cond.MyPK = mypk;
            cond.RetrieveFromDBSources();
            ds.Tables.Add(cond.ToDataTableField("Cond"));

            return(BP.Tools.Json.DataSetToJson(ds, false));
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PushMsgs msgs = new PushMsgs(this.FK_Flow);
            var      msg  = msgs.GetEntityByKey(PushMsgAttr.FK_Event, this.Event, PushMsgAttr.FK_Node, int.Parse(this.NodeID)) as PushMsg;

            if (msg == null)
            {
                msg          = new PushMsg();
                msg.FK_Event = this.Event;
                msg.FK_Node  = int.Parse(this.NodeID);
            }

            if (!string.IsNullOrWhiteSpace(this.ThePushWay))
            {
                if (this.ThePushWay != msg.PushWay.ToString())
                {
                    msg.PushDoc = string.Empty;
                    msg.Tag     = string.Empty;
                }

                msg.PushWay = int.Parse(this.ThePushWay);
            }

            this.Pub1.AddTable("class='Table' cellspacing='1' cellpadding='1' border='1' style='width:100%'");

            this.Pub1.AddTR();
            this.Pub1.AddTD("style='width:100px'", "推送设置方式:");
            var ddl = new DDL();

            ddl.BindSysEnum(PushMsgAttr.PushWay);
            ddl.ID = "DDL_" + PushMsgAttr.PushWay;
            ddl.SetSelectItem((int)msg.PushWay);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            this.Pub1.AddTD(ddl);
            this.Pub1.AddTREnd();

            switch ((PushWay)msg.PushWay)
            {
            case PushWay.ByParas:

                #region  照系统指定参数

                Pub1.AddTR();
                Pub1.AddTD("输入参数名:");
                Pub1.AddTDBegin();

                var rad = new RadioBtn();
                rad.GroupName = "Para";
                rad.ID        = "RB_0";
                rad.Text      = "系统参数";
                rad.Checked   = msg.PushDoc == "0";

                Pub1.Add(rad);

                var tb = new TB();
                tb.ID = "TB_" + PushMsgAttr.Tag;

                if (msg.PushDoc == "0")
                {
                    tb.Text = msg.Tag;
                }
                else
                {
                    tb.Text = "NoticeTo";
                }

                Pub1.Add(tb);

                Pub1.Add("&nbsp;默认为NoticeTo");
                Pub1.AddBR();

                rad           = new RadioBtn();
                rad.GroupName = "Para";
                rad.ID        = "RB_1";
                rad.Text      = "表单字段参数";
                rad.Checked   = msg.PushDoc == "1";

                Pub1.Add(rad);

                MapAttrs attrs = new MapAttrs();
                attrs.Retrieve(MapAttrAttr.FK_MapData, "ND" + this.NodeID);

                MapAttrs attrNs = new MapAttrs();

                foreach (MapAttr attr in attrs)
                {
                    if (attr.IsBigDoc)
                    {
                        continue;
                    }

                    switch (attr.KeyOfEn)
                    {
                    case "Title":
                    case "FK_Emp":
                    case "MyNum":
                    case "FK_NY":
                    case WorkAttr.Emps:
                    case WorkAttr.OID:
                    case StartWorkAttr.Rec:
                    case StartWorkAttr.FID:
                        continue;

                    default:
                        break;
                    }

                    attrNs.AddEntity(attr);
                }

                ddl    = new DDL();
                ddl.ID = "DDL_" + PushMsgAttr.Tag;
                ddl.BindEntities(attrNs, MapAttrAttr.MyPK, MapAttrAttr.Name);
                ddl.AutoPostBack = false;

                if (msg.PushDoc == "1")
                {
                    ddl.SetSelectItem(msg.Tag);
                }

                Pub1.Add(ddl);
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.NodeWorker:

                #region  照指定结点的工作人员

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                Pub1.Add("请选择要推送到的节点工作人员:<br />");
                Nodes    nds = new Nodes(this.FK_Flow);
                CheckBox cb  = null;

                foreach (BP.WF.Node nd in nds)
                {
                    if (nd.NodeID == int.Parse(this.NodeID))
                    {
                        continue;
                    }

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + nd.NodeID;
                    cb.Text    = nd.NodeID + " &nbsp;" + nd.Name;
                    cb.Checked = msg.PushDoc.Contains("@" + nd.NodeID + "@");
                    Pub1.Add(cb);
                    Pub1.AddBR();
                }

                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecDepts:

                #region  照指定的部门

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                this.Pub1.AddTR();
                this.Pub1.AddTD("colspan='3' class='GroupTitle'", "部门选择");
                this.Pub1.AddTREnd();

                //NodeDepts ndepts = new NodeDepts(int.Parse(this.NodeID));
                Depts depts = new Depts();
                depts.RetrieveAll();
                int i = 0;

                //foreach (NodeDept dept in ndepts)
                foreach (Dept dept in depts)
                {
                    i++;

                    if (i == 4)
                    {
                        i = 1;
                    }

                    if (i == 1)
                    {
                        Pub1.AddTR();
                    }

                    cb = new CheckBox();
                    //cb.ID = "CB_" + dept.FK_Dept;
                    //cb.Text = (depts.GetEntityByKey(dept.FK_Dept) as Dept).Name;
                    cb.ID   = "CB_" + dept.No;
                    cb.Text = dept.Name;

                    //if (msg.PushDoc.Contains("@" + dept.FK_Dept + "@"))
                    if (msg.PushDoc.Contains("@" + dept.No + "@"))
                    {
                        cb.Checked = true;
                    }

                    this.Pub1.AddTD(cb);

                    if (i == 3)
                    {
                        Pub1.AddTREnd();
                    }
                }

                switch (i)
                {
                case 1:
                    Pub1.AddTD();
                    Pub1.AddTD();
                    Pub1.AddTREnd();
                    break;

                case 2:
                    Pub1.AddTD();
                    Pub1.AddTREnd();
                    break;

                default:
                    break;
                }

                this.Pub1.AddTableEnd();
                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecEmps:

                #region  照指定的人员

                Pub1.AddTR();
                //Pub1.AddTDBegin("colspan='2'");

                Pub1.AddTD("选择人员:");
                Pub1.AddTDBegin();

                tb          = new TB();
                tb.ID       = "TB_Users";
                tb.TextMode = TextBoxMode.MultiLine;
                tb.Style.Add("width", "99%");
                tb.Rows     = 4;
                tb.ReadOnly = true;

                var hf = new HiddenField();
                hf.ID = "HID_Users";

                //加载已经选择的人员
                if (!string.IsNullOrWhiteSpace(msg.PushDoc))
                {
                    hf.Value = msg.PushDoc.Replace("@@", ",").Trim('@');

                    var emps = new Emps();
                    emps.RetrieveAll();

                    tb.Text =
                        hf.Value.Split(',').Select(o => (emps.GetEntityByKey(o) as Emp).Name).Aggregate(
                            string.Empty, (curr, next) => curr + next + ",").TrimEnd(',');
                }

                Pub1.Add(tb);
                Pub1.Add(hf);
                Pub1.AddBR();
                Pub1.AddBR();

                Pub1.Add(
                    "<a class='easyui-linkbutton' data-options=\"iconCls:'icon-user'\" href='javascript:void(0)' onclick=\"showWin('../Comm/Port/SelectUser_Jq.aspx','" +
                    tb.ClientID + "','" + hf.ClientID + "');\">选择人员...</a>");
                Pub1.AddTDEnd();
                //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                //depts = new Depts();
                //depts.RetrieveAll();
                //var emps = new Emps();
                //emps.RetrieveAll();
                //var empDepts = new EmpDepts();
                //empDepts.RetrieveAll();
                //var nemps = new NodeEmps(int.Parse(this.NodeID));

                //Emp emp = null;

                //foreach (Dept dept in depts)
                //{
                //    this.Pub1.AddTR();
                //    var mycb = new CheckBox();
                //    mycb.Text = dept.Name;
                //    mycb.ID = "CB_D_" + dept.No;
                //    this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                //    this.Pub1.AddTREnd();

                //    i = 0;
                //    string ctlIDs = "";

                //    foreach (EmpDept ed in empDepts)
                //    {
                //        if (ed.FK_Dept != dept.No)
                //            continue;

                //        //排除非当前结点绑定的人员
                //        if (nemps.GetEntityByKey(NodeEmpAttr.FK_Emp, ed.FK_Emp) == null)
                //            continue;

                //        i++;

                //        if (i == 4)
                //            i = 1;

                //        if (i == 1)
                //            Pub1.AddTR();

                //        emp = emps.GetEntityByKey(ed.FK_Emp) as Emp;

                //        cb = new CheckBox();
                //        cb.ID = "CB_E_" + emp.No;
                //        ctlIDs += cb.ID + ",";
                //        cb.Text = emp.Name;
                //        if (msg.PushDoc.Contains("@" + emp.No + "@"))
                //            cb.Checked = true;

                //        Pub1.AddTD(cb);

                //        if (i == 3)
                //            Pub1.AddTREnd();
                //    }

                //    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                //    switch (i)
                //    {
                //        case 1:
                //            Pub1.AddTD();
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        case 2:
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        default:
                //            break;
                //    }
                //}

                //Pub1.AddTableEnd();

                //Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecSQL:

                #region  照指定的SQL查询语句

                Pub1.AddTR();

                this.Pub1.AddTDBegin("colspan='2'");
                this.Pub1.Add("SQL查询语句:<br />");
                tb         = new TB();
                tb.ID      = "TB_" + PushMsgAttr.PushDoc;
                tb.Columns = 50;
                tb.Style.Add("width", "99%");
                tb.TextMode = TextBoxMode.MultiLine;
                tb.Rows     = 4;
                tb.Text     = msg.PushDoc;
                this.Pub1.Add(tb);
                this.Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;

            case PushWay.SpecStations:

                #region  照指定的岗位

                Pub1.AddTR();
                Pub1.AddTDBegin("colspan='2'");

                if (BP.WF.Glo.OSModel == OSModel.WorkFlow)
                {
                    SysEnums ses = new SysEnums("StaGrade");
                    Stations sts = new Stations();
                    sts.RetrieveAll();

                    string    sql = "SELECT No,Name FROM Port_Station WHERE StaGrade  NOT IN (SELECT IntKey FROM Sys_Enum WHERE EnumKey='StaGrade')";
                    DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                    if (dt.Rows.Count != 0)
                    {
                        if (ses.Count == 0)
                        {
                            SysEnum se = new SysEnum();
                            se.EnumKey = "StaGrade";
                            se.Lab     = "普通岗";
                            se.IntKey  = 0;
                            se.Insert();

                            ses.AddEntity(se);
                        }

                        foreach (Station st in sts)
                        {
                            st.StaGrade = 0;
                            st.Save();
                        }
                    }

                    this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0'  border='0' style='width:100%'");

                    foreach (SysEnum se in ses)
                    {
                        this.Pub1.AddTR();
                        CheckBox mycb = new CheckBox();
                        mycb.Text = se.Lab;
                        mycb.ID   = "CB_SG_" + se.IntKey;
                        this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                        this.Pub1.AddTREnd();

                        i = 0;
                        string ctlIDs = "";

                        foreach (Station st in sts)
                        {
                            if (st.StaGrade != se.IntKey)
                            {
                                continue;
                            }

                            i++;

                            if (i == 4)
                            {
                                i = 1;
                            }

                            if (i == 1)
                            {
                                Pub1.AddTR();
                            }

                            cb      = new CheckBox();
                            cb.ID   = "CB_S_" + st.No;
                            ctlIDs += cb.ID + ",";
                            cb.Text = st.Name;

                            if (msg.PushDoc.Contains("@" + st.No + "@"))
                            {
                                cb.Checked = true;
                            }

                            Pub1.AddTD(cb);

                            if (i == 3)
                            {
                                Pub1.AddTREnd();
                            }
                        }

                        mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                        switch (i)
                        {
                        case 1:
                            Pub1.AddTD();
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        case 2:
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        default:
                            break;
                        }
                    }

                    this.Pub1.AddTableEnd();
                }
                else
                {
                    /*BPM 模式*/
                    BP.GPM.StationTypes tps = new BP.GPM.StationTypes();
                    tps.RetrieveAll();

                    BP.GPM.Stations sts = new BP.GPM.Stations();
                    sts.RetrieveAll();

                    string    sql = "SELECT No,Name FROM Port_Station WHERE FK_StationType NOT IN (SELECT No FROM Port_StationType)";
                    DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                    if (dt.Rows.Count != 0)
                    {
                        if (tps.Count == 0)
                        {
                            var stp = new BP.GPM.StationType {
                                No = "01", Name = "普通岗"
                            };
                            stp.Save();

                            tps.AddEntity(stp);
                        }

                        //更新所有对不上岗位类型的岗位,岗位类型为01或第一个
                        foreach (BP.GPM.Station st in sts)
                        {
                            st.FK_StationType = tps[0].No;
                            st.Update();
                        }
                    }

                    this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0'  border='0' style='width:100%'");

                    foreach (BP.GPM.StationType tp in tps)
                    {
                        this.Pub1.AddTR();
                        CheckBox mycb = new CheckBox();
                        mycb.Text = tp.Name;
                        mycb.ID   = "CB_ST_" + tp.No;
                        this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb);
                        this.Pub1.AddTREnd();

                        i = 0;
                        string ctlIDs = "";

                        foreach (BP.GPM.Station st in sts)
                        {
                            if (st.FK_StationType != tp.No)
                            {
                                continue;
                            }

                            i++;

                            if (i == 4)
                            {
                                i = 1;
                            }

                            if (i == 1)
                            {
                                Pub1.AddTR();
                            }

                            cb      = new CheckBox();
                            cb.ID   = "CB_S_" + st.No;
                            ctlIDs += cb.ID + ",";
                            cb.Text = st.Name;

                            if (msg.PushDoc.Contains("@" + st.No + "@"))
                            {
                                cb.Checked = true;
                            }

                            this.Pub1.AddTD(cb);

                            if (i == 3)
                            {
                                Pub1.AddTREnd();
                            }
                        }

                        mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                        switch (i)
                        {
                        case 1:
                            Pub1.AddTD();
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        case 2:
                            Pub1.AddTD();
                            Pub1.AddTREnd();
                            break;

                        default:
                            break;
                        }
                    }

                    this.Pub1.AddTableEnd();
                }

                #region 原逻辑,只考虑了一种模式,停用
                //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                //SysEnums ses = new SysEnums("StaGrade");
                //Stations sts = new Stations();
                //NodeStations nsts = new NodeStations(int.Parse(this.NodeID));
                //sts.RetrieveAll();

                //foreach (SysEnum se in ses)
                //{
                //    this.Pub1.AddTR();
                //    var mycb = new CheckBox();
                //    mycb.Text = se.Lab;
                //    mycb.ID = "CB_SG_" + se.IntKey;
                //    this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb);
                //    this.Pub1.AddTREnd();

                //    i = 0;
                //    string ctlIDs = "";

                //    foreach (Station st in sts)
                //    {
                //        if (st.StaGrade != se.IntKey)
                //            continue;

                //        //排除非当前结点的岗位
                //        if (nsts.GetEntityByKey(NodeStationAttr.FK_Station, st.No) == null)
                //            continue;

                //        i++;

                //        if (i == 4)
                //            i = 1;

                //        if (i == 1)
                //            Pub1.AddTR();

                //        cb = new CheckBox();
                //        cb.ID = "CB_S_" + st.No;
                //        ctlIDs += cb.ID + ",";
                //        cb.Text = st.Name;
                //        if (msg.PushDoc.Contains("@" + st.No + "@"))
                //            cb.Checked = true;

                //        Pub1.AddTD(cb);

                //        if (i == 3)
                //            Pub1.AddTREnd();
                //    }

                //    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                //    switch (i)
                //    {
                //        case 1:
                //            Pub1.AddTD();
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        case 2:
                //            Pub1.AddTD();
                //            Pub1.AddTREnd();
                //            break;
                //        default:
                //            break;
                //    }
                //}
                //Pub1.AddTableEnd();
                #endregion

                Pub1.AddTDEnd();
                Pub1.AddTREnd();
                #endregion

                break;
            }

            Pub1.AddTableEnd();

            Pub1.AddBR();
            Pub1.AddSpace(1);

            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");
            btn.Click += new EventHandler(btn_Click);
            Pub1.Add(btn);

            if (!string.IsNullOrWhiteSpace(msg.MyPK))
            {
                Pub1.AddSpace(1);
                btn        = new LinkBtn(false, NamesOfBtn.Delete, "删除");
                btn.Click += new EventHandler(btn_Delete_Click);
                btn.Attributes["onclick"] = "return confirm('你确定要删除此消息推送设置吗?');";
                Pub1.Add(btn);
            }
        }
Exemplo n.º 3
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            if (!file.HasFile)
            {
                AlertAndBack("请选择组织结构Excel文件(*.xls)!");
                return;
            }

            //检查是否是.xls格式,2007格式,下面的方法有问题,暂时限定为xls格式
            if (Path.GetExtension(file.PostedFile.FileName).ToLower() != ".xls")
            {
                AlertAndBack("组织结构Excel文件必须是*.xls(Microsoft Excel 97-2003格式)!");
                return;
            }

            var updir = Path.Combine(BP.Sys.SystemConfig.PathOfDataUser, "UploadFile");

            if (Directory.Exists(updir) == false)
            {
                Directory.CreateDirectory(updir);
            }

            var xls = Path.Combine(updir, "Org_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");

            file.PostedFile.SaveAs(xls);

            var excel = new NPOIExcel(xls);

            //检查是否包含3个表
            var sheets = excel.GetSheetNames();// BP.DA.DBLoad.GenerTableNames(xls);

            if (sheets.Contains("岗位") == false || sheets.Contains("部门") == false || sheets.Contains("人员") == false)
            {
                DeleteFile(xls);
                AlertAndBack("组织结构Excel文件必须由“ccflow组织结构批量导入模板”文件编辑而成,请下载模板文件重新编辑,再进行导入!");
                return;
            }

            var colStations = new[] { "岗位名称", "岗位类型" };
            var colDepts    = new[] { "部门名称", "上级部门名称", "部门负责人" };
            var colEmps     = new[] { "人员帐号", "人员姓名", "人员编号", "部门", "岗位", "职务", "电话", "邮箱", "直属领导" };

            var dtStation = excel.ExcelToDataTable("岗位", true); // BP.DA.DBLoad.GetTableByExt(xls, "SELECT * FROM [岗位$]"); //岗位名称*,岗位类型*
            var dtDept    = excel.ExcelToDataTable("部门", true); // BP.DA.DBLoad.GetTableByExt(xls, "SELECT * FROM [部门$]");    //部门名称*,上级部门名称*,部门负责人
            var dtEmp     = excel.ExcelToDataTable("人员", true); // BP.DA.DBLoad.GetTableByExt(xls, "SELECT * FROM [人员$]");     //人员帐号*,人员姓名*,人员编号,部门*,岗位*,职务,电话,邮箱,直属领导

            //初步检查列数
            if (dtStation.Columns.Count < 2 || dtDept.Columns.Count < 3 || dtEmp.Columns.Count < 9)
            {
                AlertAndBack("组织结构Excel文件结构错误,请重新下载模板文件编辑后,再进行导入!");
                return;
            }

            //检查岗位列
            if (CheckColumns(dtStation, colStations, "岗位") == false)
            {
                return;
            }

            //检查部门列
            if (CheckColumns(dtDept, colDepts, "部门") == false)
            {
                return;
            }

            //检查人员列
            if (CheckColumns(dtEmp, colEmps, "人员") == false)
            {
                return;
            }

            excel.Dispose();
            //return;
            //获取数据库中已有数据,便于下面的数据对比
            var isBPM        = BP.WF.Glo.OSModel == BP.WF.OSModel.BPM;
            var stations     = new BP.GPM.Stations();
            var stationTypes = new BP.GPM.StationTypes();
            var depts        = new BP.GPM.Depts();
            var emps         = new BP.GPM.Emps();
            var deptEmpSts   = new BP.GPM.DeptEmpStations();

            stations.RetrieveAll();
            stationTypes.RetrieveAll();
            depts.RetrieveAll();
            emps.RetrieveAll();
            deptEmpSts.RetrieveAll();

            //集成模式,涉及数据
            var empDepts = new EmpDepts();
            var empSts   = new EmpStations();

            empDepts.RetrieveAll();
            empSts.RetrieveAll();

            //BPM独立模式,涉及数据
            var duties     = new BP.GPM.Dutys();
            var deptDuties = new BP.GPM.DeptDutys();
            var deptSts    = new BP.GPM.DeptStations();
            var deptEmps   = new BP.GPM.DeptEmps();

            duties.RetrieveAll();
            deptDuties.RetrieveAll();
            deptSts.RetrieveAll();
            deptEmps.RetrieveAll();

            //定义错误记录存储表
            var     dtStationError = dtStation.Clone();
            var     dtDeptError    = dtDept.Clone();
            var     dtEmpError     = dtEmp.Clone();
            DataRow drError        = null;
            bool    haveDuty       = false;

            BP.GPM.Station        st       = null;
            BP.GPM.StationType    stType   = null;
            BP.GPM.Dept           dept     = null;
            BP.GPM.Emp            emp      = null;
            BP.GPM.DeptEmpStation des      = null;
            BP.Port.EmpDept       empDept  = null;
            BP.Port.EmpStation    empSt    = null;
            BP.GPM.Duty           duty     = null;
            BP.GPM.DeptDuty       deptDuty = null;
            BP.GPM.DeptStation    deptSt   = null;
            BP.GPM.DeptEmp        deptEmp  = null;

            //检查数据,并将符合规范的数据写入数据库

            #region //岗位信息
            foreach (DataRow dr in dtStation.Rows)
            {
                drError = dtStationError.NewRow();
                dtStationError.Rows.Add(drError);

                //检查岗位,名称、类型必须填写,且名称不能重复
                if (IsCellNull(dr, "岗位名称"))
                {
                    drError["岗位名称"] = "岗位名称必须填写!";
                    continue;
                }

                if (IsCellNull(dr, "岗位类型"))
                {
                    drError["岗位类型"] = "岗位类型必须填写!";
                    continue;
                }

                //判断数据库中是否已经存在
                if (stations.GetEntityByKey(BP.GPM.StationAttr.Name, dr["岗位名称"].ToString()) != null)
                {
                    continue;
                }

                stType = stationTypes.GetEntityByKey(BP.GPM.StationTypeAttr.Name, dr["岗位类型"].ToString()) as BP.GPM.StationType;

                if (stType == null)
                {
                    stType = new BP.GPM.StationType {
                        Name = dr["岗位类型"].ToString()
                    };
                    stType.No = stType.GenerNewNo;
                    stType.Insert();
                    stationTypes.AddEntity(stType);
                }

                st = new BP.GPM.Station
                {
                    Name           = dr["岗位名称"].ToString(),
                    FK_StationType = stType.No
                };
                //st.No = st.GenerNewNo;
                st.Insert();
                stations.AddEntity(st);
            }
            #endregion

            #region  //部门信息
            BP.GPM.Dept parentDept = null;

            foreach (DataRow dr in dtDept.Rows)
            {
                drError = dtDeptError.NewRow();
                dtDeptError.Rows.Add(drError);

                //检查部门,名称必须填写,且名称不能重复
                if (IsCellNull(dr, "部门名称"))
                {
                    drError["部门名称"] = "部门名称必须填写!";
                    continue;
                }

                if (!IsCellNull(dr, "上级部门名称"))
                {
                    parentDept = depts.GetEntityByKey(EntityTreeAttr.Name, dr["上级部门名称"].ToString()) as BP.GPM.Dept;

                    if (parentDept == null)
                    {
                        drError["上级部门名称"] = "上级部门名称 填写错误,未找到上级部门“" + dr["上级部门名称"] + "”!";
                        continue;
                    }
                }
                else
                {
                    parentDept = null;
                }

                //判断数据库中是否已经存在
                if (depts.GetEntityByKey(EntityTreeAttr.Name, dr["部门名称"].ToString(), EntityTreeAttr.ParentNo, parentDept == null ? "0" : parentDept.No) != null)
                {
                    continue;
                }

                if (parentDept == null)
                {
                    //增加根部门
                    dept = depts.GetEntityByKey(EntityTreeAttr.ParentNo, "0") as BP.GPM.Dept;
                    if (dept == null)
                    {
                        //不存在根部门
                        dept = new BP.GPM.Dept
                        {
                            No       = "100",
                            Name     = dr["部门名称"].ToString(),
                            ParentNo = "0",
                            Leader   = dr["部门负责人"].ToString(),
                            IsDir    = false
                        };

                        dept.Insert();
                    }
                    else
                    {
                        //已经存在根部门,建立一个同级别的根部门
                        dept.Name   = dr["部门名称"].ToString();
                        dept.Leader = dr["部门负责人"].ToString();

                        //var currDept = dept.DoCreateSameLevelNode();

                        //dept = new BP.GPM.Dept(currDept.No)
                        //           {
                        //               Name = dr["部门名称"].ToString(),
                        //               Leader = dr["部门负责人"].ToString()
                        //           };

                        dept.Update();
                    }

                    depts.AddEntity(dept);
                }
                else
                {
                    //增加非根部门
                    var currDept = parentDept.DoCreateSubNode();

                    dept = new BP.GPM.Dept(currDept.No)
                    {
                        Name   = dr["部门名称"].ToString(),
                        Leader = dr["部门负责人"].ToString()
                    };

                    dept.Update();
                    depts.AddEntity(dept);
                }
            }
            #endregion

            #region //人员信息
            foreach (DataRow dr in dtEmp.Rows)
            {
                drError = dtEmpError.NewRow();
                dtEmpError.Rows.Add(drError);

                #region //检查人员,帐号、姓名、部门、岗位必须填写
                if (IsCellNull(dr, "人员帐号"))
                {
                    drError["人员帐号"] = "人员帐号必须填写!";
                    continue;
                }

                if (IsCellNull(dr, "人员姓名"))
                {
                    drError["人员姓名"] = "人员姓名必须填写!";
                    continue;
                }

                if (IsCellNull(dr, "部门"))
                {
                    drError["部门"] = "部门必须填写!";
                    continue;
                }

                if (IsCellNull(dr, "岗位"))
                {
                    drError["岗位"] = "岗位必须填写!";
                    continue;
                }
                #endregion

                //判断人员在数据库中是否已经存在
                emp = emps.GetEntityByKey(EntityNoAttr.No, dr["人员帐号"].ToString(), EntityNoNameAttr.Name,
                                          dr["人员姓名"].ToString()) as BP.GPM.Emp;
                dept = depts.GetEntityByKey(BP.GPM.DeptAttr.Name, dr["部门"].ToString()) as BP.GPM.Dept;
                st   = stations.GetEntityByKey(BP.GPM.StationAttr.Name, dr["岗位"].ToString()) as BP.GPM.Station;

                if (dept == null)
                {
                    drError["部门"] = string.Format("部门填写错误,“{0}” 在部门中未查到!", dr["部门"]);
                    continue;
                }

                if (st == null)
                {
                    drError["岗位"] = string.Format("岗位填写错误,“{0}” 在岗位中未查到!", dr["岗位"]);
                    continue;
                }

                if (isBPM)
                {
                    //BPM模式,Duty,DeptDuty
                    if (!IsCellNull(dr, "职务"))
                    {
                        duty = duties.GetEntityByKey(BP.GPM.DutyAttr.Name, dr["职务"].ToString()) as BP.GPM.Duty;
                    }
                    else
                    {
                        if (duties.Count == 0)
                        {
                            duty = new BP.GPM.Duty {
                                Name = "默认职务"
                            };
                            duty.Insert();
                            duties.AddEntity(duty);
                        }
                        else
                        {
                            duty = duties[0] as BP.GPM.Duty;
                        }
                    }

                    if (duty == null)
                    {
                        duty = new BP.GPM.Duty {
                            Name = dr["职务"].ToString()
                        };
                        //duty.No = duty.GenerNewNo;
                        duty.Insert();
                        duties.AddEntity(duty);
                    }

                    deptDuty =
                        deptDuties.GetEntityByKey(BP.GPM.DeptDutyAttr.FK_Dept, dept.No, BP.GPM.DeptDutyAttr.FK_Duty,
                                                  duty.No) as BP.GPM.DeptDuty;

                    if (deptDuty == null)
                    {
                        deptDuty = new BP.GPM.DeptDuty {
                            FK_Dept = dept.No, FK_Duty = duty.No
                        };
                        deptDuty.Insert();
                        deptDuties.AddEntity(deptDuty);
                    }
                }

                if (emp != null)
                {
                    //如果人员存在,则判断此人员的部门与岗位,如果部门、岗位不存在,则增加部门岗位关联等
                    //此处不对已存在人员的其他信息进行比对修改,如人员编号,邮箱,电话等
                    des = deptEmpSts.GetEntityByKey(BP.GPM.DeptEmpStationAttr.FK_Emp, emp.No,
                                                    BP.GPM.DeptEmpStationAttr.FK_Dept, dept.No,
                                                    BP.GPM.DeptEmpStationAttr.FK_Station, st.No) as BP.GPM.DeptEmpStation;

                    if (des != null)
                    {
                        drError["人员帐号"]   = drError["人员姓名"] =
                            drError["部门"] = drError["岗位"] = "此人员已经增加过,“人员+部门+岗位”不能重复!";
                        continue;
                    }
                }
                else
                {
                    //此人员不存在
                    emp = new BP.GPM.Emp
                    {
                        No      = dr["人员帐号"].ToString(),
                        Name    = dr["人员姓名"].ToString(),
                        Pass    = "******",
                        FK_Dept = dept.No
                    };

                    if (isBPM)
                    {
                        emp.EmpNo   = dr["人员编号"] as string;
                        emp.FK_Duty = duty.No;
                        emp.Email   = dr["邮箱"] as string;
                        emp.Tel     = dr["电话"] as string;
                        emp.Leader  = dr["直属领导"] as string;
                        emp.SetValByKey(BP.GPM.EmpAttr.NumOfDept, 1);
                    }

                    emp.Insert();
                    emps.AddEntity(emp);
                }

                des = new BP.GPM.DeptEmpStation
                {
                    FK_Emp     = emp.No,
                    FK_Dept    = dept.No,
                    FK_Station = st.No
                };

                des.Insert();
                deptEmpSts.AddEntity(des);

                if (isBPM)
                {
                    //BPM模式,DeptStation,DeptEmp
                    deptSt = deptSts.GetEntityByKey(BP.GPM.DeptStationAttr.FK_Dept, dept.No,
                                                    BP.GPM.DeptStationAttr.FK_Station, st.No) as BP.GPM.DeptStation;

                    if (deptSt == null)
                    {
                        deptSt = new BP.GPM.DeptStation {
                            FK_Dept = dept.No, FK_Station = st.No
                        };
                        deptSt.Insert();
                        deptSts.AddEntity(deptSt);
                    }

                    deptEmp =
                        deptEmps.GetEntityByKey(BP.GPM.DeptEmpAttr.FK_Dept, dept.No, BP.GPM.DeptEmpAttr.FK_Emp,
                                                emp.No) as BP.GPM.DeptEmp;

                    if (deptEmp == null)
                    {
                        deptEmp = new BP.GPM.DeptEmp
                        {
                            FK_Dept = dept.No,
                            FK_Emp  = emp.No,
                            FK_Duty = duty.No
                        };
                        deptEmp.Insert();
                        deptEmps.AddEntity(deptEmp);
                    }
                }
                else
                {
                    //集成模式,EmpDept,EmpStation
                    empDept =
                        empDepts.GetEntityByKey(EmpDeptAttr.FK_Dept, dept.No, EmpDeptAttr.FK_Emp, emp.No) as EmpDept;

                    if (empDept == null)
                    {
                        empDept = new EmpDept {
                            FK_Emp = emp.No, FK_Dept = dept.No
                        };
                        empDept.Insert();
                        empDepts.AddEntity(empDept);
                    }

                    empSt =
                        empSts.GetEntityByKey(EmpStationAttr.FK_Emp, emp.No, EmpStationAttr.FK_Station, st.No) as
                        EmpStation;

                    if (empSt == null)
                    {
                        empSt = new EmpStation {
                            FK_Emp = emp.No, FK_Station = st.No
                        };
                        empSt.Insert();
                        empSts.AddEntity(empSt);
                    }
                }
            }
            #endregion

            #region //前台输出岗位信息

            pub1.AddTableNormal();
            pub1.AddTR();
            pub1.AddTDGroupTitle("style='text-align:center;width:60px;'", "序");
            pub1.AddTDGroupTitle("style='width:140px;'", "名称");
            pub1.AddTDGroupTitle("类型");
            pub1.AddTREnd();

            for (var i = 0; i < dtStation.Rows.Count; i++)
            {
                drError = dtStationError.Rows[i];

                pub1.AddTR();
                pub1.AddTDIdx(i + 1);

                if (IsCellNull(drError, "岗位名称"))
                {
                    pub1.AddTD(dtStation.Rows[i]["岗位名称"].ToString());
                }
                else
                {
                    pub1.AddTD("style='background-color:yellow;color:red;' title='" + drError["岗位名称"] + "'",
                               dtStation.Rows[i]["岗位名称"].ToString());
                }

                if (IsCellNull(drError, "岗位类型"))
                {
                    pub1.AddTD(dtStation.Rows[i]["岗位类型"].ToString());
                }
                else
                {
                    pub1.AddTD("style='background-color:yellow;color:red;' title='" + drError["岗位类型"] + "'",
                               dtStation.Rows[i]["岗位类型"].ToString());
                }

                pub1.AddTREnd();
            }

            pub1.AddTableEnd();
            #endregion

            #region //前台输出部门信息

            pub2.AddTableNormal();
            pub2.AddTR();
            pub2.AddTDGroupTitle("style='text-align:center;width:60px;'", "序");
            pub2.AddTDGroupTitle("style='width:140px;'", "名称");
            pub2.AddTDGroupTitle("style='width:140px;'", "上级名称");
            pub2.AddTDGroupTitle("部门负责人");
            pub2.AddTREnd();

            for (var i = 0; i < dtDept.Rows.Count; i++)
            {
                drError = dtDeptError.Rows[i];

                pub2.AddTR();
                pub2.AddTDIdx(i + 1);

                if (IsCellNull(drError, "部门名称"))
                {
                    pub2.AddTD(dtDept.Rows[i]["部门名称"].ToString());
                }
                else
                {
                    pub2.AddTD("style='background-color:yellow;color:red;' title='" + drError["部门名称"] + "'",
                               dtDept.Rows[i]["部门名称"].ToString());
                }

                if (IsCellNull(drError, "上级部门名称"))
                {
                    pub2.AddTD(dtDept.Rows[i]["上级部门名称"].ToString());
                }
                else
                {
                    pub2.AddTD("style='background-color:yellow;color:red;' title='" + drError["上级部门名称"] + "'",
                               dtDept.Rows[i]["上级部门名称"].ToString());
                }

                pub2.AddTD(dtDept.Rows[i]["部门负责人"].ToString());
                pub2.AddTREnd();
            }

            pub2.AddTableEnd();
            #endregion

            #region //前台输出人员信息

            pub3.AddTableNormal();
            pub3.AddTR();
            pub3.AddTDGroupTitle("style='text-align:center;width:60px;'", "序");
            pub3.AddTDGroupTitle("style='width:120px;'", "帐号");
            pub3.AddTDGroupTitle("style='width:100px;'", "姓名");

            if (isBPM)
            {
                pub3.AddTDGroupTitle("style='width:100px;'", "编号");
            }

            pub3.AddTDGroupTitle("style='width:180px;'", "部门");

            if (!isBPM)
            {
                pub3.AddTDGroupTitle("岗位");
            }
            else
            {
                pub3.AddTDGroupTitle("style='width:100px;'", "岗位");
                pub3.AddTDGroupTitle("style='width:100px;'", "职务");
                pub3.AddTDGroupTitle("style='width:120px;'", "电话");
                pub3.AddTDGroupTitle("style='width:160px;'", "邮箱");
                pub3.AddTDGroupTitle("直属领导");
            }

            pub3.AddTREnd();

            for (var i = 0; i < dtEmp.Rows.Count; i++)
            {
                drError = dtEmpError.Rows[i];

                pub3.AddTR();
                pub3.AddTDIdx(i + 1);

                if (IsCellNull(drError, "人员帐号"))
                {
                    pub3.AddTD(dtEmp.Rows[i]["人员帐号"].ToString());
                }
                else
                {
                    pub3.AddTD("style='background-color:yellow;color:red;' title='" + drError["人员帐号"] + "'",
                               dtEmp.Rows[i]["人员帐号"].ToString());
                }

                if (IsCellNull(drError, "人员姓名"))
                {
                    pub3.AddTD(dtEmp.Rows[i]["人员姓名"].ToString());
                }
                else
                {
                    pub3.AddTD("style='background-color:yellow;color:red;' title='" + drError["人员姓名"] + "'",
                               dtEmp.Rows[i]["人员姓名"].ToString());
                }

                if (isBPM)
                {
                    pub3.AddTD(dtEmp.Rows[i]["人员编号"].ToString());
                }

                if (IsCellNull(drError, "部门"))
                {
                    pub3.AddTD(dtEmp.Rows[i]["部门"].ToString());
                }
                else
                {
                    pub3.AddTD("style='background-color:yellow;color:red;' title='" + drError["部门"] + "'",
                               dtEmp.Rows[i]["部门"].ToString());
                }

                if (IsCellNull(drError, "岗位"))
                {
                    pub3.AddTD(dtEmp.Rows[i]["岗位"].ToString());
                }
                else
                {
                    pub3.AddTD("style='background-color:yellow;color:red;' title='" + drError["岗位"] + "'",
                               dtEmp.Rows[i]["岗位"].ToString());
                }

                if (isBPM)
                {
                    pub3.AddTD(dtEmp.Rows[i]["职务"].ToString());
                    pub3.AddTD(dtEmp.Rows[i]["电话"].ToString());
                    pub3.AddTD(dtEmp.Rows[i]["邮箱"].ToString());
                    pub3.AddTD(dtEmp.Rows[i]["直属领导"].ToString());
                }

                pub3.AddTREnd();
            }

            pub3.AddTableEnd();
            #endregion
        }
Exemplo n.º 4
0
        public void BindCond()
        {
            Cond cond = new Cond();

            cond.MyPK = this.GenerMyPK;
            cond.RetrieveFromDBSources();

            /*BPM 模式*/
            BP.GPM.StationTypes tps = new BP.GPM.StationTypes();
            tps.RetrieveAll();

            BP.GPM.Stations sts = new BP.GPM.Stations();
            sts.RetrieveAll();

            string    sql = "SELECT No,Name FROM Port_Station WHERE FK_StationType NOT IN (SELECT No FROM Port_StationType)";
            DataTable dt  = DBAccess.RunSQLReturnTable(sql);

            if (dt.Rows.Count != 0)
            {
                if (tps.Count == 0)
                {
                    var stp = new BP.GPM.StationType {
                        No = "01", Name = "普通岗"
                    };
                    stp.Save();
                    tps.AddEntity(stp);
                }

                //更新所有对不上岗位类型的岗位,岗位类型为01或第一个
                foreach (BP.GPM.Station st in sts)
                {
                    st.FK_StationType = tps[0].No;
                    st.Update();
                }
            }

            this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
            foreach (BP.GPM.StationType tp in tps)
            {
                this.Pub1.AddTR();
                CheckBox mycb = new CheckBox();
                mycb.Text = tp.Name;
                mycb.ID   = "CB_s_d" + tp.No;
                this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb);
                this.Pub1.AddTREnd();

                int    i      = 0;
                string ctlIDs = "";

                foreach (BP.GPM.Station st in sts)
                {
                    if (st.FK_StationType != tp.No)
                    {
                        continue;
                    }

                    i++;

                    if (i == 4)
                    {
                        i = 1;
                    }

                    if (i == 1)
                    {
                        Pub1.AddTR();
                    }

                    CheckBox cb = new CheckBox();
                    cb.ID   = "CB_" + st.No;
                    ctlIDs += cb.ID + ",";
                    cb.Text = st.Name;
                    if (cond.OperatorValue.ToString().Contains("@" + st.No + "@"))
                    {
                        cb.Checked = true;
                    }

                    this.Pub1.AddTD(cb);

                    if (i == 3)
                    {
                        Pub1.AddTREnd();
                    }
                }

                mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                switch (i)
                {
                case 1:
                    Pub1.AddTD();
                    Pub1.AddTD();
                    Pub1.AddTREnd();
                    break;

                case 2:
                    Pub1.AddTD();
                    Pub1.AddTREnd();
                    break;

                default:
                    break;
                }
            }

            this.Pub1.AddTableEnd();
            Pub1.AddBR();

            #region //增加“指定的操作员”选项,added by liuxc,2015-10-7
            var ddl = new DDL();
            ddl.ID    = "DDL_" + CondAttr.SpecOperWay;
            ddl.Width = 200;
            ddl.Items.Add(new ListItem("当前操作员", "0"));
            ddl.Items.Add(new ListItem("指定节点的操作员", "1"));
            ddl.Items.Add(new ListItem("指定表单字段作为操作员", "2"));
            ddl.Items.Add(new ListItem("指定操作员编号", "3"));
            ddl.SetSelectItem((int)cond.SpecOperWay);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            Pub1.Add("指定的操作员:");
            Pub1.Add(ddl);
            Pub1.AddBR();
            Pub1.AddBR();

            var lbl = new Label();
            lbl.ID = "LBL1";

            switch (cond.SpecOperWay)
            {
            case SpecOperWay.SpecNodeOper:
                lbl.Text = "节点编号:";
                break;

            case SpecOperWay.SpecSheetField:
                lbl.Text = "表单字段:";
                break;

            case SpecOperWay.SpenEmpNo:
                lbl.Text = "操作员编号:";
                break;

            case SpecOperWay.CurrOper:
                lbl.Text = "参数:";
                break;
            }

            Pub1.Add(lbl);

            var tb = new TB();
            tb.ID      = "TB_" + CondAttr.SpecOperPara;
            tb.Width   = 200;
            tb.Text    = cond.SpecOperPara;
            tb.Enabled = cond.SpecOperWay != SpecOperWay.CurrOper;
            Pub1.Add(tb);
            Pub1.AddSpace(1);
            Pub1.Add("多个值请用英文“逗号”来分隔。");
            Pub1.AddBR();
            Pub1.AddBR();
            #endregion

            Pub1.AddSpace(1);
            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");
            btn.Click += new EventHandler(btn_Save_Click);
            this.Pub1.Add(btn);
            Pub1.AddSpace(1);

            btn = new LinkBtn(false, NamesOfBtn.Delete, "删除");
            btn.Attributes["onclick"] = " return confirm('您确定要删除吗?');";
            btn.Click += new EventHandler(btn_Save_Click);
            this.Pub1.Add(btn);
        }
Exemplo n.º 5
0
        public void BindCond()
        {
            string msg  = "";
            string note = "";

            Cond cond = new Cond();

            cond.MyPK = this.GenerMyPK;
            cond.RetrieveFromDBSources();

            if (BP.WF.Glo.OSModel == OSModel.WorkFlow)
            {
                SysEnums ses = new SysEnums("StaGrade");
                Stations sts = new Stations();
                sts.RetrieveAll();

                string    sql = "SELECT No,Name FROM Port_Station WHERE StaGrade  NOT IN (SELECT IntKey FROM Sys_Enum WHERE EnumKey='StaGrade')";
                DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                if (dt.Rows.Count != 0)
                {
                    if (ses.Count == 0)
                    {
                        SysEnum se = new SysEnum();
                        se.EnumKey = "StaGrade";
                        se.Lab     = "普通岗";
                        se.IntKey  = 0;
                        se.Insert();

                        ses.AddEntity(se);
                    }

                    foreach (Station st in sts)
                    {
                        st.StaGrade = 0;
                        st.Save();
                    }

                    //Pub1.AddEasyUiPanelInfo("错误",
                    //                        "在ccflow的集成工作模式下,岗位表集成或者维护错误,有" + dt.Rows.Count +
                    //                        "个岗位枚举值对应不上:<br />{技术信息:排查的sql:" + sql + "}", "icon-no");
                    //return;
                }

                this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0'  border='0' style='width:100%'");

                foreach (SysEnum se in ses)
                {
                    this.Pub1.AddTR();
                    CheckBox mycb = new CheckBox();
                    mycb.Text = se.Lab;
                    mycb.ID   = "CB_s_d" + se.IntKey;
                    this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb);
                    this.Pub1.AddTREnd();

                    int    i      = 0;
                    string ctlIDs = "";

                    foreach (Station st in sts)
                    {
                        if (st.StaGrade != se.IntKey)
                        {
                            continue;
                        }

                        i++;

                        if (i == 4)
                        {
                            i = 1;
                        }

                        if (i == 1)
                        {
                            Pub1.AddTR();
                        }

                        CheckBox cb = new CheckBox();
                        cb.ID   = "CB_" + st.No;
                        ctlIDs += cb.ID + ",";
                        cb.Text = st.Name;
                        if (cond.OperatorValue.ToString().Contains("@" + st.No + "@"))
                        {
                            cb.Checked = true;
                        }

                        Pub1.AddTD(cb);

                        if (i == 3)
                        {
                            Pub1.AddTREnd();
                        }
                    }

                    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                    switch (i)
                    {
                    case 1:
                        Pub1.AddTD();
                        Pub1.AddTD();
                        Pub1.AddTREnd();
                        break;

                    case 2:
                        Pub1.AddTD();
                        Pub1.AddTREnd();
                        break;

                    default:
                        break;
                    }
                }
            }
            else
            {
                /*BPM 模式*/
                BP.GPM.StationTypes tps = new BP.GPM.StationTypes();
                tps.RetrieveAll();

                BP.GPM.Stations sts = new BP.GPM.Stations();
                sts.RetrieveAll();

                string    sql = "SELECT No,Name FROM Port_Station WHERE FK_StationType NOT IN (SELECT No FROM Port_StationType)";
                DataTable dt  = DBAccess.RunSQLReturnTable(sql);
                if (dt.Rows.Count != 0)
                {
                    if (tps.Count == 0)
                    {
                        var stp = new BP.GPM.StationType {
                            No = "01", Name = "普通岗"
                        };
                        stp.Save();

                        tps.AddEntity(stp);
                    }

                    //更新所有对不上岗位类型的岗位,岗位类型为01或第一个
                    foreach (BP.GPM.Station st in sts)
                    {
                        st.FK_StationType = tps[0].No;
                        st.Update();
                    }

                    //Pub1.AddEasyUiPanelInfo("错误",
                    //                        "在ccflow的集成工作模式下,岗位表集成或者维护错误,有" + dt.Rows.Count +
                    //                        "个岗位外键对应不上:<br />{技术信息:排查的sql:" + sql + "}", "icon-no");
                    //return;
                }

                this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1'  border='1' style='width:100%'");
                foreach (BP.GPM.StationType tp in tps)
                {
                    this.Pub1.AddTR();
                    CheckBox mycb = new CheckBox();
                    mycb.Text = tp.Name;
                    mycb.ID   = "CB_s_d" + tp.No;
                    this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb);
                    this.Pub1.AddTREnd();

                    int    i      = 0;
                    string ctlIDs = "";

                    foreach (BP.GPM.Station st in sts)
                    {
                        if (st.FK_StationType != tp.No)
                        {
                            continue;
                        }

                        i++;

                        if (i == 4)
                        {
                            i = 1;
                        }

                        if (i == 1)
                        {
                            Pub1.AddTR();
                        }

                        CheckBox cb = new CheckBox();
                        cb.ID   = "CB_" + st.No;
                        ctlIDs += cb.ID + ",";
                        cb.Text = st.Name;
                        if (cond.OperatorValue.ToString().Contains("@" + st.No + "@"))
                        {
                            cb.Checked = true;
                        }

                        this.Pub1.AddTD(cb);

                        if (i == 3)
                        {
                            Pub1.AddTREnd();
                        }
                    }

                    mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                    switch (i)
                    {
                    case 1:
                        Pub1.AddTD();
                        Pub1.AddTD();
                        Pub1.AddTREnd();
                        break;

                    case 2:
                        Pub1.AddTD();
                        Pub1.AddTREnd();
                        break;

                    default:
                        break;
                    }
                }
            }

            this.Pub1.AddTableEnd();
            Pub1.AddBR();
            Pub1.AddSpace(1);

            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");

            btn.Click += new EventHandler(btn_Save_Click);
            this.Pub1.Add(btn);
            Pub1.AddSpace(1);

            btn = new LinkBtn(false, NamesOfBtn.Delete, "删除");
            btn.Attributes["onclick"] = " return confirm('您确定要删除吗?');";
            btn.Click += new EventHandler(btn_Save_Click);
            this.Pub1.Add(btn);
        }