Пример #1
0
        private void setvalue(bd_sbsxz sx, BD_SBTZ_SX zlsx, Dictionary<int, string> dicvalue) {
            switch (zlsx.sxtype) {
                case "1":
                case "下拉列表":
                    sx.type = "1";
                    break;
                case "2":
                case "日期":
                    sx.type = "2";
                    break;
                default:
                    sx.type = "0";
                    break;
            }
            if (!string.IsNullOrEmpty(zlsx.boxtype)) {
                if (zlsx.boxtype == "查询") {
                    try {
                        if (dicvalue.ContainsKey(zlsx.id)) {
                            sx.bv = dicvalue[zlsx.id];
                        } else {
                            IList list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", zlsx.boxvalue);
                            if (list.Count > 0) {
                                string[] ss = new string[list.Count];
                                list.CopyTo(ss, 0);
                                sx.bv = string.Join("|", ss);
                            }
                            dicvalue.Add(zlsx.id, sx.bv);
                        }
                        
                    } catch (Exception err) {
                        Console.WriteLine(zlsx.sxname+Environment.NewLine+zlsx.boxvalue);
                        Console.WriteLine(err.Message);
                        Console.WriteLine(err.Source);
                    }

                } else {
                    sx.bv = zlsx.boxvalue;
                }
            }
        }
Пример #2
0
        private Control createControl(BD_SBTZ_SX sbsx) {
            Control c = createControl(sbsx.sxtype);
            if (sbsx.sxtype == "下拉列表" || sbsx.sxtype=="1") {
                DevExpress.XtraEditors.ComboBoxEdit box = c as DevExpress.XtraEditors.ComboBoxEdit;
                switch (sbsx.boxtype) {
                    case "查询":

                        try {
                            IList list = ClientHelper.PlatformSqlMap.GetList("SelectOneStr", sbsx.boxvalue);
                            box.Properties.Items.AddRange(list);
                        } catch { }
                        break;
                    default:
                        box.Properties.Items.AddRange(sbsx.boxvalue.Split('|'));
                        break;
                }
            }
            if (sbsx.sxtype == "日期" || sbsx.sxtype == "2") {
                var cdate = c as DateEditEx;
                cdate.BindingData(rowData, sbsx.sxcol);
                //c.DataBindings.Add("EditValue", rowData, sbsx.sxcol, true, DataSourceUpdateMode.OnPropertyChanged, DBNull.Value, "yyyy-MM-dd");
            } else {
                c.DataBindings.Add("EditValue", rowData, sbsx.sxcol);
            }
            return c;
        }