Beispiel #1
0
        private static BaseField GetDate(PbBaseControlInfo pbCtl)
        {
            PbDateTimeTextInfo pbDate = (PbDateTimeTextInfo)pbCtl;
            DatePickerField    ngDate = new DatePickerField();

            ngDate.ID         = pbDate.Id;
            ngDate.Name       = pbDate.Name;
            ngDate.FieldLabel = pbDate.LeftText;
            ngDate.MustInput  = pbDate.IsMustInput;
            ngDate.XType      = "ngDatePicker";
            return(ngDate);
        }
Beispiel #2
0
        public static NGDate GetDate(PbBaseControlInfo pbCtl)
        {
            PbDateTimeTextInfo pbDate = (PbDateTimeTextInfo)pbCtl;
            NGDate             ngDate = new NGDate();

            ngDate.ID         = pbDate.Id;
            ngDate.Name       = pbDate.Name;
            ngDate.FieldLabel = pbDate.LeftText;
            ngDate.MustInput  = pbDate.IsMustInput;
            ngDate.XType      = "ngDate";
            ngDate.Visible    = pbDate.Visible;
            ngDate.MustInput  = pbDate.IsMustInput;
            ngDate.Protect    = pbDate.IsProtect;
            ngDate.FieldStyle = GetRgb(pbDate.TextColor);
            ngDate.LabelStyle = GetRgb(pbDate.LabelTextColor);
            return(ngDate);
        }
Beispiel #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);
        }