コード例 #1
0
 ///<summary>
 ///  Update the Typed Sysvar Entity with modified mock values.
 ///</summary>
 static public void UpdateMockInstance_Generated(TransactionManager tm, Sysvar mock)
 {
     mock.MType       = TestUtility.Instance.RandomString(1, false);;
     mock.MValue      = TestUtility.Instance.RandomString(99, false);;
     mock.Description = TestUtility.Instance.RandomString(99, false);;
     mock.Type        = TestUtility.Instance.RandomString(1, false);;
 }
コード例 #2
0
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                Sysvar mock   = CreateMockInstance(tm);
                bool   result = DataRepository.SysvarProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                SysvarQuery query = new SysvarQuery();

                query.AppendEquals(SysvarColumn.MCode, mock.MCode.ToString());
                query.AppendEquals(SysvarColumn.MType, mock.MType.ToString());
                if (mock.MValue != null)
                {
                    query.AppendEquals(SysvarColumn.MValue, mock.MValue.ToString());
                }
                if (mock.Description != null)
                {
                    query.AppendEquals(SysvarColumn.Description, mock.Description.ToString());
                }
                query.AppendEquals(SysvarColumn.Type, mock.Type.ToString());

                TList <Sysvar> results = DataRepository.SysvarProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
コード例 #3
0
        /// <summary>
        /// Deep load all Sysvar children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.SysvarProvider.GetPaged(tm, 0, 10, out count);

                DataRepository.SysvarProvider.DeepLoading += new EntityProviderBaseCore <Sysvar, SysvarKey> .DeepLoadingEventHandler(
                    delegate(object sender, DeepSessionEventArgs e)
                {
                    if (e.DeepSession.Count > 3)
                    {
                        e.Cancel = true;
                    }
                }
                    );

                if (mockCollection.Count > 0)
                {
                    DataRepository.SysvarProvider.DeepLoad(tm, mockCollection[0]);
                    System.Console.WriteLine("Sysvar instance correctly deep loaded at 1 level.");

                    mockCollection.Add(mock);
                    // DataRepository.SysvarProvider.DeepSave(tm, mockCollection);
                }

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
コード例 #4
0
ファイル: SysvarTest.cs プロジェクト: khanhnguyen18/tvqlLib
        ///<summary>
        ///  Update the Typed Sysvar Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, Sysvar mock)
        {
            SysvarTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
コード例 #5
0
        /// <summary>
        /// Check the foreign key dal methods.
        /// </summary>
        private void Step_10_FK_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                Sysvar entity = CreateMockInstance(tm);
                bool   result = DataRepository.SysvarProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test FK, Insert Failed");
            }
        }
コード例 #6
0
        private void FrmMain1_Load(object sender, EventArgs e)
        {
            SysvarService ser  = new SysvarService();
            Sysvar        sysV = ser.GetByMCode("Themes");

            if (sysV != null && !string.IsNullOrEmpty(sysV.MValue))
            {
                defaultLookAndFeel_0.LookAndFeel.SkinName = sysV.MValue;

                bool find = false;
                foreach (BarSubItemLink itemLink in barSubItem1.ItemLinks)
                {
                    foreach (BarItemLink styleMenu in itemLink.Item.ItemLinks)
                    {
                        BarCheckItem checkItem = styleMenu.Item as BarCheckItem;
                        if (checkItem != null && checkItem.Caption == sysV.MValue)
                        {
                            checkItem.Checked = true;
                            find = true;
                            break;
                        }
                    }

                    if (find)
                    {
                        break;
                    }
                }
            }


            BuildMenu();
            //if (Class7.GetUserRight() < 4)
            //{
            //    this.string_0 = "update tblMenus set skip = 1 ";
            //    Class7.smethod_4(this.string_0);
            //    this.string_0 = "update tblMenus set skip = 0 where menukey IN('USERGUIDE','STATIONS')";
            //    Class7.smethod_4(this.string_0);
            //    this.BuildMenu();
            //}
            //else
            //{
            //    this.UpdateSkip();
            //    this.string_0 = "update tblMenus set skip = 0 where menukey IN('USERGUIDE','STATIONS')";
            //    Class7.smethod_4(this.string_0);
            //    this.BuildMenu();
            //}

            this.Txt_Date.Caption = string.Format("{0:dd/MM/yyy}", DateTime.Now);;

            //this.Text = string.Concat(new object[] { Class7.smethod_14("m_softname"), " (USER NAME : ", Class7.string_7, "- COMPUTER NAME :", SystemInformation.ComputerName, " ", str, ")" });
            //this.Lbl_IpAddress.Caption = Class7.smethod_52();
            //this.barStaticItem1.Caption = Class13.smethod_1(Class7.smethod_14("m_copyright").ToString(), Class13.string_0);
        }
コード例 #7
0
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                Sysvar entity = mock.Copy() as Sysvar;
                entity = (Sysvar)mock.Clone();
                Assert.IsTrue(Sysvar.ValueEquals(entity, mock), "Clone is not working");
            }
        }
コード例 #8
0
ファイル: SysvarTest.cs プロジェクト: khanhnguyen18/tvqlLib
        ///<summary>
        ///  Returns a Typed Sysvar Entity with mock values.
        ///</summary>
        static public Sysvar CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            Sysvar mock = SysvarTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return(mock);
        }
コード例 #9
0
        /// <summary>
        /// Serialize the mock Sysvar entity into a temporary file.
        /// </summary>
        private void Step_06_SerializeEntity_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_Sysvar.xml");

                EntityHelper.SerializeXml(mock, fileName);
                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");

                System.Console.WriteLine("mock correctly serialized to a temporary file.");
            }
        }
コード例 #10
0
        /// <summary>
        /// Inserts a mock Sysvar entity into the database.
        /// </summary>
        private void Step_01_Insert_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                Assert.IsTrue(DataRepository.SysvarProvider.Insert(tm, mock), "Insert failed");

                System.Console.WriteLine("DataRepository.SysvarProvider.Insert(mock):");
                System.Console.WriteLine(mock);

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
コード例 #11
0
        /// <summary>
        /// Serialize a Sysvar collection into a temporary file.
        /// </summary>
        private void Step_08_SerializeCollection_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_SysvarCollection.xml");

                mock = CreateMockInstance(tm);
                TList <Sysvar> mockCollection = new TList <Sysvar>();
                mockCollection.Add(mock);

                EntityHelper.SerializeXml(mockCollection, fileName);

                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
                System.Console.WriteLine("TList<Sysvar> correctly serialized to a temporary file.");
            }
        }
コード例 #12
0
        ///<summary>
        ///  Returns a Typed Sysvar Entity with mock values.
        ///</summary>
        static public Sysvar CreateMockInstance_Generated(TransactionManager tm)
        {
            Sysvar mock = new Sysvar();

            mock.MCode       = TestUtility.Instance.RandomString(24, false);;
            mock.MType       = TestUtility.Instance.RandomString(1, false);;
            mock.MValue      = TestUtility.Instance.RandomString(99, false);;
            mock.Description = TestUtility.Instance.RandomString(99, false);;
            mock.Type        = TestUtility.Instance.RandomString(1, false);;


            // create a temporary collection and add the item to it
            TList <Sysvar> tempMockCollection = new TList <Sysvar>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((Sysvar)mock);
        }
コード例 #13
0
ファイル: SysvarTest.cs プロジェクト: khanhnguyen18/tvqlLib
 /// <summary>
 /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.)
 /// </summary>
 /// <param name="mock">Object to be modified</param>
 static private void SetSpecialTestData(Sysvar mock)
 {
     //Code your changes to the data object here.
 }
コード例 #14
0
        private void barManager_0_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                if (e.Item.GetType() == typeof(BarCheckItem))
                {
                    BarCheckItem checkItem = e.Item as BarCheckItem;
                    if (checkItem != null && checkItem.GroupIndex == 1)
                    {
                        defaultLookAndFeel_0.LookAndFeel.SkinName = e.Item.Caption;
                        SysvarService ser  = new SysvarService();
                        Sysvar        sysV = ser.GetByMCode("Themes");
                        if (sysV == null)
                        {
                            sysV       = new Sysvar();
                            sysV.MCode = "Themes";
                            sysV.Type  = "G";
                        }

                        sysV.MValue = checkItem.Caption;
                        ser.Save(sysV);
                    }

                    return;
                }

                switch (e.Item.Tag.ToString())
                {
                case "PREPORTS":
                    Class11.string_1 = "P";
                    ToolsGui.BindToParentForm(new FrmReports(), this);
                    return;

                case "STOCKADD":
                    FrmLibraryDef frm4 = new FrmLibraryDef();
                    frm4.MdiParent = this;
                    frm4.Show();
                    return;

                case "UNITS":
                    ToolsGui.BindToParentForm(new UnitsForm(), this);
                    return;

                case "GOODSGRP":
                    ToolsGui.BindToParentForm(new BookCategoryForm(), this);
                    return;

                case "GOODS":
                    ToolsGui.BindToParentForm(new BookForm(), this);
                    return;

                case "DIAGRAM":
                    ToolsGui.BindToParentForm(new LibraryLocationForm(), this);
                    return;

                case "MERCLOCATION":
                    ToolsGui.BindToParentForm(new BooksLocationForm(), this);
                    return;

                case "LABELS":
                    ToolsGui.BindToParentForm(new CardPrintForm(), this);
                    return;

                case "CUSTOMER":
                    ReaderForm frm6 = new ReaderForm();
                    frm6.MdiParent = this;
                    frm6.Show();
                    return;

                case "ORDER":
                    ToolsGui.BindToParentForm(new FrmMercOrder(), this);
                    return;

                case "TRANSCODE":
                    Class11.string_1 = "K";
                    ToolsGui.BindToParentForm(new FrmTransCode(), this);
                    return;

                case "STKINFO":
                    ToolsGui.BindToParentForm(new FrmLibraryInfo(), this);
                    return;

                case "SUPPINFO":
                    ToolsGui.BindToParentForm(new FrmSuppInfo(), this);
                    return;

                case "MERCQR":
                    ToolsGui.BindToParentForm(new FrmBookView(), this);
                    return;

                case "KREPORTS":
                    Class11.string_1 = "K";
                    ToolsGui.BindToParentForm(new FrmReports(), this);
                    return;

                case "SUPPDEF":
                    ToolsGui.BindToParentForm(new FrmCustomer(), this);
                    return;

                case "ABOUT":
                    new AboutForm().ShowDialog();
                    return;

                case "AREPORT":
                    Class11.string_1 = "A";
                    ToolsGui.BindToParentForm(new FrmReports(), this);
                    return;

                case "LOAN":
                    ToolsGui.BindToParentForm(new LoanBookForm(), this);
                    return;

                case "RECEIVED":
                    ToolsGui.BindToParentForm(new ReturnBookForm(), this);
                    return;

                case "OVERDUELST":
                    ToolsGui.BindToParentForm(new OverDueForm(), this);
                    return;

                case "BOOKSEARCH":
                    ToolsGui.BindToParentForm(new BookListForm(), this);
                    return;

                case "LANGUAGE":
                    ToolsGui.BindToParentForm(new FrmLanguage(), this);
                    return;

                case "LOANLST":
                    new FrmGetDates().ShowDialog();
                    if (Class7.IsInputDate)
                    {
                        ToolsGui.BindToParentForm(new FrmLoanInvList(), this);
                    }
                    return;

                case "LREPORTS":
                    ToolsGui.BindToParentForm(new FrmReaderInfo(), this);
                    return;

                case "LBRCARD":
                    ToolsGui.BindToParentForm(new CardPrintForm(), this);
                    return;

                default:
                    return;
                }
            }
            catch
            {
            }
        }