Example #1
0
 public IndividualPropertyFacade()
 {
     dac  = new IndividualPropertyDac();
     rule = new Rule.IndividualPropertyRule();
 }
Example #2
0
        public static ExtGridColumnInfoBase Build(string xtype, string fieldname, string header, string helpid, string combodata, int length, int declen)
        {
            ExtGridColumnInfoBase columnInfo = null;

            if (xtype == "ngRichHelp" && !string.IsNullOrWhiteSpace(helpid))
            {
                columnInfo = new ExtGridColumnInfoBase(fieldname + "_name", header);

                IndividualPropertyDac   dac    = new IndividualPropertyDac();
                ExtGridColumnHelpEditor editor = new ExtGridColumnHelpEditor();
                editor.helpid = helpid;
                DataTable dt = dac.GetHelpInfo(helpid);
                if (dt.Rows.Count > 0)
                {
                    string codeField = dt.Rows[0]["codefield"].ToString().Trim();
                    if (codeField.IndexOf('.') > 0)
                    {
                        editor.valueField = codeField.Split('.')[1];
                    }
                    else
                    {
                        editor.valueField = codeField;
                    }
                    string nameField = dt.Rows[0]["namefield"].ToString();
                    if (nameField.IndexOf('.') > 0)
                    {
                        editor.displayField = nameField.Split('.')[1];
                    }
                    else
                    {
                        editor.displayField = nameField;
                    }
                }
                editor.isInGrid = true;
                editor.xtype    = xtype;
                editor.ORMMode  = false;//自定义字段为false

                Listeners ls = new Listeners();
                ls.helpselected  = "function (obj) {var data = this.findParentByType('ngGridPanel').getSelectionModel().getSelection();" + string.Format("data[0].set('{0}', obj.code);  data[0].set('{1}', obj.name); ", fieldname, fieldname + "_name") + "}";
                editor.listeners = ls;

                columnInfo.editor = editor;
            }
            else if (xtype == "ngComboBox")
            {
                var col = new ExtGridComboBoxColumnInfo(fieldname, header);

                ExtGridComboBoxEditor editor = new ExtGridComboBoxEditor();
                editor.valueField   = "code";
                editor.displayField = "name";
                editor.queryMode    = "local";
                editor.xtype        = xtype;
                editor.data         = TranslateData(combodata, ';', '|');
                col.editor          = editor;
                col.renderer        = new IndividualUIRule().GetRenderer(combodata);
                columnInfo          = col;
            }
            else if (xtype == "ngDate")
            {
                columnInfo = new ExtGridDateColumnInfo(fieldname, header);

                ExtGridColumnEditorBase editor = new ExtGridColumnEditorBase();
                editor.xtype      = xtype;
                columnInfo.editor = editor;
            }
            else if (xtype == "ngDateTime")
            {
                columnInfo = new ExtGridDateTimeColumnInfo(fieldname, header);

                ExtGridColumnEditorBase editor = new ExtGridColumnEditorBase();
                editor.xtype      = xtype;
                columnInfo.editor = editor;
            }
            else if (xtype == "ngNumber")
            {
                columnInfo = new ExtGridNumberColumnInfo(fieldname, header, declen);

                ExtGridNumberEditor editor = new ExtGridNumberEditor();
                editor.xtype            = xtype;
                editor.decimalPrecision = declen;
                editor.maxValue         = GetMaxVal(length, declen);
                columnInfo.editor       = editor;
            }
            else if (xtype == "ngPercent")//百分比
            {
                columnInfo = new ExtGridPerCentColumnInfo(fieldname, header, declen);

                ExtGridNumberEditor editor = new ExtGridNumberEditor();
                editor.xtype            = "ngNumber";
                editor.decimalPrecision = declen;
                editor.showPercent      = true;
                editor.step             = 0.01;
                columnInfo.editor       = editor;
            }
            else
            {
                columnInfo = new ExtGridColumnInfoBase(fieldname, header);
                ExtGridColumnEditorBase editor = new ExtGridColumnEditorBase();
                editor.xtype      = xtype;
                columnInfo.editor = editor;
            }

            return(columnInfo);
        }