Ejemplo n.º 1
0
        public List <TimeSeries> GetTimeSeries(String jsonString)
        {
            JArray jsonVal = JArray.Parse(jsonString);

            foreach (JObject jObject in jsonVal)
            {
                foreach (JProperty jProperty in jObject.Properties())
                {
                    switch (jProperty.Name.ToString())
                    {
                    case "TimeSeries":
                        MapFrames mapframe = new MapFrames();
                        return(mapframe.MapTimeSeries(jProperty));
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行旧版本的兼容性检查.
        /// </summary>
        public string DoCheckFixFrmForUpdateVer()
        {
            // 更新状态.
            DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlType='' WHERE CtrlType IS NULL");
            DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL");
            DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL");

            //删除重影数据.
            DBAccess.RunSQL("DELETE FROM Sys_GroupField WHERE CtrlType='FWC' and CTRLID is null");



            //一直遇到遇到自动变长的问题, 强制其修复过来.
            DBAccess.RunSQL("UPDATE Sys_Mapattr SET colspan=3 WHERE UIHeight<=38 AND colspan=4");

            string str = "";

            //处理失去分组的字段.
            string   sql   = "SELECT MyPK FROM Sys_MapAttr WHERE FK_MapData='" + this.No + "' AND GroupID NOT IN (SELECT OID FROM Sys_GroupField WHERE FrmID='" + this.No + "' AND ( CtrlType='' OR CtrlType IS NULL)  )  OR GroupID IS NULL ";
            MapAttrs attrs = new MapAttrs();

            attrs.RetrieveInSQL(sql);
            if (attrs.Count != 0)
            {
                GroupField  gf  = null;
                GroupFields gfs = new GroupFields(this.No);
                foreach (GroupField mygf in gfs)
                {
                    if (mygf.CtrlID == "")
                    {
                        gf = mygf;
                    }
                }

                if (gf == null)
                {
                    gf       = new GroupField();
                    gf.Lab   = "基本信息";
                    gf.FrmID = this.No;
                    gf.Insert();
                }

                //设置GID.
                foreach (MapAttr attr in attrs)
                {
                    attr.Update(MapAttrAttr.GroupID, gf.OID);
                }
            }

            //从表.
            MapDtls dtls = new MapDtls(this.No);

            foreach (MapDtl dtl in dtls)
            {
                GroupField gf = new GroupField();
                int        i  = gf.Retrieve(GroupFieldAttr.CtrlID, dtl.No, GroupFieldAttr.FrmID, this.No);
                if (i == 1)
                {
                    continue;
                }

                //GroupField gf = new GroupField();
                //if (gf.IsExit(GroupFieldAttr.CtrlID, dtl.No) == true && !DataType.IsNullOrEmpty(gf.CtrlType))
                //    continue;

                gf.Lab      = dtl.Name;
                gf.CtrlID   = dtl.No;
                gf.CtrlType = "Dtl";
                gf.FrmID    = dtl.FK_MapData;
                gf.DirectSave();
                str += "@为从表" + dtl.Name + " 增加了分组.";
            }

            // 框架.
            MapFrames frams = new MapFrames(this.No);

            foreach (MapFrame fram in frams)
            {
                GroupField gf = new GroupField();
                int        i  = gf.Retrieve(GroupFieldAttr.CtrlID, fram.MyPK, GroupFieldAttr.FrmID, this.No);
                if (i == 1)
                {
                    continue;
                }

                gf.Lab      = fram.Name;
                gf.CtrlID   = fram.MyPK;
                gf.CtrlType = "Frame";
                gf.EnName   = fram.FK_MapData;
                gf.Insert();

                str += "@为框架 " + fram.Name + " 增加了分组.";
            }

            // 附件.
            FrmAttachments aths = new FrmAttachments(this.No);

            foreach (FrmAttachment ath in aths)
            {
                if (ath.IsVisable == false)
                {
                    continue;
                }

                GroupField gf = new GroupField();
                int        i  = gf.Retrieve(GroupFieldAttr.CtrlID, ath.MyPK, GroupFieldAttr.FrmID, this.No);
                if (i == 1)
                {
                    continue;
                }

                gf.Lab      = ath.Name;
                gf.CtrlID   = ath.MyPK;
                gf.CtrlType = "Ath";
                gf.FrmID    = ath.FK_MapData;
                gf.Insert();

                str += "@为附件 " + ath.Name + " 增加了分组.";
            }

            if (this.IsNodeFrm == true)
            {
                FrmNodeComponent conn = new FrmNodeComponent(this.NodeID);
                conn.Update();
            }


            //删除重复的数据, 比如一个从表显示了多个分组里. 增加此部分.
            if (SystemConfig.AppCenterDBType == DBType.Oracle)
            {
                sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) WHERE Num > 1";
            }
            else
            {
                sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) AS A WHERE A.Num > 1";
            }

            DataTable dt = DBAccess.RunSQLReturnTable(sql);

            foreach (DataRow dr in dt.Rows)
            {
                string enName   = dr[0].ToString();
                string ctrlID   = dr[1].ToString();
                string ctrlType = dr[2].ToString();

                GroupFields gfs = new GroupFields();
                gfs.Retrieve(GroupFieldAttr.FrmID, enName, GroupFieldAttr.CtrlID, ctrlID, GroupFieldAttr.CtrlType, ctrlType);

                if (gfs.Count <= 1)
                {
                    continue;
                }
                foreach (GroupField gf in gfs)
                {
                    gf.Delete(); //删除其中的一个.
                    break;
                }
            }



            if (str == "")
            {
                return("检查成功.");
            }

            return(str + ", @@@ 检查成功。");
        }
Ejemplo n.º 3
0
        public void BindList(MapData md)
        {
            MapFrames dtls = new MapFrames(md.No);

            if (dtls.Count == 0)
            {
                this.Response.Redirect("MapFrame.aspx?DoType=New&FK_MapData=" + this.FK_MapData + "&sd=sd", true);
                return;
            }

            if (dtls.Count == 1)
            {
                MapFrame d = (MapFrame)dtls[0];
                this.Response.Redirect("MapFrame.aspx?DoType=Edit&FK_MapData=" + this.FK_MapData + "&FK_MapFrame=" + d.MyPK, true);
                return;
            }

            this.Pub1.AddTable();
            this.Pub1.AddCaptionLeft("<a href='MapDef.aspx?MyPK=" + this.MyPK + "'>返回:" + md.Name + "</a> - <a href='MapFrame.aspx?DoType=New&FK_MapData=" + this.FK_MapData + "&sd=sd'><img src='../Img/Btn/New.gif' border=0/>新建</a>");
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("IDX");
            this.Pub1.AddTDTitle("编号");
            this.Pub1.AddTDTitle("名称");
            this.Pub1.AddTDTitle("操作");
            this.Pub1.AddTREnd();

            TB  tb = new TB();
            int i  = 0;

            foreach (MapFrame dtl in dtls)
            {
                i++;
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(i);
                this.Pub1.AddTD(dtl.MyPK);
                this.Pub1.AddTD(dtl.Name);
                this.Pub1.AddTD("<a href='MapFrame.aspx?FK_MapData=" + this.FK_MapData + "&DoType=Edit&FK_MapFrame=" + dtl.MyPK + "'>编辑</a>");
                this.Pub1.AddTREnd();
                continue;

                tb      = new TB();
                tb.ID   = "TB_No_" + dtl.MyPK;
                tb.Text = dtl.MyPK;
                this.Pub1.AddTD(tb);

                tb      = new TB();
                tb.ID   = "TB_Name_" + dtl.MyPK;
                tb.Text = dtl.Name;
                this.Pub1.AddTD(tb);

                this.Pub1.AddTD("<a href='MapFrame.aspx?FK_MapData=" + this.FK_MapData + "&DoType=Edit&FK_MapFrame=" + dtl.MyPK + "'>编辑</a>");
                this.Pub1.AddTREnd();
            }

            //this.Pub1.AddTRSum();
            //Button btn = new Button();
            //btn.ID = "Btn_Save";
            //btn.Text = "保存";
            //btn.Click += new EventHandler(btn_Click);
            //this.Pub1.AddTD("colspan=5", btn);
            //this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "字段复制";

            BP.WF.Node  nd  = new BP.WF.Node(this.FK_Node);
            BP.WF.Nodes nds = new BP.WF.Nodes(nd.FK_Flow);

            Node sNd = new Node(this.NodeOfSelect);

            MapAttrs attrs     = new MapAttrs(this.NodeOfSelect);
            MapAttrs attrsCopy = new MapAttrs(this.FK_Node);


            this.Pub1.AddFieldSet("选择节点");
            this.Pub1.AddUL("Main");
            foreach (BP.WF.Node en in nds)
            {
                if (this.NodeOfSelect == en.NodeID.ToString())
                {
                    this.Pub1.AddLiB("CopyFieldFromNode.aspx?FK_Node=" + this.FK_Node + "&NodeOfSelect=ND" + en.NodeID, "步骤:" + en.Step + ",名称:" + en.Name);
                }
                else
                {
                    this.Pub1.AddLi("CopyFieldFromNode.aspx?FK_Node=" + this.FK_Node + "&NodeOfSelect=ND" + en.NodeID, "步骤:" + en.Step + ",名称:" + en.Name);
                }
            }
            this.Pub1.AddULEnd();
            this.Pub1.AddFieldSetEnd();

            this.Pub2.AddTable("width='500px'");

            //this.Pub2.AddTR();
            //this.Pub2.AddTDTitle(this.ToE("Field", "字段"));
            ////this.Pub2.AddTDTitle("描述");
            ////this.Pub2.AddTDTitle("类型");
            ////this.Pub2.AddTDTitle(this.ToE("Show", "显示"));
            //this.Pub2.AddTREnd();

            GroupFields gfs  = new GroupFields(this.NodeOfSelect);
            MapDtls     dtls = new MapDtls(this.NodeOfSelect);
            MapM2Ms     m2ms = new MapM2Ms(this.NodeOfSelect);
            MapFrames   frms = new MapFrames(this.NodeOfSelect);

            bool isHave = false;

            foreach (GroupField gf in gfs)
            {
                this.Pub2.AddTRSum();
                CheckBox cb = new CheckBox();
                cb.ID   = "CB" + gf.OID;
                cb.Text = "<b>" + gf.Lab + "</b>";
                this.Pub2.AddTD(cb);
                this.Pub2.AddTREnd();

                foreach (MapDtl dtl in dtls)
                {
                    if (dtl.GroupID != gf.OID)
                    {
                        continue;
                    }

                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + dtl.No + "_" + dtl.GroupID;
                    cb.Text = "从表:" + dtl.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }

                foreach (MapM2M m2m in m2ms)
                {
                    if (m2m.GroupID != gf.OID)
                    {
                        continue;
                    }
                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + m2m.MyPK + "_" + m2m.GroupID;
                    cb.Text = "多选" + ":" + m2m.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }

                foreach (MapFrame frm in frms)
                {
                    if (frm.GroupID != gf.OID)
                    {
                        continue;
                    }
                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + frm.MyPK + "_" + frm.GroupID;
                    cb.Text = "框架" + ":" + frm.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }


                this.Pub2.AddTR();
                this.Pub2.AddTDBigDocBegain();
                foreach (MapAttr attr in attrs)
                {
                    if (gf.OID != attr.GroupID)
                    {
                        continue;
                    }

                    switch (attr.KeyOfEn)
                    {
                    case BP.WF.GEStartWorkAttr.CDT:
                    case BP.WF.GEStartWorkAttr.Emps:
                    case BP.WF.GEStartWorkAttr.FID:
                    case BP.WF.GEStartWorkAttr.OID:
                    case BP.WF.GEStartWorkAttr.RDT:
                    case BP.WF.GEStartWorkAttr.Rec:
                    case BP.WF.GEStartWorkAttr.FK_NY:
                    case BP.WF.GEStartWorkAttr.WFState:
                    case BP.WF.GEStartWorkAttr.MyNum:
                    case BP.WF.GEStartWorkAttr.FK_Dept:
                    case BP.WF.GEStartWorkAttr.FK_DeptText:
                        continue;

                    default:
                        break;
                    }

                    cb      = new CheckBox();
                    cb.ID   = attr.KeyOfEn;
                    cb.Text = attr.KeyOfEn + " " + attr.Name;

                    if (attrsCopy.Contains(MapAttrAttr.KeyOfEn, attr.KeyOfEn))
                    {
                        cb.Enabled = false;
                    }
                    else
                    {
                        cb.Enabled = true;
                    }

                    isHave = true;
                    this.Pub2.Add(cb);
                }
                this.Pub2.AddTDEnd();
                this.Pub2.AddTREnd();
            }

            this.Pub2.AddTableEndWithBR();
            Button btn = new Button();

            btn.CssClass = "Btn";
            if (isHave == false)
            {
                return;
            }
            this.Pub2.Add("到分组:");
            gfs = new GroupFields(this.FK_Node);
            BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_GroupField";
            ddl.Bind(gfs, GroupFieldAttr.OID, GroupFieldAttr.Lab);
            ddl.SetSelectItem(this.GroupField);
            this.Pub2.Add(ddl);
            btn.ID   = "Btn_OK";
            btn.Text = " 复制 ";

            btn.UseSubmitBehavior = false;
            btn.OnClientClick     = "this.disabled=true;";
            //this.disabled='disabled'; return true;";
            // btn.Attributes["onclick"] = " return confirm('您确定要复制选择的字段到 [" + nd.Name + "]表单中吗?');";
            // btn.Attributes["onclick"] = " return confirm('" + this.ToE("AYS", "您确定要复制选择的字段到 [" + nd.Name + "]表单中吗?") + "');";

            btn.Click += new EventHandler(btn_Copy_Click);
            this.Pub2.Add(btn);
        }
        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);
        }