Exemplo n.º 1
0
        public void UpdateBatchSize()
        {
            MyAdapter da = new MyAdapter();
            try
            {
                da.UpdateBatchSize = 0;
                Assert.False(true);
            }
            catch (NotSupportedException ex)
            {
                // Specified method is not supported
                Assert.Equal(typeof(NotSupportedException), ex.GetType());
                Assert.Null(ex.InnerException);
                Assert.NotNull(ex.Message);
            }
            Assert.Equal(1, da.UpdateBatchSize);

            try
            {
                da.UpdateBatchSize = int.MaxValue;
                Assert.False(true);
            }
            catch (NotSupportedException ex)
            {
                // Specified method is not supported
                Assert.Equal(typeof(NotSupportedException), ex.GetType());
                Assert.Null(ex.InnerException);
                Assert.NotNull(ex.Message);
            }
            Assert.Equal(1, da.UpdateBatchSize);

            da.UpdateBatchSize = 1;
            Assert.Equal(1, da.UpdateBatchSize);
        }
Exemplo n.º 2
0
		public void UpdateBatchSize ()
		{
			MyAdapter da = new MyAdapter ();
			try {
				da.UpdateBatchSize = 0;
				Assert.Fail ("#A1");
			} catch (NotSupportedException ex) {
				// Specified method is not supported
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#A2");
				Assert.IsNull (ex.InnerException, "#A3");
				Assert.IsNotNull (ex.Message, "#A4");
			}
			Assert.AreEqual (1, da.UpdateBatchSize, "#A5");

			try {
				da.UpdateBatchSize = int.MaxValue;
				Assert.Fail ("#B1");
			} catch (NotSupportedException ex) {
				// Specified method is not supported
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#B2");
				Assert.IsNull (ex.InnerException, "#B3");
				Assert.IsNotNull (ex.Message, "#B4");
			}
			Assert.AreEqual (1, da.UpdateBatchSize, "#B5");

			da.UpdateBatchSize = 1;
			Assert.AreEqual (1, da.UpdateBatchSize, "#C");
		}
        public void ExecuteBatch()
        {
            MyAdapter da = new MyAdapter();

            NotSupportedException ex = Assert.Throws <NotSupportedException>(() => da.ExecuteBatch());

            Assert.Null(ex.InnerException);
            Assert.NotNull(ex.Message);
        }
        public void GetBatchedParameter()
        {
            MyAdapter da = new MyAdapter();

            NotSupportedException ex = Assert.Throws <NotSupportedException>(() => da.GetBatchedParameter(1, 1));

            Assert.Null(ex.InnerException);
            Assert.NotNull(ex.Message);
        }
Exemplo n.º 5
0
 public SwipeToDelete_v2(RecyclerView.Adapter adapter, Context context)
 {
     mAdapter        = (MyAdapter)adapter;
     mContext        = context;
     background      = new ColorDrawable();
     deleteDrawable  = context.GetDrawable(Resource.Drawable.ic_delete);
     intrinsicWidth  = deleteDrawable.IntrinsicWidth;
     intrinsicHeight = deleteDrawable.IntrinsicHeight;
 }
        public void TestMethodAdapter()
        {
            /*在設計模式中,介面卡模式(英語:adapter pattern)有時候也稱包裝樣式或者包裝(wrapper)。
             * 將一個類別的介面轉接成使用者所期待的。一個適配使得因介面不相容而不能在一起工作的類別工作在一起
             * ,做法是將類別自己的介面包裹在一個已存在的類別中。
             */
            ITarget adapter = new MyAdapter();

            adapter.Request();
        }
Exemplo n.º 7
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            var ptr             = MyAdapter.GetMyVersionPtr();
            var convertedString = Marshal.PtrToStringAnsi(ptr);

            // This crashes in x64 build
            var directString = MyAdapter.GetMyVersionString();

            VersionTextBlock.Text = convertedString;
        }
Exemplo n.º 8
0
        public void GetBatchedRecordsAffected()
        {
            MyAdapter da = new MyAdapter();
            int       recordsAffected = 0;
            Exception error           = null;

            Assert.True(da.GetBatchedRecordsAffected(int.MinValue, out recordsAffected, out error));
            Assert.Equal(1, recordsAffected);
            Assert.Null(error);
        }
Exemplo n.º 9
0
		public void AcceptChangesDuringUpdate ()
		{
			DataAdapter da = new MyAdapter ();
			da.AcceptChangesDuringUpdate = true;
			Assert.IsTrue (da.AcceptChangesDuringUpdate, "#1");
			da.AcceptChangesDuringUpdate = false;
			Assert.IsFalse (da.AcceptChangesDuringUpdate, "#2");
			da.AcceptChangesDuringUpdate = true;
			Assert.IsTrue (da.AcceptChangesDuringUpdate, "#3");
		}
        public void UpdateBatchSize_Negative()
        {
            MyAdapter da = new MyAdapter();

            NotSupportedException ex = Assert.Throws <NotSupportedException>(() => da.UpdateBatchSize = -1);

            // Specified method is not supported
            Assert.Null(ex.InnerException);
            Assert.NotNull(ex.Message);
        }
Exemplo n.º 11
0
        public void Fill_Direct()
        {
            DataAdapter           da = new MyAdapter();
            DataSet               ds = new DataSet();
            NotSupportedException ex = Assert.Throws <NotSupportedException>(() => da.Fill(ds));

            // Specified method is not supported
            Assert.Null(ex.InnerException);
            Assert.NotNull(ex.Message);
        }
Exemplo n.º 12
0
 public void AcceptChangesDuringUpdate()
 {
     DataAdapter da = new MyAdapter();
     da.AcceptChangesDuringUpdate = true;
     Assert.True(da.AcceptChangesDuringUpdate);
     da.AcceptChangesDuringUpdate = false;
     Assert.False(da.AcceptChangesDuringUpdate);
     da.AcceptChangesDuringUpdate = true;
     Assert.True(da.AcceptChangesDuringUpdate);
 }
Exemplo n.º 13
0
 public void ContinueUpdateOnError()
 {
     DataAdapter da = new MyAdapter();
     da.ContinueUpdateOnError = true;
     Assert.True(da.ContinueUpdateOnError);
     da.ContinueUpdateOnError = false;
     Assert.False(da.ContinueUpdateOnError);
     da.ContinueUpdateOnError = true;
     Assert.True(da.ContinueUpdateOnError);
 }
Exemplo n.º 14
0
		public void ContinueUpdateOnError ()
		{
			DataAdapter da = new MyAdapter ();
			da.ContinueUpdateOnError = true;
			Assert.IsTrue (da.ContinueUpdateOnError, "#1");
			da.ContinueUpdateOnError = false;
			Assert.IsFalse (da.ContinueUpdateOnError, "#2");
			da.ContinueUpdateOnError = true;
			Assert.IsTrue (da.ContinueUpdateOnError, "#3");
		}
Exemplo n.º 15
0
 public void AcceptChangesDuringFill()
 {
     DataAdapter da = new MyAdapter();
     da.AcceptChangesDuringFill = true;
     Assert.True(da.AcceptChangesDuringFill);
     da.AcceptChangesDuringFill = false;
     Assert.False(da.AcceptChangesDuringFill);
     da.AcceptChangesDuringFill = true;
     Assert.True(da.AcceptChangesDuringFill);
 }
Exemplo n.º 16
0
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.Main);
        InitData();
        HorizontalInfiniteCycleViewPager viewPager = FindViewById <HorizontalInfiniteCycleViewPager>(Resource.Id.hicvp);
        MyAdapter adapter = new MyAdapter(listImage, BaseContext);

        viewPager.Adapter = adapter;
    }
Exemplo n.º 17
0
        public void FillLoadOption()
        {
            DataAdapter da = new MyAdapter();

            da.FillLoadOption = LoadOption.PreserveChanges;
            Assert.Equal(LoadOption.PreserveChanges, da.FillLoadOption);
            da.FillLoadOption = LoadOption.OverwriteChanges;
            Assert.Equal(LoadOption.OverwriteChanges, da.FillLoadOption);
            da.FillLoadOption = LoadOption.Upsert;
            Assert.Equal(LoadOption.Upsert, da.FillLoadOption);
        }
Exemplo n.º 18
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     this.SetContentView(Resource.Layout.Results);
     _searchText      = this.Intent.GetStringExtra(Constants.SearchKey);
     _myAdapter       = new MyAdapter(this);
     _theList         = this.FindViewById <ListView>(Resource.Id.TheList);
     _theList.Adapter = _myAdapter;
     _theProgressBar  = this.FindViewById <ProgressBar>(Resource.Id.TheProgress);
     StartSearch();
 }
Exemplo n.º 19
0
        public void ContinueUpdateOnError()
        {
            DataAdapter da = new MyAdapter();

            da.ContinueUpdateOnError = true;
            Assert.True(da.ContinueUpdateOnError);
            da.ContinueUpdateOnError = false;
            Assert.False(da.ContinueUpdateOnError);
            da.ContinueUpdateOnError = true;
            Assert.True(da.ContinueUpdateOnError);
        }
Exemplo n.º 20
0
        public void AcceptChangesDuringUpdate()
        {
            DataAdapter da = new MyAdapter();

            da.AcceptChangesDuringUpdate = true;
            Assert.True(da.AcceptChangesDuringUpdate);
            da.AcceptChangesDuringUpdate = false;
            Assert.False(da.AcceptChangesDuringUpdate);
            da.AcceptChangesDuringUpdate = true;
            Assert.True(da.AcceptChangesDuringUpdate);
        }
Exemplo n.º 21
0
        public void GetBatchedRecordsAffected()
        {
            MyAdapter da = new MyAdapter();
            int       recordsAffected = 0;
            Exception error           = null;

            Assert.IsTrue(da.GetBatchedRecordsAffected(int.MinValue,
                                                       out recordsAffected, out error), "#1");
            Assert.AreEqual(1, recordsAffected, "#2");
            Assert.IsNull(error, "#3");
        }
Exemplo n.º 22
0
        public void ReturnProviderSpecificTypes()
        {
            DataAdapter da = new MyAdapter();

            da.ReturnProviderSpecificTypes = true;
            Assert.True(da.ReturnProviderSpecificTypes);
            da.ReturnProviderSpecificTypes = false;
            Assert.False(da.ReturnProviderSpecificTypes);
            da.ReturnProviderSpecificTypes = true;
            Assert.True(da.ReturnProviderSpecificTypes);
        }
Exemplo n.º 23
0
        public void ReturnProviderSpecificTypes()
        {
            DataAdapter da = new MyAdapter();

            da.ReturnProviderSpecificTypes = true;
            Assert.IsTrue(da.ReturnProviderSpecificTypes, "#1");
            da.ReturnProviderSpecificTypes = false;
            Assert.IsFalse(da.ReturnProviderSpecificTypes, "#2");
            da.ReturnProviderSpecificTypes = true;
            Assert.IsTrue(da.ReturnProviderSpecificTypes, "#3");
        }
Exemplo n.º 24
0
        public void MissingMappingAction_Valid()
        {
            DataAdapter da = new MyAdapter();

            da.MissingMappingAction = MissingMappingAction.Passthrough;
            Assert.Equal(MissingMappingAction.Passthrough, da.MissingMappingAction);
            da.MissingMappingAction = MissingMappingAction.Ignore;
            Assert.Equal(MissingMappingAction.Ignore, da.MissingMappingAction);
            da.MissingMappingAction = MissingMappingAction.Error;
            Assert.Equal(MissingMappingAction.Error, da.MissingMappingAction);
        }
Exemplo n.º 25
0
        public void MissingSchemaAction_Valid()
        {
            DataAdapter da = new MyAdapter();

            da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
            Assert.Equal(MissingSchemaAction.AddWithKey, da.MissingSchemaAction);
            da.MissingSchemaAction = MissingSchemaAction.Ignore;
            Assert.Equal(MissingSchemaAction.Ignore, da.MissingSchemaAction);
            da.MissingSchemaAction = MissingSchemaAction.Error;
            Assert.Equal(MissingSchemaAction.Error, da.MissingSchemaAction);
        }
Exemplo n.º 26
0
        public void ContinueUpdateOnError()
        {
            DataAdapter da = new MyAdapter();

            da.ContinueUpdateOnError = true;
            Assert.IsTrue(da.ContinueUpdateOnError, "#1");
            da.ContinueUpdateOnError = false;
            Assert.IsFalse(da.ContinueUpdateOnError, "#2");
            da.ContinueUpdateOnError = true;
            Assert.IsTrue(da.ContinueUpdateOnError, "#3");
        }
Exemplo n.º 27
0
        public void AcceptChangesDuringFill()
        {
            DataAdapter da = new MyAdapter();

            da.AcceptChangesDuringFill = true;
            Assert.True(da.AcceptChangesDuringFill);
            da.AcceptChangesDuringFill = false;
            Assert.False(da.AcceptChangesDuringFill);
            da.AcceptChangesDuringFill = true;
            Assert.True(da.AcceptChangesDuringFill);
        }
Exemplo n.º 28
0
        public void listarNotas()
        {
            RecyclerView notasRecyclerView = FindViewById <RecyclerView>(Resource.Id.listaNotasRecycler);

            mLayoutManager = new LinearLayoutManager(this);
            notasRecyclerView.SetLayoutManager(mLayoutManager);
            listaNotas = MisNotasDb.ListarNotas();
            mAdapter   = new MyAdapter(listaNotas, listaRecycler, this);

            notasRecyclerView.SetAdapter(mAdapter);
        }
Exemplo n.º 29
0
        public void AcceptChangesDuringUpdate()
        {
            DataAdapter da = new MyAdapter();

            da.AcceptChangesDuringUpdate = true;
            Assert.IsTrue(da.AcceptChangesDuringUpdate, "#1");
            da.AcceptChangesDuringUpdate = false;
            Assert.IsFalse(da.AcceptChangesDuringUpdate, "#2");
            da.AcceptChangesDuringUpdate = true;
            Assert.IsTrue(da.AcceptChangesDuringUpdate, "#3");
        }
Exemplo n.º 30
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     this.SetContentView(Resource.Layout.Results);
     _searchText = this.Intent.GetStringExtra(Constants.SearchKey);
     _myAdapter = new MyAdapter(this);
     _theList = this.FindViewById<ListView>(Resource.Id.TheList);
     _theList.Adapter = _myAdapter;
     _theProgressBar = this.FindViewById<ProgressBar>(Resource.Id.TheProgress);
     StartSearch();
 }
Exemplo n.º 31
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.Main);
     adapter       = new MyAdapter(SupportFragmentManager);
     pager         = FindViewById <ViewPager>(Resource.Id.pager);
     tabs          = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
     pager.Adapter = adapter;
     tabs.SetViewPager(pager);
     tabs.SetBackgroundColor(Android.Graphics.Color.Argb(255, 47, 59, 162));
 }
Exemplo n.º 32
0
 public SwipeToDelete(Context context, RecyclerView.Adapter adapter, RecyclerView mRecycler)
 {
     myAdapter   = (MyAdapter)adapter;
     mContext    = context;
     newRecylcer = mRecycler;
     mBackground = new ColorDrawable();
     mClearPaint = new Paint();
     mClearPaint.SetXfermode(new PorterDuffXfermode(PorterDuff.Mode.Clear));
     deleteDrawable  = context.GetDrawable(Resource.Drawable.ic_delete);
     intrinsicWidth  = deleteDrawable.IntrinsicWidth;
     intrinsicHeight = deleteDrawable.IntrinsicHeight;
 }
Exemplo n.º 33
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.pagerSlidingTabStripUi);
     // Create your application here
     _myAdapter     = new MyAdapter(SupportFragmentManager);
     _pager         = FindViewById <ViewPager>(Resource.Id.pager);
     _tabs          = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
     _pager.Adapter = _myAdapter;
     _tabs.SetViewPager(_pager);
     _tabs.SetBackgroundColor(Android.Graphics.Color.Argb(255, 0, 149, 164));
 }
Exemplo n.º 34
0
        public void AddToBatch()
        {
            MyAdapter da = new MyAdapter();

            try {
                da.AddToBatch(new SqlCommand());
                Assert.Fail("#1");
            } catch (NotSupportedException ex) {
                Assert.AreEqual(typeof(NotSupportedException), ex.GetType(), "#2");
                Assert.IsNull(ex.InnerException, "#3");
                Assert.IsNotNull(ex.Message, "#4");
            }
        }
Exemplo n.º 35
0
        public void FillLoadOption_Invalid()
        {
            DataAdapter da = new MyAdapter();
            ArgumentOutOfRangeException ex = Assert.Throws <ArgumentOutOfRangeException>(() => da.FillLoadOption = (LoadOption)666);

            // The LoadOption enumeration value, 666, is invalid
            Assert.Null(ex.InnerException);
            Assert.NotNull(ex.Message);
            Assert.Contains("LoadOption", ex.Message);
            Assert.Contains("666", ex.Message);
            Assert.NotNull(ex.ParamName);
            Assert.Equal("LoadOption", ex.ParamName);
        }
Exemplo n.º 36
0
		public void UpdateBatchSize_Negative ()
		{
			MyAdapter da = new MyAdapter ();
			try {
				da.UpdateBatchSize = -1;
				Assert.Fail ("#1");
			} catch (NotSupportedException ex) {
				// Specified method is not supported
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
			}
		}
Exemplo n.º 37
0
        public void TerminateBatching()
        {
            MyAdapter da = new MyAdapter();

            try {
                da.TerminateBatching();
                Assert.Fail("#1");
            } catch (NotSupportedException ex) {
                Assert.AreEqual(typeof(NotSupportedException), ex.GetType(), "#2");
                Assert.IsNull(ex.InnerException, "#3");
                Assert.IsNotNull(ex.Message, "#4");
            }
        }
Exemplo n.º 38
0
		public void Fill_Direct ()
		{
			DataAdapter da = new MyAdapter ();
			DataSet ds = new DataSet ();
			try {
				da.Fill (ds);
				Assert.Fail ("#1");
			} catch (NotSupportedException ex) {
				// Specified method is not supported
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
			}
		}
Exemplo n.º 39
0
        private void LoadEvents(CalendarView calendar)
        {
            System.Object[][] items =
            {
                new System.Object[] { "Grace and Glory Conference",                new DateTime(2018, 3,  9, 17, 0, 0) },
                new System.Object[] { "Night Services Begin",                      new DateTime(2018, 2, 11, 18, 0, 0) },
                new System.Object[] { "Wild, Strong, and Free Women's Conference", "Date to be Confirmed" }
            };                                                                                               //temoprary solution while i await the official list
            myList = items;
            var adapter = new MyAdapter(items, this);

            eventList.Adapter = adapter;
            //eventList.ItemClick += EventList_ItemClick;
        }
Exemplo n.º 40
0
        public void UpdateBatchSize_Negative()
        {
            MyAdapter da = new MyAdapter();

            try {
                da.UpdateBatchSize = -1;
                Assert.Fail("#1");
            } catch (NotSupportedException ex) {
                // Specified method is not supported
                Assert.AreEqual(typeof(NotSupportedException), ex.GetType(), "#2");
                Assert.IsNull(ex.InnerException, "#3");
                Assert.IsNotNull(ex.Message, "#4");
            }
        }
        protected override void OnCreate(Bundle savedInstanceState) {
            base.OnCreate(savedInstanceState);
            SetContentView(R.Layouts.fragment_pager);

            mAdapter = new MyAdapter(GetSupportFragmentManager());

            mPager = (ViewPager)FindViewById(R.Ids.pager);
            mPager.SetAdapter(mAdapter);

            // Watch for button clicks.
            Button button = (Button)FindViewById(R.Ids.goto_first);
            button.Click += (o,a) => mPager.SetCurrentItem(0);
            
            button = (Button)FindViewById(R.Ids.goto_last);
            button.Click += (o,a) =>  mPager.SetCurrentItem(NUM_ITEMS-1);
        }
Exemplo n.º 42
0
 public void Fill_Direct()
 {
     DataAdapter da = new MyAdapter();
     DataSet ds = new DataSet();
     try
     {
         da.Fill(ds);
         Assert.False(true);
     }
     catch (NotSupportedException ex)
     {
         // Specified method is not supported
         Assert.Equal(typeof(NotSupportedException), ex.GetType());
         Assert.Null(ex.InnerException);
         Assert.NotNull(ex.Message);
     }
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView(Resource.Layout.fragment_pager);

            adapter = new MyAdapter(SupportFragmentManager);

            pager = FindViewById<ViewPager>(Resource.Id.pager);
            pager.Adapter = adapter;

            var button = FindViewById<Button>(Resource.Id.goto_first);
            button.Click += (sender, e) => {
                pager.CurrentItem = 0;
            };
            button = FindViewById<Button>(Resource.Id.goto_last);
            button.Click += (sender, e) => {
                pager.CurrentItem = NUM_ITEMS - 1;
            };
        }
Exemplo n.º 44
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView(Resource.Layout.FragmentList);

            var footer = FindViewById<TextView> (Resource.Id.footer);
            adapter = new MyAdapter(SupportFragmentManager);

            pager = FindViewById<ViewPager>(Resource.Id.pager);
            pager.Adapter = adapter;
            var mpag = new MyListener (footer);
            pager.SetOnPageChangeListener (mpag);
            /*
            var button = FindViewById<Button>(Resource.Id.goto_first);
            button.Click += (sender, e) => {
                pager.CurrentItem = 0;
            };
            button = FindViewById<Button>(Resource.Id.goto_last);
            button.Click += (sender, e) => {
                pager.CurrentItem = NUM_ITEMS - 1;
            };
            */
        }
Exemplo n.º 45
0
		public void AddToBatch ()
		{
			MyAdapter da = new MyAdapter ();
			try {
				da.AddToBatch (new SqlCommand ());
				Assert.Fail ("#1");
			} catch (NotSupportedException ex) {
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
			}
		}
		private void InitializeInstanceFields()
		{
			mSubscriberAdapter = new MyAdapter(this, this, R.layout.voice_row);
		}
				public OnClickListenerAnonymousInnerClassHelper(MyAdapter outerInstance, Subscriber subscriber, TextView name, ImageView picture)
				{
					this.outerInstance = outerInstance;
					this.subscriber = subscriber;
					this.name = name;
					this.picture = picture;
				}
Exemplo n.º 48
0
		public void GetBatchedRecordsAffected ()
		{
			MyAdapter da = new MyAdapter ();
			int recordsAffected = 0;
			Exception error = null;

			Assert.IsTrue (da. GetBatchedRecordsAffected (int.MinValue,
				out recordsAffected, out error), "#1");
			Assert.AreEqual (1, recordsAffected, "#2");
			Assert.IsNull (error, "#3");
		}
Exemplo n.º 49
0
		public void TerminateBatching ()
		{
			MyAdapter da = new MyAdapter ();
			try {
				da.TerminateBatching ();
				Assert.Fail ("#1");
			} catch (NotSupportedException ex) {
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
			}
		}
Exemplo n.º 50
0
 public void ReturnProviderSpecificTypes()
 {
     DataAdapter da = new MyAdapter();
     da.ReturnProviderSpecificTypes = true;
     Assert.True(da.ReturnProviderSpecificTypes);
     da.ReturnProviderSpecificTypes = false;
     Assert.False(da.ReturnProviderSpecificTypes);
     da.ReturnProviderSpecificTypes = true;
     Assert.True(da.ReturnProviderSpecificTypes);
 }
Exemplo n.º 51
0
        private void BindData()
        {
            string ls_sql = @"select 
                            upper(goodtype.typeno) as typeno,
                            goodtype.typename,'" + as_cuscode + @"' as cus_code, '' as memo, '" + as_type + @"' as type 
                            from goodtype   
                            where ( typeno in (select goo_type from goodsno where (goo_mate in ('PR','SZ')))) 
                            order by goodtype.typeno asc,
                            goodtype.levelnum asc";
            DataTable ldt = new DataTable();
            ldt = SqliteHelper.ExecuteDataTable(ls_sql);
            if (ldt.Rows.Count == 0)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.SetTitle("提示:");
                builder.SetMessage("当前没有染膏产品");
                builder.SetPositiveButton("确定", delegate
                {
                    StartActivity(typeof(Index));
                    Finish();
                });
                builder.SetCancelable(false);
                builder.Show();
            }
            if (as_type == "Replenishment")
            {
                #region 
                string ls_sql_prov = "select cus_prov from customer where cus_code='" + SysVisitor.cus_code + "'";
                string ls_prov = "";
                ls_prov = SqliteHelper.ExecuteScalar(ls_sql_prov);
                string sql_city = @"select cus_city, goo_type 
                                from oldsaleprice, goodsno, customer 
                                where oldsaleprice.cus_code = customer.cus_code 
                                and customer.cus_prov = '@cus_prov'
                                and oldsaleprice.goo_code = goodsno.goo_code 
                                group by cus_city,goo_type ";
                sql_city = sql_city.Replace("@cus_prov", ls_prov);
                System.Data.DataTable ldt_use = new System.Data.DataTable();
                ldt_use = SqliteHelper.ExecuteDataTable(sql_city);

                if (ldt != null)
                {
                    for (int i = 0; i < ldt.Rows.Count; i++)
                    {

                        DataRow[] datarows = ldt_use.Select("goo_type ='" + ldt.Rows[i]["typeno"] + "'");
                        DataTable ldt_item = SysVisitor.DataRowToDataTable(datarows);
                        if (ldt_item == null)
                            continue;
                        string ls_use = "";
                        for (int j = 0; j < ldt_item.Rows.Count; j++)
                        {
                            string ls_cityname = of_CitynoToName(ldt_item.Rows[j]["cus_city"]);
                            if (string.IsNullOrEmpty(ls_cityname))
                                continue;
                            else if (j == ldt_item.Rows.Count - 1)
                                ls_use += ls_cityname;
                            else
                                ls_use += ls_cityname + ",";
                        }
                        ldt.Rows[i]["memo"] = ls_use;
                    }
                }
                #endregion
            }
            ListView list = FindViewById<ListView>(Resource.Id.DyeingSel_items);
            var adapter = new MyAdapter(this, ldt);
            list.Adapter = adapter;
        }
Exemplo n.º 52
0
		public void AddToBatch ()
		{
			MyAdapter da = new MyAdapter ();
			try {
				da.AddToBatch (new SqlCommand ());
				Assert.Fail ("#1");
#if FEATURE_NO_BSD_SOCKETS
			} catch (PlatformNotSupportedException) {
#else
			} catch (NotSupportedException ex) {
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
#endif
			}
		}
Exemplo n.º 53
0
 public void FillLoadOption_Invalid()
 {
     DataAdapter da = new MyAdapter();
     try
     {
         da.FillLoadOption = (LoadOption)666;
         Assert.False(true);
     }
     catch (ArgumentOutOfRangeException ex)
     {
         // The LoadOption enumeration value, 666, is invalid
         Assert.Equal(typeof(ArgumentOutOfRangeException), ex.GetType());
         Assert.Null(ex.InnerException);
         Assert.NotNull(ex.Message);
         Assert.True(ex.Message.IndexOf("LoadOption") != -1);
         Assert.True(ex.Message.IndexOf("666") != -1);
         Assert.NotNull(ex.ParamName);
         Assert.Equal("LoadOption", ex.ParamName);
     }
 }
Exemplo n.º 54
0
		public void MissingSchemaAction_Valid ()
		{
			DataAdapter da = new MyAdapter ();
			da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
			Assert.AreEqual (MissingSchemaAction.AddWithKey, da.MissingSchemaAction, "#1");
			da.MissingSchemaAction = MissingSchemaAction.Ignore;
			Assert.AreEqual (MissingSchemaAction.Ignore, da.MissingSchemaAction, "#2");
			da.MissingSchemaAction = MissingSchemaAction.Error;
			Assert.AreEqual (MissingSchemaAction.Error, da.MissingSchemaAction, "#3");
		}
Exemplo n.º 55
0
		public void MissingMappingAction_Valid ()
		{
			DataAdapter da = new MyAdapter ();
			da.MissingMappingAction = MissingMappingAction.Passthrough;
			Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#1");
			da.MissingMappingAction = MissingMappingAction.Ignore;
			Assert.AreEqual (MissingMappingAction.Ignore, da.MissingMappingAction, "#2");
			da.MissingMappingAction = MissingMappingAction.Error;
			Assert.AreEqual (MissingMappingAction.Error, da.MissingMappingAction, "#3");
		}
Exemplo n.º 56
0
		public void MissingSchemaAction_Invalid ()
		{
			DataAdapter da = new MyAdapter ();
			try {
				da.MissingSchemaAction = (MissingSchemaAction) 666;
				Assert.Fail ("#1");
			} catch (ArgumentOutOfRangeException ex) {
				// The MissingSchemaAction enumeration value, 666, is invalid
				Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
				Assert.IsTrue (ex.Message.IndexOf ("MissingSchemaAction") != -1, "#5");
				Assert.IsTrue (ex.Message.IndexOf ("666") != -1, "#6");
				Assert.IsNotNull (ex.ParamName, "#7");
				Assert.AreEqual ("MissingSchemaAction", ex.ParamName, "#8");
			}
		}
Exemplo n.º 57
0
		public void ReturnProviderSpecificTypes ()
		{
			DataAdapter da = new MyAdapter ();
			da.ReturnProviderSpecificTypes = true;
			Assert.IsTrue (da.ReturnProviderSpecificTypes, "#1");
			da.ReturnProviderSpecificTypes = false;
			Assert.IsFalse (da.ReturnProviderSpecificTypes, "#2");
			da.ReturnProviderSpecificTypes = true;
			Assert.IsTrue (da.ReturnProviderSpecificTypes, "#3");
		}
Exemplo n.º 58
0
		public void FillLoadOption ()
		{
			DataAdapter da = new MyAdapter ();
			da.FillLoadOption = LoadOption.PreserveChanges;
			Assert.AreEqual (LoadOption.PreserveChanges, da.FillLoadOption, "#1");
			da.FillLoadOption = LoadOption.OverwriteChanges;
			Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#2");
			da.FillLoadOption = LoadOption.Upsert;
			Assert.AreEqual (LoadOption.Upsert, da.FillLoadOption, "#3");
		}
Exemplo n.º 59
0
        public void GetBatchedRecordsAffected()
        {
            MyAdapter da = new MyAdapter();
            int recordsAffected = 0;
            Exception error = null;

            Assert.True(da.GetBatchedRecordsAffected(int.MinValue, out recordsAffected, out error));
            Assert.Equal(1, recordsAffected);
            Assert.Null(error);
        }
Exemplo n.º 60
0
 public void ClearBatch()
 {
     MyAdapter da = new MyAdapter();
     try
     {
         da.ClearBatch();
         Assert.False(true);
     }
     catch (NotSupportedException ex)
     {
         Assert.Equal(typeof(NotSupportedException), ex.GetType());
         Assert.Null(ex.InnerException);
         Assert.NotNull(ex.Message);
     }
 }