Ejemplo n.º 1
0
        public void SetupLookup()
        {
            //DevExpress.XtraEditors.Controls.LookUpColumnInfo col1;
            //col1 = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("User_Name", 100);

            Hashtable htParam = new Hashtable();
            DataTable dt      = new DataTable();

            htParam.Clear();
            dt.Clear();
            lookUpEdit1.Properties.DataSource = null;



            htParam.Add("@Trans", "SELECT");
            dt = dataaccess.ExecuteSP("Sp_User", htParam);



            DataRow dr = dt.NewRow();

            dr[0] = 0;
            dr[4] = "SELECT";
            dt.Rows.InsertAt(dr, 0);
            lookUpEdit1.Properties.DataSource    = dt;
            lookUpEdit1.Properties.DisplayMember = "User_Name";
            lookUpEdit1.Properties.ValueMember   = "User_id";

            DevExpress.XtraEditors.Controls.LookUpColumnInfo col;
            col = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("User_Name", 100);
            //col.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
            lookUpEdit1.Properties.Columns.Add(col);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 绑定下拉框:paramLUE:控件名称,paramDataTable:数据源,paraDisplayMember:显示值,paramValueMember:实际值,paramSimpleOrNot:是否是类似Window经典风格数据绑定
 /// </summary>
 /// <param name="paramLUE">控件名</param>
 /// <param name="paramDataTable">数据源</param>
 /// <param name="paramDisplayMember">显示值</param>
 /// <param name="paramValueMember">实际值</param>
 /// <param name="paramSimpleOrNot">是否是类似Window经典风格数据绑定,false:不是</param>
 public static void DataBindingLookUpEdit(DevExpress.XtraEditors.LookUpEdit paramLUE, DataTable paramDataTable, string paramDisplayMember, string paramValueMember, bool paramSimpleOrNot)
 {
     paramLUE.Properties.Columns.Clear();
     if (paramLUE.Width < 218)
     {
         XtraMessageBox.Show("请保证待绑定控件的宽度不小于218", "宽度过小",
                             MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     DevExpress.XtraEditors.Controls.LookUpColumnInfo lupColumnInfoID = new DevExpress.XtraEditors.Controls.LookUpColumnInfo();
     lupColumnInfoID.FieldName = paramValueMember;
     lupColumnInfoID.Caption   = "项目编号";
     DevExpress.XtraEditors.Controls.LookUpColumnInfo lupColumnInfoName = new DevExpress.XtraEditors.Controls.LookUpColumnInfo();
     lupColumnInfoName.FieldName = paramDisplayMember;
     lupColumnInfoName.Caption   = "项目名称";
     if (paramSimpleOrNot == false)
     {
         lupColumnInfoID.Width   = paramLUE.Width / 2 - 15;
         lupColumnInfoName.Width = paramLUE.Width / 2 + 15;
         paramLUE.Properties.Columns.Add(lupColumnInfoID);
     }
     paramLUE.Properties.Columns.Add(lupColumnInfoName);
     //paramLUE.Properties.ShowFooter = !paramSimpleOrNot;
     paramLUE.Properties.ShowHeader = !paramSimpleOrNot;
     //paramLUE.Properties.ShowLines = !paramSimpleOrNot;
     //paramLUE.Properties.AllowFocused = !paramSimpleOrNot;
     if (paramDataTable.Rows.Count < 7)
     {
         paramLUE.Properties.DropDownRows = paramDataTable.Rows.Count;
     }
     paramLUE.Properties.DisplayMember = paramDisplayMember;
     paramLUE.Properties.ValueMember   = paramValueMember;
     paramLUE.Properties.DataSource    = paramDataTable;
     paramLUE.ItemIndex = 0;
 }
Ejemplo n.º 3
0
        private void lk_Product_Init()
        {
            //DataSet _ds = new DataSet();
            ACMSLogic.StockRequest.StockRequest stockRequest = new ACMSLogic.StockRequest.StockRequest();

            //string strSQL = "select * from tblproduct";
            //SqlHelper.FillDataset(connection,CommandType.StoredProcedure,"UP_GETDATA",_ds,new string[] {"table"}, new SqlParameter("@strSQL", strSQL) );
            //_ds.Tables[0];
            DataTable dt = stockRequest.GetProductByBranch(this.lkBranchTo.EditValue.ToString());            //pr.GetProductByBranch(this.lkBranchTo.EditValue.ToString());

            lk_Product.BestFit();

            DevExpress.XtraEditors.Controls.LookUpColumnInfo[] col = new DevExpress.XtraEditors.Controls.LookUpColumnInfo[6];

            col[0] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strItemCode", "Item Code", 50, DevExpress.Utils.FormatType.None, "", true, DevExpress.Utils.HorzAlignment.Default, DevExpress.Data.ColumnSortOrder.None);
            col[1] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strDescription", "Description", 50, DevExpress.Utils.FormatType.None, "", true, DevExpress.Utils.HorzAlignment.Default, DevExpress.Data.ColumnSortOrder.None);
            col[2] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strStyle", "Style", 15, DevExpress.Utils.FormatType.None, "", true, DevExpress.Utils.HorzAlignment.Default, DevExpress.Data.ColumnSortOrder.None);
            col[3] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strColor", "Color", 15, DevExpress.Utils.FormatType.None, "", true, DevExpress.Utils.HorzAlignment.Default, DevExpress.Data.ColumnSortOrder.None);
            col[4] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strSize", "Size", 15, DevExpress.Utils.FormatType.None, "", true, DevExpress.Utils.HorzAlignment.Default, DevExpress.Data.ColumnSortOrder.None);
            col[5] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("nQuantity", "Quantity", 10, DevExpress.Utils.FormatType.None, "", true, DevExpress.Utils.HorzAlignment.Default, DevExpress.Data.ColumnSortOrder.None);

            try
            {
                new ACMS.XtraUtils.LookupEditBuilder.CommonLookupEditBuilder(lk_Product, dt, col, "strItemCode", "strItemCode", "Item Code");
            }
            catch (Exception ex)
            {
                return;
            }
        }
Ejemplo n.º 4
0
        public void Mapping(string FieldName, Object ListDatas)
        {
            Type[] ts = ListDatas.GetType().GetGenericArguments();
            if (ts.Length <= 0)
            {
                return;
            }
            Type   t           = ts[0];
            string id          = "";
            string name        = "";
            string captionName = "";
            var    prop        = t.GetProperties().Where(p => Attribute.IsDefined(p, typeof(DisplaySelectionAttribute))).FirstOrDefault();

            if (prop != null)
            {
                name        = prop.Name;
                captionName = prop.GetCustomAttributesData()[0].ConstructorArguments[0].Value.ToString();
            }
            prop = t.GetProperties().Where(p => Attribute.IsDefined(p, typeof(IdSelectionAttribute))).FirstOrDefault();
            if (prop != null)
            {
                id = prop.Name;
            }
            RepositoryItemLookUpEdit lk = new RepositoryItemLookUpEdit();

            lk.ValueMember   = id;
            lk.DisplayMember = name;
            lk.DataSource    = ListDatas;
            lk.NullText      = string.Empty;
            LookUpColumnInfo lok = new DevExpress.XtraEditors.Controls.LookUpColumnInfo(name, captionName);

            lok.Visible = true;
            lk.Columns.Add(lok);
            var columnEdit = mainView.Columns.Where(item => item.FieldName == FieldName).FirstOrDefault();

            if (columnEdit != null)
            {
                columnEdit.ColumnEdit = lk;
            }
        }
Ejemplo n.º 5
0
        private void lk_Product_Init()
        {
            //DataSet _ds = new DataSet();
            ACMSLogic.StockRequest.StockRequest stockRequest = new ACMSLogic.StockRequest.StockRequest();

            //string strSQL = "select * from tblproduct";
            //SqlHelper.FillDataset(connection,CommandType.StoredProcedure,"UP_GETDATA",_ds,new string[] {"table"}, new SqlParameter("@strSQL", strSQL) );
            //_ds.Tables[0];
            DataTable dt = stockRequest.GetProductByBranch(this.lkBranchTo.EditValue.ToString());//pr.GetProductByBranch(this.lkBranchTo.EditValue.ToString());

            lk_Product.BestFit();

            DevExpress.XtraEditors.Controls.LookUpColumnInfo[] col = new DevExpress.XtraEditors.Controls.LookUpColumnInfo[6];

            col[0] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strItemCode","Item Code",50,DevExpress.Utils.FormatType.None,"",true,DevExpress.Utils.HorzAlignment.Default,DevExpress.Data.ColumnSortOrder.None);
            col[1] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strDescription","Description",50,DevExpress.Utils.FormatType.None,"",true,DevExpress.Utils.HorzAlignment.Default,DevExpress.Data.ColumnSortOrder.None);
            col[2] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strStyle","Style",15,DevExpress.Utils.FormatType.None,"",true,DevExpress.Utils.HorzAlignment.Default,DevExpress.Data.ColumnSortOrder.None);
            col[3] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strColor","Color",15,DevExpress.Utils.FormatType.None,"",true,DevExpress.Utils.HorzAlignment.Default,DevExpress.Data.ColumnSortOrder.None);
            col[4] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("strSize","Size",15,DevExpress.Utils.FormatType.None,"",true,DevExpress.Utils.HorzAlignment.Default,DevExpress.Data.ColumnSortOrder.None);
            col[5] = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("nQuantity","Quantity",10,DevExpress.Utils.FormatType.None,"",true,DevExpress.Utils.HorzAlignment.Default,DevExpress.Data.ColumnSortOrder.None);

            try
            {
                new ACMS.XtraUtils.LookupEditBuilder.CommonLookupEditBuilder(lk_Product,dt,col,"strItemCode","strItemCode","Item Code");
            }
            catch(Exception ex)
            {
                return;
            }
        }