Пример #1
0
        /// <summary>
        /// 数据源
        /// </summary>
        /// <param name="attrs">数据字符串,规则如下:
        /// <para>1.每个字段间用 ^ 来分隔</para>
        /// <para>2.字段的信息间用 ~ 来分隔</para>
        /// <para>3.字段的信息分别为:英文名称,中文名称,数据类型,最大长度,逻辑类型,序号</para>
        /// </param>
        /// <param name="tableName">数据表名称</param>
        public void InitMapAttr(string tableName, string attrs)
        {
            Pub1.AddEasyUiPanelInfo("发送信息", attrs);
            return;

            //删除有可能存在的临时数据.
            string tempStr = tableName + "Tmp";

            MapAttr ma = new MapAttr();

            ma.Delete(MapAttrAttr.FK_MapData, tempStr);

            string[] strs = attrs.Split('^');
            foreach (string str in strs)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                string[] mystrs = str.Split('~');
                ma            = new MapAttr();
                ma.KeyOfEn    = mystrs[0];
                ma.Name       = mystrs[1];
                ma.FK_MapData = tempStr;
                ma.MyDataType = int.Parse(mystrs[2]);
                ma.MaxLen     = int.Parse(mystrs[3]);
                ma.LGType     = (BP.En.FieldTypeS) int.Parse(mystrs[4]);
                ma.Idx        = int.Parse(mystrs[5]);
                ma.MyPK       = tempStr + "_" + ma.KeyOfEn;
                ma.Insert();
            }
        }
Пример #2
0
        public string SaveFKField(string fk_mapData, string fieldKey, string fieldName, string enName, double x, double y)
        {
            try
            {
                MapAttr attr = new MapAttr();
                attr.MyPK = fk_mapData + "_" + fieldKey;
                if (attr.IsExits == true)
                {
                    return("字段{" + fieldKey + "}已经存在.");
                }

                attr.FK_MapData = fk_mapData;
                attr.KeyOfEn    = fieldKey;
                attr.Name       = fieldName;
                attr.MyDataType = DataType.AppString;

                attr.X = float.Parse(x.ToString());
                attr.Y = float.Parse(y.ToString());

                attr.UIBindKey     = enName;
                attr.UIContralType = UIContralType.DDL;
                attr.LGType        = FieldTypeS.FK;
                attr.Insert();
                return("OK");
            }
            catch (Exception ex)
            {
                return("@错误信息:" + ex.Message);
            }
        }
        void btn_Click(object sender, EventArgs e)
        {
            MapDatas mds      = this.GetMDs;
            MapAttr  mattrOld = new MapAttr(this.FK_MapData, this.KeyOfEn);
            MapAttr  mattr    = new MapAttr(this.FK_MapData, this.KeyOfEn);

            foreach (MapData md in mds)
            {
                CheckBox cb = this.Pub1.GetCBByID("CB_" + md.No);
                if (cb == null)
                {
                    continue;
                }

                if (cb.Checked == false)
                {
                    continue;
                }

                if (this.DoType == "Copy")
                {
                    /*执行批量Copy*/
                    mattr.FK_MapData = md.No;
                    mattr.Insert();
                    mattr.Idx = mattrOld.Idx;
                }

                if (this.DoType == "Update")
                {
                    /*执行批量Update*/
                    MapAttr mattrUpdate = new MapAttr(md.No, this.KeyOfEn);
                    int     gID         = mattrUpdate.GroupID;
                    mattrUpdate.Copy(mattrOld);
                    mattrUpdate.FK_MapData = md.No;
                    mattrUpdate.GroupID    = gID;
                    mattrUpdate.Update();
                }

                if (this.DoType == "Delete")
                {
                    /*执行批量 Delete */
                    MapAttr mattrDelete = new MapAttr(md.No, this.KeyOfEn);
                    mattrDelete.Delete();
                }
            }
            // 转向.
            this.Response.Redirect(this.Request.RawUrl, true);
        }
Пример #4
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns>返回执行结果</returns>
        public override object Do()
        {
            string rpt = BP.PubClass.DBRpt(BP.DBLevel.High);

            // 手动升级. 2011-07-08 补充节点字段分组.
            string sql = "DELETE FROM Sys_EnCfg WHERE No='BP.WF.Ext.NodeSheet'";

            BP.DA.DBAccess.RunSQL(sql);

            sql = "INSERT INTO Sys_EnCfg(No,GroupTitle) VALUES ('BP.WF.Ext.NodeSheet','NodeID=基本配置@WarningDays=考核属性@SendLab=功能按钮标签与状态')";
            BP.DA.DBAccess.RunSQL(sql);

            // 修复因bug丢失的字段.
            MapDatas mds = new MapDatas();

            mds.RetrieveAll();
            foreach (MapData md in mds)
            {
                string nodeid = md.No.Replace("ND", "");
                try
                {
                    BP.WF.Node nd = new Node(int.Parse(nodeid));
                    nd.RepareMap();
                    continue;
                }
                catch (Exception ex)
                {
                }

                MapAttr attr = new MapAttr();
                if (attr.IsExit(MapAttrAttr.KeyOfEn, "OID", MapAttrAttr.FK_MapData, md.No) == false)
                {
                    attr.FK_MapData    = md.No;
                    attr.KeyOfEn       = "OID";
                    attr.Name          = "OID";
                    attr.MyDataType    = BP.DA.DataType.AppInt;
                    attr.UIContralType = UIContralType.TB;
                    attr.LGType        = FieldTypeS.Normal;
                    attr.UIVisible     = false;
                    attr.UIIsEnable    = false;
                    attr.DefVal        = "0";
                    attr.HisEditType   = BP.En.EditType.Readonly;
                    attr.Insert();
                }
            }
            return("执行成功...");
        }
Пример #5
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns>返回执行结果</returns>
        public override object Do()
        {
            string keys = "~!@#$%^&*()+{}|:<>?`=[];,./~!@#¥%……&×()——+{}|:“《》?`-=[];',./";

            char[] cc = keys.ToCharArray();
            foreach (char c in cc)
            {
                DBAccess.RunSQL("update sys_mapattr set keyofen=REPLACE(keyofen,'" + c + "' , '')");
            }

            BP.Sys.MapAttrs attrs = new Sys.MapAttrs();
            attrs.RetrieveAll();
            int    idx = 0;
            string msg = "";

            foreach (BP.Sys.MapAttr item in attrs)
            {
                string f = item.KeyOfEn.Clone().ToString();
                try
                {
                    int i = int.Parse(item.KeyOfEn.Substring(0, 1));
                    item.KeyOfEn = "F" + item.KeyOfEn;
                    try
                    {
                        MapAttr itemCopy = new MapAttr();
                        itemCopy.Copy(item);
                        itemCopy.Insert();
                        item.DirectDelete();
                    }
                    catch (Exception ex)
                    {
                        msg += "@" + ex.Message;
                    }
                }
                catch
                {
                    continue;
                }
                DBAccess.RunSQL("UPDATE sys_mapAttr set KeyOfEn='" + item.KeyOfEn + "', mypk=FK_MapData+'_'+keyofen where keyofen='" + item.KeyOfEn + "'");
                msg += "@第(" + idx + ")个错误修复成功,原(" + f + ")修复成(" + item.KeyOfEn + ").";
                idx++;
            }

            BP.DA.DBAccess.RunSQL("UPDATE Sys_MapAttr SET MyPK=FK_MapData+'_'+KeyOfEn WHERE MyPK!=FK_MapData+'_'+KeyOfEn");
            return("修复信息如下:" + msg);
        }
Пример #6
0
        /// <summary>
        /// 创建隐藏字段.
        /// </summary>
        /// <returns></returns>
        public string NewHidF()
        {
            MapAttr mdHid = new MapAttr();

            mdHid.MyPK        = this.FK_MapData + "_" + this.KeyOfEn;
            mdHid.FK_MapData  = this.FK_MapData;
            mdHid.KeyOfEn     = this.KeyOfEn;
            mdHid.Name        = this.Name;
            mdHid.MyDataType  = int.Parse(this.GetRequestVal("FieldType"));
            mdHid.HisEditType = EditType.Edit;
            mdHid.MaxLen      = 100;
            mdHid.MinLen      = 0;
            mdHid.LGType      = FieldTypeS.Normal;
            mdHid.UIVisible   = false;
            mdHid.UIIsEnable  = false;
            mdHid.Insert();

            return("创建成功..");
        }
Пример #7
0
    void btn_Click(object sender, EventArgs e)
    {
        MapAttrs attrsFrom = new MapAttrs(this.Dtl);
        MapAttrs attrs     = new MapAttrs(this.MyPK);

        foreach (MapAttr attr in attrsFrom)
        {
            switch (attr.KeyOfEn)
            {
            case "OID":
            case "FID":
            case "WorkID":
            case "Rec":
            case "RDT":
            case "RefPK":
                continue;

            default:
                break;
            }

            if (attrs.Contains(MapAttrAttr.KeyOfEn, attr.KeyOfEn))
            {
                continue;
            }

            if (this.GetCBByID("CB_" + attr.MyPK).Checked == false)
            {
                continue;
            }

            MapAttr en = new MapAttr();
            en.Copy(attr);
            en.FK_MapData = this.MyPK;
            en.GroupID    = 0;
            //en.Idx = 0;
            en.Insert();
        }
        this.WinCloseWithMsg("复制成功,您可以用调整从表的顺序。");
    }
Пример #8
0
    void btn_Click(object sender, EventArgs e)
    {
        MapDtls dtl2s = new MapDtls();

        dtl2s.Delete(MapDtlAttr.FK_MapData, this.MyPK);
        Nodes nds = new Nodes(BP.WF.Glo.GenerFlowNo(this.MyPK));

        foreach (BP.WF.Node nd in nds)
        {
            if (nd.IsEndNode == false)
            {
                continue;
            }

            MapDtls dtls = new MapDtls("ND" + nd.NodeID);
            int     i    = 0;

            foreach (MapDtl dtl in dtls)
            {
                if (this.Pub1.GetCBByID("CB_" + dtl.No).Checked == false)
                {
                    continue;
                }

                i++;
                // 生成从表让其可以在单个数据里显示他们。
                MapDtl dtlNew = new MapDtl();
                dtlNew.Copy(dtl);
                dtlNew.No         = this.MyPK + i;
                dtlNew.FK_MapData = this.MyPK;
                dtlNew.GroupID    = this.Pub1.GetDDLByID("DDL_" + dtl.No).SelectedItemIntVal;
                dtlNew.Insert();

                // 删除原来的数据。
                MapAttrs attrsDtl = new MapAttrs();
                attrsDtl.Delete(MapAttrAttr.FK_MapData, dtlNew.No);

                // 复制到新的数据表里。
                MapAttrs attrs = new MapAttrs(dtl.No);
                foreach (MapAttr attr in attrs)
                {
                    MapAttr attrN = new MapAttr();
                    attrN.Copy(attr);
                    attrN.FK_MapData = dtlNew.No;
                    attrN.Insert();
                }
                Cash.Map_Cash.Remove(dtlNew.No);


                #region   制成 主表.让其可以查询。
                // 处理主表。
                MapData md = new MapData();
                md.Copy(dtlNew);
                md.No = "ND" + int.Parse(this.FK_Flow) + "RptDtl" + i.ToString();
                md.Save();

                // 删除原来的属性。
                attrs.Delete(MapAttrAttr.FK_MapData, md.No);

                // 删除分组。
                GroupField gfBase = new GroupField();
                gfBase.Delete(GroupFieldAttr.EnName, md.No);

                // 增加基本信息分组。
                gfBase.EnName = md.No;
                gfBase.Lab    = md.Name;
                gfBase.Idx    = 99;
                gfBase.Insert();


                //生成基本信息属性。
                foreach (MapAttr attr in attrs)
                {
                    MapAttr attrN = new MapAttr();
                    attrN.Copy(attr);
                    attrN.FK_MapData = md.No;
                    attrN.GroupID    = gfBase.OID;
                    attrN.Insert();
                }

                MapAttrs attrNs = new MapAttrs(md.No);

                // 对个别字段进行处理。
                foreach (MapAttr attr in attrNs)
                {
                    switch (attr.KeyOfEn)
                    {
                    case StartWorkAttr.FK_Dept:
                        continue;
                        //if (attr.UIContralType != UIContralType.DDL)
                        //{
                        //attr.UIBindKey = "BP.Port.Depts";
                        //attr.UIContralType = UIContralType.DDL;
                        //attr.LGType = FieldTypeS.FK;
                        //attr.UIVisible = true;
                        //// if (gfs.Contains(attr.GroupID) == false)
                        //attr.GroupID = gfBase.OID;// gfs[0].GetValIntByKey("OID");
                        //attr.Update();
                        //// }
                        break;

                    case "FK_NY":
                        //attr.Delete();
                        ////if (attr.UIContralType != UIContralType.DDL)
                        ////{
                        //attr.UIBindKey = "BP.Pub.NYs";
                        //attr.UIContralType = UIContralType.DDL;
                        //attr.LGType = FieldTypeS.FK;
                        //attr.UIVisible = true;
                        ////   if (gfs.Contains(attr.GroupID) == false)
                        //attr.GroupID = gfBase.OID; // gfs[0].GetValIntByKey("OID");
                        //attr.Update();
                        break;

                    case "Rec":
                        attr.UIBindKey     = "BP.Port.Emps";
                        attr.UIContralType = UIContralType.DDL;
                        attr.LGType        = FieldTypeS.FK;
                        attr.UIVisible     = true;
                        attr.Name          = "最后处理人";
                        attr.GroupID       = gfBase.OID;
                        attr.Update();
                        break;

                    default:
                        break;
                    }
                }

                // 生成流程基本信息属性。
                GroupField gfFlow = new GroupField();
                gfFlow.EnName = md.No;
                gfFlow.Idx    = 0;
                gfFlow.Lab    = "流程信息";
                gfFlow.Insert();


                MapAttr attrFlow = new BP.Sys.MapAttr();

                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "Title";
                attrFlow.Name          = "标题";
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.TB;
                attrFlow.LGType        = FieldTypeS.Normal;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = true;
                attrFlow.UIIsLine      = true;
                attrFlow.MinLen        = 0;
                attrFlow.MaxLen        = 1000;
                attrFlow.IDX           = -100;
                attrFlow.GroupID       = gfFlow.OID;
                attrFlow.Insert();


                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowStarter";
                attrFlow.Name          = "发起人"; //"发起人";
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.DDL;
                attrFlow.UIBindKey     = "BP.Port.Emps";
                attrFlow.LGType        = FieldTypeS.FK;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = false;
                attrFlow.UIIsLine      = false;
                attrFlow.MaxLen        = 20;
                attrFlow.MinLen        = 0;
                attrFlow.Insert();

                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowStarterDept";
                attrFlow.Name          = "发起人部门";
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.DDL;
                attrFlow.UIBindKey     = "BP.Port.Depts";
                attrFlow.LGType        = FieldTypeS.FK;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = false;
                attrFlow.MaxLen        = 20;
                attrFlow.MinLen        = 0;
                attrFlow.Insert();



                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowEmps";
                attrFlow.Name          = "参与人"; //
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.TB;
                attrFlow.LGType        = FieldTypeS.Normal;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = true;
                attrFlow.UIIsLine      = false;
                attrFlow.MinLen        = 0;
                attrFlow.MaxLen        = 1000;
                attrFlow.IDX           = -100;
                attrFlow.GroupID       = gfFlow.OID;
                attrFlow.Insert();


                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowStartRDT";
                attrFlow.Name          = "发起时间"; //
                attrFlow.MyDataType    = BP.DA.DataType.AppDateTime;
                attrFlow.UIContralType = UIContralType.TB;
                attrFlow.LGType        = FieldTypeS.Normal;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = true;
                attrFlow.UIIsLine      = false;
                attrFlow.MinLen        = 0;
                attrFlow.MaxLen        = 1000;
                attrFlow.IDX           = -100;
                attrFlow.GroupID       = gfFlow.OID;
                attrFlow.Insert();

                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowNY";
                attrFlow.Name          = "隶属年月";
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.DDL;
                attrFlow.UIBindKey     = "BP.Pub.NYs";
                attrFlow.LGType        = FieldTypeS.FK;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = false;
                attrFlow.MaxLen        = 20;
                attrFlow.MinLen        = 0;
                attrFlow.Insert();


                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "MyNum";
                attrFlow.Name          = "条"; //
                attrFlow.MyDataType    = BP.DA.DataType.AppInt;
                attrFlow.DefVal        = "1";
                attrFlow.UIContralType = UIContralType.TB;
                attrFlow.LGType        = FieldTypeS.Normal;
                attrFlow.UIVisible     = false;
                attrFlow.UIIsEnable    = false;
                attrFlow.UIIsLine      = false;
                attrFlow.IDX           = -101;
                attrFlow.GroupID       = gfFlow.OID;
                if (attrFlow.IsExits == false)
                {
                    attrFlow.Insert();
                }

                // 清除缓存的map.
                Cash.Map_Cash.Remove(md.No);
                //检查主表的正确性。
                GEEntity ge = new GEEntity(md.No);
                ge.CheckPhysicsTable();
                #endregion   制成 主表.让其可以查询。
            }
        }
        this.WinClose();
    }
Пример #9
0
        /// <summary>
        /// 替换名称
        /// </summary>
        /// <param name="fieldOldName">旧名称</param>
        /// <param name="newField">新字段</param>
        /// <param name="newFieldName">新字段名称(可以为空)</param>
        /// <returns></returns>
        public string DoChangeFieldName(string fieldOld, string newField, string newFieldName)
        {
            MapAttr attrOld = new MapAttr();

            attrOld.KeyOfEn    = fieldOld;
            attrOld.FK_MapData = this.No;
            attrOld.MyPK       = attrOld.FK_MapData + "_" + attrOld.KeyOfEn;
            if (attrOld.RetrieveFromDBSources() == 0)
            {
                return("@旧字段输入错误[" + attrOld.KeyOfEn + "].");
            }

            //检查是否存在该字段?
            MapAttr attrNew = new MapAttr();

            attrNew.KeyOfEn    = newField;
            attrNew.FK_MapData = this.No;
            attrNew.MyPK       = attrNew.FK_MapData + "_" + attrNew.KeyOfEn;
            if (attrNew.RetrieveFromDBSources() == 1)
            {
                return("@该字段[" + attrNew.KeyOfEn + "]已经存在.");
            }

            //删除旧数据.
            attrOld.Delete();

            //copy这个数据,增加上它.
            attrNew.Copy(attrOld);
            attrNew.KeyOfEn    = newField;
            attrNew.FK_MapData = this.No;

            if (newFieldName != "")
            {
                attrNew.Name = newFieldName;
            }

            attrNew.Insert();

            //更新处理他的相关业务逻辑.
            MapExts exts = new MapExts(this.No);

            foreach (MapExt item in exts)
            {
                item.MyPK = item.MyPK.Replace("_" + fieldOld, "_" + newField);

                if (item.AttrOfOper == fieldOld)
                {
                    item.AttrOfOper = newField;
                }

                if (item.AttrsOfActive == fieldOld)
                {
                    item.AttrsOfActive = newField;
                }

                item.Tag  = item.Tag.Replace(fieldOld, newField);
                item.Tag1 = item.Tag1.Replace(fieldOld, newField);
                item.Tag2 = item.Tag2.Replace(fieldOld, newField);
                item.Tag3 = item.Tag3.Replace(fieldOld, newField);

                item.AtPara = item.AtPara.Replace(fieldOld, newField);
                item.Doc    = item.Doc.Replace(fieldOld, newField);
                item.Save();
            }
            return("执行成功");
        }
Пример #10
0
        void btn_Save_Click(object sender, EventArgs e)
        {
            var ts      = new List <Tuple <string, string, int, int, int, int> >();
            var colname = string.Empty;

            Tuple <string, string, int, int, int, int> t = null;
            HiddenField hid = null;

            MapData md = new MapData();

            md.No = this.FK_MapData;
            md.RetrieveFromDBSources();

            string msg    = "导入字段信息:";
            bool   isLeft = true;
            float  maxEnd = md.MaxEnd; //底部.

            foreach (Control ctrl in Pub1.Controls)
            {
                if (ctrl.ID == null || !ctrl.ID.StartsWith("HID_Idx_"))
                {
                    continue;
                }

                hid     = ctrl as HiddenField;
                colname = hid.ID.Substring("HID_Idx_".Length);

                MapAttr ma = new MapAttr();
                ma.KeyOfEn    = colname;
                ma.Name       = this.Pub1.GetTBByID("TB_Desc_" + colname).Text;
                ma.FK_MapData = this.FK_MapData;
                ma.MyDataType = this.Pub1.GetDDLByID("DDL_DBType_" + colname).SelectedItemIntVal;
                ma.MaxLen     = int.Parse(this.Pub1.GetTBByID("TB_Len_" + colname).Text);
                //ma.LGType = (BP.En.FieldTypeS)this.Pub1.GetDDLByID("DDL_LogicType_" + colname).SelectedItemIntVal;
                ma.UIBindKey = this.Pub1.GetTBByID("TB_BindKey_" + colname).Text;
                ma.MyPK      = this.FK_MapData + "_" + ma.KeyOfEn;
                ma.LGType    = BP.En.FieldTypeS.Normal;

                if (ma.UIBindKey != "")
                {
                    SysEnums se = new SysEnums();
                    se.Retrieve(SysEnumAttr.EnumKey, ma.UIBindKey);
                    if (se.Count > 0)
                    {
                        ma.MyDataType    = BP.DA.DataType.AppInt;
                        ma.LGType        = BP.En.FieldTypeS.Enum;
                        ma.UIContralType = BP.En.UIContralType.DDL;
                    }

                    SFTable tb = new SFTable();
                    tb.No = ma.UIBindKey;
                    if (tb.IsExits == true)
                    {
                        ma.MyDataType    = BP.DA.DataType.AppString;
                        ma.LGType        = BP.En.FieldTypeS.FK;
                        ma.UIContralType = BP.En.UIContralType.DDL;
                    }
                }

                if (ma.MyDataType == BP.DA.DataType.AppBoolean)
                {
                    ma.UIContralType = BP.En.UIContralType.CheckBok;
                }
                if (ma.IsExits)
                {
                    continue;
                }
                ma.Insert();

                msg += "\t\n字段:" + ma.KeyOfEn + "" + ma.Name + "加入成功.";
                FrmLab lab = null;
                if (isLeft == true)
                {
                    maxEnd = maxEnd + 40;
                    /* 是否是左边 */
                    lab            = new FrmLab();
                    lab.MyPK       = BP.DA.DBAccess.GenerGUID();
                    lab.FK_MapData = this.FK_MapData;
                    lab.Text       = ma.Name;
                    lab.X          = 40;
                    lab.Y          = maxEnd;
                    lab.Insert();

                    ma.X = lab.X + 80;
                    ma.Y = maxEnd;
                    ma.Update();
                }
                else
                {
                    lab            = new FrmLab();
                    lab.MyPK       = BP.DA.DBAccess.GenerGUID();
                    lab.FK_MapData = this.FK_MapData;
                    lab.Text       = ma.Name;
                    lab.X          = 350;
                    lab.Y          = maxEnd;
                    lab.Insert();

                    ma.X = lab.X + 80;
                    ma.Y = maxEnd;
                    ma.Update();
                }
                isLeft = !isLeft;
            }

            //重新设置.
            md.ResetMaxMinXY();

            BP.Sys.PubClass.WinClose("OK");
        }
Пример #11
0
        void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                Button btn = sender as Button;
                switch (btn.ID)
                {
                case "Btn_Del":
                    MapAttr attrDel = new MapAttr();
                    attrDel.MyPK = this.RefNo;
                    attrDel.Delete();
                    this.WinClose();
                    return;

                default:
                    break;
                }

                MapAttr attr = new MapAttr();
                if (this.RefNo == null || this.RefNo == "")
                {
                    attr.MyPK          = this.MyPK + "_" + this.Pub1.GetTBByID("TB_KeyOfEn").Text;
                    attr.KeyOfEn       = this.Pub1.GetTBByID("TB_KeyOfEn").Text;
                    attr.UIContralType = UIContralType.DDL;
                    attr.MyDataType    = BP.DA.DataType.AppString;
                    attr.LGType        = FieldTypeS.Normal;
                    attr.DefVal        = "";
                    attr.UIBindKey     = this.Request.QueryString["SFKey"];
                    attr.UIIsEnable    = true;
                    if (attr.IsExits == true)
                    {
                        throw new Exception("@字段名[" + attr.KeyOfEn + "]已经存在,保存失败。");
                    }

                    attr = (MapAttr)this.Pub1.Copy(attr);
                }
                else
                {
                    attr.MyPK = this.RefNo;
                    attr.Retrieve();
                    attr = (MapAttr)this.Pub1.Copy(attr);
                }

                attr.FK_MapData = this.MyPK;
                attr.GroupID    = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal;
                attr.ColSpan    = this.Pub1.GetDDLByID("DDL_ColSpan").SelectedItemIntVal;
                attr.DefVal     = this.Pub1.GetTBByID("TB_DefVal").Text;
                attr.UIBindKey  = this.Pub1.GetTBByID("TB_UIBindKey").Text;

                string field = attr.KeyOfEn;
                if (this.RefNo == null || this.RefNo == "")
                {
                    attr.Insert(); //首先插入数据表现数据.

                    //插入隐藏数据.
                    attr.KeyOfEn    = field + "T";
                    attr.UIVisible  = false;
                    attr.UIIsEnable = false; //让其不是隐藏字段.
                    attr.Insert();

                    //还原以前的值.
                    attr.KeyOfEn   = field;
                    attr.MyPK      = this.MyPK + "_" + field;
                    attr.UIVisible = true;
                }
                else
                {
                    attr.Update();
                }

                switch (btn.ID)
                {
                case "Btn_SaveAndClose":
                    this.WinClose();
                    return;

                case "Btn_SaveAndNew":
                    this.Response.Redirect("Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + attr.Idx + "&GroupField=" + this.GroupField, true);
                    return;

                default:
                    break;
                }
                this.Response.Redirect("EditSQL.aspx?DoType=Edit&MyPK=" + this.MyPK + "&RefNo=" + attr.MyPK + "&GroupField=" + this.GroupField, true);
            }
            catch (Exception ex)
            {
                this.Alert(ex.Message);
            }
        }
        void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                Button btn = sender as Button;
                switch (btn.ID)
                {
                case "Btn_Del":
                    MapAttr attrDel = new MapAttr();
                    attrDel.MyPK = this.RefNo;
                    attrDel.Delete();
                    this.WinClose();
                    return;

                default:
                    break;
                }

                MapAttr attr = new MapAttr();
                if (this.RefNo == null || this.RefNo == "")
                {
                    attr.MyPK          = this.MyPK + "_" + this.Pub1.GetTBByID("TB_KeyOfEn").Text;
                    attr.UIContralType = UIContralType.DDL;
                    attr.MyDataType    = BP.DA.DataType.AppString;
                    attr.LGType        = FieldTypeS.FK;
                    attr.DefVal        = "";
                    attr.UIBindKey     = this.Request.QueryString["SFKey"];
                    attr.UIIsEnable    = true;
                }
                else
                {
                    attr.MyPK = this.RefNo;
                    attr.Retrieve();
                }
                attr            = (MapAttr)this.Pub1.Copy(attr);
                attr.FK_MapData = this.MyPK;
                attr.GroupID    = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal;
                attr.DefVal     = this.Pub1.GetTBByID("TB_DefVal").Text;
                attr.UIBindKey  = this.Pub1.GetTBByID("TB_UIBindKey").Text;

                //if (this.Pub1.IsExit("CB_IsDefValNull"))
                //{
                //    if (this.Pub1.GetCBByID("CB_IsDefValNull").Checked == false)
                //        attr.DefVal = this.Pub1.GetDDLByID("DDL").SelectedItemStringVal;
                //    else
                //        attr.DefVal = "";
                //}
                //else
                //{
                //    string s = this.Pub1.GetDDLByID("DDL_DefVal").SelectedItemStringVal;
                //    if (s == "@Select")
                //    {
                //        attr.DefVal = this.Pub1.GetDDLByID("DDL").SelectedItemStringVal;
                //    }
                //    else
                //    {
                //        attr.DefVal = s;
                //    }
                //}

                if (this.RefNo == null || this.RefNo == "")
                {
                    attr.Insert();
                }
                else
                {
                    attr.Update();
                }

                switch (btn.ID)
                {
                case "Btn_SaveAndClose":
                    this.WinClose();
                    return;

                case "Btn_SaveAndNew":
                    this.Response.Redirect("Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + attr.Idx + "&GroupField=" + this.GroupField, true);
                    return;

                default:
                    break;
                }
                this.Response.Redirect("EditTable.aspx?DoType=Edit&MyPK=" + this.MyPK + "&RefNo=" + attr.MyPK + "&GroupField=" + this.GroupField, true);
            }
            catch (Exception ex)
            {
                this.Alert(ex.Message);
            }
        }
Пример #13
0
        void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                Button btn = sender as Button;
                switch (btn.ID)
                {
                case "Btn_Del":
                    this.Response.Redirect("Do.aspx?DoType=Del&MyPK=" + this.MyPK + "&RefNo=" + this.RefNo, true);
                    return;

                default:
                    break;
                }

                MapAttr attr = new MapAttr();
                attr.MyPK = this.RefNo;
                if (this.RefNo != null)
                {
                    attr.Retrieve();
                }
                attr            = (MapAttr)this.Pub1.Copy(attr);
                attr.FK_MapData = this.MyPK;
                attr.DefVal     = this.Pub1.GetDDLByID("DDL").SelectedItemStringVal;
                attr.GroupID    = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal;

                if (this.Pub1.GetRadioButtonByID("RB_Ctrl_0").Checked)
                {
                    attr.UIContralType = UIContralType.DDL;
                }
                else
                {
                    attr.UIContralType = UIContralType.RadioBtn;
                }

                if (this.RefNo == null)
                {
                    attr.MyPK = this.MyPK + "_" + this.Pub1.GetTBByID("TB_KeyOfEn").Text;
                    string idx = this.Request.QueryString["IDX"];
                    if (idx == null || idx == "")
                    {
                    }
                    else
                    {
                        attr.IDX = int.Parse(this.Request.QueryString["IDX"]);
                    }

                    string enumKey = this.Request.QueryString["EnumKey"];
                    attr.UIBindKey   = enumKey;
                    attr.MyDataType  = BP.DA.DataType.AppInt;
                    attr.HisEditType = EditType.Edit;

                    attr.UIContralType = UIContralType.DDL;
                    attr.LGType        = FieldTypeS.Enum;
                    attr.Insert();
                }
                else
                {
                    attr.Update();
                }

                switch (btn.ID)
                {
                case "Btn_SaveAndClose":
                    this.WinClose();
                    return;

                case "Btn_SaveAndNew":
                    this.Response.Redirect("Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + attr.IDX + "&GroupField=" + this.GroupField, true);
                    return;

                default:
                    break;
                }
                if (this.RefNo == null)
                {
                    this.Response.Redirect("EditEnum.aspx?DoType=Edit&MyPK=" + this.MyPK + "&RefNo=" + attr.MyPK + "&GroupField=" + this.GroupField, true);
                }
            }
            catch (Exception ex)
            {
                this.Alert(ex.Message);
            }
        }
Пример #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "字段分组";

            switch (this.DoType)
            {
            case "FunList":
                this.Pub1.AddFieldSet("字段分组向导");
                this.Pub1.AddUL();
                this.Pub1.AddLi("<b><a href='GroupField.aspx?DoType=NewGroup&RefNo=" + this.RefNo + "'>新建空白字段分组</a></b><br><font color=green>空白字段分组,建立后可以把相关的字段放入此分组里。</font>");
                this.Pub1.AddLi("<b><a href='GroupField.aspx?DoType=NewCheckGroup&RefNo=" + this.RefNo + "'>新建审核分组</a></b><br><font color=green>系统会让您输入审核的信息,并创建审核分组。</font>");
                this.Pub1.AddLi("<b><a href='GroupField.aspx?DoType=NewEvalGroup&RefNo=" + this.RefNo + "'>创建工作质量考核字段分组</a></b><br><font color=green>创建质量考核: EvalEmpNo,EvalEmpName,EvalCent,EvalNote 4个必要的字段。</font>");
                this.Pub1.AddULEnd();
                this.Pub1.AddFieldSetEnd();
                return;

            case "NewCheckGroup":
                this.Pub1.AddFieldSet("<a href=GroupField.aspx?DoType=FunList&RefNo=" + this.RefNo + " >字段分组向导</a> - " + "审核分组");
                TB tbc = new TB();
                tbc.ID = "TB_Sta";
                this.Pub1.Add("审核岗位<font color=red>*</font>");
                this.Pub1.Add(tbc);
                this.Pub1.AddBR("<font color=green>比如:分局长审核、科长审核、总经理审核。</font>");
                this.Pub1.AddBR();

                tbc    = new TB();
                tbc.ID = "TB_Prx";
                this.Pub1.Add("字段前缀:");
                this.Pub1.Add(tbc);
                this.Pub1.AddBR("<font color=green>用于自动创建字段,请输入英文字母或者字母数字组合。系统自动依据您的输入产生字段。如:XXX_Note,审核意见。XXX_RDT审核时间。XXX_Checker审核人,为空系统自动用拼音表示。</font>");
                this.Pub1.AddBR();
                this.Pub1.AddHR();
                Btn btnc = new Btn();
                btnc.Click += new EventHandler(btn_Check_Click);
                btnc.Text   = "保存";

                this.Pub1.Add(btnc);
                this.Pub1.AddFieldSetEnd();
                return;

            case "NewEvalGroup":

                GroupField gf = new GroupField();
                gf.Lab    = "工作质量考核";
                gf.EnName = this.RefNo;
                gf.Insert();

                MapAttr attr = new MapAttr();
                attr.FK_MapData    = this.RefNo;
                attr.KeyOfEn       = BP.WF.WorkSysFieldAttr.EvalNote;
                attr.Name          = "审核意见";
                attr.MyDataType    = DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.UIIsEnable    = true;
                attr.UIIsLine      = true;
                attr.MaxLen        = 500;
                attr.GroupID       = gf.OID;
                attr.UIHeight      = 23;
                attr.ColSpan       = 4;
                attr.Idx           = 1;
                attr.Insert();

                attr               = new MapAttr();
                attr.FK_MapData    = this.RefNo;
                attr.KeyOfEn       = BP.WF.WorkSysFieldAttr.EvalCent;
                attr.Name          = "分值";
                attr.MyDataType    = DataType.AppFloat;
                attr.UIContralType = UIContralType.TB;
                attr.MaxLen        = 50;
                attr.MinLen        = 0;
                attr.UIIsEnable    = true;
                attr.UIIsLine      = false;
                attr.DefVal        = "0";
                attr.UIIsEnable    = false;
                attr.GroupID       = gf.OID;
                attr.IsSigan       = true;
                attr.Idx           = 2;
                attr.Insert();

                attr               = new MapAttr();
                attr.FK_MapData    = this.RefNo;
                attr.KeyOfEn       = BP.WF.WorkSysFieldAttr.EvalEmpNo;
                attr.Name          = "被评估人编号";
                attr.MyDataType    = DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.UIIsEnable    = true;
                attr.UIIsLine      = false;
                attr.DefVal        = "";
                attr.UIIsEnable    = false;
                attr.GroupID       = gf.OID;
                attr.Idx           = 3;
                attr.Insert();

                attr               = new MapAttr();
                attr.FK_MapData    = this.RefNo;
                attr.KeyOfEn       = BP.WF.WorkSysFieldAttr.EvalEmpName;
                attr.Name          = "被评估人名称";
                attr.MyDataType    = DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.UIIsEnable    = true;
                attr.UIIsLine      = false;
                attr.DefVal        = "";
                attr.UIIsEnable    = false;
                attr.GroupID       = gf.OID;
                attr.Idx           = 4;
                attr.Insert();
                this.WinCloseWithMsg("保存成功");     // "增加成功,您可以调整它的位置与修改字段的标签。"
                return;

            case "NewGroup":
                GroupFields mygfs = new GroupFields(this.RefNo);
                GroupField  gf1   = new GroupField();
                gf1.Idx    = mygfs.Count;
                gf1.Lab    = "新建字段分组";  // "新建字段分组";
                gf1.EnName = this.RefNo;
                if (gf1.IsExit(GroupFieldAttr.EnName, gf1.EnName, GroupFieldAttr.Lab, gf1.Lab) == false)
                {
                    gf1.Insert();
                }
                this.Response.Redirect("GroupField.aspx?RefNo=" + this.RefNo + "&RefOID=" + gf1.OID, true);
                return;

            default:
                break;
            }

            #region edit operation
            GroupField en = new GroupField(this.RefOID);
            this.Pub1.Add("<Table border=0 align=center>");
            this.Pub1.AddCaptionLeft("字段分组");
            this.Pub1.AddTR();

            this.Pub1.AddTD("分组名称");

            TB tb = new TB();
            tb.ID      = "TB_Lab_" + en.OID;
            tb.Text    = en.Lab;
            tb.Columns = 50;
            this.Pub1.AddTD(tb);
            this.Pub1.AddTREnd();

            this.Pub1.AddTRSum();
            this.Pub1.Add("<TD align=center colspan=2>");
            Btn btn = new Btn();
            btn.Text   = "保存";
            btn.ID     = "Btn_Save";
            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);
            btn        = new Btn();
            btn.Text   = "保存并关闭";
            btn.ID     = "Btn_SaveAndClose";
            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);

            btn        = new Btn();
            btn.Text   = "新建字段";
            btn.ID     = "Btn_NewField";
            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);

            //btn = new Btn();
            //btn.Text = this.ToE("CopyField", "复制字段");
            //btn.ID = "Btn_CopyField";
            //btn.Click += new EventHandler(btn_Click);
            //this.Pub1.Add(btn);


            btn        = new Btn();
            btn.Text   = "删除";
            btn.ID     = "Btn_Delete";
            btn.Click += new EventHandler(btn_del_Click);
            btn.Attributes["onclick"] = " return confirm('您确认吗?');";

            this.Pub1.Add(btn);

            this.Pub1.Add("</TD>");
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
            this.Pub1.Add("把相近的字段放在一个大单元格里,只是为了显示所用没有任何计算意义。");
            #endregion
        }
Пример #15
0
        void btn_Check_Click(object sender, EventArgs e)
        {
            string sta = this.Pub1.GetTBByID("TB_Sta").Text.Trim();

            if (sta.Length == 0)
            {
                this.Alert("审核岗位不能为空");
                return;
            }

            string Prx = this.Pub1.GetTBByID("TB_Prx").Text.Trim();

            if (Prx.Length == 0)
            {
                Prx = chs2py.convert(sta);
            }

            MapAttr attr = new MapAttr();
            int     i    = attr.Retrieve(MapAttrAttr.FK_MapData, this.RefNo, MapAttrAttr.KeyOfEn, Prx + "_Note");

            i += attr.Retrieve(MapAttrAttr.FK_MapData, this.RefNo, MapAttrAttr.KeyOfEn, Prx + "_Checker");
            i += attr.Retrieve(MapAttrAttr.FK_MapData, this.RefNo, MapAttrAttr.KeyOfEn, Prx + "_RDT");

            if (i > 0)
            {
                this.Alert("前缀已经使用:" + Prx + " , 请确认您是否增加了这个审核分组或者,请您更换其他的前缀。");
                return;
            }

            GroupField gf = new GroupField();

            gf.Lab    = sta;
            gf.EnName = this.RefNo;
            gf.Insert();

            attr               = new MapAttr();
            attr.FK_MapData    = this.RefNo;
            attr.KeyOfEn       = Prx + "_Note";
            attr.Name          = "审核意见"; // sta;  // this.ToE("CheckNote", "审核意见");
            attr.MyDataType    = DataType.AppString;
            attr.UIContralType = UIContralType.TB;
            attr.UIIsEnable    = true;
            attr.UIIsLine      = true;
            attr.MaxLen        = 4000;
            attr.ColSpan       = 4;
            attr.GroupID       = gf.OID;
            attr.UIHeight      = 23 * 3;
            attr.Idx           = 1;
            attr.Insert();

            attr               = new MapAttr();
            attr.FK_MapData    = this.RefNo;
            attr.KeyOfEn       = Prx + "_Checker";
            attr.Name          = "审核人";// "审核人";
            attr.MyDataType    = DataType.AppString;
            attr.UIContralType = UIContralType.TB;
            attr.MaxLen        = 50;
            attr.MinLen        = 0;
            attr.UIIsEnable    = true;
            attr.UIIsLine      = false;
            attr.DefVal        = "@WebUser.No";
            attr.UIIsEnable    = false;
            attr.GroupID       = gf.OID;
            attr.IsSigan       = true;
            attr.Idx           = 2;
            attr.Insert();

            attr               = new MapAttr();
            attr.FK_MapData    = this.RefNo;
            attr.KeyOfEn       = Prx + "_RDT";
            attr.Name          = "审核日期"; // "审核日期";
            attr.MyDataType    = DataType.AppDateTime;
            attr.UIContralType = UIContralType.TB;
            attr.UIIsEnable    = true;
            attr.UIIsLine      = false;
            attr.DefVal        = "@RDT";
            attr.UIIsEnable    = false;
            attr.GroupID       = gf.OID;
            attr.Idx           = 3;
            attr.Insert();
            this.WinCloseWithMsg("保存成功"); // "增加成功,您可以调整它的位置与修改字段的标签。"
        }
Пример #16
0
        public string DoType(string dotype, string v1, string v2, string v3, string v4, string v5)
        {
            string sql = "";

            try
            {
                switch (dotype)
                {
                case "CreateCheckGroup":
                    string gKey    = v1;
                    string gName   = v2;
                    string enName1 = v3;

                    MapAttr attrN = new MapAttr();
                    int     i     = attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_Note");
                    i += attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_Checker");
                    i += attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_RDT");
                    if (i > 0)
                    {
                        return("前缀已经使用:" + gKey + " , 请确认您是否增加了这个审核分组或者,请您更换其他的前缀。");
                    }

                    GroupField gf = new GroupField();
                    gf.Lab    = gName;
                    gf.EnName = enName1;
                    gf.Insert();

                    attrN               = new MapAttr();
                    attrN.FK_MapData    = enName1;
                    attrN.KeyOfEn       = gKey + "_Note";
                    attrN.Name          = "审核意见";
                    attrN.MyDataType    = DataType.AppString;
                    attrN.UIContralType = UIContralType.TB;
                    attrN.UIIsEnable    = true;
                    attrN.UIIsLine      = true;
                    attrN.MaxLen        = 4000;
                    attrN.GroupID       = gf.OID;
                    attrN.UIHeight      = 23 * 3;
                    attrN.IDX           = 1;
                    attrN.Insert();

                    attrN               = new MapAttr();
                    attrN.FK_MapData    = enName1;
                    attrN.KeyOfEn       = gKey + "_Checker";
                    attrN.Name          = "审核人";// "审核人";
                    attrN.MyDataType    = DataType.AppString;
                    attrN.UIContralType = UIContralType.TB;
                    attrN.MaxLen        = 50;
                    attrN.MinLen        = 0;
                    attrN.UIIsEnable    = true;
                    attrN.UIIsLine      = false;
                    attrN.DefVal        = "@WebUser.Name";
                    attrN.UIIsEnable    = false;
                    attrN.GroupID       = gf.OID;
                    attrN.IsSigan       = true;
                    attrN.IDX           = 2;
                    attrN.Insert();

                    attrN               = new MapAttr();
                    attrN.FK_MapData    = enName1;
                    attrN.KeyOfEn       = gKey + "_RDT";
                    attrN.Name          = "审核日期"; // "审核日期";
                    attrN.MyDataType    = DataType.AppDateTime;
                    attrN.UIContralType = UIContralType.TB;
                    attrN.UIIsEnable    = true;
                    attrN.UIIsLine      = false;
                    attrN.DefVal        = "@RDT";
                    attrN.UIIsEnable    = false;
                    attrN.GroupID       = gf.OID;
                    attrN.IDX           = 3;
                    attrN.Insert();
                    return(null);

                case "NewDtl":
                    MapDtl dtlN = new MapDtl();
                    dtlN.No = v1;
                    if (dtlN.RetrieveFromDBSources() != 0)
                    {
                        return("从表已存在");
                    }
                    dtlN.Name       = v1;
                    dtlN.FK_MapData = v2;
                    dtlN.PTable     = v1;
                    dtlN.Insert();
                    dtlN.IntMapAttrs();
                    return(null);

                case "DelM2M":
                    MapM2M m2mDel = new MapM2M();
                    m2mDel.MyPK = v1;
                    m2mDel.Delete();
                    //M2M m2mData = new M2M();
                    //m2mData.Delete(M2MAttr.FK_MapData, v1);
                    return(null);

                case "NewAthM":     // 新建 NewAthM.
                    string fk_mapdataAth = v1;
                    string athName       = v2;

                    BP.Sys.FrmAttachment athM = new FrmAttachment();
                    athM.MyPK = athName;
                    if (athM.IsExits)
                    {
                        return("多选名称:" + athName + ",已经存在。");
                    }

                    athM.X          = float.Parse(v3);
                    athM.Y          = float.Parse(v4);
                    athM.Name       = "多文件上传";
                    athM.FK_MapData = fk_mapdataAth;
                    athM.Insert();
                    return(null);

                case "NewM2M":
                    string fk_mapdataM2M = v1;
                    string m2mName       = v2;
                    MapM2M m2m           = new MapM2M();
                    m2m.FK_MapData = v1;
                    m2m.NoOfObj    = v2;
                    if (v3 == "0")
                    {
                        m2m.HisM2MType = M2MType.M2M;
                        m2m.Name       = "新建一对多";
                    }
                    else
                    {
                        m2m.HisM2MType = M2MType.M2MM;
                        m2m.Name       = "新建一对多多";
                    }

                    m2m.X    = float.Parse(v4);
                    m2m.Y    = float.Parse(v5);
                    m2m.MyPK = m2m.FK_MapData + "_" + m2m.NoOfObj;
                    if (m2m.IsExits)
                    {
                        return("多选名称:" + m2mName + ",已经存在。");
                    }
                    m2m.Insert();
                    return(null);

                case "DelEnum":
                    // 检查这个物理表是否被使用。
                    sql = "SELECT  * FROM Sys_MapAttr WHERE UIBindKey='" + v1 + "'";
                    DataTable dtEnum     = DBAccess.RunSQLReturnTable(sql);
                    string    msgDelEnum = "";
                    foreach (DataRow dr in dtEnum.Rows)
                    {
                        msgDelEnum += "\n 表单编号:" + dr["FK_MapData"] + " , 字段:" + dr["KeyOfEn"] + ", 名称:" + dr["Name"];
                    }

                    if (msgDelEnum != "")
                    {
                        return("该枚举已经被如下字段所引用,您不能删除它。" + msgDelEnum);
                    }

                    sql  = "DELETE FROM Sys_EnumMain WHERE No='" + v1 + "'";
                    sql += "@DELETE FROM Sys_Enum WHERE EnumKey='" + v1 + "' ";
                    DBAccess.RunSQLs(sql);
                    return(null);

                case "DelSFTable":     /* 删除自定义的物理表. */
                    // 检查这个物理表是否被使用。
                    sql = "SELECT  * FROM Sys_MapAttr WHERE UIBindKey='" + v1 + "'";
                    DataTable dt     = DBAccess.RunSQLReturnTable(sql);
                    string    msgDel = "";
                    foreach (DataRow dr in dt.Rows)
                    {
                        msgDel += "\n 表单编号:" + dr["FK_MapData"] + " , 字段:" + dr["KeyOfEn"] + ", 名称:" + dr["Name"];
                    }

                    if (msgDel != "")
                    {
                        return("该数据表已经被如下字段所引用,您不能删除它。" + msgDel);
                    }

                    SFTable sfDel = new SFTable();
                    sfDel.No = v1;
                    sfDel.DirectDelete();
                    return(null);

                case "SaveSFTable":
                    string enName = v2;
                    string chName = v1;
                    if (string.IsNullOrEmpty(v1) || string.IsNullOrEmpty(v2))
                    {
                        return("视图中的中英文名称不能为空。");
                    }

                    SFTable sf = new SFTable();
                    sf.No   = enName;
                    sf.Name = chName;

                    sf.No   = enName;
                    sf.Name = chName;

                    sf.FK_Val = enName;
                    sf.Save();
                    if (DBAccess.IsExitsObject(enName) == true)
                    {
                        /*已经存在此对象,检查一下是否有No,Name列。*/
                        sql = "SELECT No,Name FROM " + enName;
                        try
                        {
                            DBAccess.RunSQLReturnTable(sql);
                        }
                        catch (Exception ex)
                        {
                            return("您指定的表或视图(" + enName + "),不包含No,Name两列,不符合ccflow约定的规则。技术信息:" + ex.Message);
                        }
                        return(null);
                    }
                    else
                    {
                        /*创建这个表,并且插入基础数据。*/
                        try
                        {
                            // 如果没有该表或者视图,就要创建它。
                            sql = "CREATE TABLE " + enName + "(No varchar(30) NOT NULL,Name varchar(50) NULL)";
                            DBAccess.RunSQL(sql);
                            DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('001','Item1')");
                            DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('002','Item2')");
                            DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('003','Item3')");
                        }
                        catch (Exception ex)
                        {
                            sf.DirectDelete();
                            return("创建物理表期间出现错误,可能是非法的物理表名.技术信息:" + ex.Message);
                        }
                    }
                    return(null);      /*创建成功后返回空值*/

                case "FrmTempleteExp": //导出表单.
                    MapData mdfrmtem = new MapData();
                    mdfrmtem.No = v1;
                    if (mdfrmtem.RetrieveFromDBSources() == 0)
                    {
                        if (v1.Contains("ND"))
                        {
                            int  nodeId = int.Parse(v1.Replace("ND", ""));
                            Node nd     = new Node(nodeId);
                            mdfrmtem.Name   = nd.Name;
                            mdfrmtem.PTable = v1;
                            mdfrmtem.EnPK   = "OID";
                            mdfrmtem.Insert();
                        }
                    }

                    DataSet ds   = mdfrmtem.GenerHisDataSet();
                    string  file = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Temp\\" + v1 + ".xml";
                    if (System.IO.File.Exists(file))
                    {
                        System.IO.File.Delete(file);
                    }
                    ds.WriteXml(file);

                    // BP.PubClass.DownloadFile(file, mdfrmtem.Name + ".xml");
                    //this.DownLoadFile(System.Web.HttpContext.Current, file, mdfrmtem.Name);
                    return(null);

                case "FrmTempleteImp":     //导入表单.
                    DataSet dsImp   = new DataSet();
                    string  fileImp = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Temp\\" + v1 + ".xml";
                    dsImp.ReadXml(fileImp);     //读取文件.
                    MapData.ImpMapData(v1, dsImp, true);
                    return(null);

                case "NewHidF":
                    string  fk_mapdataHid = v1;
                    string  key           = v2;
                    string  name          = v3;
                    int     dataType      = int.Parse(v4);
                    MapAttr mdHid         = new MapAttr();
                    mdHid.MyPK        = fk_mapdataHid + "_" + key;
                    mdHid.FK_MapData  = fk_mapdataHid;
                    mdHid.KeyOfEn     = key;
                    mdHid.Name        = name;
                    mdHid.MyDataType  = dataType;
                    mdHid.HisEditType = EditType.Edit;
                    mdHid.MaxLen      = 100;
                    mdHid.MinLen      = 0;
                    mdHid.LGType      = FieldTypeS.Normal;
                    mdHid.UIVisible   = false;
                    mdHid.UIIsEnable  = false;
                    mdHid.Insert();
                    return(null);

                case "DelDtl":
                    MapDtl dtl = new MapDtl(v1);
                    dtl.Delete();
                    return(null);

                case "DeleteFrm":
                    string  delFK_Frm = v1;
                    MapData mdDel     = new MapData(delFK_Frm);
                    mdDel.Delete();
                    sql = "@DELETE FROM Sys_MapData WHERE No='" + delFK_Frm + "'";
                    sql = "@DELETE FROM WF_FrmNode WHERE FK_Frm='" + delFK_Frm + "'";
                    DBAccess.RunSQLs(sql);
                    return(null);

                case "FrmUp":
                case "FrmDown":
                    FrmNode myfn = new FrmNode();
                    myfn.Retrieve(FrmNodeAttr.FK_Node, v1, FrmNodeAttr.FK_Frm, v2);
                    if (dotype == "FrmUp")
                    {
                        myfn.DoUp();
                    }
                    else
                    {
                        myfn.DoDown();
                    }
                    return(null);

                case "SaveFlowFrm":
                    // 转化参数意义.
                    string vals    = v1;
                    string fk_Node = v2;
                    string fk_flow = v3;
                    bool   isPrint = false;
                    if (v5 == "1")
                    {
                        isPrint = true;
                    }

                    bool isReadonly = false;
                    if (v4 == "1")
                    {
                        isReadonly = true;
                    }

                    string msg = this.SaveEn(vals);
                    if (msg.Contains("Error"))
                    {
                        return(msg);
                    }

                    string fk_frm = msg;
                    Frm    fm     = new Frm();
                    fm.No = fk_frm;
                    fm.Retrieve();

                    FrmNode fn = new FrmNode();
                    if (fn.Retrieve(FrmNodeAttr.FK_Frm, fk_frm,
                                    FrmNodeAttr.FK_Node, fk_Node) == 1)
                    {
                        fn.IsEdit  = !isReadonly;
                        fn.IsPrint = isPrint;
                        fn.FK_Flow = fk_flow;
                        fn.Update();
                        BP.DA.DBAccess.RunSQL("UPDATE Sys_MapData SET FK_FrmSort='01',AppType=1  WHERE No='" + fk_frm + "'");
                        return(fk_frm);
                    }

                    fn.FK_Frm  = fk_frm;
                    fn.FK_Flow = fk_flow;
                    fn.FK_Node = int.Parse(fk_Node);
                    fn.IsEdit  = !isReadonly;
                    fn.IsPrint = isPrint;
                    fn.Idx     = 100;
                    fn.FK_Flow = fk_flow;
                    fn.Insert();

                    MapData md = new MapData();
                    md.No = fm.No;
                    if (md.RetrieveFromDBSources() == 0)
                    {
                        md.Name = fm.Name;
                        md.EnPK = "OID";
                        md.Insert();
                    }

                    MapAttr attr = new MapAttr();
                    attr.FK_MapData    = md.No;
                    attr.KeyOfEn       = "OID";
                    attr.Name          = "WorkID";
                    attr.MyDataType    = BP.DA.DataType.AppInt;
                    attr.UIContralType = UIContralType.TB;
                    attr.LGType        = FieldTypeS.Normal;
                    attr.UIVisible     = false;
                    attr.UIIsEnable    = false;
                    attr.DefVal        = "0";
                    attr.HisEditType   = BP.En.EditType.Readonly;
                    attr.Insert();

                    attr               = new MapAttr();
                    attr.FK_MapData    = md.No;
                    attr.KeyOfEn       = "FID";
                    attr.Name          = "FID";
                    attr.MyDataType    = BP.DA.DataType.AppInt;
                    attr.UIContralType = UIContralType.TB;
                    attr.LGType        = FieldTypeS.Normal;
                    attr.UIVisible     = false;
                    attr.UIIsEnable    = false;
                    attr.DefVal        = "0";
                    attr.HisEditType   = BP.En.EditType.Readonly;
                    attr.Insert();

                    attr               = new MapAttr();
                    attr.FK_MapData    = md.No;
                    attr.KeyOfEn       = "RDT";
                    attr.Name          = "记录日期";
                    attr.MyDataType    = BP.DA.DataType.AppDateTime;
                    attr.UIContralType = UIContralType.TB;
                    attr.LGType        = FieldTypeS.Normal;
                    attr.UIVisible     = false;
                    attr.UIIsEnable    = false;
                    attr.DefVal        = "@RDT";
                    attr.HisEditType   = BP.En.EditType.Readonly;
                    attr.Insert();
                    return(fk_frm);

                default:
                    return("Error:" + dotype + " , 未设置此标记.");
                }
            }
            catch (Exception ex)
            {
                return("Error:" + ex.Message);
            }
        }
Пример #17
0
        void btn_SavePowerOrders_Click(object sender, EventArgs e)
        {
            string tfModel = SystemConfig.AppSettings["TreeFrmModel"];

            BP.WF.Node nd  = new BP.WF.Node(this.FK_Node);
            FrmNodes   fns = new FrmNodes(this.FK_Flow, this.FK_Node);

            foreach (FrmNode fn in fns)
            {
                //  fn.IsEdit = this.Pub1.GetCBByID("CB_IsEdit_" + fn.FK_Frm).Checked;
                fn.IsPrint = this.Pub1.GetCBByID("CB_IsPrint_" + fn.FK_Frm).Checked;

                //是否启
                fn.IsEnableLoadData = this.Pub1.GetCBByID("CB_IsEnableLoadData_" + fn.FK_Frm).Checked;

                fn.Idx = int.Parse(this.Pub1.GetTextBoxByID("TB_Idx_" + fn.FK_Frm).Text);
                //fn.HisFrmType = (BP.Sys.FrmType)this.Pub1.GetDDLByID("DDL_FrmType_" + fn.FK_Frm).SelectedItemIntVal;
                if (tfModel == "1")
                {
                    if (currND.IsStartNode == false)
                    {
                        fn.GuanJianZiDuan = this.Pub1.GetDDLByID("DDL_Attr_" + fn.FK_Frm).SelectedValue;
                    }
                }

                //表单启用规则. 去掉了 2016-05-11 使用连接替代.
                // fn.FrmEnableRoleInt = this.Pub1.GetDDLByID("DDL_FrmEnableRole_" + fn.FK_Frm).SelectedItemIntVal;

                //权限控制方案.
                fn.FrmSln  = this.Pub1.GetDDLByID("DDL_Sln_" + fn.FK_Frm).SelectedItemIntVal;
                fn.WhoIsPK = (WhoIsPK)this.Pub1.GetDDLByID("DDL_WhoIsPK_" + fn.FK_Frm).SelectedItemIntVal;


                fn.FK_Flow = this.FK_Flow;
                fn.FK_Node = this.FK_Node;

                fn.MyPK = fn.FK_Frm + "_" + fn.FK_Node + "_" + fn.FK_Flow;

                if (fn.HisFrmType == FrmType.WordFrm || fn.HisFrmType == FrmType.ExcelFrm)
                {
                    fn.TempleteFile = this.Pub1.GetDDLByID("DDL_File_" + fn.FK_Frm).SelectedItemStringVal;
                }

                // add  for hainan 2016.3.25 增加1对N.
                if (nd.HisRunModel == RunModel.FL || nd.HisRunModel == RunModel.FHL)
                {
                    fn.Is1ToN = this.Pub1.GetCBByID("CB_Is1ToN_" + fn.FK_Frm).Checked;
                    if (fn.Is1ToN == true)
                    {
                        /*检查该表单里是否具有FID的隐藏字段,如果没有系统自动给他增加上.*/
                        MapAttrs attrs = new MapAttrs(fn.FK_Frm);
                        if (attrs.Contains("KeyOfEn", "FID") == false)
                        {
                            MapAttr attr = new MapAttr();
                            attr.MyPK       = fn.FK_Frm + "_FID";
                            attr.FK_MapData = fn.FK_Frm;
                            attr.KeyOfEn    = "FID";
                            attr.LGType     = FieldTypeS.Normal;
                            attr.UIVisible  = false;
                            attr.MyDataType = BP.DA.DataType.AppInt;
                            attr.Insert();
                        }
                    }
                }

                if (nd.HisRunModel == RunModel.SubThread)
                {
                    fn.HuiZong = this.Pub1.GetDDLByID("DDL_HuiZong_" + fn.FK_Frm).SelectedItemStringVal;
                }

                fn.Update();
            }
            this.Response.Redirect("BindFrms.aspx?ShowType=EditPowerOrder&FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow, true);
        }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                switch (this.DoType)
                {
                case "DownTempFrm":
                    MapData md   = new MapData(this.FK_MapData);
                    DataSet ds   = md.GenerHisDataSet();
                    string  name = "ccflow表单模板." + md.Name + "." + md.No + ".xml";
                    string  file = this.Request.PhysicalApplicationPath + "\\Temp\\" + this.FK_MapData + ".xml";
                    ds.WriteXml(file);
                    this.Response.Redirect("../../Temp/" + this.FK_MapData + ".xml", true);
                    this.WinClose();
                    break;

                case "CCForm":
                    this.Application.Clear();
                    if (WebUser.NoOfRel != "admin")
                    {
                        BP.Port.Emp emp = new BP.Port.Emp("admin");
                        BP.Web.WebUser.SignInOfGener(emp);
                    }

                    MapAttr mattr = new MapAttr();
                    mattr.MyPK = this.Request.QueryString["MyPK"];
                    int i = mattr.RetrieveFromDBSources();
                    mattr.KeyOfEn    = this.Request.QueryString["KeyOfEn"];
                    mattr.FK_MapData = this.Request.QueryString["FK_MapData"];
                    mattr.MyDataType = int.Parse(this.Request.QueryString["DataType"]);

                    if (!string.IsNullOrEmpty(this.Request.QueryString["UIBindKey"] + ""))
                    {
                        mattr.UIBindKey = this.Request.QueryString["UIBindKey"];
                    }
                    mattr.UIContralType = (UIContralType)int.Parse(this.Request.QueryString["UIContralType"]);
                    mattr.LGType        = (BP.En.FieldTypeS) int.Parse(this.Request.QueryString["LGType"]);
                    if (i == 0)
                    {
                        mattr.Name       = System.Web.HttpUtility.UrlDecode(this.Request.QueryString["KeyName"], System.Text.Encoding.GetEncoding("GB2312"));
                        mattr.UIIsEnable = true;
                        mattr.UIVisible  = true;
                        if (mattr.LGType == FieldTypeS.Enum)
                        {
                            mattr.DefVal = "0";
                        }
                        mattr.Insert();
                    }
                    else
                    {
                        mattr.Update();
                    }

                    switch (mattr.LGType)
                    {
                    case BP.En.FieldTypeS.Enum:
                        this.Response.Redirect("EditEnum.aspx?MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK, true);
                        return;

                    case BP.En.FieldTypeS.Normal:
                        this.Response.Redirect("EditF.aspx?DoType=Edit&MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK + "&FType=" + mattr.MyDataType + "&GroupField=0", true);
                        return;

                    case BP.En.FieldTypeS.FK:
                        this.Response.Redirect("EditTable.aspx?DoType=Edit&MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK + "&FType=" + mattr.MyDataType + "&GroupField=0", true);
                        return;

                    default:
                        break;
                    }
                    break;

                case "DobackToF":
                    MapAttr ma = new MapAttr(this.RefNo);
                    switch (ma.LGType)
                    {
                    case FieldTypeS.Normal:
                        this.Response.Redirect("EditF.aspx?RefNo=" + this.RefNo, true);
                        return;

                    case FieldTypeS.FK:
                        this.Response.Redirect("EditTable.aspx?RefNo=" + this.RefNo, true);
                        return;

                    case FieldTypeS.Enum:
                        this.Response.Redirect("EditEnum.aspx?RefNo=" + this.RefNo, true);
                        return;

                    default:
                        return;
                    }
                    break;

                case "AddEnum":
                    SysEnumMain sem1    = new SysEnumMain(this.Request.QueryString["EnumKey"]);
                    MapAttr     attrAdd = new MapAttr();
                    attrAdd.KeyOfEn = sem1.No;
                    if (attrAdd.IsExit(MapAttrAttr.FK_MapData, this.MyPK, MapAttrAttr.KeyOfEn, sem1.No))
                    {
                        BP.Sys.PubClass.Alert("字段已经存在 [" + sem1.No + "]。");
                        BP.Sys.PubClass.WinClose();
                        return;
                    }

                    attrAdd.FK_MapData    = this.MyPK;
                    attrAdd.Name          = sem1.Name;
                    attrAdd.UIContralType = UIContralType.DDL;
                    attrAdd.UIBindKey     = sem1.No;
                    attrAdd.MyDataType    = BP.DA.DataType.AppInt;
                    attrAdd.LGType        = FieldTypeS.Enum;
                    attrAdd.DefVal        = "0";
                    attrAdd.UIIsEnable    = true;
                    if (this.Idx == null || this.Idx == "")
                    {
                        MapAttrs attrs1 = new MapAttrs(this.MyPK);
                        attrAdd.Idx = 0;
                    }
                    else
                    {
                        attrAdd.Idx = int.Parse(this.Idx);
                    }
                    attrAdd.Insert();
                    this.Response.Redirect("EditEnum.aspx?MyPK=" + this.MyPK + "&RefNo=" + attrAdd.MyPK, true);
                    this.WinClose();
                    return;

                case "DelEnum":
                    string      eKey = this.Request.QueryString["EnumKey"];
                    SysEnumMain sem  = new SysEnumMain();
                    sem.No = eKey;
                    sem.Delete();
                    this.WinClose();
                    return;

                case "AddSysEnum":
                    this.AddFEnum();
                    break;

                case "AddSFTable":
                    this.AddSFTable();
                    break;

                case "AddSFTableAttr":
                    SFTable sf = new SFTable(this.Request.QueryString["RefNo"]);
                    this.Response.Redirect("EditTable.aspx?MyPK=" + this.MyPK + "&SFKey=" + sf.No, true);
                    this.WinClose();
                    return;

                case "AddFG":     /*执行一个插入列组的命令.*/
                    switch (this.RefNo)
                    {
                    case "IsPass":
                        MapDtl dtl = new MapDtl(this.FK_MapData);
                        dtl.IsEnablePass = true;         /*更新是否启动审核分组字段.*/
                        MapAttr attr = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "Check_Note";
                        attr.Name          = "审核意见";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.DefVal        = "同意";
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = true;
                        attr.MaxLen        = 4000;
                        attr.ColSpan       = 4;   // 默认为4列。
                        attr.Idx           = 1;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "Checker";
                        attr.Name          = "审核人";// "审核人";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.DefVal        = "@WebUser.Name";
                        attr.UIIsEnable    = false;
                        attr.IsSigan       = true;
                        attr.Idx           = 2;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "IsPass";
                        attr.Name          = "通过否?";// "审核人";
                        attr.MyDataType    = DataType.AppBoolean;
                        attr.UIContralType = UIContralType.CheckBok;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.UIIsEnable    = false;
                        attr.IsSigan       = true;
                        attr.DefVal        = "1";
                        attr.Idx           = 2;
                        attr.DefVal        = "0";
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "Check_RDT";
                        attr.Name          = "审核日期"; // "审核日期";
                        attr.MyDataType    = DataType.AppDateTime;
                        attr.UIContralType = UIContralType.TB;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.DefVal        = "@RDT";
                        attr.UIIsEnable    = false;
                        attr.Idx           = 3;
                        attr.Insert();

                        /* 处理批次ID*/
                        attr            = new MapAttr();
                        attr.FK_MapData = this.FK_MapData;
                        attr.KeyOfEn    = "BatchID";
                        attr.Name       = "BatchID";  // this.ToE("IsPass", "是否通过");// "审核人";
                        attr.MyDataType = DataType.AppInt;
                        attr.UIIsEnable = false;
                        attr.UIIsLine   = false;
                        attr.UIIsEnable = false;
                        attr.UIVisible  = false;
                        attr.Idx        = 2;
                        attr.DefVal     = "0";
                        attr.Insert();

                        dtl.Update();
                        this.WinClose();
                        return;

                    case "Eval":         /* 质量评价 */
                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "EvalEmpNo";
                        attr.Name          = "被评价人员编号";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.UIIsEnable    = false;
                        attr.IsSigan       = true;
                        attr.Idx           = 1;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "EvalEmpName";
                        attr.Name          = "被评价人员名称";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.UIIsEnable    = false;
                        attr.IsSigan       = true;
                        attr.Idx           = 2;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "EvalCent";
                        attr.Name          = "工作得分";
                        attr.MyDataType    = DataType.AppFloat;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.UIIsEnable    = true;
                        attr.Idx           = 3;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "EvalNote";
                        attr.Name          = "评价信息";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsEnable    = true;
                        attr.Idx           = 4;
                        attr.Insert();
                        this.WinClose();
                        return;

                    default:
                        break;
                    }
                    break;

                case "AddFGroup":
                    this.AddFGroup();
                    return;

                case "AddF":
                case "ChoseFType":
                    this.AddF();
                    break;

                case "Up":
                    MapAttr attrU = new MapAttr(this.RefNo);
                    if (this.Request.QueryString["IsDtl"] != null)
                    {
                        attrU.DoDtlUp();
                    }
                    else
                    {
                        attrU.DoUp();
                    }

                    this.WinClose();
                    break;

                case "Down":     //让一个字段下移动.
                    MapAttr attrD = new MapAttr(this.RefNo);
                    attrD.DoDown();
                    this.WinClose();
                    break;

                case "DownAttr":     //让一个字段下移动.
                    MapAttr attrAttr = new MapAttr(this.RefNo);
                    attrAttr.DoDtlDown();
                    this.WinClose();
                    break;

                case "Jump":
                    MapAttr attrFrom = new MapAttr(this.Request.QueryString["FromID"]);
                    MapAttr attrTo   = new MapAttr(this.Request.QueryString["ToID"]);
                    attrFrom.DoJump(attrTo);
                    this.WinClose();
                    break;

                case "MoveTo":
                    string  toID     = this.Request.QueryString["ToID"];
                    int     toGFID   = int.Parse(this.Request.QueryString["ToGID"]);
                    int     fromGID  = int.Parse(this.Request.QueryString["FromGID"]);
                    string  fromID   = this.Request.QueryString["FromID"];
                    MapAttr fromAttr = new MapAttr();
                    fromAttr.MyPK = fromID;
                    fromAttr.Retrieve();
                    if (toGFID == fromAttr.GroupID && fromAttr.MyPK == toID)
                    {
                        /* 如果没有移动. */
                        this.WinClose();
                        return;
                    }
                    if (toGFID != fromAttr.GroupID && fromAttr.MyPK == toID)
                    {
                        MapAttr toAttr = new MapAttr(toID);
                        fromAttr.Update(MapAttrAttr.GroupID, toAttr.GroupID, MapAttrAttr.Idx, toAttr.Idx);
                        this.WinClose();
                        return;
                    }
                    this.Response.Redirect(this.Request.RawUrl.Replace("MoveTo", "Jump"), true);
                    return;

                case "Edit":
                    Edit();
                    break;

                case "Del":
                    MapAttr attrDel = new MapAttr();
                    attrDel.MyPK = this.RefNo;
                    attrDel.Delete();
                    this.WinClose();
                    break;

                case "GFDoUp":
                    GroupField gf = new GroupField(this.RefOID);
                    gf.DoUp();
                    gf.Retrieve();
                    if (gf.Idx == 0)
                    {
                        this.WinClose();
                        return;
                    }
                    int oidIdx = gf.Idx;
                    gf.Idx = gf.Idx - 1;
                    GroupField gfUp = new GroupField();
                    if (gfUp.Retrieve(GroupFieldAttr.EnName, gf.EnName, GroupFieldAttr.Idx, gf.Idx) == 1)
                    {
                        gfUp.Idx = oidIdx;
                        gfUp.Update();
                    }
                    gf.Update();
                    this.WinClose();
                    break;

                case "GFDoDown":
                    GroupField mygf = new GroupField(this.RefOID);
                    mygf.DoDown();
                    mygf.Retrieve();
                    int oidIdx1 = mygf.Idx;
                    mygf.Idx = mygf.Idx + 1;
                    GroupField gfDown = new GroupField();
                    if (gfDown.Retrieve(GroupFieldAttr.EnName, mygf.EnName, GroupFieldAttr.Idx, mygf.Idx) == 1)
                    {
                        gfDown.Idx = oidIdx1;
                        gfDown.Update();
                    }
                    mygf.Update();
                    this.WinClose();
                    break;

                case "AthDoUp":
                    FrmAttachment frmAth = new FrmAttachment(this.MyPK);
                    if (frmAth.RowIdx > 0)
                    {
                        frmAth.RowIdx = frmAth.RowIdx - 1;
                        frmAth.Update();
                    }
                    this.WinClose();
                    break;

                case "AthDoDown":
                    FrmAttachment frmAthD = new FrmAttachment(this.MyPK);
                    if (frmAthD.RowIdx < 10)
                    {
                        frmAthD.RowIdx = frmAthD.RowIdx + 1;
                        frmAthD.Update();
                    }
                    this.WinClose();
                    break;

                case "DtlDoUp":
                    MapDtl dtl1 = new MapDtl(this.MyPK);
                    if (dtl1.RowIdx > 0)
                    {
                        dtl1.RowIdx = dtl1.RowIdx - 1;
                        dtl1.Update();
                    }
                    this.WinClose();
                    break;

                case "DtlDoDown":
                    MapDtl dtl2 = new MapDtl(this.MyPK);
                    if (dtl2.RowIdx < 10)
                    {
                        dtl2.RowIdx = dtl2.RowIdx + 1;
                        dtl2.Update();
                    }
                    this.WinClose();
                    break;

                case "M2MDoUp":
                    MapM2M ddtl1 = new MapM2M(this.MyPK);
                    if (ddtl1.RowIdx > 0)
                    {
                        ddtl1.RowIdx = ddtl1.RowIdx - 1;
                        ddtl1.Update();
                    }
                    this.WinClose();
                    break;

                case "M2MDoDown":
                    MapM2M ddtl2 = new MapM2M(this.MyPK);
                    if (ddtl2.RowIdx < 10)
                    {
                        ddtl2.RowIdx = ddtl2.RowIdx + 1;
                        ddtl2.Update();
                    }
                    this.WinClose();
                    break;

                case "FrameDoUp":
                    MapFrame frame1 = new MapFrame(this.MyPK);
                    if (frame1.RowIdx > 0)
                    {
                        frame1.RowIdx = frame1.RowIdx - 1;
                        frame1.Update();
                    }
                    this.WinClose();
                    break;

                case "FrameDoDown":
                    MapFrame frame2 = new MapFrame(this.MyPK);
                    if (frame2.RowIdx < 10)
                    {
                        frame2.RowIdx = frame2.RowIdx + 1;
                        frame2.Update();
                    }
                    this.WinClose();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Pub1.AddMsgOfWarning("错误:", ex.Message + " <br>" + this.Request.RawUrl);
            }
        }
        void btn_Copy_Click(object sender, EventArgs e)
        {
            BP.WF.Node nd  = new BP.WF.Node(this.FK_Node);
            Node       sNd = new Node(this.NodeOfSelect);

            BP.En.Attrs attrs     = sNd.HisWork.EnMap.Attrs;
            BP.En.Attrs attrsCopy = nd.HisWork.EnMap.Attrs;

            // 开始copy 分组的节点。
            GroupFields gfs  = new GroupFields(this.NodeOfSelect);
            MapDtls     dtls = new MapDtls(this.NodeOfSelect);
            MapM2Ms     m2ms = new MapM2Ms(this.NodeOfSelect);
            MapFrames   frms = new MapFrames(this.NodeOfSelect);

            foreach (GroupField gf in gfs)
            {
                CheckBox cb = this.Pub2.GetCBByID("CB" + gf.OID);
                if (cb.Checked == false)
                {
                    continue;
                }

                // 生成一个分组实体.
                GroupField mygf = new GroupField();
                mygf.Lab    = gf.Lab;
                mygf.EnName = this.FK_Node;
                mygf.Idx    = gf.Idx;
                mygf.Insert();

                foreach (MapM2M m2m in m2ms)
                {
                    if (m2m.GroupID != gf.OID)
                    {
                        continue;
                    }

                    MapM2M mym2m = new MapM2M();
                    mym2m.MyPK = m2m.MyPK.Replace(this.NodeOfSelect, this.FK_Node);
                    //  mym2m.FK_MapData =this
                    if (mym2m.IsExits)
                    {
                        continue;
                    }

                    mym2m.Copy(m2m);
                    mym2m.FK_MapData = this.FK_Node;
                    mym2m.GroupID    = mygf.OID;
                    mym2m.MyPK       = m2m.MyPK.Replace(this.NodeOfSelect, this.FK_Node);
                    mym2m.Insert();
                }

                foreach (MapFrame frm in frms)
                {
                    if (frm.GroupID != gf.OID)
                    {
                        continue;
                    }

                    MapFrame myen = new MapFrame();
                    myen.MyPK = frm.MyPK.Replace(this.NodeOfSelect, this.FK_Node);
                    if (myen.IsExits)
                    {
                        continue;
                    }

                    myen.Copy(frm);
                    myen.FK_MapData = this.FK_Node;
                    myen.GroupID    = mygf.OID;
                    myen.MyPK       = frm.MyPK.Replace(this.NodeOfSelect, this.FK_Node);
                    myen.Insert();
                }

                // 复制从表.
                foreach (MapDtl dtl in dtls)
                {
                    cb = this.Pub2.GetCBByID("CB_" + dtl.No + gf.OID);
                    MapDtl dtlNew = new MapDtl();
                    dtlNew.No = dtl.No.Replace(this.NodeOfSelect, this.FK_Node);
                    if (dtlNew.IsExits)
                    {
                        continue;
                    }

                    dtlNew.Copy(dtl);
                    dtlNew.FK_MapData = this.FK_Node;
                    dtlNew.No         = dtl.No.Replace(this.NodeOfSelect, this.FK_Node);

                    //  dtlNew.No = this.FK_Node + "Dtl";
                    // dtlNew.No = dtl.No.Replace(this.FK_Node, this.NodeOfSelect);

                    dtlNew.IsInsert = false;
                    dtlNew.IsUpdate = false;
                    dtlNew.IsDelete = false;

                    dtlNew.GroupID = mygf.OID;
                    dtlNew.PTable  = dtlNew.No;

                    dtlNew.Insert();

                    // 复制从表里面的明细。
                    int      idx    = 0;
                    MapAttrs mattrs = new MapAttrs(dtl.No);
                    foreach (MapAttr attr in mattrs)
                    {
                        MapAttr attrNew = new MapAttr();
                        attrNew.Copy(attr);
                        attrNew.FK_MapData = dtlNew.No;
                        attrNew.UIIsEnable = false;
                        if (attrNew.DefVal.Contains("@"))
                        {
                            attrNew.DefVal = "";
                        }

                        dtlNew.RowIdx       = idx;
                        attrNew.HisEditType = EditType.Edit;
                        attrNew.Insert();
                    }
                }

                // copy his fields.
                MapAttrs willCopyAttrs = new MapAttrs();
                willCopyAttrs.Retrieve(MapAttrAttr.GroupID, gf.OID, MapAttrAttr.Idx);
                int idx1 = 0;
                foreach (MapAttr attr in willCopyAttrs)
                {
                    MapAttr attrNew = new MapAttr();
                    if (attrNew.IsExit(MapAttrAttr.FK_MapData, this.FK_Node,
                                       MapAttrAttr.KeyOfEn, attr.KeyOfEn) == true)
                    {
                        continue;
                    }

                    if (attr.UIVisible == false)
                    {
                        continue;
                    }

                    idx1++;
                    attrNew.Copy(attr);
                    attrNew.GroupID    = mygf.OID;
                    attrNew.FK_MapData = this.FK_Node;
                    attrNew.UIIsEnable = false;
                    attrNew.Idx        = idx1;
                    if (attrNew.KeyOfEn == "Title")
                    {
                        attrNew.HisEditType = EditType.Edit;
                    }

                    attrNew.HisEditType = EditType.Edit;
                    attrNew.DefVal      = "";
                    attrNew.Insert();
                }
            }


            int GroupField = this.Pub2.GetDDLByID("DDL_GroupField").SelectedItemIntVal;

            foreach (Attr attr in attrs)
            {
                if (this.Pub2.IsExit(attr.Key) == false)
                {
                    continue;
                }
                CheckBox cb = this.Pub2.GetCBByID(attr.Key);
                if (cb.Checked == false)
                {
                    continue;
                }

                BP.Sys.MapAttr ma = new BP.Sys.MapAttr();
                int            i  = ma.Retrieve(BP.Sys.MapAttrAttr.KeyOfEn, attr.Key,
                                                BP.Sys.MapAttrAttr.FK_MapData, this.NodeOfSelect);

                BP.Sys.MapAttr ma1     = new BP.Sys.MapAttr();
                bool           ishavle = ma1.IsExit(BP.Sys.MapAttrAttr.KeyOfEn, attr.Key,
                                                    BP.Sys.MapAttrAttr.FK_MapData, this.FK_Node);

                if (ishavle)
                {
                    continue;
                }


                ma1.Copy(ma);

                ma1.FK_MapData = this.FK_Node;
                ma1.KeyOfEn    = ma.KeyOfEn;
                ma1.Name       = ma.Name;
                ma1.GroupID    = GroupField;
                ma1.UIIsEnable = false;

                ma1.HisEditType = EditType.Edit;

                if (ma1.DefVal != null && ma1.DefVal.Contains("@"))
                {
                    ma1.DefVal = "";
                }
                ma1.Insert();
            }

            if (this.Pub2.IsExit("CB_Table"))
            {
                if (this.Pub2.GetCBByID("CB_Table").Checked)
                {
                    MapData md1 = new MapData(this.NodeOfSelect);
                    MapData md2 = new MapData(this.FK_Node);
                    //md2.CellsX = md1.CellsX;
                    //md2.CellsY = md1.CellsY;
                    md2.Update();

                    //MapAttrs ma1 = md1.GenerHisTableCells;
                    // 删除历史数据。

                    //ma1.Delete(MapAttrAttr.FK_MapData, this.FK_Node + "T");
                    //foreach (MapAttr attr in ma1)
                    //{
                    //    MapAttr attr2 = new MapAttr();
                    //    attr2.Copy(attr);
                    //    // attr2.OID = 0;
                    //    attr2.GroupID = 0;
                    //    attr2.Idx = 0;
                    //    attr2.FK_MapData = this.FK_Node + "T";
                    //    attr2.UIIsEnable = false;
                    //    attr2.Insert();
                    //}
                }
            }

            this.WinClose();
            //this.WinCloseWithMsg("复制成功");
            //this.Response.Redirect("MapDef.aspx?PK=" + this.FK_Node + "&NodeOfSelect=" + this.NodeOfSelect);
        }
Пример #20
0
        public string Imp_Src_Step3_Save()
        {
            string hidImpFields = this.GetRequestVal("hidImpFields");

            string[] fields = hidImpFields.TrimEnd(',').Split(',');

            MapData md = new MapData();

            md.No = this.FK_MapData;
            md.RetrieveFromDBSources();


            string msg    = "导入字段信息:";
            bool   isLeft = true;
            float  maxEnd = md.MaxEnd; //底部.

            for (int i = 0; i < fields.Length; i++)
            {
                string colname = fields[i];

                MapAttr ma = new MapAttr();
                ma.KeyOfEn    = colname;
                ma.Name       = this.GetRequestVal("TB_Desc_" + colname);
                ma.FK_MapData = this.FK_MapData;
                ma.MyDataType = int.Parse(this.GetRequestVal("DDL_DBType_" + colname));
                ma.MaxLen     = int.Parse(this.GetRequestVal("TB_Len_" + colname));
                ma.UIBindKey  = this.GetRequestVal("TB_BindKey_" + colname);
                ma.MyPK       = this.FK_MapData + "_" + ma.KeyOfEn;
                ma.LGType     = BP.En.FieldTypeS.Normal;

                if (ma.UIBindKey != "")
                {
                    SysEnums se = new SysEnums();
                    se.Retrieve(SysEnumAttr.EnumKey, ma.UIBindKey);
                    if (se.Count > 0)
                    {
                        ma.MyDataType    = BP.DA.DataType.AppInt;
                        ma.LGType        = BP.En.FieldTypeS.Enum;
                        ma.UIContralType = BP.En.UIContralType.DDL;
                    }

                    SFTable tb = new SFTable();
                    tb.No = ma.UIBindKey;
                    if (tb.IsExits == true)
                    {
                        ma.MyDataType    = BP.DA.DataType.AppString;
                        ma.LGType        = BP.En.FieldTypeS.FK;
                        ma.UIContralType = BP.En.UIContralType.DDL;
                    }
                }

                if (ma.MyDataType == BP.DA.DataType.AppBoolean)
                {
                    ma.UIContralType = BP.En.UIContralType.CheckBok;
                }
                if (ma.IsExits)
                {
                    continue;
                }
                ma.Insert();

                msg += "\t\n字段:" + ma.KeyOfEn + "" + ma.Name + "加入成功.";
                FrmLab lab = null;
                if (isLeft == true)
                {
                    maxEnd = maxEnd + 40;
                    /* 是否是左边 */
                    lab            = new FrmLab();
                    lab.MyPK       = BP.DA.DBAccess.GenerGUID();
                    lab.FK_MapData = this.FK_MapData;
                    lab.Text       = ma.Name;
                    lab.X          = 40;
                    lab.Y          = maxEnd;
                    lab.Insert();

                    ma.X = lab.X + 80;
                    ma.Y = maxEnd;
                    ma.Update();
                }
                else
                {
                    lab            = new FrmLab();
                    lab.MyPK       = BP.DA.DBAccess.GenerGUID();
                    lab.FK_MapData = this.FK_MapData;
                    lab.Text       = ma.Name;
                    lab.X          = 350;
                    lab.Y          = maxEnd;
                    lab.Insert();

                    ma.X = lab.X + 80;
                    ma.Y = maxEnd;
                    ma.Update();
                }
                isLeft = !isLeft;
            }

            //重新设置.
            md.ResetMaxMinXY();

            return(msg);
        }