Пример #1
0
 /// <summary>
 /// 通过一个字符数组增加BPRadioButtonList中的各选择项
 /// </summary>
 /// <param name="rad">BPRadioButtonList</param>
 /// <param name="items">字符数组</param>
 private void AddCheckItems(BPRadioButtonList rad, string[] items)
 {
     for (var i = 1; i <= items.Length; i++)
     {
         rad.Items.Add(new ListItem(i + "." + items[i - 1], i.ToString()));
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GloVar gvar = new GloVar();

            gvars = gvar.GetNewEntities as GloVars;
            gvars.Retrieve(GloVarAttr.GroupKey, "IntegrationSet");

            gvarSModel  = gvars.GetEntityByKey("StructureModel") as GloVar;
            gvarSMKind  = gvars.GetEntityByKey("StructureMngKind") as GloVar;
            gvarSSource = gvars.GetEntityByKey("StructureSource") as GloVar;

            GenerateCheckedInfo();

            switch (Step)
            {
            case 1:

                #region 设置组织结构模式

                Pub1.Add("选择组织结构模式:");

                if (gvarSModel == null)
                {
                    gvarSModel          = new GloVar();
                    gvarSModel.No       = "StructureModel";
                    gvarSModel.Name     = "组织结构模式";
                    gvarSModel.Val      = "1";
                    gvarSModel.GroupKey = "IntegrationSet";
                    gvarSModel.Note     = GetJoinStringFromArray(_smodels);
                    gvarSModel.Insert();
                }

                BPRadioButtonList rads = new BPRadioButtonList();
                rads.ID = "Rads_StructureModel";
                AddCheckItems(rads, _smodels);
                rads.RepeatDirection = RepeatDirection.Horizontal;
                rads.RepeatLayout    = RepeatLayout.Flow;
                rads.SetSelectItem(gvarSModel.Val);
                Pub1.Add(rads);
                Pub1.AddBR();
                Pub1.AddBR();

                AddButton(NamesOfBtn.Save, "保存并继续");
                #endregion

                break;

            case 2:

                #region 设置组织结构维护方式

                Pub1.Add("设置组织结构维护方式:");

                if (gvarSMKind == null)
                {
                    gvarSMKind          = new GloVar();
                    gvarSMKind.No       = "StructureMngKind";
                    gvarSMKind.Name     = "组织结构维护方式";
                    gvarSMKind.Val      = "1";
                    gvarSMKind.GroupKey = "IntegrationSet";
                    gvarSMKind.Note     = GetJoinStringFromArray(_smkinds);
                    gvarSMKind.Insert();
                }

                rads    = new BPRadioButtonList();
                rads.ID = "Rads_StructureMngKind";
                AddCheckItems(rads, _smkinds);
                rads.RepeatDirection = RepeatDirection.Horizontal;
                rads.RepeatLayout    = RepeatLayout.Flow;
                rads.SetSelectItem(gvarSMKind.Val);
                Pub1.Add(rads);
                Pub1.AddBR();
                Pub1.AddBR();

                AddButton(NamesOfBtn.Save, "保存并继续");
                Pub1.AddSpace(1);
                AddButton(NamesOfBtn.Back, "上一步");
                #endregion

                break;

            case 3:

                #region  择组织结构来源

                Pub1.Add("选择组织结构来源:");

                if (gvarSSource == null)
                {
                    gvarSSource          = new GloVar();
                    gvarSSource.No       = "StructureSource";
                    gvarSSource.Name     = "选择组织结构来源";
                    gvarSSource.Val      = "1";
                    gvarSSource.GroupKey = "IntegrationSet";
                    gvarSSource.Note     = GetJoinStringFromArray(_ssources);
                    gvarSSource.Insert();
                }

                rads    = new BPRadioButtonList();
                rads.ID = "Rads_StructureSource";
                AddCheckItems(rads, _ssources);
                rads.RepeatDirection = RepeatDirection.Horizontal;
                rads.RepeatLayout    = RepeatLayout.Flow;
                rads.SetSelectItem(gvarSSource.Val);
                Pub1.Add(rads);
                Pub1.AddBR();
                Pub1.AddBR();

                AddButton(NamesOfBtn.Save, "保存并继续");
                Pub1.AddSpace(1);
                AddButton(NamesOfBtn.Back, "上一步");
                #endregion

                break;

            case 4:

                #region 配置查询语句

                string msg = string.Empty;

                if (gvarSModel == null)
                {
                    msg = "“<a href='?step=1'>组织结构模式</a>”、";
                }

                if (gvarSMKind == null)
                {
                    msg += "“<a href='?step=2'>组织结构维护方式</a>”、";
                }

                if (gvarSSource == null)
                {
                    msg += "“<a href='?step=3'>组织结构来源</a>”";
                }

                if (!string.IsNullOrWhiteSpace(msg))
                {
                    Pub1.AddEasyUiPanelInfo("信息", "请先配置" + msg.TrimEnd('、') + ",然后配置此项!");
                    Pub1.AddBR();
                    AddButton(NamesOfBtn.Back, "上一步");
                    return;
                }

                //如果组织结构来源选择的是WebService和AD,则提示用户编写提供的通用webservice,以联接这两方载体
                if (gvarSSource.Val == "2" || gvarSSource.Val == "3")
                {
                    Pub1.AddEasyUiPanelInfo("信息", "您选择的组织结构数据来源是“<span style='font-weight:bold;'>" + _ssources[int.Parse(gvarSSource.Val) - 1] + "</span>”,该种方式目前请自行修改位于CCFlow项目下的WebService文件:\\DataUser\\PortalInterface.asmx,此WebService用来提供组织结构的相关数据。");
                    Pub1.AddBR();
                    AddButton(NamesOfBtn.Back, "上一步");
                    return;
                }

                if (gvarSModel.Val == "1")
                {
                    //一个用户一个部门
                    _oneones = new Dictionary <string, Dictionary <string, string> >();
                    maps     = new[]
                    {
                        new BP.Port.Station().EnMap,
                        new BP.Port.Dept().EnMap,
                        new BP.Port.Emp().EnMap,
                        new BP.Port.EmpStation().EnMap
                    };
                    GenerateMapAttrs(_oneones, maps);
                }
                else
                {
                    //一个用户多个部门
                    _onemores = new Dictionary <string, Dictionary <string, string> >();
                    maps      = new[]
                    {
                        new BP.GPM.StationType().EnMap,
                        new BP.GPM.Station().EnMap,
                        new BP.GPM.Dept().EnMap,
                        new BP.GPM.Duty().EnMap,
                        new BP.GPM.DeptDuty().EnMap,
                        new BP.GPM.Emp().EnMap,
                        new BP.GPM.DeptEmp().EnMap,
                        new BP.GPM.DeptStation().EnMap,
                        new BP.GPM.DeptEmpStation().EnMap
                    };
                    GenerateMapAttrs(_onemores, maps);
                }

                //如果组织结构维护方式选择的是由“CCBPM组织结构维护”,则下面的配置查询语句就不需要了
                if (gvarSMKind.Val == "1")
                {
                    msg = "您选择的组织结构数据来源是“<span style='font-weight:bold;'>" + _ssources[int.Parse(gvarSSource.Val) - 1] + "</span>”,组织结构维护方式选择的是“<span style='font-weight:bold;'>" + _smkinds[int.Parse(gvarSMKind.Val) - 1] + "</span>”,组织结构模式是“<span style='font-weight:bold;'>" + _smodels[int.Parse(gvarSModel.Val) - 1] + "</span>”,此种模式下,在ccbpm的主库中需要维护的相关表有:<br />";

                    if (gvarSModel.Val == "1")
                    {
                        //一个用户一个部门
                        msg += "1.岗位类型[Sys_Enum]。Sys_Enum枚举表中EnumKey='StaGrade'的枚举。<br />";

                        for (int i = 0; i < maps.Length; i++)
                        {
                            msg += string.Format("{0}.{1}[{2}]。<br />", i + 2, maps[i].EnDesc, maps[i].PhysicsTable);
                        }
                    }
                    else
                    {
                        //一个用户多个部门
                        for (int i = 0; i < maps.Length; i++)
                        {
                            msg += string.Format("{0}.{1}[{2}]。<br />", i + 1, maps[i].EnDesc, maps[i].PhysicsTable);
                        }
                    }

                    msg += " <hr> 在这种运行模式下,ccbpm系统已经为您提供了一套维护组织机构的功能,您可以左边的组织机构树进行维护。";
                    Pub1.AddEasyUiPanelInfo("信息", msg);
                    Pub1.AddBR();
                    AddButton(NamesOfBtn.Back, "上一步");
                }
                else
                {
                    Pub1.Add(
                        "您选择的组织结构数据来源是“<span style='font-weight:bold;'>" + _ssources[int.Parse(gvarSSource.Val) - 1] + "</span>”,组织结构维护方式选择的是“<span style='font-weight:bold;'>" + _smkinds[int.Parse(gvarSMKind.Val) - 1] + "</span>”,组织结构模式是“<span style='font-weight:bold;'>" + _smodels[int.Parse(gvarSModel.Val) - 1] + "</span>”。<br />");

                    gvarDBSrc = gvars.GetEntityByKey("StructureDBSrc") as GloVar;

                    if (gvarDBSrc == null)
                    {
                        gvarDBSrc          = new GloVar();
                        gvarDBSrc.No       = "StructureDBSrc";
                        gvarDBSrc.Name     = "数据源编号";
                        gvarDBSrc.Val      = "local";
                        gvarDBSrc.Note     = "数据源是Sys_SFDBSrc表";
                        gvarDBSrc.GroupKey = "IntegrationSet";
                        gvarDBSrc.Save();
                    }

                    //gvarDBOver = gvars.GetEntityByKey("StructureDBOver") as GloVar;

                    //if (gvarDBOver == null)
                    //{
                    //    gvarDBOver = new GloVar();
                    //    gvarDBOver.No = "StructureDBOver";
                    //    gvarDBOver.Name = "数据源SQL配置是否完成";
                    //    gvarDBOver.Val = "False";
                    //    gvarDBOver.Note = "若组织结构配置的SQL已经配置完成,且有效,则为True;反之,为False";
                    //    gvarDBOver.GroupKey = "IntegrationSet";
                    //    gvarDBOver.Save();
                    //}

                    SFDBSrcs srcs = new SFDBSrcs();
                    srcs.RetrieveAll(SFDBSrcAttr.DBSrcType);

                    //根据传来的数据源编号,变更当前的数据源
                    if (!string.IsNullOrWhiteSpace(Request.QueryString["src"]) && srcs.IsExits(SFDBSrcAttr.No, Request.QueryString["src"]))
                    {
                        gvarDBSrc.Val = Request.QueryString["src"];
                        gvarDBSrc.Update();
                    }

                    DDL ddl = new DDL();
                    ddl.CssClass = "easyui-combobox";
                    ddl.Attributes["data-options"] = "onSelect:function(rcd){location.href='Integration.aspx?step=4&src=' + rcd.value;}";
                    ddl.ID           = "DDL_DBSrcs";
                    ddl.AutoPostBack = true;
                    ddl.BindEntities(srcs);
                    ddl.SetSelectItem(gvarDBSrc.Val);

                    Pub1.AddBR();
                    Pub1.Add("选择数据源:");
                    Pub1.Add(ddl);
                    Pub1.AddSpace(1);
                    Pub1.Add("<a href=\"javascript: OpenEasyUiDialog('../../Comm/Sys/SFDBSrcNewGuide.aspx', 'eudlgframe', '新建数据源', 760, 470, 'icon-add', true, function () {location.href = location.href;})\" class='easyui-linkbutton' data-optinos=\"iconCls:'icon-add'\">新建数据源</a>");
                    Pub1.AddBR();
                    Pub1.AddBR();

                    //if (gvarDBSrc.Val == "local")
                    //{
                    //    Pub1.AddEasyUiPanelInfo("信息", string.Format("“<span style='font-weight:bold;'>{0}</span>”是CCFlow主数据源,不需要进行组织结构的SQL配置。", ddl.SelectedItem.Text));
                    //    Pub1.AddBR();
                    //    AddButton(NamesOfBtn.Back, "上一步");
                    //    return;
                    //}

                    Pub1.Add("选择此数据源,需要配置的相关表的SQL查询语句如下:");
                    Pub1.AddBR();
                    Pub1.AddBR();

                    if (gvarSModel.Val == "1")
                    {
                        #region     //一个用户一个部门
                        Pub1.Add("1.<span style='font-weight:bold;'>岗位类型数据</span>。<br />");
                        LinkBtn btn = new LinkBtn(false, NamesOfBtn.Edit, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编辑数据");
                        btn.PostBackUrl   = "javascript:void(0)";
                        btn.OnClientClick = "OpenEasyUiDialog('../../Comm/Sys/EnumList.aspx?RefNo=StaGrade&t=' + Math.random(), 'euiframe','编辑岗位类型',600,374,'icon-edit')";
                        Pub1.Add(btn);
                        Pub1.AddBR();
                        Pub1.AddBR();
                        #endregion
                    }

                    int idx = gvarSModel.Val == "1" ? 2 : 1;
                    TB  tb  = null;
                    foreach (BP.En.Map map in maps)
                    {
                        gvar = CheckGloVar(gvars, map.PhysicsTable, map.EnDesc);
                        Pub1.Add(GenerateAttrDescs(map, idx++));
                        tb          = new TB();
                        tb.ID       = "TB_" + map.PhysicsTable;
                        tb.TextMode = TextBoxMode.MultiLine;
                        tb.Text     = (gvar.Val ?? string.Empty).Replace('~', '\'');
                        tb.Wrap     = true;
                        tb.Width    = 760;
                        tb.Height   = 60;
                        Pub1.Add(tb);
                        Pub1.AddBR();
                        AddButton(NamesOfBtn.DataCheck + "_" + map.PhysicsTable, "检查正确性");
                        Pub1.AddSpace(1);
                        AddButton(NamesOfBtn.Open + "_" + map.PhysicsTable, "打开数据源");
                        Pub1.AddBR();
                        Pub1.AddBR();
                    }

                    AddButton(NamesOfBtn.Setting, "设置全部");
                    Pub1.AddSpace(1);
                    AddButton(NamesOfBtn.Back, "上一步");
                    Pub1.AddBR();
                    Pub1.AddBR();
                }
                #endregion

                break;
            }
        }