예제 #1
0
 public static IList <PbPictureboxInfo> ToPbPictureBoxMetadata(DwInfo dwInfo, PbHeadInfo headInfo)
 {
     try
     {
         IList <PbPictureboxInfo> pbPictureboxInfos = new List <PbPictureboxInfo>();
         foreach (DwBitmap dwBitmap in dwInfo.DwBitmaps)
         {
             PbPictureboxInfo pbPictureboxInfo = new PbPictureboxInfo();
             pbPictureboxInfo.Name             = dwBitmap.Name;
             pbPictureboxInfo.Visible          = dwBitmap.Visible;
             pbPictureboxInfo.Tag              = dwBitmap.Tag;
             pbPictureboxInfo.FileName         = dwBitmap.FileName;
             pbPictureboxInfo.Width            = Convert.ToInt32(dwBitmap.Width * 1.3);
             pbPictureboxInfo.Height           = Convert.ToInt32(dwBitmap.Height);
             pbPictureboxInfo.XPos             = Convert.ToInt32(dwBitmap.XPos * 1.3);
             pbPictureboxInfo.YPos             = Convert.ToInt32(dwBitmap.YPos);
             pbPictureboxInfo.IsFromAttachment = true;
             try
             {
                 pbPictureboxInfo.ColSpan = Convert.ToInt32(headInfo.ColSpanDic[dwBitmap.Name + "_url"]);
             }
             catch
             {
                 pbPictureboxInfo.ColSpan = 1;
             }
             pbPictureboxInfos.Add(pbPictureboxInfo);
         }
         return(pbPictureboxInfos);
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
        public static IList <PbGroupboxInfo> ToPbGroupBoxMetadata(DwInfo dwInfo, string dwAuthName, IDictionary <string, string> collapsedic)
        {
            try
            {
                IList <PbGroupboxInfo> pbGroupboxInfos = new List <PbGroupboxInfo>();
                foreach (DwGroupBox dwGroupBox in dwInfo.DwGroupBoxs)
                {
                    PbGroupboxInfo pbGroupboxInfo = new PbGroupboxInfo();
                    pbGroupboxInfo.FullName  = dwAuthName + dwGroupBox.Name;
                    pbGroupboxInfo.Height    = Convert.ToInt32(dwGroupBox.Height);
                    pbGroupboxInfo.Name      = dwGroupBox.Name;
                    pbGroupboxInfo.Text      = dwGroupBox.Text;
                    pbGroupboxInfo.TextColor = dwGroupBox.Color;
                    pbGroupboxInfo.Visible   = dwGroupBox.Visible;
                    pbGroupboxInfo.Width     = Convert.ToInt32(dwGroupBox.Width * 1.3);
                    pbGroupboxInfo.XPos      = Convert.ToInt32(dwGroupBox.XPos * 1.3);
                    pbGroupboxInfo.YPos      = Convert.ToInt32(dwGroupBox.YPos);

                    //设置fieldset折叠属性
                    if (collapsedic != null && collapsedic.Count() != 0)
                    {
                        if (collapsedic.ContainsKey(dwGroupBox.Name))  //有关联的标签和输入框
                        {
                            pbGroupboxInfo.Collapse = collapsedic[dwGroupBox.Name];
                        }
                        else
                        {
                            pbGroupboxInfo.Collapse = string.Empty;
                        }
                    }

                    pbGroupboxInfos.Add(pbGroupboxInfo);
                }
                return(pbGroupboxInfos);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #3
0
        //ParseBillHead 调用
        public static IList <PbBaseTextInfo> ToPbColumnsMetadata(DwInfo dwInfo, string dwAuthName, IDictionary <string, string> dddwSourceDic, string titlename,
                                                                 Dictionary <string, string> colrefdic, IDictionary <string, string> textareadic, IDictionary <string, string> colspandic, IDictionary <string, string> multiselectdic)
        {
            IList <PbBaseTextInfo> pbBaseTextInfos = new List <PbBaseTextInfo>();

            //普通列
            foreach (DwColumn dc in dwInfo.DwColumns)
            {
                //如果控件宽度或高度为0,该控件不加入列表
                if (dc.Height == 0 || dc.Width == 0)
                {
                    continue;
                }

                DwDbColumn dwDbColumn = dwInfo.GetDwDbColumnByName(dc.Name);

                if (dwDbColumn == null)
                {
                    continue;
                }

                //if (sumdic != null && sumdic.Count() != 0)
                //{
                //    if (sumdic.ContainsKey(dc.Name))
                //    {
                //        dwDbColumn.SummaryType = sumdic[dc.Name];
                //    }
                //}

                DwText dwText = dwInfo.GetDwTextByName(dc.Name);

                //xkq. 2016-12-8 寻找[window]中ref中是否有对应text
                if (colrefdic != null && colrefdic.Count() != 0)
                {
                    if (dwText == null || dwText.Name == null)
                    {
                        if (colrefdic.ContainsKey(dc.Name))  //有关联的标签和输入框
                        {
                            string textname = colrefdic[dc.Name];
                            if (!string.IsNullOrEmpty(textname))
                            {
                                dwText = dwInfo.GetDwTextByName1(textname);
                            }
                        }
                        else  //单独的标签
                        {
                            dc.SingleText = true;
                        }
                    }
                }

                //add by ljy 2017.07.13 找出类型时textarea的字段
                if (textareadic != null && textareadic.Count() != 0)
                {
                    if (textareadic.ContainsKey(dc.Name))
                    {
                        dc.TextArea = true;
                    }
                }

                //add by ljy 2017.07.14 设置所有列的列占位数
                if (colspandic != null && colspandic.Count() != 0)
                {
                    if (colspandic.ContainsKey(dc.Name))  //有关联的标签和输入框
                    {
                        dc.ColSpan = Convert.ToInt32(colspandic[dc.Name]);
                    }
                }

                //add by ljy 2017.11.03 找出复选帮助字段
                if (multiselectdic != null && multiselectdic.Count() != 0)
                {
                    if (multiselectdic.ContainsKey(dwAuthName + "." + dc.Name))
                    {
                        dc.MultiSelect = true;
                    }
                }

                if (dc.Name.Equals("res_code"))
                {
                    dwDbColumn.DataType = "DataHelpEdit";
                    PbDataHelpEditInfo pbDataHelpEditInfo = new PbDataHelpEditInfo();
                    CommonAssignment(pbDataHelpEditInfo, dwDbColumn, dwText, dc, SqlDbType.NVarChar, dwAuthName);
                    DataRow[] drs = HelpDac.XmlHelpDT.Select("Id='" + pbDataHelpEditInfo.Name + "'");
                    if (drs.Length > 0)//系统内置的通用帮助
                    {
                        pbDataHelpEditInfo.DataHelpId = drs[0]["HelpId"].ToString();
                    }
                    pbBaseTextInfos.Add(pbDataHelpEditInfo);
                    continue;
                }

                if (dc.Name.Equals("c_name"))
                {
                    continue;
                }

                //if(dc.Name.Equals("msunit"))
                //{
                //    sqlDbType = SqlDbType.NVarChar;
                //    dc.ControlType = DwControlType.TextEdit;
                //}

                SqlDbType sqlDbType = DwDbTypeConvert.ToSqlDbType(dwDbColumn.DataType);

                switch (sqlDbType)
                {
                case SqlDbType.NVarChar:
                    switch (dc.ControlType)
                    {
                    case DwControlType.CheckBoxEdit:
                        PbCheckboxInfo checkboxInfo = new PbCheckboxInfo();
                        CommonAssignment(checkboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(checkboxInfo);
                        break;

                    case DwControlType.RedioBoxEdit:
                        PbRadioboxInfo pbRadioboxInfo = new PbRadioboxInfo();
                        CommonAssignment(pbRadioboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbRadioboxInfo.PbPairValueInfos = ConvertToPairValueInfo(dwDbColumn.Values);
                        pbBaseTextInfos.Add(pbRadioboxInfo);
                        break;

                    case DwControlType.ComboBoxEdit:
                        PbComboboxInfo pbComboboxInfo = new PbComboboxInfo();
                        CommonAssignment(pbComboboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbComboboxInfo.PbComboboxValueInfos = ConvertToPairValueInfo(dwDbColumn.Values);
                        pbBaseTextInfos.Add(pbComboboxInfo);
                        break;

                    case DwControlType.DataHelpEdit:
                        PbDataHelpEditInfo pbDataHelpEditInfo = new PbDataHelpEditInfo();
                        CommonAssignment(pbDataHelpEditInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        SetHelpId(pbDataHelpEditInfo, dddwSourceDic);          //设置helpid
                        pbBaseTextInfos.Add(pbDataHelpEditInfo);
                        break;

                    case DwControlType.RichTextEdit:
                        PbRichTextInfo pbRichTextInfo = new PbRichTextInfo();
                        CommonAssignment(pbRichTextInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(pbRichTextInfo);
                        break;

                    case DwControlType.TextEdit:
                        PbTextInfo textInfo = new PbTextInfo();
                        CommonAssignment(textInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(textInfo);
                        break;

                    default:
                        PbTextInfo textInfo1 = new PbTextInfo();
                        CommonAssignment(textInfo1, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(textInfo1);
                        break;
                    }
                    break;

                case SqlDbType.DateTime:
                    PbDateTimeTextInfo dateTimeTextInfo = new PbDateTimeTextInfo();
                    CommonAssignment(dateTimeTextInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                    pbBaseTextInfos.Add(dateTimeTextInfo);
                    break;

                case SqlDbType.Int:
                    switch (dc.ControlType)
                    {
                    case DwControlType.TextEdit:
                        PbIntTextInfo intTextInfo = new PbIntTextInfo();
                        CommonAssignment(intTextInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(intTextInfo);
                        break;

                    case DwControlType.CheckBoxEdit:
                        PbCheckboxInfo checkboxInfo = new PbCheckboxInfo();
                        CommonAssignment(checkboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(checkboxInfo);
                        break;

                    case DwControlType.RedioBoxEdit:
                        PbRadioboxInfo pbRadioboxInfo = new PbRadioboxInfo();
                        CommonAssignment(pbRadioboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(pbRadioboxInfo);
                        break;

                    case DwControlType.ComboBoxEdit:
                        PbComboboxInfo pbComboboxInfo = new PbComboboxInfo();
                        CommonAssignment(pbComboboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbComboboxInfo.PbComboboxValueInfos = ConvertToPairValueInfo(dwDbColumn.Values);
                        pbBaseTextInfos.Add(pbComboboxInfo);
                        break;

                    case DwControlType.DataHelpEdit:
                        PbDataHelpEditInfo pbDataHelpEditInfo = new PbDataHelpEditInfo();
                        CommonAssignment(pbDataHelpEditInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        SetHelpId(pbDataHelpEditInfo, dddwSourceDic);          //设置helpid
                        pbBaseTextInfos.Add(pbDataHelpEditInfo);
                        break;

                    case DwControlType.RichTextEdit:
                        PbRichTextInfo pbRichTextInfo = new PbRichTextInfo();
                        CommonAssignment(pbRichTextInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(pbRichTextInfo);
                        break;

                    default:
                        PbIntTextInfo intTextInfo1 = new PbIntTextInfo();
                        CommonAssignment(intTextInfo1, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(intTextInfo1);
                        break;
                    }
                    break;

                case SqlDbType.Decimal:
                    switch (dc.ControlType)
                    {
                    case DwControlType.CheckBoxEdit:
                        PbCheckboxInfo checkboxInfo = new PbCheckboxInfo();
                        CommonAssignment(checkboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(checkboxInfo);
                        break;

                    case DwControlType.RedioBoxEdit:
                        PbRadioboxInfo pbRadioboxInfo = new PbRadioboxInfo();
                        CommonAssignment(pbRadioboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbRadioboxInfo.PbPairValueInfos = ConvertToPairValueInfo(dwDbColumn.Values);
                        pbBaseTextInfos.Add(pbRadioboxInfo);
                        break;

                    case DwControlType.ComboBoxEdit:
                        PbComboboxInfo pbComboboxInfo = new PbComboboxInfo();
                        CommonAssignment(pbComboboxInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbComboboxInfo.PbComboboxValueInfos = ConvertToPairValueInfo(dwDbColumn.Values);
                        pbBaseTextInfos.Add(pbComboboxInfo);
                        break;

                    case DwControlType.DataHelpEdit:
                        PbDataHelpEditInfo pbDataHelpEditInfo = new PbDataHelpEditInfo();
                        CommonAssignment(pbDataHelpEditInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        SetHelpId(pbDataHelpEditInfo, dddwSourceDic);          //设置helpid
                        pbBaseTextInfos.Add(pbDataHelpEditInfo);
                        break;

                    case DwControlType.RichTextEdit:
                        PbRichTextInfo pbRichTextInfo = new PbRichTextInfo();
                        CommonAssignment(pbRichTextInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(pbRichTextInfo);
                        break;

                    case DwControlType.TextEdit:
                        PbTextInfo textInfo = new PbTextInfo();
                        CommonAssignment(textInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(textInfo);
                        break;

                    default:
                        PbDecimalTextInfo pbDecimalTextInfo = new PbDecimalTextInfo();
                        CommonAssignment(pbDecimalTextInfo, dwDbColumn, dwText, dc, sqlDbType, dwAuthName);
                        pbBaseTextInfos.Add(pbDecimalTextInfo);
                        break;
                    }
                    break;

                default:
                    break;
                }
            }

            //按钮列
            foreach (DwButton db in dwInfo.DwButtons)
            {
                //如果控件宽度或高度为0,该控件不加入列表
                if (db.Height == 0 || db.Width == 0)
                {
                    continue;
                }

                PbButtonInfo buttonInfo = new PbButtonInfo();

                buttonInfo.Name      = db.Name;
                buttonInfo.FullName  = db.Name;
                buttonInfo.LeftText  = db.Text;
                buttonInfo.Height    = db.Height;
                buttonInfo.Width     = db.Width;
                buttonInfo.TextColor = db.Color;
                buttonInfo.Visible   = db.Visible;

                buttonInfo.XPos       = db.XPos;
                buttonInfo.YPos       = db.YPos;
                buttonInfo.LabelWidth = db.Width;
                pbBaseTextInfos.Add(buttonInfo);
            }

            //纯文本列
            foreach (DwText dt in dwInfo.DwTexts)
            {
                bool isTitle = false;

                //如果控件宽度或高度为0,该控件不加入列表
                if (dt.Height == 0 || dt.Width == 0)
                {
                    continue;
                }

                //存在于列标签和列单元格的关联关系中,说明不是独立标签,是作为文本框的标签,则跳过
                if (colrefdic != null && colrefdic.ContainsValue(dt.Name))
                {
                    continue;
                }

                if (dt.Name.Equals(titlename) && !string.IsNullOrEmpty(titlename))
                {
                    isTitle = true;  //该标签作为标题
                }
                else
                {
                    //name最后两位不是"_t"的为独立标签
                    if (dt.Name.Substring(dt.Name.Length - 2, 2) == "_t")
                    {
                        continue;
                    }
                }

                PbLabelInfo labelInfo = new PbLabelInfo();

                //add by ljy 2018.05.21 设置所有列的列占位数
                if (colspandic != null && colspandic.Count() != 0)
                {
                    if (colspandic.ContainsKey(dt.Name))  //有关联的标签和输入框
                    {
                        labelInfo.ColSpan = Convert.ToInt32(colspandic[dt.Name]);
                    }
                }

                labelInfo.IsTitle        = isTitle;
                labelInfo.Name           = dt.Name;
                labelInfo.FullName       = dt.Name;
                labelInfo.LeftText       = dt.Text;
                labelInfo.Height         = dt.Height;
                labelInfo.Width          = dt.Width;
                labelInfo.TextColor      = dt.Color;
                labelInfo.LabelTextColor = dt.LabelTextColor;
                labelInfo.Visible        = dt.Visible;

                labelInfo.XPos = dt.XPos;
                labelInfo.YPos = dt.YPos;

                labelInfo.Font       = dt.Font;
                labelInfo.Align      = dt.Align;
                labelInfo.LabelWidth = dt.Width;

                pbBaseTextInfos.Add(labelInfo);
            }

            return(pbBaseTextInfos);
        }
예제 #4
0
        public static DwInfo ParseDataWindow(string dwSyntax, IDictionary <string, string> coldic)
        {
            try
            {
                DwInfo   dwInfo   = new DwInfo();
                string[] arrayStr = dwSyntax.Split(new string[] { DwRes.Crlf }, StringSplitOptions.RemoveEmptyEntries);
                int      step     = 1;
                for (int i = 1; i < arrayStr.Length; i += step)
                {
                    string str = arrayStr[i].Trim();

                    if (str.Contains("htmltable"))
                    {
                        break;
                    }

                    if (str.StartsWith(DwRes.TableSectionStart, StringComparison.OrdinalIgnoreCase))
                    {
                        str = str.Remove(0, DwRes.TableSectionStart.Length);
                    }
                    if (str.EndsWith(")"))
                    {
                        step = 1;
                    }
                    else
                    {
                        step = 2;
                        string tempStr = arrayStr[i + 1].Trim();
                        if (tempStr.StartsWith(DwRes.ValuesSectionStart))
                        {
                            str = str + " " + tempStr;
                        }
                    }

                    if (str.StartsWith(DwRes.DbColumnSectionStart))
                    {
                        dwInfo.DwDbColumns.Add(ParseDwDbColumn(str));
                    }
                    else if (str.StartsWith(DwRes.ColumnSectionStart))
                    {
                        dwInfo.DwColumns.Add(ParseDwColumn(str, coldic));
                    }
                    else if (str.StartsWith(DwRes.GroupBoxSectionStart))
                    {
                        dwInfo.DwGroupBoxs.Add(ParseDwGroupBox(str));
                    }
                    else if (str.StartsWith(DwRes.TextSectionStart))
                    {
                        dwInfo.DwTexts.Add(ParseDwText(str));
                    }
                    else if (str.StartsWith(DwRes.ButtonSectionStart))
                    {
                        dwInfo.DwButtons.Add(ParseDwButton(str));
                    }
                    else if (str.StartsWith(DwRes.BitmapSectionStart))
                    {
                        dwInfo.DwBitmaps.Add(ParseDwBitmap(str));
                    }
                    else if (str.StartsWith(DwRes.SqlSection))
                    {
                        int index = str.IndexOf("=");
                        dwInfo.Sql = RemoveQuotes(str.Substring(index + 1));
                    }
                }
                return(dwInfo);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #5
0
 //ParseBillList和ParseBillBody 调用
 public static IList <PbBaseTextInfo> ToPbColumnsMetadata(DwInfo dwInfo, string dwAuthName, IDictionary <string, string> dddwSourceDic, string titlename, IDictionary <string, string> multiselectdic)
 {
     return(ToPbColumnsMetadata(dwInfo, dwAuthName, dddwSourceDic, titlename, null, null, null, multiselectdic));
 }