示例#1
0
        public void GenDefaultValidate()
        {
            foreach (TBlockItem BlockItem in FClientData.Blocks)
            {
                if (String.Compare(BlockItem.Name, "View") == 0)
                    continue;

                DefaultValidate aValidate = null;
                int count = 1;
                foreach (TBlockFieldItem aFieldItem in BlockItem.BlockFieldItems)
                {
                    if (aFieldItem.CheckNull != null && aFieldItem.CheckNull.ToUpper() == "Y" || (aFieldItem.DefaultValue != "" && aFieldItem.DefaultValue != null))
                    {
                        if (aValidate == null)
                        {
                            aValidate = FDesignerHost.CreateComponent(typeof(DefaultValidate), "dv" + BlockItem.ProviderName) as DefaultValidate;
                            aValidate.BindingSource = BlockItem.BindingSource;
                        }
                        FieldItem FI = new FieldItem();
                        FI.FieldName = aFieldItem.DataField;
                        FI.CheckNull = aFieldItem.CheckNull.ToUpper() == "Y";
                        FI.DefaultValue = aFieldItem.DefaultValue;
                        if (!aValidate.BindingSource.Site.Name.EndsWith("Details"))
                            FI.ValidateLabelLink = "label" + count;
                        aValidate.FieldItems.Add(FI);
                    }
                    count++;
                }
            }
        }
示例#2
0
 void buttonFieldAdd_Click(object sender, EventArgs e)
 {
     string name = (sender as Control).ID.Replace(BUTTON_FIELD_ADD, string.Empty);
     Control container = this.report.MultiView;
     ListBox listboxFieldAll = (ListBox)container.FindControl(string.Format("{0}{1}", LISTBOX_FIELD_ALL, name));
     if (!string.IsNullOrEmpty(listboxFieldAll.SelectedValue))
     {
         ListBox listboxFieldSelected = (ListBox)container.FindControl(string.Format("{0}{1}", LISTBOX_FIELD_SELECTED, name));
         if (name.Length == 0)
         {
             FieldItem item = new FieldItem();
             item.ColumnName = listboxFieldAll.SelectedValue;
             item.Caption = listboxFieldAll.SelectedItem.Text;
             Guid id = Guid.NewGuid();
             report.ItemTable.Add(id, XmlConverter.ConvertFrom(item));
             listboxFieldSelected.Items.Add(new ListItem(listboxFieldAll.SelectedItem.Text, id.ToString()));
             listboxFieldSelected.SelectedValue = id.ToString();
         }
         else
         {
             listboxFieldSelected.Items.Add(new ListItem(listboxFieldAll.SelectedItem.Text, listboxFieldAll.SelectedItem.Value));
         }
         listboxFieldAll.Items.Remove(listboxFieldAll.SelectedItem);
         listboxFieldSelected_SelectedIndexChanged(listboxFieldSelected, e);
     }
 }
示例#3
0
        private string GetDefaultValue(FieldItem fielditem)
        {
            string defVal = CliUtils.GetValue(fielditem.DefaultValue, this.OwnerComp).ToString();
            string[] defvaldates = new string[]{"_today", "_servertoday", "_firstday", "_lastday", "_firstdaylm"
                , "_lastdaylm", "_firstdayty", "_lastdayty", "_firstdayly", "_lastdayly"};
            foreach (string str in defvaldates)
            {
                if(string.Compare(str, fielditem.DefaultValue, true) == 0)
                {
                    InfoDataSet ids = this.BindingSource.GetDataSource() as InfoDataSet;
                    Type type = null;
                    if(this.BindingSource.DataSource is InfoDataSet)
                    {
                        type = ids.RealDataSet.Tables[this.BindingSource.DataMember].Columns[fielditem.FieldName].DataType;
                    }
                    else if(this.BindingSource.DataSource is InfoBindingSource)
                    {
                        type = ids.RealDataSet.Relations[this.BindingSource.DataMember].ChildTable.Columns[fielditem.FieldName].DataType;
                    }
                    if (type == typeof(string))
                    {
                        try
                        {
                            defVal = Convert.ToDateTime(defVal).ToString("yyyyMMdd");
                        }
                        catch
                        {

                        }
                    }
                    break;
                }
            }
            return defVal;
        }
示例#4
0
 void buttonFieldAddAll_Click(object sender, EventArgs e)
 {
     string name = (sender as Control).ID.Replace(BUTTON_FIELD_ADD_ALL, string.Empty);
     Control container = this.report.MultiView;
     ListBox listboxFieldAll = (ListBox)container.FindControl(string.Format("{0}{1}", LISTBOX_FIELD_ALL, name));
     ListBox listboxFieldSelected = (ListBox)container.FindControl(string.Format("{0}{1}", LISTBOX_FIELD_SELECTED, name));
     foreach (ListItem li in listboxFieldAll.Items)
     {
         if (name.Length == 0)
         {
             FieldItem item = new FieldItem();
             item.ColumnName = li.Value;
             item.Caption = li.Text;
             Guid id = Guid.NewGuid();
             report.ItemTable.Add(id, XmlConverter.ConvertFrom(item));
             listboxFieldSelected.Items.Add(new ListItem(li.Text, id.ToString()));
         }
         else
         {
             listboxFieldSelected.Items.Add(new ListItem(li.Text, li.Value));
         }
     }
     listboxFieldAll.Items.Clear();
 }