コード例 #1
0
ファイル: GridHelper.cs プロジェクト: youthjoy/cshelper
        void ug_list_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGrid ug_list = sender as UltraGrid;
            Sys_PD_RefModule refModuleData = new Sys_PD_RefModule();
            int i = 0;
            //ug_list.DisplayLayout.Appearance.FontData.SizeInPoints = (float)30;
            //ug_list.ResetDisplayLayout();
            //绑定每一列,并修改表头
            Sys_PD_Module module = new Sys_PD_Module();
            GridTagObject gridObj = ug_list.Tag as GridTagObject;
            module = gridObj.Module;
            //module = ug_list.Tag as Sys_PD_Module;
            List<Sys_PD_Filed> filedList = new List<Sys_PD_Filed>();
            filedList = instField.GetListByWhere(" and DCP_ModuleName='" + module.SPM_Module + "' order by DCP_Order ASC").ToList();

            //			 e.Layout.Bands[0].Columns["price"].MaskInput= "$#,###.##";

            Infragistics.Win.UltraWinGrid.UltraGridColumn ugCol;
            for (i = 0; i < e.Layout.Bands[0].Columns.Count; i++)//使所有的都不能编辑
            {
                ugCol = e.Layout.Bands[0].Columns[i];
                //使其不能在Grid上编辑
                ugCol.CellActivation = Activation.NoEdit;
                ugCol.Hidden = true;
                //ugCol.Header.te

            }
            ug_list.DisplayLayout.Bands[0].Summaries.Clear();

            foreach (Sys_PD_Filed field in filedList)
            {
                UltraGridBand band = e.Layout.Bands[0];
                if (band.Columns.Exists(field.DCP_ControlID))
                {
                    band.Columns[field.DCP_ControlID].Header.Caption = field.DCP_Label;
                    band.Columns[field.DCP_ControlID].Hidden = field.DCP_IsHidden == 1 ? true : false;
                    band.Columns[field.DCP_ControlID].Tag = field;//置tag属性,保存列的配置属性
                    band.Columns[field.DCP_ControlID].Header.VisiblePosition = field.DCP_Order;
                    band.Columns[field.DCP_ControlID].CellActivation = Activation.AllowEdit;

                }
                else
                {
                    continue;
                }

                if (field.DCP_IsSummary > 0)
                {
                    ug_list.DisplayLayout.Bands[0].Columns[field.DCP_ControlID].AllowRowSummaries = AllowRowSummaries.SingleSummaryBasedOnDataType;

                    ug_list.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, ug_list.DisplayLayout.Bands[0].Columns[field.DCP_ControlID]);
                    ug_list.DisplayLayout.Bands[0].SummaryFooterCaption = "合计";
                }

                //绑定编辑的控件
                switch (field.DCP_ControlType)
                {
                    case "text":
                        if (field.DCP_IsReadonly == 1)
                        {
                            band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                        }
                        break;
                    case "dec":
                        band.Columns[field.DCP_ControlID].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Double;
                        band.Columns[field.DCP_ControlID].PromptChar = ' ';
                        band.Columns[field.DCP_ControlID].MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.Raw;
                        band.Columns[field.DCP_ControlID].MaskDataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.Raw;
                        if (field.DCP_IsReadonly == 1)
                        {
                            band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                        }

                        break;
                    case "int":
                        band.Columns[field.DCP_ControlID].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Integer;

                        if (field.DCP_IsReadonly == 1)
                        {
                            band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                        }
                        break;
                    case "check":
                        band.Columns[field.DCP_ControlID].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;

                        if (field.DCP_IsReadonly == 1)
                        {
                            band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                        }
                        break;
                    case "date":
                        band.Columns[field.DCP_ControlID].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Date;
                        band.Columns[field.DCP_ControlID].MaskInput = "yyyy-mm-dd";
                        //band.Columns[field.DCP_ControlID].DefaultCellValue = DateTime.Now;

                        if (field.DCP_IsReadonly == 1)
                        {
                            band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                        }
                        break;
                    case "time":
                        band.Columns[field.DCP_ControlID].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTimeWithoutDropDown;
                        band.Columns[field.DCP_ControlID].MaskInput = "yyyy-mm-dd hh:mm";
                        //band.Columns[field.DCP_ControlID].DefaultCellValue = DateTime.Now;

                        if (field.DCP_IsReadonly == 1)
                        {
                            band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                        }
                        break;
                    case "dict":
                        var dict = instDict.GetListByWhere(string.Format(" and dict_key='{0}' and dict_code <>'{0}' order by dict_order ", field.DCP_Type));
                        var valueList = new ValueList();
                        foreach (var obj in dict)
                        {
                            valueList.ValueListItems.Add(obj.Dict_Code, obj.Dict_Name);
                        }
                        band.Columns[field.DCP_ControlID].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
                        band.Columns[field.DCP_ControlID].ValueList = valueList;
                        band.Columns[field.DCP_ControlID].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnCellActivate;

                        if (field.DCP_IsReadonly == 1)
                        {
                            band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                        }
                        break;
                    case "ref":
                        //e.Layout.Bands[0].Columns[field.DCP_ControlID].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.ul;
                        UltraDropDown drop = new UltraDropDown();
                        string sql = string.Empty;
                        //if (!string.IsNullOrEmpty(field.DCP_RefSQL))
                        //{
                        //    sql = string.Format(field.DCP_RefSQL, "");
                        //MethodInvoker exc = delegate
                        //{
                        ADOSys_PD_RefModule refInst = new ADOSys_PD_RefModule();
                        Sys_PD_RefModule refModule = refInst.GetListByWhere(string.Format(" and SPR_RefModule='{0}'", field.DCP_RefSQL)).FirstOrDefault();

                        if (refModule != null && !string.IsNullOrEmpty(field.DCP_RefSQL))
                        {

                            sql = refModule.SPR_RefSQL.Trim();
                            DataTable refDate = new DataTable();
                            refDate = instField.GetRefData(sql);
                            drop.DataSource = refDate.DefaultView;
                            drop.DisplayMember = field.DCP_RefValue;
                            drop.ValueMember = field.DCP_RefCode;

                            drop.Tag = field;

                            //drop.v += new EventHandler(drop_TextChanged);
                            band.Columns[field.DCP_ControlID].ValueList = drop;
                            band.Columns[field.DCP_ControlID].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;

                            if (field.DCP_IsReadonly == 1)
                            {
                                band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                            }
                            drop.Rows.ColumnFilters[field.DCP_RefValue].FilterConditions.Add(FilterComparisionOperator.Contains, drop.Text);
                        }
                        else
                        {
                            DataTable refDate = new DataTable();
                            drop.DataSource = refDate.DefaultView;
                            drop.DisplayMember = field.DCP_RefValue;
                            drop.ValueMember = field.DCP_RefCode;
                            //drop.v += new EventHandler(drop_TextChanged);
                            band.Columns[field.DCP_ControlID].ValueList = drop;
                            band.Columns[field.DCP_ControlID].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;

                            if (field.DCP_IsReadonly == 1)
                            {
                                band.Columns[field.DCP_ControlID].CellClickAction = CellClickAction.RowSelect;
                            }

                            //drop.Rows.ColumnFilters[field.DCP_RefValue].FilterConditions.Add(FilterComparisionOperator.Contains, drop.Text);
                        }
                        //};

                        //exc.BeginInvoke(null, null);

                        //}

                        break;
                }
            }
            if (module.SPM_IsFilter > 0)
            {
                SetExcelStyleFilter(ug_list);
            }
            ug_list.DisplayLayout.AutoFitStyle = AutoFitStyle.ExtendLastColumn;
            GridFormater.RetrieveSetGridFormat(ug_list, ug_list.DisplayLayout.Bands[0], module.SPM_Module, SessionConfig.UserID);
        }
コード例 #2
0
ファイル: FormHelper.cs プロジェクト: youthjoy/cshelper
        void ResetChildControl(UltraCombo ccCom, Sys_PD_Filed field, string parentValue)
        {
            try
            {
                Sys_PD_Module module = ccCom.Parent.Tag as Sys_PD_Module;
                Sys_PD_Filed cField = new Sys_PD_Filed();
                Sys_PD_RefModule refModule = new Sys_PD_RefModule();

                string sql = string.Empty;
                if (ccCom != null) //如果是UltraCombo
                {
                    cField = ccCom.Tag as Sys_PD_Filed;

                    if (!string.IsNullOrEmpty(cField.DCP_RefSQL))
                    {
                        refModule = instRef.GetListByWhere(string.Format(" and SPR_RefModule='{0}'", cField.DCP_RefSQL)).FirstOrDefault();//获取参考
                        if (refModule != null)
                        {
                            sql = string.Format(refModule.SPR_RefSQL.Trim(), parentValue);
                            DataTable refDate = new DataTable();
                            refDate = instField.GetRefData(sql);
                            ccCom.DataSource = refDate.DefaultView;
                            ccCom.DisplayMember = refModule.SPR_RefData;
                            ccCom.ValueMember = refModule.SPR_RefValue;
                        }
                    }
                }
            }
            catch { }
        }
コード例 #3
0
ファイル: FormHelper.cs プロジェクト: youthjoy/cshelper
        void uCom_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs e)
        {
            UltraCombo uCom = sender as UltraCombo;
            //if (uCom.Value == null)
            //{
            //    uCom.Value = "";
            //}

            Sys_PD_Filed field = uCom.Tag as Sys_PD_Filed;
            Sys_PD_RefModule refModule = new Sys_PD_RefModule();
            refModule = instRef.GetListByWhere(string.Format(" and SPR_RefModule='{0}'", field.DCP_RefSQL)).FirstOrDefault();
            if (refModule == null)
            {
                return;
            }
            string sql = string.Empty;
            //处理有上级控件的情况
            if (!string.IsNullOrEmpty(field.DCP_PControl))
            {
                uCom.Enabled = true;
                Form frm = uCom.FindForm();

                UltraCombo ultra = new UltraCombo();
                UltraComboEditor ultrEditor = new UltraComboEditor();
                Control ct = new Control();
                string pValue = "";
                ct = frm.Controls.Find(field.DCP_PControl, true).FirstOrDefault();

                if (ct.GetType() == typeof(UltraCombo))
                {
                    ultra = ct as UltraCombo;
                    pValue = ultra.Value.ToString();
                }
                else if (ct.GetType() == typeof(UltraComboEditor))
                {
                    ultrEditor = ct as UltraComboEditor;
                    pValue = ultrEditor.Value.ToString();
                }
            }
            else
            {
            }
        }
コード例 #4
0
ファイル: FormHelper.cs プロジェクト: youthjoy/cshelper
        void _refTextBox_TextChanged(object sender, EventArgs e)
        {
            UltraTextEditor _refTextBox = sender as UltraTextEditor;
            Sys_PD_Filed field = _refTextBox.Tag as Sys_PD_Filed;
            Sys_PD_RefModule refModule = new Sys_PD_RefModule();
            string sql = string.Empty;
            #region 处理其参考及带出
            if (!string.IsNullOrEmpty(field.DCP_RefSQL) && !string.IsNullOrEmpty(field.DCP_RefBack))
            {
                refModule = instRef.GetListByWhere(string.Format(" and SPR_RefModule='{0}'", field.DCP_RefSQL)).FirstOrDefault();//获取参考
                if (refModule != null)
                {
                    sql = string.Format(refModule.SPR_RefSQL.Trim(), _refTextBox.Text.Trim());
                    DataTable refDate = new DataTable();
                    refDate = instField.GetRefData(sql);
                    if (refDate.Rows.Count > 0)
                    {
                        //回写DCP_RefBack
                        string[] arr = field.DCP_RefBack.Split(',');
                        foreach (string controlInfo in arr)
                        {
                            string[] control = controlInfo.Split(':');
                            try
                            {
                                Control ct = _refTextBox.FindForm().Controls.Find(control[0].Trim(), true).FirstOrDefault();
                                if (ct.GetType() == typeof(UltraNumericEditor))
                                {
                                    UltraNumericEditor ne = _refTextBox.FindForm().Controls.Find(control[0].Trim(), true).FirstOrDefault() as UltraNumericEditor;
                                    ne.Value = refDate.Rows[0][control[1]].ToString().Trim();
                                }
                                else
                                {
                                    ct.Text = refDate.Rows[0][control[1]].ToString().Trim();
                                }
                            }
                            catch(Exception ex) {
                                throw ex;
                            }
                        }
                    }
                }
            }
            #endregion

            #region 处理下级控件
            //处理下级控件的情况
            if (!string.IsNullOrEmpty(field.DCP_CControl) && !string.IsNullOrEmpty(_refTextBox.Text))
            {
                Form frm = _refTextBox.FindForm();
                UltraCombo ccCom = frm.Controls.Find(field.DCP_CControl, true).FirstOrDefault() as UltraCombo;
                if (ccCom != null)
                {
                    ccCom.Enabled = true;// 处理下级控件的数据绑定
                    ResetChildControl(ccCom, field, _refTextBox.Text.ToString());
                }
            }
            #endregion
        }
コード例 #5
0
ファイル: FormHelper.cs プロジェクト: youthjoy/cshelper
        public Size GenerateTipsForm(Sys_PD_Module module, List<Sys_PD_Filed> filedList, Control ctr, Point p)
        {
            Sys_PD_RefModule refModule = new Sys_PD_RefModule();
            ctr.Tag = module;
            ctr.Text = module.SPM_Name;

            int iTabInex = 0;
            int xPosition = p.X;
            int yPosition = p.Y;
            int vXPosition = p.X;
            int step = 0;//控制一行已经输出多少列
            int fTI = module.SPM_TI;
            int fTX = module.SPM_TX;
            int fTY = module.SPM_TY;
            int fHeight = module.SPM_Height;
            int controlWidth = 0;
            int controlHeight = 0;

            Size lableSize = new Size(module.SPM_LX, module.SPM_LY);//标签的大小
            Size textSize = new Size(fTX, fTY);//文本框的大小
            Size areaSize = new Size((fTX * 2) + module.SPM_LX + module.SPM_LI, fTY * 3);//备注框大小
            foreach (Sys_PD_Filed field in filedList)
            {

                if (field.DCP_IsHidden == 1)
                {
                    UltraTextEditor _hiddenBox = new UltraTextEditor();
                    _hiddenBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                    _hiddenBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                    _hiddenBox.Visible = false;
                    ctr.Controls.Add(_hiddenBox);
                    continue;
                }
                if (field.DCP_Style == "newline" ||
                    (field.DCP_ControlType == "textarea" &&
                    step > module.SPM_CNum - 2))
                {
                    step = 0;
                    vXPosition = xPosition;
                    yPosition += fHeight;
                }

                fTI = module.SPM_TI;
                fTX = module.SPM_TX;
                fTY = module.SPM_TY;
                fHeight = module.SPM_Height;
                textSize = new Size(fTX, fTY);//文本框的大小
                areaSize = new Size((fTX * 2) + module.SPM_LX + module.SPM_LI, fTY * 3);

                /////////如果字段有自定义的大小,则赋值到相关模块
                if (field.DCP_TI != 0 && field.DCP_TX != 0 && field.DCP_TY != 0 && field.DCP_Height != 0)
                {
                    textSize = new Size(field.DCP_TX, field.DCP_TY);
                    areaSize = new Size(field.DCP_TX, field.DCP_TY);
                    fTX = field.DCP_TX;
                    fTY = field.DCP_TY;
                    fTI = field.DCP_TI;
                    fHeight = field.DCP_Height;
                }

                Infragistics.Win.Misc.UltraLabel _lab = new Infragistics.Win.Misc.UltraLabel();
                _lab.Location = new Point(vXPosition, yPosition + 6);
                _lab.Name = module.SPM_LPrefix + field.DCP_ControlID.ToString();
                _lab.Size = lableSize;
                _lab.TabIndex = iTabInex++;
                _lab.Text = field.DCP_Label.ToString();
                ctr.Controls.Add(_lab);

                vXPosition += module.SPM_LI;

                #region 控件生成
                switch (field.DCP_ControlType)
                {
                    case "dec":
                        UltraNumericEditor _numBox = new UltraNumericEditor();
                        _numBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _numBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _numBox.Size = textSize;
                        _numBox.NumericType = NumericType.Double;
                        _numBox.TabIndex = iTabInex++;
                        _numBox.PromptChar = ' ';
                        _numBox.Nullable = true;
                        _numBox.NullText = "0";
                        if (field.DCP_IsReadonly == 1)
                        {
                            _numBox.ReadOnly = true;
                        }
                        ctr.Controls.Add(_numBox);
                        break;
                    case "int":
                        UltraNumericEditor _intBox = new UltraNumericEditor();
                        _intBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _intBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _intBox.Size = textSize;
                        _intBox.NumericType = NumericType.Integer;
                        _intBox.TabIndex = iTabInex++;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _intBox.ReadOnly = true;
                        }
                        _intBox.PromptChar = ' ';
                        _intBox.Nullable = true;
                        _intBox.NullText = "";
                        ctr.Controls.Add(_intBox);
                        break;
                    case "text":
                        UltraTextEditor _textBox = new UltraTextEditor();
                        _textBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _textBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _textBox.Size = textSize;
                        _textBox.TabIndex = iTabInex++;
                        _textBox.Nullable = true;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _textBox.ReadOnly = true;
                        }
                        ctr.Controls.Add(_textBox);
                        break;
                    case "textl":
                        UltraTextEditor _texBox = new UltraTextEditor();
                        _texBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _texBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _texBox.Size = new Size(textSize.Width * 2, textSize.Height);
                        _texBox.TabIndex = iTabInex++;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _texBox.ReadOnly = true;
                        }
                        ctr.Controls.Add(_texBox);
                        step++;
                        vXPosition += (fTI + module.SPM_LI);
                        break;
                    case "textarea":

                        UltraTextEditor _mBox = new UltraTextEditor();
                        _mBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _mBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _mBox.Multiline = true;
                        _mBox.Size = areaSize;
                        _mBox.TabIndex = iTabInex++;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _mBox.ReadOnly = true;
                        }
                        ctr.Controls.Add(_mBox);
                        break;
                    case "date":
                        UltraDateTimeEditor _dateCom = new UltraDateTimeEditor();
                        _dateCom.BackColor = System.Drawing.SystemColors.Window;
                        _dateCom.MaskInput = "yyyy-mm-dd";
                        _dateCom.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.OnMouseEnter;
                        _dateCom.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _dateCom.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _dateCom.Size = textSize;
                        _dateCom.TabIndex = iTabInex++;
                        _dateCom.Value = DateTime.Now;
                        _dateCom.PromptChar = ' ';
                        _dateCom.Nullable = true;
                        _dateCom.NullText = DateTime.Now.ToString();
                        if (field.DCP_IsReadonly == 1)
                        {
                            _dateCom.ReadOnly = true;
                        }
                        ctr.Controls.Add(_dateCom);
                        break;
                    case "time":
                        UltraDateTimeEditor _timeCom = new UltraDateTimeEditor();
                        _timeCom.BackColor = System.Drawing.SystemColors.Window;
                        _timeCom.MaskInput = "yyyy-mm-dd hh:mm";
                        _timeCom.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.OnMouseEnter;
                        _timeCom.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _timeCom.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _timeCom.Size = textSize;
                        _timeCom.TabIndex = iTabInex++;
                        _timeCom.Value = DateTime.Now;
                        _timeCom.PromptChar = ' ';
                        _timeCom.Nullable = true;
                        _timeCom.NullText = DateTime.Now.ToString();
                        if (field.DCP_IsReadonly == 1)
                        {
                            _timeCom.ReadOnly = true;
                        }
                        ctr.Controls.Add(_timeCom);
                        break;
                    case "dict":
                        UltraComboEditor _comEdit = new UltraComboEditor();
                        _comEdit.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _comEdit.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _comEdit.Size = textSize;
                        _comEdit.TabIndex = iTabInex++;
                        _comEdit.DropDownStyle = DropDownStyle.DropDownList;
                        _comEdit.Tag = field;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _comEdit.ReadOnly = true;
                        }
                        _comEdit.ValueChanged += new EventHandler(_comEdit_ValueChanged);

                        ctr.Controls.Add(_comEdit);
                        //ExcuteWithReturnValue ddd = new ExcuteWithReturnValue(this.SetDictValue);

                        //ddd.BeginInvoke(_comEdit, field.DCP_Type, null, null);
                        SetDictValue(_comEdit, field.DCP_Type);
                        break;
                    case "ref":
                        #region UltraGrid 界面设置

                        UltraCombo uCom = new UltraCombo();
                        #endregion
                        uCom.Location = new System.Drawing.Point(vXPosition, yPosition);
                        uCom.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        uCom.Size = textSize;
                        uCom.TabIndex = iTabInex++;
                        uCom.Tag = field;
                        //uCom.Text =
                        ctr.Controls.Add(uCom);
                        //if (uCom.Value == null)
                        //{
                        //    uCom.Value = "";
                        //}

                        string sql = string.Empty;
                        if (!string.IsNullOrEmpty(field.DCP_RefSQL))
                        {
                            refModule = instRef.GetListByWhere(string.Format(" and SPR_RefModule='{0}'", field.DCP_RefSQL)).FirstOrDefault();//获取参考
                            if (refModule != null)
                            {
                                sql = string.Format(refModule.SPR_RefSQL.Trim(), "", "");
                                DataTable refDate = new DataTable();
                                refDate = instField.GetRefData(sql);
                                uCom.DataSource = refDate.DefaultView;
                                uCom.DisplayMember = refModule.SPR_RefData;
                                uCom.ValueMember = refModule.SPR_RefValue;
                            }
                        }
                        if (!string.IsNullOrEmpty(field.DCP_PControl))
                        {
                            uCom.Enabled = false;
                        }

                        uCom.ValueChanged += new EventHandler(uCom_ValueChanged);
                        //uCom.BeforeDropDown += new System.ComponentModel.CancelEventHandler(uCom_BeforeDropDown);
                        uCom.TextChanged += new EventHandler(uCom_TextChanged);
                        //uCom.LostFocus += new EventHandler(uCom_LostFocus);
                        //uCom.InitializeLayout += new InitializeLayoutEventHandler(uCom_InitializeLayout);

                        if (field.DCP_IsReadonly == 1)
                        {
                            uCom.ReadOnly = true;
                        }
                        break;
                }
                #endregion

                if (field.DCP_ControlType == "textarea" && step + 2 < module.SPM_CNum - 2)
                {
                    vXPosition += fTI;//
                    step++;
                }
                else if (field.DCP_ControlType == "textarea" && step + 2 > module.SPM_CNum - 2)
                {
                    step = module.SPM_CNum - 1;

                    if (field.DCP_TI != 0 && field.DCP_TX != 0 && field.DCP_TY != 0 && field.DCP_Height != 0)
                    {
                        yPosition += fHeight;
                    }
                    else
                    {
                        yPosition += fHeight * 2 - 14; ;
                    }
                }

                vXPosition += fTI;
                if (controlWidth < vXPosition)
                {
                    controlWidth = vXPosition;
                }
                if (controlHeight < yPosition + module.SPM_Height)
                {
                    controlHeight = yPosition + module.SPM_Height;
                }
                if (step == module.SPM_CNum - 1)
                {
                    step = 0;
                    vXPosition = xPosition;
                    yPosition += module.SPM_Height;
                }
                else
                {
                    step++;
                }
            }
            ctr.Height = controlHeight;
            Size point = new Size(controlWidth + 20, controlHeight + 10);
            ctr.KeyUp += new KeyEventHandler(ctr_KeyUp);
            return point;
        }
コード例 #6
0
        /// <summary>
        /// 更新Sys_PD_RefModule对象(即:一条记录
        /// </summary>
        public int Update(Sys_PD_RefModule sys_PD_RefModule)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Sys_PD_RefModule       SET ");
            if(sys_PD_RefModule.SPR_RefModule_IsChanged){sbParameter.Append("SPR_RefModule=@SPR_RefModule, ");}
              if(sys_PD_RefModule.SPR_RefSQL_IsChanged){sbParameter.Append("SPR_RefSQL=@SPR_RefSQL, ");}
              if(sys_PD_RefModule.SPR_RefValue_IsChanged){sbParameter.Append("SPR_RefValue=@SPR_RefValue, ");}
              if(sys_PD_RefModule.SPR_RefData_IsChanged){sbParameter.Append("SPR_RefData=@SPR_RefData, ");}
              if(sys_PD_RefModule.SPR_UDef1_IsChanged){sbParameter.Append("SPR_UDef1=@SPR_UDef1, ");}
              if(sys_PD_RefModule.SPR_UDef2_IsChanged){sbParameter.Append("SPR_UDef2=@SPR_UDef2, ");}
              if(sys_PD_RefModule.SPR_UDef3_IsChanged){sbParameter.Append("SPR_UDef3=@SPR_UDef3, ");}
              if(sys_PD_RefModule.SPR_UDef4_IsChanged){sbParameter.Append("SPR_UDef4=@SPR_UDef4, ");}
              if(sys_PD_RefModule.SPR_UDef5_IsChanged){sbParameter.Append("SPR_UDef5=@SPR_UDef5, ");}
              if(sys_PD_RefModule.Stat_IsChanged){sbParameter.Append("Stat=@Stat ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and SPR_ID=@SPR_ID; " );
              string sql=sb.ToString();
             if(sys_PD_RefModule.SPR_RefModule_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefModule))
             {
            idb.AddParameter("@SPR_RefModule", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefModule", sys_PD_RefModule.SPR_RefModule);
             }
              }
             if(sys_PD_RefModule.SPR_RefSQL_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefSQL))
             {
            idb.AddParameter("@SPR_RefSQL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefSQL", sys_PD_RefModule.SPR_RefSQL);
             }
              }
             if(sys_PD_RefModule.SPR_RefValue_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefValue))
             {
            idb.AddParameter("@SPR_RefValue", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefValue", sys_PD_RefModule.SPR_RefValue);
             }
              }
             if(sys_PD_RefModule.SPR_RefData_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefData))
             {
            idb.AddParameter("@SPR_RefData", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefData", sys_PD_RefModule.SPR_RefData);
             }
              }
             if(sys_PD_RefModule.SPR_UDef1_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef1))
             {
            idb.AddParameter("@SPR_UDef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef1", sys_PD_RefModule.SPR_UDef1);
             }
              }
             if(sys_PD_RefModule.SPR_UDef2_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef2))
             {
            idb.AddParameter("@SPR_UDef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef2", sys_PD_RefModule.SPR_UDef2);
             }
              }
             if(sys_PD_RefModule.SPR_UDef3_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef3))
             {
            idb.AddParameter("@SPR_UDef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef3", sys_PD_RefModule.SPR_UDef3);
             }
              }
             if(sys_PD_RefModule.SPR_UDef4_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef4))
             {
            idb.AddParameter("@SPR_UDef4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef4", sys_PD_RefModule.SPR_UDef4);
             }
              }
             if(sys_PD_RefModule.SPR_UDef5_IsChanged)
             {
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef5))
             {
            idb.AddParameter("@SPR_UDef5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef5", sys_PD_RefModule.SPR_UDef5);
             }
              }
             if(sys_PD_RefModule.Stat_IsChanged)
             {
             if (sys_PD_RefModule.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", sys_PD_RefModule.Stat);
             }
              }

             idb.AddParameter("@SPR_ID", sys_PD_RefModule.SPR_ID);

             return idb.ExeCmd(sql);
コード例 #7
0
 /// <summary>
 /// 获取指定的Sys_PD_RefModule对象集合
 /// </summary>
 public List<Sys_PD_RefModule> GetListByWhere(string strCondition)
 {
     List<Sys_PD_RefModule> ret = new List<Sys_PD_RefModule>();
      string sql = "SELECT  SPR_ID,SPR_RefModule,SPR_RefSQL,SPR_RefValue,SPR_RefData,SPR_UDef1,SPR_UDef2,SPR_UDef3,SPR_UDef4,SPR_UDef5,Stat FROM Sys_PD_RefModule WHERE 1=1 AND ((Stat is null) or (Stat=0) ) ";
      if(!string.IsNullOrEmpty(strCondition))
      {
     strCondition.Replace('\'','"'); //防sql注入
     sql += strCondition ;
      }
       SqlDataReader dr=null;
        try {
       dr=(SqlDataReader)idb.ReturnReader(sql);
      while(dr.Read())
      {
     Sys_PD_RefModule sys_PD_RefModule = new Sys_PD_RefModule();
     if (dr["SPR_ID"] != DBNull.Value) sys_PD_RefModule.SPR_ID = Convert.ToInt64(dr["SPR_ID"]);
     if (dr["SPR_RefModule"] != DBNull.Value) sys_PD_RefModule.SPR_RefModule = Convert.ToString(dr["SPR_RefModule"]);
     if (dr["SPR_RefSQL"] != DBNull.Value) sys_PD_RefModule.SPR_RefSQL = Convert.ToString(dr["SPR_RefSQL"]);
     if (dr["SPR_RefValue"] != DBNull.Value) sys_PD_RefModule.SPR_RefValue = Convert.ToString(dr["SPR_RefValue"]);
     if (dr["SPR_RefData"] != DBNull.Value) sys_PD_RefModule.SPR_RefData = Convert.ToString(dr["SPR_RefData"]);
     if (dr["SPR_UDef1"] != DBNull.Value) sys_PD_RefModule.SPR_UDef1 = Convert.ToString(dr["SPR_UDef1"]);
     if (dr["SPR_UDef2"] != DBNull.Value) sys_PD_RefModule.SPR_UDef2 = Convert.ToString(dr["SPR_UDef2"]);
     if (dr["SPR_UDef3"] != DBNull.Value) sys_PD_RefModule.SPR_UDef3 = Convert.ToString(dr["SPR_UDef3"]);
     if (dr["SPR_UDef4"] != DBNull.Value) sys_PD_RefModule.SPR_UDef4 = Convert.ToString(dr["SPR_UDef4"]);
     if (dr["SPR_UDef5"] != DBNull.Value) sys_PD_RefModule.SPR_UDef5 = Convert.ToString(dr["SPR_UDef5"]);
     if (dr["Stat"] != DBNull.Value) sys_PD_RefModule.Stat = Convert.ToInt32(dr["Stat"]);
     ret.Add(sys_PD_RefModule);
      }
       }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
      return ret;
 }
コード例 #8
0
        /// <summary>
        /// 添加Sys_PD_RefModule对象(即:一条记录)
        /// </summary>
        public int Add(Sys_PD_RefModule sys_PD_RefModule)
        {
            string sql = "INSERT INTO Sys_PD_RefModule (SPR_RefModule,SPR_RefSQL,SPR_RefValue,SPR_RefData,SPR_UDef1,SPR_UDef2,SPR_UDef3,SPR_UDef4,SPR_UDef5,Stat) VALUES (@SPR_RefModule,@SPR_RefSQL,@SPR_RefValue,@SPR_RefData,@SPR_UDef1,@SPR_UDef2,@SPR_UDef3,@SPR_UDef4,@SPR_UDef5,@Stat)";
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefModule))
             {
            idb.AddParameter("@SPR_RefModule", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefModule", sys_PD_RefModule.SPR_RefModule);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefSQL))
             {
            idb.AddParameter("@SPR_RefSQL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefSQL", sys_PD_RefModule.SPR_RefSQL);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefValue))
             {
            idb.AddParameter("@SPR_RefValue", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefValue", sys_PD_RefModule.SPR_RefValue);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefData))
             {
            idb.AddParameter("@SPR_RefData", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefData", sys_PD_RefModule.SPR_RefData);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef1))
             {
            idb.AddParameter("@SPR_UDef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef1", sys_PD_RefModule.SPR_UDef1);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef2))
             {
            idb.AddParameter("@SPR_UDef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef2", sys_PD_RefModule.SPR_UDef2);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef3))
             {
            idb.AddParameter("@SPR_UDef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef3", sys_PD_RefModule.SPR_UDef3);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef4))
             {
            idb.AddParameter("@SPR_UDef4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef4", sys_PD_RefModule.SPR_UDef4);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef5))
             {
            idb.AddParameter("@SPR_UDef5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef5", sys_PD_RefModule.SPR_UDef5);
             }
             if (sys_PD_RefModule.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", sys_PD_RefModule.Stat);
             }

             return idb.ExeCmd(sql);
        }
コード例 #9
0
        /// <summary>
        /// 获取指定的Sys_PD_RefModule对象(即:一条记录
        /// </summary>
        public Sys_PD_RefModule GetByKey(Int64 sPR_ID)
        {
            Sys_PD_RefModule sys_PD_RefModule = new Sys_PD_RefModule();
             string sql = "SELECT  SPR_ID,SPR_RefModule,SPR_RefSQL,SPR_RefValue,SPR_RefData,SPR_UDef1,SPR_UDef2,SPR_UDef3,SPR_UDef4,SPR_UDef5,Stat FROM Sys_PD_RefModule WHERE 1=1 AND ((Stat is null) or (Stat=0) )  AND SPR_ID=@SPR_ID ";
             idb.AddParameter("@SPR_ID", sPR_ID);

              SqlDataReader dr=null;
               try {
              dr=(SqlDataReader)idb.ReturnReader(sql);
             while(dr.Read())
             {
            if (dr["SPR_ID"] != DBNull.Value) sys_PD_RefModule.SPR_ID = Convert.ToInt64(dr["SPR_ID"]);
            if (dr["SPR_RefModule"] != DBNull.Value) sys_PD_RefModule.SPR_RefModule = Convert.ToString(dr["SPR_RefModule"]);
            if (dr["SPR_RefSQL"] != DBNull.Value) sys_PD_RefModule.SPR_RefSQL = Convert.ToString(dr["SPR_RefSQL"]);
            if (dr["SPR_RefValue"] != DBNull.Value) sys_PD_RefModule.SPR_RefValue = Convert.ToString(dr["SPR_RefValue"]);
            if (dr["SPR_RefData"] != DBNull.Value) sys_PD_RefModule.SPR_RefData = Convert.ToString(dr["SPR_RefData"]);
            if (dr["SPR_UDef1"] != DBNull.Value) sys_PD_RefModule.SPR_UDef1 = Convert.ToString(dr["SPR_UDef1"]);
            if (dr["SPR_UDef2"] != DBNull.Value) sys_PD_RefModule.SPR_UDef2 = Convert.ToString(dr["SPR_UDef2"]);
            if (dr["SPR_UDef3"] != DBNull.Value) sys_PD_RefModule.SPR_UDef3 = Convert.ToString(dr["SPR_UDef3"]);
            if (dr["SPR_UDef4"] != DBNull.Value) sys_PD_RefModule.SPR_UDef4 = Convert.ToString(dr["SPR_UDef4"]);
            if (dr["SPR_UDef5"] != DBNull.Value) sys_PD_RefModule.SPR_UDef5 = Convert.ToString(dr["SPR_UDef5"]);
            if (dr["Stat"] != DBNull.Value) sys_PD_RefModule.Stat = Convert.ToInt32(dr["Stat"]);
             }
              }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
             return sys_PD_RefModule;
        }
コード例 #10
0
        /// <summary>
        /// 添加Sys_PD_RefModule对象(即:一条记录)
        /// </summary>
        public object AddWithReturn(Sys_PD_RefModule sys_PD_RefModule)
        {
            string sql = "INSERT INTO Sys_PD_RefModule (SPR_RefModule,SPR_RefSQL,SPR_RefValue,SPR_RefData,SPR_UDef1,SPR_UDef2,SPR_UDef3,SPR_UDef4,SPR_UDef5,Stat) VALUES (@SPR_RefModule,@SPR_RefSQL,@SPR_RefValue,@SPR_RefData,@SPR_UDef1,@SPR_UDef2,@SPR_UDef3,@SPR_UDef4,@SPR_UDef5,@Stat);SELECT @@IDENTITY AS ReturnID;";
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefModule))
             {
            idb.AddParameter("@SPR_RefModule", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefModule", sys_PD_RefModule.SPR_RefModule);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefSQL))
             {
            idb.AddParameter("@SPR_RefSQL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefSQL", sys_PD_RefModule.SPR_RefSQL);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefValue))
             {
            idb.AddParameter("@SPR_RefValue", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefValue", sys_PD_RefModule.SPR_RefValue);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_RefData))
             {
            idb.AddParameter("@SPR_RefData", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_RefData", sys_PD_RefModule.SPR_RefData);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef1))
             {
            idb.AddParameter("@SPR_UDef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef1", sys_PD_RefModule.SPR_UDef1);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef2))
             {
            idb.AddParameter("@SPR_UDef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef2", sys_PD_RefModule.SPR_UDef2);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef3))
             {
            idb.AddParameter("@SPR_UDef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef3", sys_PD_RefModule.SPR_UDef3);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef4))
             {
            idb.AddParameter("@SPR_UDef4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef4", sys_PD_RefModule.SPR_UDef4);
             }
             if (string.IsNullOrEmpty(sys_PD_RefModule.SPR_UDef5))
             {
            idb.AddParameter("@SPR_UDef5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@SPR_UDef5", sys_PD_RefModule.SPR_UDef5);
             }
             if (sys_PD_RefModule.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", sys_PD_RefModule.Stat);
             }

             return idb.ReturnValue(sql);
        }