Example #1
0
        public string Fields_Save()
        {
            Node currND = new Node(this.FK_Node);

            string FieldsAttrsObj = this.GetRequestVal("FieldsAttrsObj");
            var    jsonSetting    = new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            };
            List <FieldsAttrs> fieldsAttrsList = JsonConvert.DeserializeObject <List <FieldsAttrs> >(FieldsAttrsObj, jsonSetting);

            if (fieldsAttrsList == null)
            {
                return("0");
            }

            MapAttrs attrs = new MapAttrs();
            //增加排序
            QueryObject obj = new QueryObject(attrs);

            obj.AddWhere(MapAttrAttr.FK_MapData, this.FK_MapData);
            obj.DoQuery();

            foreach (MapAttr attr in attrs)
            {
                foreach (FieldsAttrs fieldsAttrs in fieldsAttrsList)
                {
                    if (!attr.KeyOfEn.Equals(fieldsAttrs.KeyOfEn))
                    {
                        continue;
                    }

                    if (currND.HisFormType == NodeFormType.RefOneFrmTree)
                    {
                        attr.UIVisible  = fieldsAttrs.UIVisible;
                        attr.UIIsEnable = fieldsAttrs.UIIsEnable;
                        attr.IsSigan    = fieldsAttrs.IsSigan;
                        attr.DefVal     = fieldsAttrs.DefVal;
                        attr.UIIsInput  = fieldsAttrs.IsNotNull;
                        attr.FK_MapData = this.FK_MapData;
                        attr.KeyOfEn    = attr.KeyOfEn;
                        attr.Name       = attr.Name;
                        attr.Update();

                        //如果是表单库表单,需要写入MapAttr
                        if (DataType.IsNullOrEmpty(fieldsAttrs.RegularExp) == false)
                        {
                            MapExt ext       = new MapExt();
                            bool   extisExit = ext.IsExit("MyPK", "RegularExpression_" + this.FK_MapData + "_" + fieldsAttrs.KeyOfEn + "_onchange");

                            ext.FK_MapData = this.FK_MapData;
                            ext.ExtType    = MapExtXmlList.RegularExpression;
                            ext.DoWay      = 0;
                            ext.AttrOfOper = fieldsAttrs.KeyOfEn;
                            ext.Doc        = fieldsAttrs.RegularExp;
                            ext.Tag        = "onchange";
                            ext.Tag1       = "格式不正确!";

                            if (extisExit)
                            {
                                ext.Update();
                            }
                            else
                            {
                                ext.MyPK = "RegularExpression_" + this.FK_MapData + "_" + fieldsAttrs.KeyOfEn + "_onchange";
                                ext.Insert();
                            }
                        }
                    }

                    FrmField frmField = new FrmField();
                    bool     isExit   = frmField.IsExit("MyPK",
                                                        this.FK_MapData + "_" + this.FK_Flow + "_" + this.FK_Node + "_" + fieldsAttrs.KeyOfEn + "_" + FrmEleType.Field);

                    frmField.UIVisible          = fieldsAttrs.UIVisible;
                    frmField.UIIsEnable         = fieldsAttrs.UIIsEnable;
                    frmField.IsSigan            = fieldsAttrs.IsSigan;
                    frmField.DefVal             = fieldsAttrs.DefVal;
                    frmField.IsNotNull          = fieldsAttrs.IsNotNull;
                    frmField.RegularExp         = fieldsAttrs.RegularExp;
                    frmField.IsWriteToFlowTable = fieldsAttrs.IsWriteToFlowTable;
                    //frmField.IsWriteToGenerWorkFlow = fieldsAttrs.IsWriteToGenerWorkFlow;  //sln无此属性
                    frmField.FK_Node    = this.FK_Node;
                    frmField.FK_Flow    = this.FK_Flow;
                    frmField.FK_MapData = this.FK_MapData;
                    frmField.KeyOfEn    = attr.KeyOfEn;
                    frmField.Name       = attr.Name;

                    if (isExit)
                    {
                        frmField.Update();
                    }
                    else
                    {
                        frmField.Insert();
                    }
                }
            }

            return(fieldsAttrsList.Count.ToString());
        }
Example #2
0
        void btn_Field_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;

            if (btn.ID == "Btn_Del")
            {
                FrmFields fss1 = new FrmFields();
                fss1.Delete(FrmFieldAttr.FK_MapData, this.FK_MapData,
                            FrmFieldAttr.FK_Node, int.Parse(this.FK_Node));
                this.Response.Redirect("Sln.aspx?FK_Flow=" + this.FK_Flow + "&FK_Node=" + this.FK_Node + "&FK_MapData=" + this.FK_MapData + "&IsOk=1&DoType=Field", true);
                return;
            }

            //表单属性
            MapAttrs attrs = new MapAttrs();
            //增加排序
            QueryObject obj = new QueryObject(attrs);

            obj.AddWhere(MapAttrAttr.FK_MapData, this.FK_MapData);
            obj.addOrderBy(MapAttrAttr.Y, MapAttrAttr.X);
            obj.DoQuery();

            // 查询出来解决方案.
            FrmFields fss = new  FrmFields();

            fss.Delete(FrmFieldAttr.FK_MapData, this.FK_MapData, FrmFieldAttr.FK_Node, int.Parse(this.FK_Node));

            foreach (MapAttr attr in attrs)
            {
                switch (attr.KeyOfEn)
                {
                case BP.WF.WorkAttr.RDT:
                case BP.WF.WorkAttr.FID:
                case BP.WF.WorkAttr.OID:
                case BP.WF.WorkAttr.Rec:
                case BP.WF.WorkAttr.MyNum:
                case BP.WF.WorkAttr.MD5:
                case BP.WF.WorkAttr.Emps:
                case BP.WF.WorkAttr.CDT:
                    continue;

                default:
                    break;
                }

                bool isChange  = false;
                bool UIVisible = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_UIVisible").Checked;
                if (attr.UIVisible != UIVisible)
                {
                    isChange = true;
                }

                bool UIIsEnable = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_UIIsEnable").Checked;
                if (attr.UIIsEnable != UIIsEnable)
                {
                    isChange = true;
                }

                bool IsSigan = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_IsSigan").Checked;
                if (attr.IsSigan != IsSigan)
                {
                    isChange = true;
                }

                string defVal = this.Pub2.GetTextBoxByID("TB_" + attr.KeyOfEn + "_DefVal").Text;
                if (attr.DefValReal != defVal)
                {
                    isChange = true;
                }

                bool IsNotNull = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_IsNotNull").Checked;
                if (IsNotNull == true)
                {
                    isChange = true;
                }

                bool IsWriteToFlowTable = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_" + FrmFieldAttr.IsWriteToFlowTable).Checked;
                if (IsWriteToFlowTable == true)
                {
                    isChange = true;
                }

                string exp = this.Pub2.GetTextBoxByID("TB_" + attr.KeyOfEn + "_RegularExp").Text;
                if (string.IsNullOrEmpty(exp))
                {
                    isChange = true;
                }

                if (isChange == false)
                {
                    continue;
                }

                FrmField sln = new FrmField();
                sln.UIVisible  = UIVisible;
                sln.UIIsEnable = UIIsEnable;
                sln.IsSigan    = IsSigan;
                sln.DefVal     = defVal;

                sln.IsNotNull          = IsNotNull;
                sln.RegularExp         = exp;
                sln.IsWriteToFlowTable = IsWriteToFlowTable;
                sln.FK_Node            = int.Parse(this.FK_Node);
                sln.FK_Flow            = this.FK_Flow;

                sln.FK_MapData = this.FK_MapData;
                sln.KeyOfEn    = attr.KeyOfEn;
                sln.Name       = attr.Name;

                sln.MyPK = this.FK_MapData + "_" + this.FK_Flow + "_" + this.FK_Node + "_" + attr.KeyOfEn;
                sln.Insert();
            }
            this.Response.Redirect("Sln.aspx?FK_Flow=" + this.FK_Flow + "&FK_Node=" + this.FK_Node + "&FK_MapData=" + this.FK_MapData + "&IsOk=1&DoType=Field", true);
        }