/// <devdoc>
 /// <para>Provides a deep copy of the collection.  Used mainly by design time dialogs to implement "cancel" rollback behavior.</para>
 /// </devdoc>
 public DataControlFieldCollection CloneFields() {
     DataControlFieldCollection fields = new DataControlFieldCollection();
     foreach (DataControlField field in this) {
         fields.Add(field.CloneField());
     }
     return fields;
 }
        public void can_initalise()
        {
            /*
             * prepare a definied testable structure
             */
            DataControlFieldCollection columns = new DataControlFieldCollection();
            Dictionary<string, bool> setupConfig = TrackListing.getKeyboardConfiguration(new HashedSet<string>(), new HashedSet<string>());

            foreach(KeyValuePair<string, bool> entry in setupConfig) {
                BoundField dummy = new BoundField();
                dummy.HeaderText = entry.Key;
                columns.Add(dummy);
            }

            Assert.AreEqual(15, columns.Count);
            foreach(DataControlField dummy in columns)
                Assert.IsTrue(dummy.Visible);

            /*
             * ... more definied structure
             */
            string disabledColumn = Track.Property.Titel.ToString();
            string fadedColumn = Track.Property.Year.ToString();
            ISet<string> disabled = new HashedSet<string>(new string[] { disabledColumn });
            ISet<string> faded = new HashedSet<string>(new string[] { fadedColumn });

            Dictionary<string, bool> testConfig = TrackListing.getKeyboardConfiguration(disabled, faded);

            Assert.AreEqual(14, testConfig.Count);
            foreach(KeyValuePair<string, bool> entry in testConfig) {
                if(entry.Key.Equals(fadedColumn))
                    Assert.IsTrue(entry.Value);
                else
                    Assert.IsFalse(entry.Value);
            }

            StateBag stateBag = new StateBag();
            /*
             * white-box expectations
             */
            Expect.Once.On(view).GetProperty("StateBag").Will(Return.Value(stateBag));
            Expect.Once.On(view).GetProperty("DisabledColumns").Will(Return.Value(disabled));
            Expect.Once.On(view).GetProperty("FadedColumns").Will(Return.Value(faded));
            Expect.Once.On(view).GetProperty("Columns").Will(Return.Value(columns));

            /*
             * do the testing
             */
            presenter.initialise();

            Assert.AreEqual(SortDirection.Ascending, (SortDirection)StateBagTask.getSortDirection(stateBag));
            Assert.AreEqual(Track.Property.Titel, (Track.Property)StateBagTask.getSortExpression(stateBag));

            foreach(DataControlField dummy in columns) {
                if(dummy.HeaderText.Equals(disabledColumn) || dummy.HeaderText.Equals(fadedColumn))
                    Assert.IsFalse(dummy.Visible);
                else
                    Assert.IsTrue(dummy.Visible);
            }
        }
 private void @__BuildControl__control20(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.BoundField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control21();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.TemplateField @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control22();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.BoundField @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control25();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.BoundField @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control26();
     @__ctrl.Add(@__ctrl4);
     global::System.Web.UI.WebControls.BoundField @__ctrl5;
     @__ctrl5 = this.@__BuildControl__control27();
     @__ctrl.Add(@__ctrl5);
     global::System.Web.UI.WebControls.BoundField @__ctrl6;
     @__ctrl6 = this.@__BuildControl__control28();
     @__ctrl.Add(@__ctrl6);
     global::System.Web.UI.WebControls.TemplateField @__ctrl7;
     @__ctrl7 = this.@__BuildControl__control29();
     @__ctrl.Add(@__ctrl7);
     global::System.Web.UI.WebControls.TemplateField @__ctrl8;
     @__ctrl8 = this.@__BuildControl__control32();
     @__ctrl.Add(@__ctrl8);
     global::System.Web.UI.WebControls.TemplateField @__ctrl9;
     @__ctrl9 = this.@__BuildControl__control35();
     @__ctrl.Add(@__ctrl9);
 }
 private void @__BuildControl__control2(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.BoundField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control3();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.TemplateField @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control4();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.BoundField @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control9();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.BoundField @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control10();
     @__ctrl.Add(@__ctrl4);
     global::System.Web.UI.WebControls.BoundField @__ctrl5;
     @__ctrl5 = this.@__BuildControl__control11();
     @__ctrl.Add(@__ctrl5);
     global::System.Web.UI.WebControls.BoundField @__ctrl6;
     @__ctrl6 = this.@__BuildControl__control12();
     @__ctrl.Add(@__ctrl6);
     global::System.Web.UI.WebControls.BoundField @__ctrl7;
     @__ctrl7 = this.@__BuildControl__control13();
     @__ctrl.Add(@__ctrl7);
     global::System.Web.UI.WebControls.BoundField @__ctrl8;
     @__ctrl8 = this.@__BuildControl__control14();
     @__ctrl.Add(@__ctrl8);
     global::System.Web.UI.WebControls.BoundField @__ctrl9;
     @__ctrl9 = this.@__BuildControl__control15();
     @__ctrl.Add(@__ctrl9);
     global::System.Web.UI.WebControls.TemplateField @__ctrl10;
     @__ctrl10 = this.@__BuildControl__control16();
     @__ctrl.Add(@__ctrl10);
 }
		public DataControlFieldCollection CloneFields ()
		{
			DataControlFieldCollection col = new DataControlFieldCollection ();
			foreach (DataControlField field in this)
				col.Add (field.CloneField ());
			return col;
		}
Ejemplo n.º 6
0
		public void DataControlFieldCollection_Clear ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			collection.Add (new BoundField ());
			Assert.AreEqual (1, collection.Count, "Add");
			collection.Clear ();
			Assert.AreEqual (0, collection.Count, "Clear");
		}
 private void @__BuildControl__control6(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.BoundField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control7();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.ButtonField @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control8();
     @__ctrl.Add(@__ctrl2);
 }
        /// <devdoc>
        /// <para>Provides a deep copy of the collection.  Used mainly by design time dialogs to implement "cancel" rollback behavior.</para>
        /// </devdoc>
        public DataControlFieldCollection CloneFields()
        {
            DataControlFieldCollection fields = new DataControlFieldCollection();

            foreach (DataControlField field in this)
            {
                fields.Add(field.CloneField());
            }
            return(fields);
        }
        public DataControlFieldCollection CloneFields()
        {
            DataControlFieldCollection col = new DataControlFieldCollection();

            foreach (DataControlField field in this)
            {
                col.Add(field.CloneField());
            }
            return(col);
        }
Ejemplo n.º 10
0
 public static void AssignColumName(DataControlFieldCollection col, string name, object value )
 {
     for (int i = 0; i < col.Count; i++)
     {
         if(col[i].HeaderText==name)
         {
              col[i].HeaderText=value as string;
         }
     }
 }
 private void @__BuildControl__control3(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.BoundField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control4();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.BoundField @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control5();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.TemplateField @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control6();
     @__ctrl.Add(@__ctrl3);
 }
Ejemplo n.º 12
0
 private void @__BuildControl__control10(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.ButtonField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control11();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.BoundField @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control12();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.BoundField @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control13();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.BoundField @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control14();
     @__ctrl.Add(@__ctrl4);
 }
 private void @__BuildControl__control2(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.BoundField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control3();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.TemplateField @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control4();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.BoundField @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control7();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.BoundField @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control8();
     @__ctrl.Add(@__ctrl4);
     global::System.Web.UI.WebControls.ButtonField @__ctrl5;
     @__ctrl5 = this.@__BuildControl__control9();
     @__ctrl.Add(@__ctrl5);
 }
 private void @__BuildControl__control10(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.BoundField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control11();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.TemplateField @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control12();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.BoundField @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control15();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.BoundField @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control16();
     @__ctrl.Add(@__ctrl4);
     global::System.Web.UI.WebControls.BoundField @__ctrl5;
     @__ctrl5 = this.@__BuildControl__control17();
     @__ctrl.Add(@__ctrl5);
 }
 private void @__BuildControl__control4(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.BoundField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control5();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.BoundField @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control7();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.BoundField @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control10();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.BoundField @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control12();
     @__ctrl.Add(@__ctrl4);
     global::System.Web.UI.WebControls.BoundField @__ctrl5;
     @__ctrl5 = this.@__BuildControl__control14();
     @__ctrl.Add(@__ctrl5);
     global::System.Web.UI.WebControls.HyperLinkField @__ctrl6;
     @__ctrl6 = this.@__BuildControl__control16();
     @__ctrl.Add(@__ctrl6);
 }
Ejemplo n.º 16
0
 //***************************************************************************
 // Class Constrcutors
 // 
 public GridView()
 {
     this._cols = new DataControlFieldCollection();
     this.PagerSettings.Visible = false;
     this.ChildControlsCreated = false;
 }
Ejemplo n.º 17
0
 private void @__BuildControl__control2(System.Web.UI.WebControls.DataControlFieldCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.TemplateField @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control3();
     @__ctrl.Add(@__ctrl1);
 }
        public void can_update()
        {
            /*
             * prepare a definied testable structure
             */
            DataControlFieldCollection columns = new DataControlFieldCollection();
            Dictionary<string, bool> setupConfig = TrackListing.getKeyboardConfiguration(new HashedSet<string>(), new HashedSet<string>());

            foreach(KeyValuePair<string, bool> entry in setupConfig) {
                BoundField dummy = new BoundField();
                dummy.HeaderText = entry.Key;
                columns.Add(dummy);
            }

            /*
             * all TestColumns must be Visible
             */
            foreach(DataControlField dummy in columns)
                Assert.IsTrue(dummy.Visible);

            /*
             * ... more definied structure
             */
            string disabledColumn1 = Track.Property.Autor.ToString();
            string disabledColumn2 = Track.Property.Bpm.ToString();
            string disabledColumn3 = Track.Property.Code.ToString();
            string fadedColumn1 = Track.Property.Year.ToString();
            string fadedColumn2 = Track.Property.Ending.ToString();
            string fadedColumn3 = Track.Property.Interpret.ToString();

            StateBag stateBag = new StateBag();
            StateBagTask.fadeOut(fadedColumn1, stateBag);
            StateBagTask.fadeOut(fadedColumn2, stateBag);
            StateBagTask.fadeOut(fadedColumn3, stateBag);
            ISet<string> faded = StateBagTask.getFadedColumns(stateBag);

            Assert.AreEqual(3, faded.Count);
            Assert.IsTrue(faded.Contains(fadedColumn1));
            Assert.IsTrue(faded.Contains(fadedColumn2));
            Assert.IsTrue(faded.Contains(fadedColumn3));

            ISet<string> disabled = new HashedSet<string>(new string[] { disabledColumn1, disabledColumn2, disabledColumn3 });
            Dictionary<string, bool> testConfig = TrackListing.getKeyboardConfiguration(disabled, faded);

            /*
             * all TestColumns - disabled - faded are Visible
             *
             */
            foreach(KeyValuePair<string, bool> entry in testConfig) {
                if(faded.Contains(entry.Key))
                    Assert.IsTrue(entry.Value);
                else
                    Assert.IsFalse(entry.Value);
            }

            string selectedId = fadedColumn1;

            Expect.Once.On(view).GetProperty("StateBag").Will(Return.Value(stateBag));
            Expect.Once.On(view).GetProperty("SelectedId").Will(Return.Value(selectedId));
            Expect.Once.On(view).GetProperty("DisabledColumns").Will(Return.Value(disabled));
            Expect.Exactly(2).On(view).GetProperty("FadedColumns").Will(Return.Value(faded));
            Expect.Once.On(view).GetProperty("Columns").Will(Return.Value(columns));

            /*
             * do the testing
             */
            presenter.update();

            Assert.AreEqual(2, faded.Count);
            Assert.IsFalse(faded.Contains(selectedId));

            /*
             * all TestColumns - disabled are Visible. Former faded == SelectedId is Visible again.
             */
            foreach(DataControlField dummy in columns) {
                if(dummy.HeaderText.Equals(selectedId))
                    Assert.IsTrue(dummy.Visible);
                else if(disabled.Contains(dummy.HeaderText) || faded.Contains(dummy.HeaderText))
                    Assert.IsFalse(dummy.Visible);
                else
                    Assert.IsTrue(dummy.Visible);
            }
        }
Ejemplo n.º 19
0
		public void DataControlFieldCollection_GetEnumerator ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			collection.Add (new BoundField ());
			IEnumerator numerator = collection.GetEnumerator ();
			Assert.IsNotNull (numerator, "GetEnumerator");
			if (!(numerator is IEnumerator))
				Assert.Fail ("IEnumerator not been created");
		}
Ejemplo n.º 20
0
		public void DataControlFieldCollection_IndexOf ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			BoundField field = new BoundField ();
			int result;
			result = collection.IndexOf (field);
			Assert.AreEqual (-1, result, "NotExistFieldIndex");
			collection.Add (field);
			result = collection.IndexOf (field);
			Assert.AreEqual (0, result, "ExistFieldIndex");
		}
Ejemplo n.º 21
0
		public void DataControlFieldCollection_Contains ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			BoundField field = new BoundField ();
			collection.Add (field);
			bool result = collection.Contains (field);
			Assert.AreEqual (true, result, "Contains");
		}
Ejemplo n.º 22
0
		public void DataControlFieldCollection_CopyTo ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			collection.Add (new BoundField ());
			DataControlField[] fields = new DataControlField[collection.Count];
			Array array = new DataControlField[collection.Count];
			collection.CopyTo (fields, 0);
			Assert.AreEqual (1, fields.Length, "CopyToDataControlField");
			collection.CopyTo (array, 0);
			Assert.AreEqual (1, array.Length, "CopyToArray");
		}
        private string GetNewDataSourceName(System.Type controlType, int editMode, ref int startIndex)
        {
            int num = startIndex;
            DataControlFieldCollection fields = new DataControlFieldCollection();
            int count = this._selFieldsList.Items.Count;
            for (int i = 0; i < count; i++)
            {
                FieldItem item = (FieldItem) this._selFieldsList.Items[i];
                fields.Add(item.RuntimeField);
            }
            if ((fields != null) && (fields.Count > 0))
            {
                bool flag = false;
                while (!flag)
                {
                    for (int j = 0; j < fields.Count; j++)
                    {
                        DataControlField field = fields[j];
                        if (field is TemplateField)
                        {
                            ITemplate itemTemplate = null;
                            switch (editMode)
                            {
                                case 0:
                                    itemTemplate = ((TemplateField) field).ItemTemplate;
                                    break;

                                case 1:
                                    itemTemplate = ((TemplateField) field).EditItemTemplate;
                                    break;

                                case 2:
                                    itemTemplate = ((TemplateField) field).InsertItemTemplate;
                                    break;
                            }
                            if (itemTemplate != null)
                            {
                                IDesignerHost service = (IDesignerHost) this.Control.Site.GetService(typeof(IDesignerHost));
                                if (ControlSerializer.SerializeTemplate(itemTemplate, service).Contains(controlType.Name + num.ToString(NumberFormatInfo.InvariantInfo)))
                                {
                                    num++;
                                    continue;
                                }
                            }
                        }
                        if (j == (fields.Count - 1))
                        {
                            flag = true;
                        }
                    }
                }
            }
            startIndex = num;
            return (controlType.Name + num.ToString(NumberFormatInfo.InvariantInfo));
        }
Ejemplo n.º 24
0
		public void DataControlFieldCollection_Insert ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			BoundField field = new BoundField ();
			collection.Add (new BoundField ());
			collection.Add (new BoundField ());
			Assert.AreEqual (2, collection.Count, "CollectionCount");
			collection.Insert (0, field);
			int result = collection.IndexOf (field);
			Assert.AreEqual (0, result, "Insert");
		}
Ejemplo n.º 25
0
		public void DataControlFieldCollection_FieldsChangedEvent ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			collection.FieldsChanged += new EventHandler (collection_FieldsChanged);
			BoundField field = new BoundField ();
			collection.Add (field);
			Assert.AreEqual (true, EventDone, "FieldsChangedEvenAdd");
			ResetEvent ();
			collection.Clear ();
			Assert.AreEqual (true, EventDone, "FieldsChangedEvenClear");
			ResetEvent ();
			collection.Insert (0, field);
			Assert.AreEqual (true, EventDone, "FieldsChangedEvenInsert");
			ResetEvent ();
			collection.Remove (field);
			Assert.AreEqual (true, EventDone, "FieldsChangedEvenRemove");
		}
Ejemplo n.º 26
0
		public void DataControlFieldCollection_RemoveAt ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			collection.Add (new BoundField ());
			Assert.AreEqual (1, collection.Count, "CollectionCount");
			collection.RemoveAt (0);
			Assert.AreEqual (0, collection.Count, "RemoveAtIndex");
		}
Ejemplo n.º 27
0
		public void DataControlFieldCollection_Remove ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			BoundField field = new BoundField ();
			collection.Add (field);
			Assert.AreEqual (1, collection.Count, "CollectionCount");
 			collection.Remove(null);
			Assert.AreEqual (1, collection.Count, "RemoveNotExistField");
			collection.Remove (field);
			Assert.AreEqual (0, collection.Count, "RemoveExistField");
		}
Ejemplo n.º 28
0
		public void DataControlFieldCollection_RemoveAtException ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			collection.RemoveAt (0);
		}
Ejemplo n.º 29
0
		public void DataControlFieldCollection_Clone ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			collection.Add (new BoundField ());
			Assert.AreEqual (1, collection.Count, "Add");
			DataControlFieldCollection clone = collection.CloneFields ();
			Assert.AreEqual (1, clone.Count, "Clone");
		}
Ejemplo n.º 30
0
 private void InitializeMembers()
 {
     this.parentEntity = null;
     this.childrenType = EntityType.Unknown;
     this.entityGroup = Registry.EntityGroup.None;
     this.text = null;
     this.columns = new DataControlFieldCollection();
 }
Ejemplo n.º 31
0
		public void DataControlFieldCollection_DefaultProperty ()
		{
			DataControlFieldCollection collection = new DataControlFieldCollection ();
			Assert.AreEqual (0, collection.Count, "Count");
		}
		public void DetailsView_AssignToDefaultProperties ()
		{
			PokerDetailsView dv = new PokerDetailsView ();
			dv.AllowPaging = true;
			dv.DataSource = myds;
			dv.DataBind ();			
			Assert.AreEqual (true, dv.AllowPaging, "AllowPaging");
			dv.AlternatingRowStyle.CssClass = "style.css";
			Assert.AreEqual ("style.css", dv.AlternatingRowStyle.CssClass, "AlternatingRowStyle");
			dv.AutoGenerateDeleteButton = true;
			Assert.AreEqual (true, dv.AutoGenerateDeleteButton, "AutoGenerateDeleteButton");
			dv.AutoGenerateEditButton = true;
			Assert.AreEqual (true, dv.AutoGenerateEditButton, "AutoGenerateEditButton");
			dv.AutoGenerateInsertButton = true;
			Assert.AreEqual (true, dv.AutoGenerateInsertButton, "AutoGenerateInsertButton");
			dv.AutoGenerateRows = false;
			Assert.AreEqual (false, dv.AutoGenerateRows, "AutoGenerateRows");
			dv.BackImageUrl = "image.jpg";
			Assert.AreEqual ("image.jpg", dv.BackImageUrl, "BackImageUrl");
			dv.Caption = "Caption Test";
			Assert.AreEqual ("Caption Test", dv.Caption, "Caption");
			dv.CaptionAlign = TableCaptionAlign.Right;
			Assert.AreEqual (TableCaptionAlign.Right, dv.CaptionAlign, "CaptionAlign");
			dv.CellPadding = 2;
			Assert.AreEqual (2, dv.CellPadding, "CellPadding");
			dv.CellSpacing = 5;
			Assert.AreEqual (5, dv.CellSpacing, "CellSpacing");
			dv.CommandRowStyle.BackColor = Color.Purple;
			Assert.AreEqual (Color.Purple, dv.CommandRowStyle.BackColor, "CommandRowStyle.BackColor");
			dv.ChangeMode (DetailsViewMode.Insert);
			Assert.AreEqual (DetailsViewMode.Insert, dv.CurrentMode, "CurrentModeInsert");
			dv.ChangeMode (DetailsViewMode.Edit );
			Assert.AreEqual (DetailsViewMode.Edit, dv.CurrentMode, "CurrentModeEdit");
			Assert.AreEqual ("Item1", dv.DataItem, "DataItem");
			Assert.AreEqual (6, dv.DataItemCount, "DataItemCount");
			Assert.AreEqual (0, dv.DataItemIndex, "DataItemIndex");
			string[] names ={ "test1", "test2", "test3" };
			dv.DataKeyNames = names;
			Assert.AreEqual (names, dv.DataKeyNames, "DataKeyNames");
			dv.DefaultMode = DetailsViewMode.Edit;
			Assert.AreEqual (DetailsViewMode.Edit, dv.DefaultMode, "DefaultModeEdit");
			dv.DefaultMode = DetailsViewMode.Insert;
			Assert.AreEqual (DetailsViewMode.Insert, dv.DefaultMode, "DefaultModeInsert");
			dv.DefaultMode = DetailsViewMode.ReadOnly;
			Assert.AreEqual (DetailsViewMode.ReadOnly, dv.DefaultMode, "DefaultModeReadOnly");
			dv.EditRowStyle.ForeColor = Color.Pink;
			Assert.AreEqual (Color.Pink, dv.EditRowStyle.ForeColor, "EditRowStyle");
			dv.EmptyDataRowStyle.HorizontalAlign = HorizontalAlign.Center;
			Assert.AreEqual (HorizontalAlign.Center, dv.EmptyDataRowStyle.HorizontalAlign, "HorizontalAlignCenter");
			dv.EmptyDataTemplate = new DTemplate ();
			Assert.AreEqual (typeof (DTemplate), dv.EmptyDataTemplate.GetType() , "EmptyDataTemplate");
			dv.EmptyDataText = "No Data";
			Assert.AreEqual ("No Data", dv.EmptyDataText, "EmptyDataText");
			dv.EnablePagingCallbacks = true;
			Assert.AreEqual (true, dv.EnablePagingCallbacks, "EnablePagingCallbacks");
			dv.FieldHeaderStyle.CssClass = "style.css";
			Assert.AreEqual ("style.css", dv.FieldHeaderStyle.CssClass, "FieldHeaderStyle");
			DataControlFieldCollection coll=new DataControlFieldCollection ();
			dv.FooterStyle.HorizontalAlign = HorizontalAlign.Right ;
			Assert.AreEqual (HorizontalAlign.Right, dv.FooterStyle.HorizontalAlign , "FooterStyle");
			dv.FooterTemplate = new DTemplate ();
			Assert.AreEqual (typeof(DTemplate ),dv.FooterTemplate.GetType() ,"FooterTemplate");
			dv.FooterText = "Footer Text";
			Assert.AreEqual ("Footer Text", dv.FooterText, "FooterText");
			dv.GridLines = GridLines.Horizontal;
			Assert.AreEqual (GridLines.Horizontal, dv.GridLines, "GridLinesHorizontal ");
			dv.GridLines = GridLines.None;
			Assert.AreEqual (GridLines.None , dv.GridLines, "GridLinesNone ");
			dv.GridLines = GridLines.Vertical;
			Assert.AreEqual (GridLines.Vertical, dv.GridLines, "GridLinesVertical ");
			dv.GridLines = GridLines.Both;
			Assert.AreEqual (GridLines.Both, dv.GridLines, "GridLinesBoth ");
			dv.HeaderStyle.BorderColor = Color.PapayaWhip;
			Assert.AreEqual (Color.PapayaWhip, dv.HeaderStyle.BorderColor, "HeaderStyle");
			dv.HeaderTemplate = new DTemplate ();
			Assert.AreEqual (typeof (DTemplate), dv.HeaderTemplate.GetType (), "HeaderTemplate"); 
			dv.HeaderText = "Header Text";
			Assert.AreEqual ("Header Text", dv.HeaderText, "HeaderText");
			dv.HorizontalAlign = HorizontalAlign.Center;
			Assert.AreEqual (HorizontalAlign.Center, dv.HorizontalAlign, "HorizontalAlignCenter");
			dv.HorizontalAlign = HorizontalAlign.Justify;
			Assert.AreEqual (HorizontalAlign.Justify , dv.HorizontalAlign, "HorizontalAlignJustify");
			dv.HorizontalAlign = HorizontalAlign.Left ;
			Assert.AreEqual (HorizontalAlign.Left , dv.HorizontalAlign, "HorizontalAlignLeft");
			dv.HorizontalAlign = HorizontalAlign.NotSet ;
			Assert.AreEqual (HorizontalAlign.NotSet , dv.HorizontalAlign, "HorizontalAlignNotSet");
			dv.HorizontalAlign = HorizontalAlign.Right ;
			Assert.AreEqual (HorizontalAlign.Right , dv.HorizontalAlign, "HorizontalAlignRight");
			dv.InsertRowStyle.BackColor = Color.PeachPuff;
			Assert.AreEqual (Color.PeachPuff, dv.InsertRowStyle.BackColor, "InsertRowStyle");
			Assert.AreEqual (6, dv.PageCount, "PageCount");
			Assert.AreEqual (0, dv.PageIndex, "PageIndex");
			dv.PagerSettings.LastPageImageUrl = "image.jpg";
			Assert.AreEqual ("image.jpg", dv.PagerSettings.LastPageImageUrl, "PagerSettings");
			dv.PagerStyle.CssClass = "style.css";
			Assert.AreEqual ("style.css", dv.PagerStyle.CssClass, "PagerStyle");
			dv.PagerTemplate = new DTemplate ();
			Assert.AreEqual (typeof (DTemplate), dv.PagerTemplate.GetType (), "PagerTemplate");
			Assert.AreEqual (1, dv.Rows.Count, "Rows");
			dv.RowStyle.BackColor  = Color.Plum  ;
			Assert.AreEqual (Color.Plum, dv.RowStyle.BackColor, "RowStyle");
			dv.FooterRow.CssClass="style.css";
			Assert.AreEqual ("style.css", dv.FooterRow.CssClass , "FooterRow");
			dv.HeaderRow.BackColor =Color.Pink ;
			Assert.AreEqual (Color.Pink, dv.HeaderRow.BackColor, "HeaderRow");  

		}
Ejemplo n.º 33
0
        /// <summary>
        /// 导出头。
        /// </summary>
        protected void ExportHeader(DataControlFieldCollection colums, string split, ref StringWriter swHeader, out Dictionary<string, string> dataInfo)
        {
            dataInfo = new Dictionary<string, string>();
            if (colums != null)
            {
                BoundField field;
                //int i = 0;
                string /*headName,*/ datafiled;
                //StringBuilder buidler = new StringBuilder();
                swHeader.WriteLine("<tr>");
                foreach (DataControlField col in colums)
                {
                    field = col as BoundField;
                    if (field != null && !(field is CheckBoxFieldEx) && field.Visible)
                    {
                        datafiled = field.DataField;
                        swHeader.WriteLine(string.Format("<td>{0}</td>", field.HeaderText));
                        //headName = field.HeaderText;
                        //if (split.IndexOf(",") > -1)
                        //    headName = ModuleUtil.StringReplace(headName, ",", ",");
                        //buidler.AppendFormat(string.Format("{0}{1}",
                        //    i == 0 ? string.Empty : split, headName));

                        if (!dataInfo.ContainsKey(datafiled))
                            dataInfo.Add(datafiled, field.DataFormatString);
                        //i++;
                    }
                }
                swHeader.WriteLine("</tr>");
                //swHeader.WriteLine(buidler.ToString());
            }
        }