예제 #1
0
 /// <summary>
 /// 设置控件元素的形状参数
 /// </summary>
 /// <param name="rcRect"></param>
 /// <param name="GenerAttribute"></param>
 private void SetRect(out FormProvoider.Rect rcRect, GeneralAttribute GenerAttribute)
 {
     rcRect.left   = GenerAttribute.Left;
     rcRect.right  = GenerAttribute.Left + GenerAttribute.Width;
     rcRect.top    = GenerAttribute.Top;
     rcRect.bottom = GenerAttribute.Top + GenerAttribute.Height;
 }
예제 #2
0
 public void SaveAssets(AssetsMain main, GeneralAttribute attr)
 {
     main.InputTime    = DateTime.Now;
     main.ExtDataTable = "ASSETS_GENERAL";
     _assetsMainRep.Save(main);
     attr.AssetsNum = main.AssetsNum;
     _generalRep.Save(attr);
 }
예제 #3
0
        public int UpdateAssetsEx(AssetsMain main, GeneralAttribute attr)
        {
            main.InputTime    = DateTime.Now;
            main.ExtDataTable = "ASSETS_GENERAL";
            _assetsMainRep.Save(main);
            attr.AssetsNum = main.AssetsNum;
            _generalRep.Update(attr);

            var result = _assetsMainRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);

            return(result.EntityId);
        }
예제 #4
0
        /// <summary>
        /// 生成表单文件
        /// </summary>
        /// <param name="formDesignerWorkbenchWindow"></param>
        /// <param name="FilePath"></param>
        /// <returns></returns>
        //public bool Execute(FormDesignerWorkbenchWindow formDesignerWorkbenchWindow, out string xmlString)
        //{
        //    bool isCheckerok = true;
        //    xmlString = string.Empty;
        //    try
        //    {
        //        List<object> list = new List<object>();
        //        list.Add(formDesignerWorkbenchWindow.formValidatesCollection);
        //        //list.Add(formDesignerWorkbenchWindow.dataDefineResource);
        //        list.Add(formDesignerWorkbenchWindow.formDataCollection);
        //        list.Add(formDesignerWorkbenchWindow.formRightsCollection);
        //        BuildRuleChecker.CheckReference(formDesignerWorkbenchWindow);
        //        string message = string.Empty;
        //        if (isCheckerok)
        //        {
        //            xmlString = DistFormXmlBuilder.BuildXml(list,formDesignerWorkbenchWindow,
        //                formDesignerWorkbenchWindow.SheetLayoutXML);
        //        }
        //    }
        //    catch(Exception E)
        //    {
        //        isCheckerok = false;
        //        MessageBox.Show(E.Message);
        //    }
        //    return isCheckerok;
        //}

        /// <summary>
        /// 读取单个表单文件
        /// </summary>
        /// <param name="dockFormDesigner"></param>
        /// <param name="filePath"></param>
        public void ResetXml(DockFormDesigner dockFormDesigner, string fileContent)
        {
            #region
            //控件
            FormXmlParser formXmlParser = new FormXmlParser(fileContent, true);
            PageProperty.IsPrint = formXmlParser.GetPrintProperty("/Form", "isprint");

            Dictionary <string, string> dic = new Dictionary <string, string>();
            ControlCollection           controlCollection = formXmlParser.GetControls(dockFormDesigner, "/Form/Control", out dic);

            string width, height;
            dic.TryGetValue("width", out width);
            dic.TryGetValue("height", out height);
            FormProvoider.SetFormViewSize(Convert.ToInt32(width), Convert.ToInt32(height));

            foreach (KeyValuePair <string, object> kvp in controlCollection)
            {
                #region FormItemType == 5
                if (((GeneralAttribute)kvp.Value).FormItemType == 5)
                {
                    FormProvoider.Rect rcRect = new FormProvoider.Rect();
                    SetRect(out rcRect, (GeneralAttribute)kvp.Value);
                    FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType),
                                                 rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType);

                    TableContorlAttribute tableContorlAttribute = (TableContorlAttribute)kvp.Value;
                    int page = 0;
                    foreach (KeyValuePair <string, Group> kvpGroup in tableContorlAttribute.Groups)
                    {
                        FormProvoider.InsertTabPage(((GeneralAttribute)kvp.Value).FormItemId, kvpGroup.Value.Name, page);

                        foreach (KeyValuePair <string, GeneralAttribute> kvpChildAttribute in kvpGroup.Value.GroupControls)
                        {
                            FormProvoider.Rect rcRectChild = new FormProvoider.Rect();
                            SetRect(out rcRectChild, (GeneralAttribute)kvpChildAttribute.Value);
                            FormProvoider.CreateChlidFormItem(kvpChildAttribute.Value.FormItemType, rcRectChild, Convert.ToInt32(kvpChildAttribute.Key),
                                                              Convert.ToInt32(kvp.Key), page, ((GeneralAttribute)kvpChildAttribute.Value).ExtensionType);
                            if (((GeneralAttribute)kvpChildAttribute.Value).Multiline == true && ((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 1)
                            {
                                FormProvoider.SetFormItemStyle(Convert.ToInt32(kvpChildAttribute.Key), 0x00010000, true);//0x00010000
                            }
                            if (((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 7)
                            {
                                //SetDataGrid(formDesignerWorkbenchWindow, kvpChildAttribute.Key, kvpChildAttribute.Value);
                            }
                            if (((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 20)
                            {
                                SetRadioButtonList(kvpChildAttribute.Value);
                            }
                            if (((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 4 ||
                                ((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 15 ||
                                ((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 3 ||
                                ((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 6)
                            {
                                FormProvoider.SetStaticText(Convert.ToInt32(kvpChildAttribute.Key), kvpChildAttribute.Value.Text);
                            }
                            if (((GeneralAttribute)kvpChildAttribute.Value).FormItemType == 4)
                            {
                                FormProvoider.FontWnd font = new FormProvoider.FontWnd();
                                font.itemName = ((GeneralAttribute)kvpChildAttribute.Value).WindowTextFont.FontFamily.Name;
                                font.ftSize   = Convert.ToInt32(((GeneralAttribute)kvpChildAttribute.Value).WindowTextFont.Size);
                                font.ftStyle  = GeneralAttribute.GetFontStyle(((GeneralAttribute)kvpChildAttribute.Value).WindowTextFont);
                                FormProvoider.SetFormItemFont(((GeneralAttribute)kvpChildAttribute.Value).FormItemId, font);
                                FormProvoider.SetFormItemStyle(((GeneralAttribute)kvpChildAttribute.Value).FormItemId, 0x00800000, ((GeneralAttribute)kvpChildAttribute.Value).Border);
                            }
                        }
                        page++;
                    }
                }
                #endregion
                else if (((GeneralAttribute)kvp.Value).FormItemType == 7)
                {
                    FormProvoider.Rect rcRect = new FormProvoider.Rect();
                    SetRect(out rcRect, (GeneralAttribute)kvp.Value);
                    FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType),
                                                 rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType);
                    //SetDataGrid(formDesignerWorkbenchWindow, kvp.Key, kvp.Value);
                }
                else if (((GeneralAttribute)kvp.Value).FormItemType == 20)
                {
                    FormProvoider.Rect rcRect = new FormProvoider.Rect();
                    SetRect(out rcRect, (GeneralAttribute)kvp.Value);
                    FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType),
                                                 rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType);
                    SetRadioButtonList(kvp.Value);
                }
                else if (((GeneralAttribute)kvp.Value).FormItemType == 255)//直线
                {
                    FormProvoider.Rect rcRect = new FormProvoider.Rect();
                    SetRect(out rcRect, (GeneralAttribute)kvp.Value);
                    FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType),
                                                 rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType);
                }
                else
                {
                    FormProvoider.Rect rcRect = new FormProvoider.Rect();
                    SetRect(out rcRect, (GeneralAttribute)kvp.Value);
                    FormProvoider.CreateFormItem(Convert.ToInt32(((GeneralAttribute)kvp.Value).FormItemType),
                                                 rcRect, Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).ExtensionType);
                    if (((GeneralAttribute)kvp.Value).FormItemType == 1)
                    {
                        DockFormDesigner.controlIdItems.Add(kvp.Key);
                    }
                    else
                    {
                        FormProvoider.SetStaticText(Convert.ToInt32(kvp.Key), ((GeneralAttribute)kvp.Value).Text);
                    }
                    //Dap2xProvoider.SetFormItemStyle(((GeneralAttribute)kvp.Value).FormItemId, 0x00800000, false);

                    if (((GeneralAttribute)kvp.Value).FormItemType == 1 && ((GeneralAttribute)kvp.Value).Multiline == true)
                    {
                        FormProvoider.SetFormItemStyle(((GeneralAttribute)kvp.Value).FormItemId, 0x00010000, true);
                    }
                    else
                    {
                        FormProvoider.SetFormItemStyle(((GeneralAttribute)kvp.Value).FormItemId, 0x00010000, false);
                    }
                    if (((GeneralAttribute)kvp.Value).FormItemType == 4)
                    {
                        FormProvoider.FontWnd font = new FormProvoider.FontWnd();
                        font.itemName = ((GeneralAttribute)kvp.Value).WindowTextFont.FontFamily.Name;
                        font.ftSize   = Convert.ToInt32(((GeneralAttribute)kvp.Value).WindowTextFont.Size);
                        font.ftStyle  = GeneralAttribute.GetFontStyle(((GeneralAttribute)kvp.Value).WindowTextFont);
                        FormProvoider.SetFormItemFont(((GeneralAttribute)kvp.Value).FormItemId, font);
                        Color color = ((GeneralAttribute)kvp.Value).WindowTextColor;
                        FormProvoider.SetFormItemColor(((GeneralAttribute)kvp.Value).FormItemId, color.B << 16 | color.G << 8 | color.R);
                        //边框
                        FormProvoider.SetFormItemStyle(((GeneralAttribute)kvp.Value).FormItemId, 0x00800000, ((GeneralAttribute)kvp.Value).Border);
                    }
                }
            }
            #endregion

            //formDesignerWorkbenchWindow.formDataCollection = formDesignerWorkbenchWindow.FormParameter.FormDataCollection;
            //formDesignerWorkbenchWindow.formValidatesCollection = getObjectFromXml.GetFormValidatesCollection("/Form/Validation");//formValidatesCollection
            //formDesignerWorkbenchWindow.formRightsCollection = getObjectFromXml.GetFormRightsCollection("/Form/Right");//formRightsCollection
            ////zhanben20100919 新增表单脚本功能
            //formDesignerWorkbenchWindow.FormScriptString = getObjectFromXml.GetFormScriptString("/Form/Script");
        }
예제 #5
0
        public void FormItemProperty()
        {
            try
            {
                ControlItemAttribute attr = new ControlItemAttribute();
                if (_selectedControl.formItemType != 0)
                {
                    attr.FormItemInfo = _selectedControl;
                    StringBuilder windowtext = new StringBuilder(2560);
                    FormProvoider.GetStaticText(_selectedControl.formItemID, windowtext, windowtext.Capacity);

                    attr.Left         = _selectedControl.left;
                    attr.Top          = _selectedControl.top;
                    attr.Width        = _selectedControl.width;
                    attr.Height       = _selectedControl.height;
                    attr.FormItemId   = _selectedControl.formItemID;
                    attr.FormItemType = _selectedControl.formItemType;
                    attr.Text         = windowtext.ToString();
                    attr.ControlType  = ControlMapping.GetInstance().GetExtensionTypeName(_selectedControl.formItemType.ToString(), _selectedControl.extension.ToString());

                    if (_selectedControl.formItemType != 0) //==4
                    {
                        //get the contorl's font
                        FormProvoider.FontWnd fontWnd = new FormProvoider.FontWnd();
                        FormProvoider.GetFormItemFont(_selectedControl.formItemID, out fontWnd);
                        if (!string.IsNullOrEmpty(fontWnd.itemName))
                        {
                            Font font = GeneralAttribute.SetFontStyle(new FontFamily(fontWnd.itemName), fontWnd.ftSize
                                                                      , fontWnd.ftStyle);
                            attr.SetAttributeFont(font);
                        }
                        //点击控件显示其 绑定信息
                        if (_selectedControl.formItemType == 1 && FormProvoider.GetSelectedFormItemsCount() == 1)
                        {
                            attr.Text = attr.DataItem;
                        }

                        //get the contorl's color
                        Int32 oldColor;
                        FormProvoider.GetFormItemColor(_selectedControl.formItemID, out oldColor);
                        attr.SetAttributeColor(ColorTranslator.FromOle(oldColor));
                        attr.Border = FormProvoider.BorderStyle(_selectedControl);
                    }
                    //_focusedControl = FormParameter.FormId + "_" + _selectedControl.formItemID.ToString();
                    DockFormDesigner.controlDictionary.AddValue(_selectedControl.formItemID, _selectedControl.formItemID.ToString());
                }
                else
                {
                    attr.IsPrint = PageProperty.IsPrint.ToString();
                    //SelectedItemId = _selectedControl.formItemID.ToString();
                    //_selectedItemType = _selectedControl.formItemType.ToString();
                }

                propertyGridControl1.SelectedObject = attr;
                //propertyGridControl1.RetrieveFields();
                //FormParameter.ControlsCollection = controlsDictionary;
            }
            catch (Exception E)
            {
                //XtraMessageBox.Show(E.Message, "系统提示", MessageBoxButtons.OK);
                MainForm.ERROR(E.Message);
            }
        }
예제 #6
0
        /// <summary>
        /// 获取控件信息集
        /// </summary>
        /// <param name="xPath"></param>
        /// <returns></returns>
        public ControlCollection GetControls(DockFormDesigner dockFormDesigner, string xPath, out Dictionary <string, string> panelProperty)
        {
            _dockFormDesigner = dockFormDesigner;
            ControlCollection controlCollection = new ControlCollection();
            XmlNode           contorlNodes      = formXmlParser.GetNode(xPath);

            panelProperty = new Dictionary <string, string>();
            //textBoxsType = new TextBoxsType();
            panelProperty.Add("width", contorlNodes.Attributes["width"].Value);
            panelProperty.Add("height", contorlNodes.Attributes["height"].Value);
            DockFormDesigner.controlDictionary.Clear();
            foreach (XmlNode xmlnode in contorlNodes)
            {
                GeneralAttribute generalAttribute = new GeneralAttribute();

                Int16 ItemType = 0;
                ItemType = Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(xmlnode.Name));

                switch (ItemType)
                {
                case 5:
                    #region ItemType=5
                    TableContorlAttribute tableContorlAttribute = new TableContorlAttribute();
                    BindGeneralAttribute(tableContorlAttribute, xmlnode, Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(xmlnode.Name)));
                    foreach (XmlNode groupNode in xmlnode)
                    {
                        Group group = new Group();
                        group.Name = groupNode.Attributes["name"].Value;
                        foreach (XmlNode childNode in groupNode)
                        {
                            Int16 ItemTypec;
                            //if (childNode.Name == "DateTimePicker")
                            //{
                            //    ItemTypec = 1;
                            //    textBoxsType.AddTextBox(childNode.Attributes["id"].Value);
                            //}
                            //else
                            ItemTypec = Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(childNode.Name));
                            switch (ItemTypec)
                            {
                            case 7:
                                DataGridControlAttribute DataGridControlAttribute = AppendGrid(childNode);
                                group.AddGroupControl(DataGridControlAttribute.ControlId, DataGridControlAttribute);
                                break;

                            case 20:
                                RadioButtonListAttribute rbtlist = AppendRadioButton(childNode);
                                group.AddGroupControl(rbtlist.ControlId, rbtlist);
                                break;

                            default:

                                GeneralAttribute childContrlAttribute = new GeneralAttribute();
                                BindGeneralAttribute(childContrlAttribute, childNode, ItemTypec);
                                group.AddGroupControl(childContrlAttribute.ControlId, childContrlAttribute);
                                break;
                            }
                        }
                        tableContorlAttribute.AddGroup(group.Name, group);
                    }
                    generalAttribute = tableContorlAttribute;
                    #endregion
                    break;

                case 7:
                    generalAttribute = AppendGrid(xmlnode);
                    break;

                case 20:
                    generalAttribute = AppendRadioButton(xmlnode);
                    break;

                default:
                    BindGeneralAttribute(generalAttribute, xmlnode, ItemType);
                    break;
                }
                controlCollection.Add(xmlnode.Attributes["id"].Value, generalAttribute);
            }
            return(controlCollection);
        }
예제 #7
0
        /// <summary>
        /// 控件一般属性解析
        /// </summary>
        /// <param name="ContrlAttribute"></param>
        /// <param name="xmlNode"></param>
        /// <param name="ItemType"></param>
        private void BindGeneralAttribute(GeneralAttribute ContrlAttribute, XmlNode xmlNode, Int16 ItemType)
        {
            AddControl(xmlNode);
            ContrlAttribute.Left         = Convert.ToInt32(xmlNode.Attributes["x"].Value);
            ContrlAttribute.Top          = Convert.ToInt32(xmlNode.Attributes["y"].Value);
            ContrlAttribute.Height       = Convert.ToInt32(xmlNode.Attributes["height"].Value);
            ContrlAttribute.Width        = Convert.ToInt32(xmlNode.Attributes["width"].Value);
            ContrlAttribute.FormItemId   = Convert.ToInt32(xmlNode.Attributes["id"].Value);
            ContrlAttribute.FormItemType = ItemType;
            if (xmlNode.Attributes["text"] != null)
            {
                ContrlAttribute.Text = xmlNode.Attributes["text"].Value;
            }
            if (xmlNode.Attributes["multiline"] != null)
            {
                ContrlAttribute.Multiline = xmlNode.Attributes["multiline"].Value == "true" ? true : false;
            }
            if (xmlNode.Attributes["font"] != null)
            {
                string[] strFont = xmlNode.Attributes["font"].Value.Split('|');
                ContrlAttribute.WindowTextFont = GeneralAttribute.SetFontStyle(new FontFamily(strFont[0]), Convert.ToInt16(strFont[1]), Convert.ToInt32(strFont[2]));
            }
            if (xmlNode.Attributes["color"] != null)
            {
                ContrlAttribute.WindowTextColor = ColorTranslator.FromOle(Convert.ToInt32(xmlNode.Attributes["color"].Value));
            }
            if (xmlNode.Attributes["readonly"] != null)
            {
                if (xmlNode.Attributes["readonly"].Value == "true")
                {
                    ControlMapping.ReadControls.Add(ContrlAttribute.FormItemId.ToString());
                }
            }
            if (xmlNode.Attributes["isprint"] != null)
            {
                if (xmlNode.Attributes["isprint"].Value == "false")
                {
                    ControlMapping.NotPrintControls.Add(ContrlAttribute.FormItemId.ToString());
                }
            }
            //// 新增解析isprintwhenarchive的代码
            //if (xmlNode.Attributes["isprintwhenarchive"] != null)
            //{
            //    DAP2ControlMapping.PrintWhenArchiveControls.Add(ContrlAttribute.FormItemId,
            //        xmlNode.Attributes["isprintwhenarchive"].Value);
            //}

            //if (xmlNode.Attributes["relationControl"]!=null)
            //{
            //    DAP2ControlMapping.ControlRelation.Add(ContrlAttribute.FormItemId,
            //        xmlNode.Attributes["relationControl"].Value);
            //}
            if (xmlNode.Attributes["extensionType"] != null)
            {
                string enttype = ControlMapping.GetInstance().GetExtensionTypeId(ContrlAttribute.FormItemType.ToString()
                                                                                 , xmlNode.Attributes["extensionType"].Value);
                if (!string.IsNullOrEmpty(enttype))
                {
                    ContrlAttribute.ExtensionType = Convert.ToInt16(enttype);
                }
            }
            if (xmlNode.Attributes["tip"] != null)
            {
                ControlMapping.ControlTip.Add(ContrlAttribute.FormItemId, xmlNode.Attributes["tip"].Value);
            }
            //if (xmlNode.Attributes["numberDefine"] != null)
            //{
            //    DAP2ControlMapping.ControlNumberDefine.Add(ContrlAttribute.FormItemId,
            //        xmlNode.Attributes["numberDefine"].Value);
            //}
            if (xmlNode.Attributes["defaultValue"] != null)
            {
                ControlMapping.DefaultValues.Add(ContrlAttribute.FormItemId, xmlNode.Attributes["defaultValue"].Value);
            }
            if (xmlNode.Attributes["expression"] != null)
            {
                ControlMapping.ExpressionControls.Add(ContrlAttribute.FormItemId, xmlNode.Attributes["expression"].Value);
            }
            if (xmlNode.Attributes["border"] != null)
            {
                ContrlAttribute.Border = bool.Parse(xmlNode.Attributes["border"].Value);
            }

            if (ContrlAttribute.FormItemType == 2)
            {
                if (xmlNode.Attributes["comboxEdit"] != null)
                {
                    if (xmlNode.Attributes["comboxEdit"].Value == "true")
                    {
                        ControlMapping.ComboxEditControls.Add(ContrlAttribute.ControlId);
                    }
                }
            }
        }
예제 #8
0
 public void AddAssetsGeneral(GeneralAttribute item)
 {
     _assetsGeneralRep.Add(item);
 }