Exemple #1
0
        /// <summary>
        /// SearchLookUpEdit货架信息控件初始化
        /// </summary>
        public void RepositoryItemSearchLookUpEdit_ShelfInfo(RepositoryItemSearchLookUpEdit repSearchLookUp, string valueMemberStr = "AutoId", string displayMemberStr = "ShelfNo")
        {
            if (DataTypeConvert.GetString(repSearchLookUp.View.Tag) == "Init")
            {
                return;
            }

            GridColumn grdColAutoId = new GridColumn();

            grdColAutoId.Caption   = "AutoId";
            grdColAutoId.FieldName = "AutoId";
            grdColAutoId.Name      = "grdColAutoId";

            GridColumn grdColShelfNo = new GridColumn();

            grdColShelfNo.Caption   = "货架号";
            grdColShelfNo.FieldName = "ShelfNo";
            grdColShelfNo.Name      = "grdColShelfNo";
            grdColShelfNo.AppearanceHeader.Options.UseTextOptions = true;
            grdColShelfNo.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColShelfNo.Visible      = true;
            grdColShelfNo.VisibleIndex = 0;

            GridColumn grdColShelfLocation = new GridColumn();

            grdColShelfLocation.Caption   = "货架位置";
            grdColShelfLocation.FieldName = "ShelfLocation";
            grdColShelfLocation.Name      = "grdColShelfLocation";
            grdColShelfLocation.AppearanceHeader.Options.UseTextOptions = true;
            grdColShelfLocation.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColShelfLocation.Visible      = true;
            grdColShelfLocation.VisibleIndex = 1;

            GridColumn grdColLocationName = new GridColumn();

            grdColLocationName.Caption   = "仓位名称";
            grdColLocationName.FieldName = "LocationName";
            grdColLocationName.Name      = "grdColLocationName";
            grdColLocationName.AppearanceHeader.Options.UseTextOptions = true;
            grdColLocationName.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColLocationName.Visible      = true;
            grdColLocationName.VisibleIndex = 2;

            repSearchLookUp.View.Columns.AddRange(new GridColumn[] { grdColAutoId, grdColShelfNo, grdColShelfLocation, grdColLocationName });

            repSearchLookUp.NullText      = "";
            repSearchLookUp.ValueMember   = valueMemberStr;
            repSearchLookUp.DisplayMember = displayMemberStr;

            if (shelfInfoTable_false == null)
            {
                shelfInfoTable_false = commonDAO.QueryShelfInfo(false);
            }
            repSearchLookUp.DataSource = shelfInfoTable_false;

            repSearchLookUp.View.IndicatorWidth          = 60;
            repSearchLookUp.View.CustomDrawRowIndicator += searchLookUpView_CustomDrawRowIndicator;

            repSearchLookUp.View.Tag = "Init";
        }
 private void InitializeComponent()
 {
     this.fProperties     = new DevExpress.XtraEditors.Repository.RepositoryItemSearchLookUpEdit();
     this.fPropertiesView = new DevExpress.XtraGrid.Views.Grid.GridView();
     ((System.ComponentModel.ISupportInitialize)(this.fProperties)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.fPropertiesView)).BeginInit();
     this.SuspendLayout();
     //
     // fProperties
     //
     this.fProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
         new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)
     });
     this.fProperties.Name = "fProperties";
     this.fProperties.View = this.fPropertiesView;
     //
     // fPropertiesView
     //
     this.fPropertiesView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
     this.fPropertiesView.Name           = "fPropertiesView";
     this.fPropertiesView.OptionsSelection.EnableAppearanceFocusedCell = false;
     this.fPropertiesView.OptionsView.ShowGroupPanel = false;
     ((System.ComponentModel.ISupportInitialize)(this.fProperties)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.fPropertiesView)).EndInit();
     this.ResumeLayout(false);
 }
Exemple #3
0
        private void LinesView_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
        {
            try
            {
                if (LinesView.IsFilterRow(e.RowHandle))
                {
                    e.RepositoryItem = new RepositoryItemTextEdit();
                }
                else
                {
                    if (e.RowHandle >= 0 && e.Column.AbsoluteIndex == 3)
                    {
                        int  PCode;
                        bool IsParsed = int.TryParse(LinesView.GetRowCellValue(e.RowHandle, LinesView.Columns[1]).ToString(), out PCode);

                        if (IsParsed == true)
                        {
                            FillWareHouse(PCode, e.RowHandle);
                            RepositoryItemSearchLookUpEdit re = (RepositoryItemSearchLookUpEdit)repWareHouse.Clone();
                            e.RepositoryItem = re;
                        }
                        else
                        {
                            // MessageBox.Show("You Must Choose Product Firstly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #4
0
        /// <summary>
        /// SearchLookUpEdit项目信息控件初始化
        /// </summary>
        public void RepositoryItemSearchLookUpEdit_ProjectList(RepositoryItemSearchLookUpEdit repSearchLookUp, string valueMemberStr = "ProjectNo", string displayMemberStr = "ProjectName")
        {
            if (DataTypeConvert.GetString(repSearchLookUp.View.Tag) == "Init")
            {
                return;
            }

            GridColumn grdColAutoId = new GridColumn();

            grdColAutoId.Caption   = "AutoId";
            grdColAutoId.FieldName = "AutoId";
            grdColAutoId.Name      = "grdColAutoId";

            GridColumn grdColProjectNo = new GridColumn();

            grdColProjectNo.Caption   = "项目号";
            grdColProjectNo.FieldName = "ProjectNo";
            grdColProjectNo.Name      = "grdColProjectNo";
            grdColProjectNo.AppearanceHeader.Options.UseTextOptions = true;
            grdColProjectNo.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColProjectNo.Visible      = true;
            grdColProjectNo.VisibleIndex = 0;

            GridColumn grdColProjectName = new GridColumn();

            grdColProjectName.Caption   = "项目名称";
            grdColProjectName.FieldName = "ProjectName";
            grdColProjectName.Name      = "grdColProjectName";
            grdColProjectName.AppearanceHeader.Options.UseTextOptions = true;
            grdColProjectName.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColProjectName.Visible      = true;
            grdColProjectName.VisibleIndex = 1;

            GridColumn grdColRemark = new GridColumn();

            grdColRemark.Caption   = "备注";
            grdColRemark.FieldName = "Remark";
            grdColRemark.Name      = "grdColRemark";
            grdColRemark.AppearanceHeader.Options.UseTextOptions = true;
            grdColRemark.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColRemark.Visible      = true;
            grdColRemark.VisibleIndex = 2;

            repSearchLookUp.View.Columns.AddRange(new GridColumn[] { grdColAutoId, grdColProjectNo, grdColProjectName, grdColRemark });

            repSearchLookUp.NullText      = "";
            repSearchLookUp.ValueMember   = valueMemberStr;
            repSearchLookUp.DisplayMember = displayMemberStr;

            if (projectListTable_false == null)
            {
                projectListTable_false = commonDAO.QueryProjectList(false);
            }
            repSearchLookUp.DataSource = projectListTable_false;

            repSearchLookUp.View.IndicatorWidth          = 60;
            repSearchLookUp.View.CustomDrawRowIndicator += searchLookUpView_CustomDrawRowIndicator;

            repSearchLookUp.View.Tag = "Init";
        }
Exemple #5
0
        public void LinkListToColumn(DevExpress.XtraGrid.Columns.GridColumn col, Type tableType, string _valueMember = "", string gridFilterString = "")
        {
            XPClassInfo classInfo = AppListSession.GetClassInfo(tableType);

            DataMemberXPCollection = new XPCollection(AppListSession, classInfo);

            var lookupGrd     = new RepositoryItemSearchLookUpEdit();
            var lookupGrdView = new GridView();

            lookupGrd.BeginInit();
            lookupGrdView.BeginInit();
            SetupGridView(lookupGrdView, DataMemberXPCollection);
            lookupGrd.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
                new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)
            });
            lookupGrd.Name          = "lookupGrd";
            lookupGrd.View          = lookupGrdView;
            lookupGrd.DataSource    = DataMemberXPCollection;
            lookupGrd.DisplayMember = DisplayMember;
            lookupGrd.ValueMember   = string.IsNullOrEmpty(_valueMember) ? ValueMember : _valueMember;
            //if (_valueMember.IsNotNull()) lookupGrd.KeyMember = _valueMember;
            col.ColumnEdit = lookupGrd;

            ActiveColumnLinks.Add(col);
            RetrieveRows(false); //Tell AppList to get its rows if it the first use
        }
Exemple #6
0
        public static void CargarRepositoryItemSearchLookUpEdit(RepositoryItemSearchLookUpEdit slue, object dataSource, List <BESearchLookUpEdit> lstSLUE)
        {
            BindingSource bs = new BindingSource();

            bs.DataSource = dataSource;

            slue.DataSource = null;


            slue.ValueMember   = lstSLUE[0].fieldName;
            slue.DisplayMember = lstSLUE[1].fieldName;
            slue.PopulateViewColumns();

            foreach (var item in lstSLUE)
            {
                slue.View.Columns.Add(new GridColumn {
                    Caption = item.caption, FieldName = item.fieldName, Visible = false
                });
            }
            slue.View.Columns[1].Visible = true;

            slue.DataSource = bs;
            //slue..Columns[0].Visible = false;
            //slue.Properties.DataSource = dataSource;
            //lue.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
            //lue.Properties.PopupFilterMode = DevExpress.XtraEditors.PopupFilterMode.Contains;
        }
Exemple #7
0
        public static void SetupLookUpEdit(
            this RepositoryItemSearchLookUpEdit lookUpEdit,
            string valueMember,
            string displayMember,
            object itemSource,
            List <ColumnInfo> columns = null,
            string nullText           = "",
            bool enterChoiceFirstRow  = true,
            int popupFormWidth        = -1)
        {
            lookUpEdit.DataSource    = itemSource;
            lookUpEdit.ValueMember   = valueMember;
            lookUpEdit.DisplayMember = displayMember;
            lookUpEdit.NullText      = nullText;

            if (columns != null)
            {
                foreach (var col in columns)
                {
                    lookUpEdit.View.AddColumn(col.FieldName, col.Caption, col.Width);
                }
            }

            if (popupFormWidth >= 0)
            {
                lookUpEdit.PopupFormWidth = popupFormWidth;
            }

            if (enterChoiceFirstRow)
            {
                lookUpEdit.Popup += LookUpEdit_Popup;
            }
        }
Exemple #8
0
        public static void AddSearchLookupEditColumn(
            this TreeList gridView,
            string fieldName,
            string caption,
            int width,
            object itemSource,
            string valueMember,
            string displayMember,
            List <ColumnInfo> columns,
            bool isAllowEdit = true,
            string nullText  = "",
            EventHandler editValueChanged = null,
            int popupFormWidth            = -1,
            bool enterChoiceFirstRow      = true)
        {
            RepositoryItemSearchLookUpEdit itemCtrl = new RepositoryItemSearchLookUpEdit();

            itemCtrl.SetupLookUpEdit(
                valueMember,
                displayMember,
                itemSource,
                columns,
                nullText: nullText,
                enterChoiceFirstRow: enterChoiceFirstRow,
                popupFormWidth: popupFormWidth);

            if (editValueChanged != null)
            {
                itemCtrl.EditValueChanged += editValueChanged;
            }

            gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl);
        }
Exemple #9
0
 /// <summary>
 /// 设置RepositoryItemSearchLookUpEdit基本属性
 /// </summary>
 /// <param name="p_DrpID">RepositoryItemSearchLookUpEdit控件</param>
 /// <param name="p_dt">数据源DataTable</param>
 /// <param name="p_ValueMember">ValueMember</param>
 /// <param name="p_DisplayMember">DisplayMember</param>
 /// <param name="p_NullText">控件值为空时显示的文字</param>
 public static void LoadRepositorySearch(RepositoryItemSearchLookUpEdit p_DrpID, DataTable p_dt, string p_ValueMember, string p_DisplayMember, string p_NullText)
 {
     p_DrpID.DataSource    = p_dt;
     p_DrpID.ValueMember   = p_ValueMember;
     p_DrpID.DisplayMember = p_DisplayMember;
     p_DrpID.NullText      = p_NullText;
     p_DrpID.PopulateViewColumns();
     p_DrpID.Popup += new System.EventHandler(p_DrpID_Popup);
 }
Exemple #10
0
 public static void EnterToSelectFirstRow(RepositoryItemSearchLookUpEdit slu)
 {
     slu.Popup += (s1, e1) =>
     {
         PopupSearchLookUpEditForm popupForm = (s1 as IPopupControl).PopupWindow as PopupSearchLookUpEditForm;
         popupForm.KeyPreview = true;
         popupForm.KeyUp     -= popupForm_KeyUp;
         popupForm.KeyUp     += popupForm_KeyUp;
     };
 }
Exemple #11
0
 /// <summary>
 /// 绑定客户 多个客户类型
 /// </summary>
 public static void BindVendor(RepositoryItemSearchLookUpEdit p_DrpID, int[] p_VendorType, string p_Condition, bool p_ShowBlank)
 {
     LoadRepositorySearch(p_DrpID, BindVendorDataSource(p_VendorType, p_Condition), "VendorID", "VendorAttn", string.Empty); //new int[2] { 20, 20 },
     SetSLKGrid(p_DrpID.View, new string[2] {
         "VendorID", "VendorAttn"
     }, new string[2] {
         "客户编码", "客户简称"
     }, new bool[2] {
         true, true
     });
 }
Exemple #12
0
        private static void BindEvent(RepositoryItemSearchLookUpEdit properties, string displayMember, string valueMember, int pageIndex, int pageSize, DbFrom dbFrom, kkCondition defaultCondition, Func <string, kkCondition> GetFilterCondition)
        {
            if (dbFrom == null)
            {
                return;
            }
            int       originPageIndex = pageIndex;
            int       count;
            DataTable dataContainer = new DataTable();

            dbFrom.TopDbFrom().Condition = defaultCondition;
            dataContainer.AddRange(bll.GetListByPager(dbFrom, pageIndex, pageSize, out count));
            properties.DisplayMember = displayMember;
            properties.ValueMember   = valueMember;
            properties.DataSource    = dataContainer;
            var gv = properties.View;

            if (dataContainer.Rows.Count < count)
            {
                gv.ColumnFilterChanged += (sender, e) =>
                {
                    pageIndex = 1;
                    dataContainer.Clear();
                    string filterText = gv.FindFilterText;
                    if (string.IsNullOrEmpty(filterText))
                    {
                        dataContainer.AddRange(bll.GetListByPager(dbFrom, originPageIndex, pageSize, out count));
                    }
                    else
                    {
                        kkCondition filterCondition  = GetFilterCondition(filterText);
                        dbFrom.TopDbFrom().Condition = filterCondition;
                        dataContainer.AddRange(bll.GetListByPager(dbFrom, pageIndex, pageSize, out count));
                    }
                    gv.RefreshData();
                    gv.ApplyFindFilter(filterText);
                };
                gv.TopRowChanged += (sender, e) =>
                {
                    string      filterText       = gv.FindFilterText;
                    kkCondition condition        = string.IsNullOrWhiteSpace(filterText) ? defaultCondition : GetFilterCondition(filterText);
                    dbFrom.TopDbFrom().Condition = condition;
                    int pageCount = (count + pageSize - 1) / pageSize;
                    if (gv.IsRowVisible(gv.DataRowCount - 1) == RowVisibleState.Visible && pageIndex < pageCount)
                    {
                        pageIndex++;
                        dataContainer.AddRange(bll.GetListByPager(dbFrom, pageIndex, pageSize, out count));
                        gv.RefreshData();
                        gv.ApplyFindFilter(filterText);
                    }
                };
            }
        }
Exemple #13
0
        /// <summary>
        /// 创建GridView的列编辑为SearchLookUpEdit
        /// </summary>
        /// <param name="gridColumn">GridColumn列对象</param>
        /// <returns></returns>
        public static RepositoryItemSearchLookUpEdit CreateSearchLookUpEdit(this GridColumn gridColumn)
        {
            RepositoryItemSearchLookUpEdit repositoryItem = new RepositoryItemSearchLookUpEdit
            {
                AutoHeight = false,
                NullText   = ""
            };

            gridColumn.View.GridControl.RepositoryItems.Add(repositoryItem);
            gridColumn.ColumnEdit = repositoryItem;
            return(repositoryItem);
        }
Exemple #14
0
        /// <summary>
        /// SearchLookUpEdit零件信息控件初始化
        /// </summary>
        public void RepositoryItemSearchLookUpEdit_PartsCode(RepositoryItemSearchLookUpEdit repSearchLookUp, string valueMemberStr = "AutoId", string displayMemberStr = "CodeName")
        {
            if (DataTypeConvert.GetString(repSearchLookUp.View.Tag) == "Init")
            {
                return;
            }

            GridColumn grdColAutoId = new GridColumn();

            grdColAutoId.Caption   = "AutoId";
            grdColAutoId.FieldName = "AutoId";
            grdColAutoId.Name      = "grdColAutoId";

            GridColumn grdColCodeFileName = new GridColumn();

            grdColCodeFileName.Caption   = "零件编号";
            grdColCodeFileName.FieldName = "CodeFileName";
            grdColCodeFileName.Name      = "grdColCodeFileName";
            grdColCodeFileName.AppearanceHeader.Options.UseTextOptions = true;
            grdColCodeFileName.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColCodeFileName.Visible      = true;
            grdColCodeFileName.VisibleIndex = 0;

            GridColumn grdColCodeName = new GridColumn();

            grdColCodeName.Caption   = "零件名称";
            grdColCodeName.FieldName = "CodeName";
            grdColCodeName.Name      = "grdColCodeName";
            grdColCodeName.AppearanceHeader.Options.UseTextOptions = true;
            grdColCodeName.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            grdColCodeName.Visible      = true;
            grdColCodeName.VisibleIndex = 1;

            repSearchLookUp.View.Columns.AddRange(new GridColumn[] { grdColAutoId, grdColCodeFileName, grdColCodeName });

            repSearchLookUp.NullText      = "";
            repSearchLookUp.ValueMember   = valueMemberStr;
            repSearchLookUp.DisplayMember = displayMemberStr;

            if (partsCodeTable_false == null)
            {
                partsCodeTable_false = commonDAO.QueryPartsCode(false);
            }
            repSearchLookUp.DataSource = partsCodeTable_false;

            repSearchLookUp.View.IndicatorWidth          = 60;
            repSearchLookUp.View.CustomDrawRowIndicator += searchLookUpView_CustomDrawRowIndicator;

            repSearchLookUp.View.Tag = "Init";
        }
Exemple #15
0
        /// <summary>
        ///  绑定国家
        /// </summary>
        /// <param name="p_DrpID">RepositoryItemSearchLookUpEdit控件</param>
        public static void BindRCountry(RepositoryItemSearchLookUpEdit p_DrpID)
        {
            string    sql = "Select CompanyName,CompanyName FROM Data_CompanyList WHERE 1=1";
            DataTable dt  = SysUtils.Fill(sql);

            LoadRepositorySearch(p_DrpID, dt, "CompanyName", "CompanyName", string.Empty);
            SetSLKGrid(p_DrpID.View, new string[2] {
                "CompanyName", "CompanyName"
            }, new string[2] {
                "国家", "国家"
            }, new bool[2] {
                false, true
            });
        }
Exemple #16
0
        /// <summary>
        /// 绑定半成品
        /// </summary>
        /// <param name="p_DrpID"></param>
        /// <param name="p_ShowBlank"></param>
        public static void BindItemBCP(RepositoryItemSearchLookUpEdit p_DrpID, bool p_ShowBlank)
        {
            string    sql = "SELECT ItemCode,ItemModel,ItemStd,ItemName FROM Data_Item Where ItemTypeID = 5";
            DataTable dt  = SysUtils.Fill(sql);

            LoadRepositorySearch(p_DrpID, dt, "ItemCode", "ItemCode", string.Empty);
            SetSLKGrid(p_DrpID.View, new string[4] {
                "ItemCode", "ItemModel", "ItemStd", "ItemName"
            }, new string[4] {
                "坯布编号", "坯布品名", "坯布规格", "坯布成分"
            }, new bool[4] {
                true, true, true, true
            });
        }
Exemple #17
0
        public static void ConfigRepositoryLookupEditSetViewColumns(RepositoryItemSearchLookUpEdit lkupControl, String Columns)
        {
            dynamic oColumns = JArray.Parse(Columns);

            DevExpress.XtraGrid.Views.Grid.GridView lookupView = lkupControl.View; //new DevExpress.XtraGrid.Views.Grid.GridView();
            bool AutoWidth = false;
            int  count     = 0;

            lookupView.Columns.Clear();
            foreach (dynamic ele in oColumns)
            {
                DevExpress.XtraGrid.Columns.GridColumn col = new DevExpress.XtraGrid.Columns.GridColumn();
                col.Caption   = ele.ColumnCaption;
                col.FieldName = ele.ColumnField;
                col.MinWidth  = 10;
                col.Visible   = true;
                col.OptionsFilter.AutoFilterCondition = DevExpress.XtraGrid.Columns.AutoFilterCondition.Contains;
                col.VisibleIndex = count;

                if (ele.width != null)
                {
                    col.Width = Convert.ToInt32(((Convert.ToDouble(lkupControl.PopupFormSize.Width) - 27) * Convert.ToDouble(ele.width)) / 100);
                }
                else
                {
                    AutoWidth = true;
                }

                col.OptionsColumn.AllowSize = true;

                lookupView.Columns.Add(col);

                count++;
            }

            lookupView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            lookupView.OptionsLayout.StoreAllOptions                = true;
            lookupView.BestFitMaxRowCount                           = -1;
            lookupView.OptionsFilter.ColumnFilterPopupRowCount      = 10;
            lookupView.OptionsFilter.DefaultFilterEditorView        = DevExpress.XtraEditors.FilterEditorViewMode.VisualAndText;
            lookupView.OptionsFind.FindDelay                        = 100;
            lookupView.OptionsFind.SearchInPreview                  = true;
            lookupView.OptionsView.ColumnAutoWidth                  = AutoWidth;
            lookupView.OptionsFind.ShowClearButton                  = false;
            lookupView.OptionsLayout.Columns.AddNewColumns          = false;
            lookupView.OptionsSelection.EnableAppearanceFocusedCell = false;
            lookupView.OptionsView.ShowGroupPanel                   = false;
            lkupControl.View = lookupView;
        }
Exemple #18
0
        /// <summary>
        /// 绑定列表对象到控件
        /// </summary>
        /// <param name="control">控件对象</param>
        /// <param name="list">列表集合</param>
        /// <param name="emptyFlag">是否插入空行</param>
        /// <returns></returns>
        public static List <CListItem> BindDictItems(this RepositoryItemSearchLookUpEdit control, List <CListItem> list, bool emptyFlag = true)
        {
            if (emptyFlag)
            {
                list.Insert(0, new CListItem(""));
            }

            BindDictItems(control, list, "Text", "Value", 300, new LookUpColumnInfo[]
            {
                new LookUpColumnInfo("Text", "名称", 150),
                new LookUpColumnInfo("Value", "编码", 150),
            });

            return(list);
        }
Exemple #19
0
        public void costID_new(RepositoryItemSearchLookUpEdit cmb)
        {
            SqlDataAdapter sqla = new SqlDataAdapter();
            DataSet        ds   = new DataSet();

            sqla.SelectCommand = new SqlCommand("Select id from tblCostcenter where CostCenter = '" + cmb.DisplayMember + "' ", con);
            sqla.Fill(ds);
            DataTable dt;

            dt = ds.Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                cmb.Tag = dt.Rows[0][0].ToString();
            }
        }
Exemple #20
0
        private static void BindEvent(RepositoryItemSearchLookUpEdit properties, string displayMember, string valueMember, int pageIndex, int pageSize, GetData callBack)
        {
            if (callBack == null)
            {
                return;
            }
            int       originPageIndex = pageIndex;
            int       count;
            DataTable dataContainer = new DataTable();

            dataContainer.AddRange(callBack(null, pageIndex, pageSize, out count));
            properties.DisplayMember = displayMember;
            properties.ValueMember   = valueMember;
            properties.DataSource    = dataContainer;
            var gv = properties.View;

            if (dataContainer.Rows.Count < count)
            {
                gv.ColumnFilterChanged += (sender, e) =>
                {
                    pageIndex = 1;
                    dataContainer.Clear();
                    string filterText = gv.FindFilterText;
                    if (string.IsNullOrEmpty(filterText))
                    {
                        dataContainer.AddRange(callBack(null, originPageIndex, pageSize, out count));
                    }
                    else
                    {
                        dataContainer.AddRange(callBack(filterText, pageIndex, pageSize, out count));
                    }
                    gv.RefreshData();
                    gv.ApplyFindFilter(filterText);
                };
                gv.TopRowChanged += (sender, e) =>
                {
                    string filterText = gv.FindFilterText;
                    int    pageCount  = (count + pageSize - 1) / pageSize;
                    if (gv.IsRowVisible(gv.DataRowCount - 1) == DevExpress.XtraGrid.Views.Grid.RowVisibleState.Visible && pageIndex < pageCount)
                    {
                        pageIndex++;
                        dataContainer.AddRange(callBack(filterText, pageIndex, pageSize, out count));
                        gv.RefreshData();
                        gv.ApplyFindFilter(filterText);
                    }
                };
            }
        }
Exemple #21
0
        /// <summary>
        /// 绑定全部员工
        /// </summary>
        public static void BindAllOP(RepositoryItemSearchLookUpEdit p_DrpID)
        {
            string sql = "SELECT OPID,OPName FROM Data_OP WHERE 1=1";

            sql += " AND UseableFlag=1 ";
            sql += " AND isnull(DefaultFlag,0)=0";
            DataTable dt = SysUtils.Fill(sql);

            LoadRepositorySearch(p_DrpID, dt, "OPID", "OPName", string.Empty);
            SetSLKGrid(p_DrpID.View, new string[2] {
                "OPID", "OPName"
            }, new string[2] {
                "员工编号", "员工姓名"
            }, new bool[2] {
                true, true
            });
        }
Exemple #22
0
        /// <summary>
        /// 绑定控件的数据源
        /// </summary>
        /// <param name="lookup">控件对象</param>
        /// <param name="dataSource">数据源</param>
        /// <param name="displayMember">显示字段</param>
        /// <param name="valueMember">值字段</param>
        /// <param name="popupWidth">显示宽度</param>
        /// <param name="lookUpColumnInfos">显示的列</param>
        /// <returns></returns>
        public static object BindDictItems(this RepositoryItemSearchLookUpEdit lookup, object dataSource,
                                           string displayMember, string valueMember, int popupWidth, params LookUpColumnInfo[] lookUpColumnInfos)
        {
            lookup.DataSource    = dataSource;
            lookup.DisplayMember = displayMember;
            lookup.ValueMember   = valueMember;
            lookup.View.Columns.Clear();
            for (int i = 0; i < lookUpColumnInfos.Length; i++)
            {
                lookup.View.CreateColumn(lookUpColumnInfos[i].FieldName, lookUpColumnInfos[i].Caption,
                                         lookUpColumnInfos[i].Width, true, UnboundColumnType.Bound, DefaultBoolean.False, FixedStyle.None);
            }
            lookup.ImmediatePopup = true;
            lookup.TextEditStyle  = TextEditStyles.Standard;

            return(dataSource);
        }
Exemple #23
0
        public static void populateSearchLookUpEdit <T>(RepositoryItemSearchLookUpEdit lkup, String valueMember, String displayMember, List <T> lista)
        {
            //Specify an array of countries as a data source
            lkup.DataSource = lista;

            //The field whose values are displayed in the edit box
            //lkup.DisplayMember = displayMember;
            //The field whose values match the edit value
            //lkup.ValueMember = valueMember;

            lkup.PopupFilterMode = PopupFilterMode.Default;

            //Unbound column
            //lkup.View.Columns.AddVisible(valueMember, "Id");
            //Column bound to the existing 'Country' field from the data source
            //lkup.View.Columns.AddVisible(displayMember, "Nombre");
        }
Exemple #24
0
 /// <summary>
 /// Set cột lọc cho lưới
 /// </summary>
 /// <param name="gridView">Lưới</param>
 /// <param name="columnName">Cột cần set</param>
 /// <param name="findFilterColumns">Danh sách cột filter(cách nhau bằng dấu chấm phẩy(;)</param>
 /// <param name="searchMode">Kiểu tìm kiếm</param>
 public static void SetFindFilterColumns(
     this GridView gridView,
     string columnName,
     string findFilterColumns   = "*",
     FilterCondition searchMode = FilterCondition.Default)
 {
     if (gridView.Columns[columnName] != null)
     {
         var columnEdit = gridView.Columns[columnName].ColumnEdit;
         if (columnEdit is RepositoryItemSearchLookUpEdit)
         {
             RepositoryItemSearchLookUpEdit lookUpEdit = columnEdit.CastTo <RepositoryItemSearchLookUpEdit>();
             lookUpEdit.View.OptionsFind.FindFilterColumns    = findFilterColumns;
             lookUpEdit.View.OptionsFind.HighlightFindResults = true;
             lookUpEdit.View.OptionsFind.Condition            = searchMode;
         }
     }
 }
        public static void BindDataAsync(this RepositoryItemSearchLookUpEdit repositoryItem, CriteriaOperator commonFilter, string objectName)
        {
            var worker = new BackgroundWorker();

            repositoryItem.View.InitWithDefaultLayout(objectName);
            var context = new SearchLookUpEditLoadDataContext {
                RepositoryItem = repositoryItem
            };

            worker.DoWork += (s, e) =>
            {
                var results = ListData(objectName, commonFilter);
                context.Result = results;
                e.Result       = context;
            };
            worker.RunWorkerCompleted += WorkerRunWorkerCompleted;
            worker.RunWorkerAsync();
        }
        /// <summary>
        /// Cài đặt SearchLookUpEdit
        /// </summary>
        /// <param name="lookUpEdit">SearchLookUpEdit</param>
        /// <param name="valueMember"></param>
        /// <param name="displayMember"></param>
        /// <param name="itemSource">data source cho loopkup</param>
        /// <param name="columns">danh sách cột hiển thị</param>
        /// <param name="nullText">giá trị hiển thị khi null</param>
        /// <param name="enterChoiceFirstRow">Enter sẽ chọn dòng đầu tiên</param>
        /// <param name="popupFormWidth">Chiều rộng của popup</param>
        /// <param name="popupFormHeight">Chiều cao của popup</param>
        /// <param name="columnAutoWidth">Cột tự động giãn hết grid</param>
        /// <param name="isBestFitColumn">Cột tự động giãn theo nội dung của cột</param>
        public static void SetupLookUpEdit(
            this RepositoryItemSearchLookUpEdit lookUpEdit,
            string valueMember,
            string displayMember,
            object itemSource,
            List <ColumnInfo> columns,
            string nullText          = "",
            bool enterChoiceFirstRow = true,
            int popupFormWidth       = -1,
            int popupFormHeight      = -1,
            bool columnAutoWidth     = false,
            bool isBestFitColumn     = false)
        {
            lookUpEdit.DataSource    = itemSource;
            lookUpEdit.ValueMember   = valueMember;
            lookUpEdit.DisplayMember = displayMember;
            lookUpEdit.NullText      = nullText;

            if (columns != null)
            {
                foreach (var col in columns)
                {
                    lookUpEdit.View.AddColumn(col.FieldName, col.Caption, col.Width);
                }
            }

            if (popupFormWidth >= 0 || popupFormHeight >= 0)
            {
                popupFormWidth           = popupFormWidth >= 0 ? popupFormWidth : lookUpEdit.PopupFormSize.Width;
                popupFormHeight          = popupFormHeight >= 0 ? popupFormHeight : lookUpEdit.PopupFormSize.Height;
                lookUpEdit.PopupFormSize = new Size(popupFormWidth, popupFormHeight);
            }

            if (enterChoiceFirstRow)
            {
                lookUpEdit.Popup += LookUpEdit_Popup;
            }

            lookUpEdit.View.OptionsView.ColumnAutoWidth = columnAutoWidth;
            if (isBestFitColumn)
            {
                lookUpEdit.BestFitMode = BestFitMode.BestFit;
            }
        }
Exemple #27
0
        public static void AddSearchLookupEditColumn(
            this GridView gridView,
            string fieldName,
            string caption,
            int width,
            object itemSource,
            string valueMember,
            string displayMember,
            List <ColumnInfo> columns     = null,
            bool isAllowEdit              = true,
            string nullText               = "",
            EventHandler editValueChanged = null,
            int popupFormWidth            = -1,
            int popupFormHeight           = -1,
            bool enterChoiceFirstRow      = true,
            KeyEventHandler keyDown       = null,
            bool isBestFitColumn          = false)
        {
            RepositoryItemSearchLookUpEdit itemCtrl = new RepositoryItemSearchLookUpEdit();

            itemCtrl.SetupLookUpEdit(
                valueMember,
                displayMember,
                itemSource, columns,
                nullText: nullText,
                enterChoiceFirstRow: enterChoiceFirstRow,
                popupFormWidth: popupFormWidth,
                popupFormHeight: popupFormHeight,
                isBestFitColumn: isBestFitColumn);

            if (editValueChanged != null)
            {
                itemCtrl.EditValueChanged += editValueChanged;
                //itemCtrl.EditValueChanged += ItemCtrl_EditValueChanged;
            }

            if (keyDown != null)
            {
                itemCtrl.KeyDown += new KeyEventHandler(keyDown);
            }

            gridView.AddColumn(fieldName, caption, width, isAllowEdit, itemCtrl: itemCtrl);
        }
Exemple #28
0
        public void loadCostCenter_new(RepositoryItemSearchLookUpEdit cmb)
        {
            SqlDataAdapter sqla = new SqlDataAdapter();
            DataSet        ds   = new DataSet();

            sqla.SelectCommand = new SqlCommand("Exec CostCenterLoad", con);//select s.id, c.CostCenter, s.ShipmentSl from tblShipmentInfo S left join tblCostcenter c on c.id =s.LCno
            sqla.Fill(ds);
            DataTable dt;

            dt = ds.Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cmb.DataSource    = dt;
                    cmb.DisplayMember = "ShipmentSl";
                    cmb.ValueMember   = "ShipmentSl";
                }
            }
        }
Exemple #29
0
 private void InitializeComponent()
 {
     this.fProperties     = new DevExpress.XtraEditors.Repository.RepositoryItemSearchLookUpEdit();
     this.fPropertiesView = new DevExpress.XtraGrid.Views.Grid.GridView();
     this.gridView1       = new DevExpress.XtraGrid.Views.Grid.GridView();
     ((System.ComponentModel.ISupportInitialize)(this.fProperties)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.fPropertiesView)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
     this.SuspendLayout();
     //
     // fProperties
     //
     this.fProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
         new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)
     });
     this.fProperties.Name = "fProperties";
     this.fProperties.View = this.gridView1;
     //
     // fPropertiesView
     //
     this.fPropertiesView.Name = "fPropertiesView";
     //
     // gridView1
     //
     this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
     this.gridView1.Name           = "gridView1";
     this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
     this.gridView1.OptionsView.ShowGroupPanel = false;
     //
     // MyGridLookUpEdit
     //
     this.Closed           += new DevExpress.XtraEditors.Controls.ClosedEventHandler(this.MyGridLookUpEdit_Closed);
     this.EditValueChanged += new System.EventHandler(this.MyGridLookUpEdit_EditValueChanged);
     this.KeyDown          += new System.Windows.Forms.KeyEventHandler(this.MyGridLookUpEdit_KeyDown);
     ((System.ComponentModel.ISupportInitialize)(this.fProperties)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.fPropertiesView)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
     this.ResumeLayout(false);
 }
 public void CargarLookEditDevExpress_Generico(RepositoryItemSearchLookUpEdit LookEdit, DataTable Data_Table, string DisplayMember, string valuemember, string Captions)
 {
     try
     {
         LookEdit.DataSource    = Data_Table;
         LookEdit.DisplayMember = DisplayMember.ToUpper();
         LookEdit.ValueMember   = valuemember.ToUpper();
         LookEdit.View.Columns.Clear();
         string[] newline = Captions.Split(',');
         int      index   = 0;
         foreach (DataColumn colum in Data_Table.Columns)
         {
             if ((colum.ColumnName != valuemember.ToUpper()))
             {
                 LookEdit.View.Columns.AddField(colum.ColumnName).Caption = newline[index].Trim();
                 LookEdit.View.Columns[colum.ColumnName].Visible          = true;
                 index += 1;
             }
         }
         if ((Data_Table.Rows.Count > 0))
         {
             LookEdit.EditValueChangedDelay = 0;
             LookEdit.EditValueChangedDelay = Convert.ToInt32(Data_Table.Rows[0][valuemember]);
             LookEdit.ShowClearButton       = false;
         }
         else
         {
             LookEdit.EditValueChangedDelay = 0;
         }
     }
     catch (Exception ex)
     {
         //MsgBox("Error: " & vbCrLf & ex.Message)
         DevExpress.XtraEditors.XtraMessageBox.Show("Error: " + "\n" + ex.Message, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }