예제 #1
0
        ///<summary>
        ///  Returns a Typed Goods Entity with mock values.
        ///</summary>
        static public Goods CreateMockInstance_Generated(TransactionManager tm)
        {
            Goods mock = new Goods();

            mock.GoodsId     = TestUtility.Instance.RandomString(6, false);;
            mock.Barcode     = TestUtility.Instance.RandomString(9, false);;
            mock.Mbc         = TestUtility.Instance.RandomBoolean();
            mock.SafeNameRef = TestUtility.Instance.RandomString(10, false);;
            mock.GrpId       = TestUtility.Instance.RandomString(24, false);;
            mock.ShortName   = TestUtility.Instance.RandomString(49, false);;
            mock.FullName    = TestUtility.Instance.RandomString(99, false);;
            mock.Packunit    = TestUtility.Instance.RandomString(3, false);;
            mock.Piceunit    = TestUtility.Instance.RandomString(3, false);;
            mock.Unitconv    = (decimal)TestUtility.Instance.RandomShort();
            mock.SuppId      = TestUtility.Instance.RandomString(5, false);;
            mock.Image       = new byte[] { TestUtility.Instance.RandomByte() };
            mock.OpenDate    = TestUtility.Instance.RandomDateTime();
            mock.TaxCode     = TestUtility.Instance.RandomString(3, false);;
            mock.MercType    = TestUtility.Instance.RandomString(2, false);;
            mock.AttrType    = TestUtility.Instance.RandomString(2, false);;
            mock.Domestic    = TestUtility.Instance.RandomBoolean();
            mock.Warranty    = TestUtility.Instance.RandomBoolean();
            mock.Status      = TestUtility.Instance.RandomBoolean();


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

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


            return((Goods)mock);
        }
예제 #2
0
        ///<summary>
        ///  Returns a Typed Menus Entity with mock values.
        ///</summary>
        static public Menus CreateMockInstance_Generated(TransactionManager tm)
        {
            Menus mock = new Menus();

            mock.Subitem    = TestUtility.Instance.RandomNumber();
            mock.Parent     = TestUtility.Instance.RandomNumber();
            mock.Menukey    = TestUtility.Instance.RandomString(14, false);;
            mock.Prompt     = TestUtility.Instance.RandomString(99, false);;
            mock.Type       = TestUtility.Instance.RandomString(1, false);;
            mock.Procerdue  = TestUtility.Instance.RandomString(19, false);;
            mock.Imageidx   = TestUtility.Instance.RandomNumber();
            mock.Password   = TestUtility.Instance.RandomBoolean();
            mock.Basicright = TestUtility.Instance.RandomNumber();
            mock.Depcode    = TestUtility.Instance.RandomString(1, false);;
            mock.Skip       = TestUtility.Instance.RandomBoolean();


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

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


            return((Menus)mock);
        }
예제 #3
0
        ///<summary>
        ///  Returns a Typed Store Entity with mock values.
        ///</summary>
        static public Store CreateMockInstance_Generated(TransactionManager tm)
        {
            Store mock = new Store();

            mock.Id        = TestUtility.Instance.RandomString(5, false);;
            mock.Type      = TestUtility.Instance.RandomString(2, false);;
            mock.Name      = TestUtility.Instance.RandomString(49, false);;
            mock.Fullname  = TestUtility.Instance.RandomString(99, false);;
            mock.Address   = TestUtility.Instance.RandomString(249, false);;
            mock.Phone     = TestUtility.Instance.RandomString(49, false);;
            mock.Fax       = TestUtility.Instance.RandomString(24, false);;
            mock.Bankname  = TestUtility.Instance.RandomString(74, false);;
            mock.BankBr    = TestUtility.Instance.RandomString(74, false);;
            mock.Accnum    = TestUtility.Instance.RandomString(24, false);;
            mock.Vatnum    = TestUtility.Instance.RandomString(24, false);;
            mock.Contactps = TestUtility.Instance.RandomString(24, false);;
            mock.Remark    = TestUtility.Instance.RandomString(249, false);;
            mock.OpenDate  = TestUtility.Instance.RandomDateTime();
            mock.Status    = TestUtility.Instance.RandomBoolean();


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

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


            return((Store)mock);
        }
        ///<summary>
        ///  Returns a Typed TestIssue117Tablec Entity with mock values.
        ///</summary>
        static public TestIssue117Tablec CreateMockInstance_Generated(TransactionManager tm)
        {
            TestIssue117Tablec mock = new TestIssue117Tablec();

            mock.DumbField = TestUtility.Instance.RandomBoolean();

            //OneToOneRelationship
            TestIssue117Tablea mockTestIssue117TableaByTestIssue117TableAid = TestIssue117TableaTest.CreateMockInstance(tm);

            DataRepository.TestIssue117TableaProvider.Insert(tm, mockTestIssue117TableaByTestIssue117TableAid);
            mock.TestIssue117TableAid = mockTestIssue117TableaByTestIssue117TableAid.TestIssue117TableAid;
            //OneToOneRelationship
            TestIssue117Tableb mockTestIssue117TablebByTestIssue117TableBid = TestIssue117TablebTest.CreateMockInstance(tm);

            DataRepository.TestIssue117TablebProvider.Insert(tm, mockTestIssue117TablebByTestIssue117TableBid);
            mock.TestIssue117TableBid = mockTestIssue117TablebByTestIssue117TableBid.TestIssue117TableBid;

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

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


            return((TestIssue117Tablec)mock);
        }
        ///<summary>
        ///  Returns a Typed StoreContact Entity with mock values.
        ///</summary>
        static public StoreContact CreateMockInstance_Generated(TransactionManager tm)
        {
            StoreContact mock = new StoreContact();

            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Contact mockContactByContactId = ContactTest.CreateMockInstance(tm);

            DataRepository.ContactProvider.Insert(tm, mockContactByContactId);
            mock.ContactId = mockContactByContactId.ContactId;
            //OneToOneRelationship
            ContactType mockContactTypeByContactTypeId = ContactTypeTest.CreateMockInstance(tm);

            DataRepository.ContactTypeProvider.Insert(tm, mockContactTypeByContactTypeId);
            mock.ContactTypeId = mockContactTypeByContactTypeId.ContactTypeId;
            //OneToOneRelationship
            Store mockStoreByCustomerId = StoreTest.CreateMockInstance(tm);

            DataRepository.StoreProvider.Insert(tm, mockStoreByCustomerId);
            mock.CustomerId = mockStoreByCustomerId.CustomerId;

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

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


            return((StoreContact)mock);
        }
        /// <summary>
        /// Deep load all TestIssue117Tablec children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.TestIssue117TablecProvider.GetPaged(tm, 0, 10, out count);

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

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

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

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
예제 #7
0
        ///<summary>
        ///  Returns a Typed EmployeeAddress Entity with mock values.
        ///</summary>
        static public EmployeeAddress CreateMockInstance_Generated(TransactionManager tm)
        {
            EmployeeAddress mock = new EmployeeAddress();

            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Address mockAddressByAddressId = AddressTest.CreateMockInstance(tm);

            DataRepository.AddressProvider.Insert(tm, mockAddressByAddressId);
            mock.AddressId = mockAddressByAddressId.AddressId;
            //OneToOneRelationship
            Employee mockEmployeeByEmployeeId = EmployeeTest.CreateMockInstance(tm);

            DataRepository.EmployeeProvider.Insert(tm, mockEmployeeByEmployeeId);
            mock.EmployeeId = mockEmployeeByEmployeeId.EmployeeId;

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

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


            return((EmployeeAddress)mock);
        }
        ///<summary>
        ///  Returns a Typed ContactCreditCard Entity with mock values.
        ///</summary>
        static public ContactCreditCard CreateMockInstance_Generated(TransactionManager tm)
        {
            ContactCreditCard mock = new ContactCreditCard();

            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Contact mockContactByContactId = ContactTest.CreateMockInstance(tm);

            DataRepository.ContactProvider.Insert(tm, mockContactByContactId);
            mock.ContactId = mockContactByContactId.ContactId;
            //OneToOneRelationship
            CreditCard mockCreditCardByCreditCardId = CreditCardTest.CreateMockInstance(tm);

            DataRepository.CreditCardProvider.Insert(tm, mockCreditCardByCreditCardId);
            mock.CreditCardId = mockCreditCardByCreditCardId.CreditCardId;

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

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


            return((ContactCreditCard)mock);
        }
예제 #9
0
        ///<summary>
        ///  Returns a Typed CsCard Entity with mock values.
        ///</summary>
        static public CsCard CreateMockInstance_Generated(TransactionManager tm)
        {
            CsCard mock = new CsCard();

            mock.CardId        = TestUtility.Instance.RandomString(8, false);;
            mock.IsVip         = TestUtility.Instance.RandomBoolean();
            mock.CsSex         = TestUtility.Instance.RandomBoolean();
            mock.PersonId      = TestUtility.Instance.RandomString(9, false);;
            mock.Birthday      = TestUtility.Instance.RandomDateTime();
            mock.PsIssuedate   = TestUtility.Instance.RandomDateTime();
            mock.PsPlaceissuse = TestUtility.Instance.RandomString(49, false);;
            mock.Fullname      = TestUtility.Instance.RandomString(49, false);;
            mock.Address       = TestUtility.Instance.RandomString(149, false);;
            mock.Phone         = TestUtility.Instance.RandomString(24, false);;
            mock.Email         = TestUtility.Instance.RandomString(99, false);;
            mock.DiscPc        = (decimal)TestUtility.Instance.RandomShort();
            mock.IssDate       = TestUtility.Instance.RandomDateTime();
            mock.DueDate       = TestUtility.Instance.RandomDateTime();
            mock.Image         = new byte[] { TestUtility.Instance.RandomByte() };
            mock.Remark        = TestUtility.Instance.RandomString(149, false);;
            mock.Begmark       = (decimal)TestUtility.Instance.RandomShort();
            mock.Endmark       = (decimal)TestUtility.Instance.RandomShort();
            mock.Status        = TestUtility.Instance.RandomBoolean();


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

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


            return((CsCard)mock);
        }
예제 #10
0
        ///<summary>
        ///  Returns a Typed OnOrder Entity with mock values.
        ///</summary>
        static public OnOrder CreateMockInstance_Generated(TransactionManager tm)
        {
            OnOrder mock = new OnOrder();

            mock.TranDate  = TestUtility.Instance.RandomDateTime();
            mock.TranTime  = TestUtility.Instance.RandomString(5, false);;
            mock.DeliverDt = TestUtility.Instance.RandomDateTime();
            mock.TransNum  = TestUtility.Instance.RandomString(5, false);;
            mock.TransCode = TestUtility.Instance.RandomString(2, false);;
            mock.ExpId     = TestUtility.Instance.RandomString(5, false);;
            mock.GoodsId   = TestUtility.Instance.RandomString(6, false);;
            mock.Qty       = (decimal)TestUtility.Instance.RandomShort();
            mock.UnitSymb  = TestUtility.Instance.RandomString(3, false);;
            mock.Price     = (decimal)TestUtility.Instance.RandomShort();
            mock.MercType  = TestUtility.Instance.RandomString(2, false);;
            mock.UserId    = (decimal)TestUtility.Instance.RandomShort();
            mock.Remark    = TestUtility.Instance.RandomString(99, false);;
            mock.Recnum    = (decimal)TestUtility.Instance.RandomShort();
            mock.Status    = TestUtility.Instance.RandomBoolean();
            mock.EndQty    = (decimal)TestUtility.Instance.RandomShort();


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

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


            return((OnOrder)mock);
        }
예제 #11
0
        ///<summary>
        ///  Returns a Typed CurrencyRate Entity with mock values.
        ///</summary>
        static public CurrencyRate CreateMockInstance_Generated(TransactionManager tm)
        {
            CurrencyRate mock = new CurrencyRate();

            mock.CurrencyRateDate = TestUtility.Instance.RandomDateTime();
            mock.AverageRate      = TestUtility.Instance.RandomShort();
            mock.EndOfDayRate     = TestUtility.Instance.RandomShort();
            mock.ModifiedDate     = TestUtility.Instance.RandomDateTime();

            int count0 = 0;
            TList <Currency> _collection0 = DataRepository.CurrencyProvider.GetPaged(tm, 0, 10, out count0);

            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.FromCurrencyCode = _collection0[0].CurrencyCode;
            }
            int count1 = 0;
            TList <Currency> _collection1 = DataRepository.CurrencyProvider.GetPaged(tm, 0, 10, out count1);

            //_collection1.Shuffle();
            if (_collection1.Count > 0)
            {
                mock.ToCurrencyCode = _collection1[0].CurrencyCode;
            }

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

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


            return((CurrencyRate)mock);
        }
예제 #12
0
        public TList GetList <TList, TEntity>(params object[] keyValues)
            where TList : IList <TEntity>, IEnumerable, new()
            where TEntity : class, new()
        {
            DbDataReader reader  = null;
            ICommand     command = null;

            try
            {
                command = Provider.CommandBuilder.CreateGetObjectByKeyCommand <TEntity>();

                Provider.CommandBuilder.SupplyGetObjectByKeyCommandParameters(ref command, keyValues);

                reader = GetReader(command);

                var list = new TList();
                if (typeof(IDataObject).IsAssignableFrom(typeof(TEntity)))
                {
                    var mapper = Provider.Mapper.GetDataObjectMappingMethod <TEntity>();
                    while (reader.Read())
                    {
                        var newT = mapper(reader, this);
                        LoadAssociations(ref newT);
                        list.Add(newT);
                    }
                }
                else
                {
                    var mapper = Provider.Mapper.GetTMappingMethod <TEntity>();
                    while (reader.Read())
                    {
                        var newT = mapper(reader);
                        LoadAssociations(ref newT);
                        list.Add(newT);
                    }
                }
                return(list);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                Provider.CommandExecutor.FinalizeCommand(command);
            }
        }
예제 #13
0
 public override void Add(int ID, string name)
 {
     if (TList == null)
     {
         TList = new List <Fill>();
     }
     TList.Add(new Fill(ID, name));
 }
예제 #14
0
        public static TList <SystemUser> Fill(IDataReader reader, TList <SystemUser> rows, int start, int pageLength)
        {
            int num;

            for (num = 0; num < start; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
            }
            for (num = 0; num < pageLength; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
                string     text = null;
                SystemUser item = null;
                if (DataRepository.Provider.UseEntityFactory)
                {
                    text = "SystemUser" + (reader.IsDBNull(reader.GetOrdinal("UserCode")) ? string.Empty : ((string)reader["UserCode"])).ToString();
                    item = EntityManager.LocateOrCreate <SystemUser>(text.ToString(), "SystemUser", DataRepository.Provider.EntityCreationalFactoryType, DataRepository.Provider.EnableEntityTracking);
                }
                else
                {
                    item = new SystemUser();
                }
                if (!(DataRepository.Provider.EnableEntityTracking && (item.EntityState != EntityState.Added)))
                {
                    item.SuppressEntityEvents = true;
                    item.UserCode             = (string)reader["UserCode"];
                    item.OriginalUserCode     = item.UserCode;
                    item.UserID            = reader.IsDBNull(reader.GetOrdinal("UserID")) ? null : ((string)reader["UserID"]);
                    item.UserName          = reader.IsDBNull(reader.GetOrdinal("UserName")) ? null : ((string)reader["UserName"]);
                    item.OwnName           = reader.IsDBNull(reader.GetOrdinal("OwnName")) ? null : ((string)reader["OwnName"]);
                    item.PassWord          = reader.IsDBNull(reader.GetOrdinal("PassWord")) ? null : ((string)reader["PassWord"]);
                    item.Sex               = reader.IsDBNull(reader.GetOrdinal("Sex")) ? null : ((string)reader["Sex"]);
                    item.Phone             = reader.IsDBNull(reader.GetOrdinal("Phone")) ? null : ((string)reader["Phone"]);
                    item.MailBox           = reader.IsDBNull(reader.GetOrdinal("MailBox")) ? null : ((string)reader["MailBox"]);
                    item.Note              = reader.IsDBNull(reader.GetOrdinal("Note")) ? null : ((string)reader["Note"]);
                    item.BirthDay          = reader.IsDBNull(reader.GetOrdinal("BirthDay")) ? null : ((DateTime?)reader["BirthDay"]);
                    item.PhoneHome         = reader.IsDBNull(reader.GetOrdinal("PhoneHome")) ? null : ((string)reader["PhoneHome"]);
                    item.Address           = reader.IsDBNull(reader.GetOrdinal("Address")) ? null : ((string)reader["Address"]);
                    item.Mobile            = reader.IsDBNull(reader.GetOrdinal("Mobile")) ? null : ((string)reader["Mobile"]);
                    item.Fax               = reader.IsDBNull(reader.GetOrdinal("Fax")) ? null : ((string)reader["Fax"]);
                    item.Status            = reader.IsDBNull(reader.GetOrdinal("Status")) ? null : ((int?)reader["Status"]);
                    item.LastProjectCode   = reader.IsDBNull(reader.GetOrdinal("LastProjectCode")) ? null : ((string)reader["LastProjectCode"]);
                    item.SortID            = reader.IsDBNull(reader.GetOrdinal("SortID")) ? null : ((string)reader["SortID"]);
                    item.ShortUserName     = reader.IsDBNull(reader.GetOrdinal("ShortUserName")) ? null : ((string)reader["ShortUserName"]);
                    item.EntityTrackingKey = text;
                    item.AcceptChanges();
                    item.SuppressEntityEvents = false;
                }
                rows.Add(item);
            }
            return(rows);
        }
예제 #15
0
        ///<summary>
        ///  Returns a Typed Transaction Entity with mock values.
        ///</summary>
        static public Transaction CreateMockInstance_Generated(TransactionManager tm)
        {
            Transaction mock = new Transaction();

            mock.TranDate    = TestUtility.Instance.RandomDateTime();
            mock.TranTime    = TestUtility.Instance.RandomString(5, false);;
            mock.TransNum    = TestUtility.Instance.RandomString(5, false);;
            mock.TransCode   = TestUtility.Instance.RandomString(2, false);;
            mock.Voucher     = TestUtility.Instance.RandomString(6, false);;
            mock.Invoice     = TestUtility.Instance.RandomString(10, false);;
            mock.Post        = TestUtility.Instance.RandomBoolean();
            mock.ExpId       = TestUtility.Instance.RandomString(5, false);;
            mock.ImpId       = TestUtility.Instance.RandomString(5, false);;
            mock.GoodsId     = TestUtility.Instance.RandomString(6, false);;
            mock.KitQty      = (decimal)TestUtility.Instance.RandomShort();
            mock.KitId       = TestUtility.Instance.RandomString(6, false);;
            mock.Qty         = (decimal)TestUtility.Instance.RandomShort();
            mock.UnitSymb    = TestUtility.Instance.RandomString(3, false);;
            mock.Amount      = (decimal)TestUtility.Instance.RandomShort();
            mock.Discount    = (decimal)TestUtility.Instance.RandomShort();
            mock.CarddiscAmt = (decimal)TestUtility.Instance.RandomShort();
            mock.VatAmt      = (decimal)TestUtility.Instance.RandomShort();
            mock.Surplus     = (decimal)TestUtility.Instance.RandomShort();
            mock.CommisAmt   = (decimal)TestUtility.Instance.RandomShort();
            mock.ForexCys    = TestUtility.Instance.RandomString(3, false);;
            mock.ForexRate   = (decimal)TestUtility.Instance.RandomShort();
            mock.ExpiryDt    = TestUtility.Instance.RandomDateTime();
            mock.UserId      = (decimal)TestUtility.Instance.RandomShort();
            mock.Station     = TestUtility.Instance.RandomNumber();
            mock.CsId        = TestUtility.Instance.RandomString(5, false);;
            mock.CustaxId    = TestUtility.Instance.RandomString(14, false);;
            mock.SafeNameRef = TestUtility.Instance.RandomString(5, false);;
            mock.Remark      = TestUtility.Instance.RandomString(49, false);;
            mock.Updated     = TestUtility.Instance.RandomBoolean();
            mock.MercType    = TestUtility.Instance.RandomString(2, false);;
            mock.TaxCode     = TestUtility.Instance.RandomString(3, false);;
            mock.VatIncl     = TestUtility.Instance.RandomBoolean();
            mock.Discpervat  = TestUtility.Instance.RandomBoolean();
            mock.DiscIncl    = TestUtility.Instance.RandomBoolean();
            mock.Copies      = (decimal)TestUtility.Instance.RandomShort();
            mock.Recnum      = (decimal)TestUtility.Instance.RandomShort();
            mock.CardId      = TestUtility.Instance.RandomString(7, false);;
            mock.Shift       = TestUtility.Instance.RandomNumber();
            mock.Status      = TestUtility.Instance.RandomBoolean();


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

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


            return((Transaction)mock);
        }
예제 #16
0
        public GameActive[] GetActiveList(FunctionEnum activeType)
        {
            TList <GameActive> activeList = new TList <GameActive>();

            foreach (var gameActive in _gameActiveList)
            {
                if (gameActive.ActiveType != FunctionEnum.Gonghui && (gameActive.ActiveType != activeType ||
                                                                      new GameDataCacheSet <UserFunction>().FindKey(_userId, gameActive.ActiveType) == null))
                {
                    continue;
                }
                activeList.Add(gameActive);
                if (activeType == FunctionEnum.Gonghui)
                {
                    if (gameActive.ActiveType == FunctionEnum.Gonghui)
                    {
                        GameUser userInfo = new GameDataCacheSet <GameUser>().FindKey(_userId);
                        if (userInfo != null)
                        {
                            UserGuild guild = new ShareCacheStruct <UserGuild>().FindKey(userInfo.MercenariesID);
                            if (guild != null)
                            {
                                GuildLvInfo lvInfo = new ConfigCacheSet <GuildLvInfo>().FindKey(guild.GuildLv);
                                if (lvInfo != null)
                                {
                                    var activityArray = lvInfo.ActivityDesc;
                                    foreach (ActivityShow activityShow in activityArray)
                                    {
                                        if (activityShow.ActivityID == (int)gameActive.ActiveStyle)
                                        {
                                            activeList.Add(gameActive);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            ;
            return(activeList.ToArray());
        }
예제 #17
0
         // ... 
     internal TList<T> Get() {
     if (String.IsNullOrEmpty(SP_GET)) {
       throw new NotSupportedException(string.Format("Get Procedure does not exist for {0}.", typeof(T)));
     }
     var list = new TList<T>();
     using (var cmd = new SqlCommand(SP_GET, m_openConn)) {
       cmd.CommandType = cmd.GetCommandTextType();
       using (var r = cmd.ExecuteReader()) {
         while (r.Read()) {
           list.Add(_fullFunc(r));
 }
예제 #18
0
        public static TList <ContractCost> Fill(IDataReader reader, TList <ContractCost> rows, int start, int pageLength)
        {
            int num;

            for (num = 0; num < start; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
            }
            for (num = 0; num < pageLength; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
                string       text = null;
                ContractCost item = null;
                if (DataRepository.Provider.UseEntityFactory)
                {
                    text = "ContractCost" + (reader.IsDBNull(reader.GetOrdinal("ContractCostCode")) ? string.Empty : ((string)reader["ContractCostCode"])).ToString();
                    item = EntityManager.LocateOrCreate <ContractCost>(text.ToString(), "ContractCost", DataRepository.Provider.EntityCreationalFactoryType, DataRepository.Provider.EnableEntityTracking);
                }
                else
                {
                    item = new ContractCost();
                }
                if (!(DataRepository.Provider.EnableEntityTracking && (item.EntityState != EntityState.Added)))
                {
                    decimal?nullable;
                    item.SuppressEntityEvents     = true;
                    item.ContractCostCode         = (string)reader["ContractCostCode"];
                    item.OriginalContractCostCode = item.ContractCostCode;
                    item.ContractCode             = reader.IsDBNull(reader.GetOrdinal("ContractCode")) ? null : ((string)reader["ContractCode"]);
                    item.CostCode          = reader.IsDBNull(reader.GetOrdinal("CostCode")) ? null : ((string)reader["CostCode"]);
                    item.Amount            = reader.IsDBNull(reader.GetOrdinal("Amount")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["Amount"]);
                    item.Money             = reader.IsDBNull(reader.GetOrdinal("Money")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["Money"]);
                    item.UnitPrise         = reader.IsDBNull(reader.GetOrdinal("UnitPrise")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["UnitPrise"]);
                    item.Moneycash         = reader.IsDBNull(reader.GetOrdinal("Moneycash")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["Moneycash"]);
                    item.OriginalMoneycash = reader.IsDBNull(reader.GetOrdinal("OriginalMoneycash")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["OriginalMoneycash"]);
                    item.MoneyType         = reader.IsDBNull(reader.GetOrdinal("MoneyType")) ? null : ((string)reader["MoneyType"]);
                    item.ExchangeRate      = reader.IsDBNull(reader.GetOrdinal("ExchangeRate")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["ExchangeRate"]);
                    item.CostBudgetSetCode = reader.IsDBNull(reader.GetOrdinal("CostBudgetSetCode")) ? null : ((string)reader["CostBudgetSetCode"]);
                    item.Description       = reader.IsDBNull(reader.GetOrdinal("Description")) ? null : ((string)reader["Description"]);
                    item.OriginalMoney     = reader.IsDBNull(reader.GetOrdinal("OriginalMoney")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["OriginalMoney"]);
                    item.EntityTrackingKey = text;
                    item.AcceptChanges();
                    item.SuppressEntityEvents = false;
                }
                rows.Add(item);
            }
            return(rows);
        }
예제 #19
0
        public static TList <PayoutItem> Fill(IDataReader reader, TList <PayoutItem> rows, int start, int pageLength)
        {
            int num;

            for (num = 0; num < start; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
            }
            for (num = 0; num < pageLength; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
                string     text = null;
                PayoutItem item = null;
                if (DataRepository.Provider.UseEntityFactory)
                {
                    text = "PayoutItem" + (reader.IsDBNull(reader.GetOrdinal("PayoutItemCode")) ? string.Empty : ((string)reader["PayoutItemCode"])).ToString();
                    item = EntityManager.LocateOrCreate <PayoutItem>(text.ToString(), "PayoutItem", DataRepository.Provider.EntityCreationalFactoryType, DataRepository.Provider.EnableEntityTracking);
                }
                else
                {
                    item = new PayoutItem();
                }
                if (!(DataRepository.Provider.EnableEntityTracking && (item.EntityState != EntityState.Added)))
                {
                    decimal?nullable;
                    item.SuppressEntityEvents   = true;
                    item.PayoutItemCode         = (string)reader["PayoutItemCode"];
                    item.OriginalPayoutItemCode = item.PayoutItemCode;
                    item.PayoutCode             = reader.IsDBNull(reader.GetOrdinal("PayoutCode")) ? null : ((string)reader["PayoutCode"]);
                    item.PaymentItemCode        = reader.IsDBNull(reader.GetOrdinal("PaymentItemCode")) ? null : ((string)reader["PaymentItemCode"]);
                    item.PayoutMoney            = reader.IsDBNull(reader.GetOrdinal("PayoutMoney")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["PayoutMoney"]);
                    item.SubjectCode            = reader.IsDBNull(reader.GetOrdinal("SubjectCode")) ? null : ((string)reader["SubjectCode"]);
                    item.Remark             = reader.IsDBNull(reader.GetOrdinal("Remark")) ? null : ((string)reader["Remark"]);
                    item.AlloType           = reader.IsDBNull(reader.GetOrdinal("AlloType")) ? null : ((string)reader["AlloType"]);
                    item.IsManualAlloc      = reader.IsDBNull(reader.GetOrdinal("IsManualAlloc")) ? null : ((int?)reader["IsManualAlloc"]);
                    item.PayoutCash         = reader.IsDBNull(reader.GetOrdinal("PayoutCash")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["PayoutCash"]);
                    item.MoneyType          = reader.IsDBNull(reader.GetOrdinal("MoneyType")) ? null : ((string)reader["MoneyType"]);
                    item.ExchangeRate       = reader.IsDBNull(reader.GetOrdinal("ExchangeRate")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["ExchangeRate"]);
                    item.PayoutMoneyType    = reader.IsDBNull(reader.GetOrdinal("PayoutMoneyType")) ? null : ((string)reader["PayoutMoneyType"]);
                    item.PayoutExchangeRate = reader.IsDBNull(reader.GetOrdinal("PayoutExchangeRate")) ? ((decimal?)(nullable = null)) : ((decimal?)reader["PayoutExchangeRate"]);
                    item.EntityTrackingKey  = text;
                    item.AcceptChanges();
                    item.SuppressEntityEvents = false;
                }
                rows.Add(item);
            }
            return(rows);
        }
예제 #20
0
    private void LoadSummary()
    {
        TList <Lesson> listlessons = new TList <Lesson>();

        listlessons = DataRepository.LessonProvider.GetByCustomerId(customer.CustomerId);
        listlessons.Sort("LessonDate DESC");
        try
        {
            summarymovie = DataRepository.SummaryMovieProvider.GetByLessonId(listlessons[0].LessonId)[0];
            wmpfile      = "http://www.swingmodel.com/" + summarymovie.FilePath;
            //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyKey", "MakeSummaryVisible();", true);

            TList <SummaryMovie> summarymovies = new TList <SummaryMovie>();
            summarymovies.Add(summarymovie);

            TList <Lesson> lessons = new TList <Lesson>();
            lessons = DataRepository.LessonProvider.GetByCustomerId(customer.CustomerId);
            lessons.Sort("LessonDate DESC");
            SummaryMovie sm;
            foreach (Lesson l in lessons)
            {
                try
                {
                    sm = DataRepository.SummaryMovieProvider.GetByLessonId(l.LessonId)[0];
                    if (!sm.DateRecorded.Equals(summarymovie.DateRecorded))
                    {
                        summarymovies.Add(sm);
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
        catch (Exception)
        {
            wmpfile = string.Empty;
            //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "key", "document.getElementById('square').innerHTML = '';", true);
            //System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "anyOtherKey", "MakeSummaryInvisible();", true);
        }
    }
예제 #21
0
파일: RPGData.cs 프로젝트: PenpenLi/Hifior
 /// <summary>
 /// 载入路径下所有继承ScriptableObject的T类
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="TList"></param>
 /// <param name="path"></param>
 /// <param name="postfix"></param>
 public static void LoadDefAssetAtPath <T>(ref List <T> TList, string path, string postfix) where T : ScriptableObject
 {
     if (TList == null)
     {
         TList = new List <T>();
     }
     TList.Clear();
     string[] defs = (ScriptableObjectUtility.GetFiles(path, postfix));
     foreach (string defFileName in defs)
     {
         TList.Add(AssetDatabase.LoadAssetAtPath <T>(defFileName));
     }
 }
예제 #22
0
        internal static void Main()
        {
            //// adding element + AutoGrow()
            TList<int> somelist = new TList<int>(2);
            somelist.Add(1);
            somelist.Add(2);
            somelist.Add(3);

            //// removing element by index
            somelist.RemoveAt(1);

            //// inserting element at given position
            somelist.InsertAt(0, 0);

            //// accessing element by index (I feel so sleepy that I dont't see 2)
            for (int i = 0; i < somelist.Count; i++)
            {
                Console.WriteLine(somelist[i]);
            }

            //// finding element by its value
            Console.WriteLine(somelist.Contains(3));

            ////ToString override
            Console.WriteLine(somelist.ToString());

            //// Min and max value
            int minValue = somelist.Min();
            int maxValue = somelist.Max();

            Console.WriteLine("MinValue = {0}\nMaxValue = {1}\n", minValue, maxValue);

            ////Clear list - List is empty & nothing is printed
            somelist.Clear();
            for (int i = 0; i < somelist.Count; i++)
            {
                Console.WriteLine(somelist[i]);
            }
        }
예제 #23
0
        /// <summary>
        /// 法宝技能——属性转换
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static TList <GeneralProperty> AttributeConversion(string userID, decimal powerNum, decimal soulNum, decimal intellectNum)
        {
            decimal changeNum = 0;
            TList <GeneralProperty> propertyList = new TList <GeneralProperty>();
            UserGeneral             general      = UserGeneral.GetMainGeneral(userID);

            if (general == null)
            {
                return(propertyList);
            }
            UserTrump userTrump = new GameDataCacheSet <UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID);

            if (userTrump != null && userTrump.LiftNum > 0 && userTrump.SkillInfo.Count > 0)
            {
                foreach (SkillInfo skillInfo in userTrump.SkillInfo)
                {
                    AbilityInfo abilityInfo = new ConfigCacheSet <AbilityInfo>().FindKey(skillInfo.AbilityID);
                    if (abilityInfo != null && abilityInfo.AttackType == AttackType.Change)
                    {
                        SkillLvInfo skillLvInfo = new ConfigCacheSet <SkillLvInfo>().FindKey(skillInfo.AbilityID, skillInfo.AbilityLv);
                        if (skillLvInfo == null)
                        {
                            break;
                        }
                        switch (abilityInfo.ChangeAbility)
                        {
                        case AbilityType.PowerNum:
                            changeNum = powerNum;
                            break;

                        case AbilityType.SoulNum:
                            changeNum = soulNum;
                            break;

                        case AbilityType.IntelligenceNum:
                            changeNum = intellectNum;
                            break;

                        default:
                            changeNum = 0;
                            break;
                        }
                        GeneralProperty property = new GeneralProperty();
                        property.AbilityType  = abilityInfo.AfterAbility;
                        property.AbilityValue = changeNum * skillLvInfo.Coefficient;
                        propertyList.Add(property);
                    }
                }
            }
            return(propertyList);
        }
예제 #24
0
        public static TList <ContractNexus> Fill(IDataReader reader, TList <ContractNexus> rows, int start, int pageLength)
        {
            int num;

            for (num = 0; num < start; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
            }
            for (num = 0; num < pageLength; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
                string        text = null;
                ContractNexus item = null;
                if (DataRepository.Provider.UseEntityFactory)
                {
                    text = "ContractNexus" + (reader.IsDBNull(reader.GetOrdinal("ContractNexusCode")) ? string.Empty : ((string)reader["ContractNexusCode"])).ToString();
                    item = EntityManager.LocateOrCreate <ContractNexus>(text.ToString(), "ContractNexus", DataRepository.Provider.EntityCreationalFactoryType, DataRepository.Provider.EnableEntityTracking);
                }
                else
                {
                    item = new ContractNexus();
                }
                if (!(DataRepository.Provider.EnableEntityTracking && (item.EntityState != EntityState.Added)))
                {
                    item.SuppressEntityEvents      = true;
                    item.ContractNexusCode         = (string)reader["ContractNexusCode"];
                    item.OriginalContractNexusCode = item.ContractNexusCode;
                    item.ContractCode       = reader.IsDBNull(reader.GetOrdinal("ContractCode")) ? null : ((string)reader["ContractCode"]);
                    item.ContractChangeCode = reader.IsDBNull(reader.GetOrdinal("ContractChangeCode")) ? null : ((string)reader["ContractChangeCode"]);
                    item.Code              = reader.IsDBNull(reader.GetOrdinal("Code")) ? null : ((string)reader["Code"]);
                    item.Type              = reader.IsDBNull(reader.GetOrdinal("Type")) ? null : ((string)reader["Type"]);
                    item.Name              = reader.IsDBNull(reader.GetOrdinal("Name")) ? null : ((string)reader["Name"]);
                    item.ID                = reader.IsDBNull(reader.GetOrdinal("ID")) ? null : ((string)reader["ID"]);
                    item.Person            = reader.IsDBNull(reader.GetOrdinal("Person")) ? null : ((string)reader["Person"]);
                    item.Date              = reader.IsDBNull(reader.GetOrdinal("Date")) ? null : ((DateTime?)reader["Date"]);
                    item.Path              = reader.IsDBNull(reader.GetOrdinal("Path")) ? null : ((string)reader["Path"]);
                    item.Money             = reader.IsDBNull(reader.GetOrdinal("Money")) ? null : ((decimal?)reader["Money"]);
                    item.EntityTrackingKey = text;
                    item.AcceptChanges();
                    item.SuppressEntityEvents = false;
                }
                rows.Add(item);
            }
            return(rows);
        }
예제 #25
0
        private void btnLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gridViewNguoiDung.FocusedRowHandle = -1;
            TList <TaiKhoan> listAppUser = bindingSourceNguoiDung.DataSource as TList <TaiKhoan>;

            if (listAppUser != null)
            {
                if (XtraMessageBox.Show("Bạn có muốn lưu các thay đổi không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        bindingSourceNguoiDung.EndEdit();
                        TList <PMS.Entities.HeThong> listAppSystems = DataServices.HeThong.GetByUserId(_userID);
                        foreach (TaiKhoan user in listAppUser)
                        {
                            PMS.Entities.HeThong objHeThong = listAppSystems.Find(p => p.UserId == _userID && p.ParentId == user.MaTaiKhoan);
                            if (user.Chon)
                            {
                                if (objHeThong == null)
                                {
                                    listAppSystems.Add(new PMS.Entities.HeThong()
                                    {
                                        UserId = _userID, ParentId = user.MaTaiKhoan
                                    });
                                }
                            }
                            else
                            {
                                if (objHeThong != null)
                                {
                                    objHeThong.MarkToDelete();
                                }
                            }
                        }
                        if (listAppSystems.IsValid)
                        {
                            DataServices.HeThong.Save(listAppSystems);
                            DevExpress.XtraEditors.XtraMessageBox.Show("Bạn đã lưu các thay đổi thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            DevExpress.XtraEditors.XtraMessageBox.Show(string.Format("Có {0} dòng dữ liệu không hợp lệ.", listAppSystems.InvalidItems.Count), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    catch
                    {
                        XtraMessageBox.Show("Đã xảy ra lỗi trong quá trình lưu các thay đổi.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
예제 #26
0
        public static TList <GE.MyLearning.BL.Menus> GetMenusByUserID(string userid)
        {
            string whereClause = "ParentMenuID is not null and ParentMenuID<>'' and ParentMenuID<>'0' and PermissionID in (   select PermissionID   from RolePermission as a inner join UserRole as b on a.RoleID=b.RoleID   where userid=" + CommonClass.sqlString(userid) + " ) and status=" + ConfigInfo.Instance().VertualUniversityStyle.ToString();
            string orderBy     = "ParentMenuID,ShowOrder";
            int    count       = -1;
            TList <GE.MyLearning.BL.Menus> menus = DataRepository.MenusProvider.GetPaged(whereClause, orderBy, 0, 0x7fffffff, out count);

            whereClause = "(ParentMenuID is null or ParentMenuID='' or ParentMenuID='0') and status=" + ConfigInfo.Instance().VertualUniversityStyle.ToString();
            orderBy     = "ShowOrder";
            TList <GE.MyLearning.BL.Menus> groups = DataRepository.MenusProvider.GetPaged(whereClause, orderBy, 0, 0x7fffffff, out count);

            for (int i = 0; i < groups.Count; i++)
            {
                if (menus.FindAll(MenusColumn.ParentMenuId, groups[i].MenuId).Count > 0)
                {
                    menus.Add(groups[i]);
                }
            }
            if (ConfigInfo.Instance().VertualUniversityStyle.ToString() == "0")
            {
                DataRepository.UserRoleProvider.GetPaged(string.Format("(UserID='{0}') and (RoleID='000000003' or RoleID='000000004')", userid), null, 0, 0x7fffffff, out count);
                if (count != 0)
                {
                    return(menus);
                }
                DataRepository.UserInfoProvider.GetPaged(string.Format("OHR_HR_Rep='{0}'", userid), null, 0, 0x7fffffff, out count);
                if (count == 0)
                {
                    return(menus);
                }
                groups = DataRepository.MenusProvider.GetPaged("PermissionID='MgtInstitute03'", null, 0, 0x7fffffff, out count);
                foreach (GE.MyLearning.BL.Menus menu in groups)
                {
                    menus.Add(menu);
                }
            }
            return(menus);
        }
예제 #27
0
        ///<summary>
        ///  Returns a Typed Region Entity with mock values.
        ///</summary>
        public static Region CreateMockInstance_Generated(TransactionManager tm)
        {
            Region mock = new Region();

            mock.RegionId = TestUtility.Instance.RandomNumber();
            mock.RegionDescription = TestUtility.Instance.RandomString(24, false);;

            // create a temporary collection and add the item to it
            TList<Region> tempMockCollection = new TList<Region>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Region)mock;
        }
        public static TList <MaterialPurchasDtl> Fill(IDataReader reader, TList <MaterialPurchasDtl> rows, int start, int pageLength)
        {
            int num;

            for (num = 0; num < start; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
            }
            for (num = 0; num < pageLength; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
                string             text = null;
                MaterialPurchasDtl item = null;
                if (DataRepository.Provider.UseEntityFactory)
                {
                    text = "MaterialPurchasDtl" + (reader.IsDBNull(reader.GetOrdinal("MaterialPurchasDtlID")) ? 0 : ((int)reader["MaterialPurchasDtlID"])).ToString();
                    item = EntityManager.LocateOrCreate <MaterialPurchasDtl>(text.ToString(), "MaterialPurchasDtl", DataRepository.Provider.EntityCreationalFactoryType, DataRepository.Provider.EnableEntityTracking);
                }
                else
                {
                    item = new MaterialPurchasDtl();
                }
                if (!(DataRepository.Provider.EnableEntityTracking && (item.EntityState != EntityState.Added)))
                {
                    decimal? nullable2;
                    DateTime?nullable3;
                    item.SuppressEntityEvents = true;
                    item.MaterialPurchasDtlID = (int)reader["MaterialPurchasDtlID"];
                    item.MaterialPurchasID    = reader.IsDBNull(reader.GetOrdinal("MaterialPurchasID")) ? null : ((int?)reader["MaterialPurchasID"]);
                    item.TypeStandard         = reader.IsDBNull(reader.GetOrdinal("TypeStandard")) ? null : ((string)reader["TypeStandard"]);
                    item.Unit              = reader.IsDBNull(reader.GetOrdinal("Unit")) ? null : ((string)reader["Unit"]);
                    item.Number            = reader.IsDBNull(reader.GetOrdinal("Number")) ? ((decimal?)(nullable2 = null)) : ((decimal?)reader["Number"]);
                    item.NeedDate          = reader.IsDBNull(reader.GetOrdinal("NeedDate")) ? ((DateTime?)(nullable3 = null)) : ((DateTime?)reader["NeedDate"]);
                    item.SignDate          = reader.IsDBNull(reader.GetOrdinal("SignDate")) ? ((DateTime?)(nullable3 = null)) : ((DateTime?)reader["SignDate"]);
                    item.SearchPriceDtl    = reader.IsDBNull(reader.GetOrdinal("SearchPriceDtl")) ? null : ((string)reader["SearchPriceDtl"]);
                    item.FinalPrice        = reader.IsDBNull(reader.GetOrdinal("FinalPrice")) ? ((decimal?)(nullable2 = null)) : ((decimal?)reader["FinalPrice"]);
                    item.EntityTrackingKey = text;
                    item.AcceptChanges();
                    item.SuppressEntityEvents = false;
                }
                rows.Add(item);
            }
            return(rows);
        }
예제 #29
0
        public static TList <Material> Fill(IDataReader reader, TList <Material> rows, int start, int pageLength)
        {
            int num;

            for (num = 0; num < start; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
            }
            for (num = 0; num < pageLength; num++)
            {
                if (!reader.Read())
                {
                    return(rows);
                }
                string   text = null;
                Material item = null;
                if (DataRepository.Provider.UseEntityFactory)
                {
                    text = "Material" + (reader.IsDBNull(reader.GetOrdinal("MaterialCode")) ? 0 : ((int)reader["MaterialCode"])).ToString();
                    item = EntityManager.LocateOrCreate <Material>(text.ToString(), "Material", DataRepository.Provider.EntityCreationalFactoryType, DataRepository.Provider.EnableEntityTracking);
                }
                else
                {
                    item = new Material();
                }
                if (!(DataRepository.Provider.EnableEntityTracking && (item.EntityState != EntityState.Added)))
                {
                    item.SuppressEntityEvents = true;
                    item.MaterialCode         = (int)reader["MaterialCode"];
                    item.OriginalMaterialCode = item.MaterialCode;
                    item.MaterialName         = reader.IsDBNull(reader.GetOrdinal("MaterialName")) ? null : ((string)reader["MaterialName"]);
                    item.GroupCode            = reader.IsDBNull(reader.GetOrdinal("GroupCode")) ? null : ((string)reader["GroupCode"]);
                    item.Spec              = reader.IsDBNull(reader.GetOrdinal("Spec")) ? null : ((string)reader["Spec"]);
                    item.Unit              = reader.IsDBNull(reader.GetOrdinal("Unit")) ? null : ((string)reader["Unit"]);
                    item.StandardPrice     = reader.IsDBNull(reader.GetOrdinal("StandardPrice")) ? null : ((decimal?)reader["StandardPrice"]);
                    item.InputPerson       = reader.IsDBNull(reader.GetOrdinal("InputPerson")) ? null : ((string)reader["InputPerson"]);
                    item.InputDate         = reader.IsDBNull(reader.GetOrdinal("InputDate")) ? null : ((DateTime?)reader["InputDate"]);
                    item.Remark            = reader.IsDBNull(reader.GetOrdinal("Remark")) ? null : ((string)reader["Remark"]);
                    item.EntityTrackingKey = text;
                    item.AcceptChanges();
                    item.SuppressEntityEvents = false;
                }
                rows.Add(item);
            }
            return(rows);
        }
예제 #30
0
    /// <summary>
    /// 解析动画标签
    /// </summary>
    protected void MatchEmojiRichText()
    {
        MatchCollection spriteTagMatchCollection = m_spriteTagRegex.Matches(m_OutputText);
        int             matchLength = 0;

        foreach (Match match in spriteTagMatchCollection)
        {
            List <string> tempListName = new List <string>();
            for (int i = 0, len = m_spriteAsset.listSpriteInfor.Count; i < len; i++)
            {
                // Debug.Log((m_spriteAsset.listSpriteInfor[i].name));
                if (m_spriteAsset.listSpriteInfor[i].name.StartsWith(match.Groups[1].Value))
                {
                    tempListName.Add(m_spriteAsset.listSpriteInfor[i].name);
                }
            }
            if (tempListName.Count > 0)
            {
                float size  = float.Parse(match.Groups[2].Value);
                float width = float.Parse(match.Groups[3].Value);
                if (size <= 0f)
                {
                    size = this.fontSize;
                }
                if (width <= 0f)
                {
                    width = 1;
                }
                int sLength = tempListName.Count;
                TList <SpriteTagInfor> spriteTagInfor = new TList <SpriteTagInfor>();
                for (int i = 0; i < sLength; i++)
                {
                    SpriteTagInfor tempSpriteTag = new SpriteTagInfor();
                    tempSpriteTag.name   = tempListName[i];
                    tempSpriteTag.index  = match.Index;
                    tempSpriteTag.size   = new Vector2(size * width, size);
                    tempSpriteTag.Length = match.Length;
                    spriteTagInfor.Add(tempSpriteTag);
                }
                //listTagInfor.Add(tempArrayTag[0]);
                m_AnimSpiteTag.Add(spriteTagInfor);
                mEmojiIndexList.Add(m_AnimSpiteTag.Count - 1);
            }

            matchLength += match.Length;
        }
        mRichTextParams[1] = spriteTagMatchCollection.Count;
        mRichTextParams[0] = mRichTextParams[0] - matchLength + mRichTextParams[1];
    }
        /// <summary>
        /// When overridden in a derived class, returns the number of profiles in which the last activity date occurred on or before the specified date.
        /// </summary>
        /// <returns>
        /// The number of profiles in which the last activity date occurred on or before the specified date.
        /// </returns>
        /// <param name="authenticationOption">One of the <see cref="T:System.Web.Profile.ProfileAuthenticationOption"/> values, specifying whether anonymous, authenticated, or both types of profiles are returned.
        ///                 </param><param name="userInactiveSinceDate">A <see cref="T:System.DateTime"/> that identifies which user profiles are considered inactive. If the <see cref="P:System.Web.Profile.ProfileInfo.LastActivityDate"/>  of a user profile occurs on or before this date and time, the profile is considered inactive.
        ///                 </param>
        public override int GetNumberOfInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            var profileList    = new TList <Profile>();
            var profileService = new ProfileService();

            foreach (var item in profileService.GetAll())
            {
                if (item.LastActivityDate.Value < userInactiveSinceDate)
                {
                    profileList.Add(item);
                }
            }

            return(profileList.Count);
        }
예제 #32
0
        ///<summary>
        ///  Returns a Typed Categories Entity with mock values.
        ///</summary>
        public static Categories CreateMockInstance_Generated(TransactionManager tm)
        {
            Categories mock = new Categories();

            mock.CategoryName = TestUtility.Instance.RandomString(6, false);;
            mock.Description = TestUtility.Instance.RandomString(2, false);;
            mock.Picture = new byte[] { TestUtility.Instance.RandomByte() };

            // create a temporary collection and add the item to it
            TList<Categories> tempMockCollection = new TList<Categories>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Categories)mock;
        }
예제 #33
0
        private static TList <CountryUser> FilterCombatUsers(CountryLvGroup lvGroup)
        {
            var list       = new TList <CountryUser>();
            var removeList = new TList <CountryUser>();

            while (lvGroup.PairCombatQueue.Count > 0)
            {
                CountryUser cuser = lvGroup.PairCombatQueue.Get();
                if (cuser == null)
                {
                    continue;
                }

                GameUser gameUser = new GameDataCacheSet <GameUser>().FindKey(cuser.UserId);
                if (gameUser != null && gameUser.UserStatus == UserStatus.CountryCombat)
                {
                    cuser.Status = 2;
                    list.Add(cuser);
                }
            }
            while (lvGroup.CombaQueue.Count > 0)
            {
                CountryUser cuser = lvGroup.CombaQueue.Get();
                if (cuser == null)
                {
                    continue;
                }

                if (cuser.Status == 1 && cuser.Refresh.AddSeconds(CombatInterval) <= DateTime.Now)
                {
                    GameUser gameUser = new GameDataCacheSet <GameUser>().FindKey(cuser.UserId);
                    if (gameUser != null && gameUser.UserStatus == UserStatus.CountryCombat)
                    {
                        cuser.Status = 2;
                        list.Add(cuser);
                    }
                }
                else if (cuser.Status == 1)
                {
                    removeList.Add(cuser);
                }
            }
            foreach (var countryUser in removeList)
            {
                lvGroup.CombaQueue.Add(countryUser);
            }
            return(list);
        }
        ///<summary>
        ///  Returns a Typed CustomerCustomerDemo Entity with mock values.
        ///</summary>
        public static CustomerCustomerDemo CreateMockInstance_Generated(TransactionManager tm)
        {
            CustomerCustomerDemo mock = new CustomerCustomerDemo();

            //OneToOneRelationship
            CustomerDemographics mockCustomerDemographicsByCustomerTypeId = CustomerDemographicsTest.CreateMockInstance(tm);
            DataRepository.CustomerDemographicsProvider.Insert(tm, mockCustomerDemographicsByCustomerTypeId);
            mock.CustomerTypeId = mockCustomerDemographicsByCustomerTypeId.CustomerTypeId;
            //OneToOneRelationship
            Customers mockCustomersByCustomerId = CustomersTest.CreateMockInstance(tm);
            DataRepository.CustomersProvider.Insert(tm, mockCustomersByCustomerId);
            mock.CustomerId = mockCustomersByCustomerId.CustomerId;

            // create a temporary collection and add the item to it
            TList<CustomerCustomerDemo> tempMockCollection = new TList<CustomerCustomerDemo>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (CustomerCustomerDemo)mock;
        }
예제 #35
0
        ///<summary>
        ///  Returns a Typed Suppliers Entity with mock values.
        ///</summary>
        public static Suppliers CreateMockInstance_Generated(TransactionManager tm)
        {
            Suppliers mock = new Suppliers();

            mock.CompanyName = TestUtility.Instance.RandomString(19, false);;
            mock.ContactName = TestUtility.Instance.RandomString(14, false);;
            mock.ContactTitle = TestUtility.Instance.RandomString(14, false);;
            mock.Address = TestUtility.Instance.RandomString(29, false);;
            mock.City = TestUtility.Instance.RandomString(6, false);;
            mock.Region = TestUtility.Instance.RandomString(6, false);;
            mock.PostalCode = TestUtility.Instance.RandomString(10, false);;
            mock.Country = TestUtility.Instance.RandomString(6, false);;
            mock.Phone = TestUtility.Instance.RandomString(11, false);;
            mock.Fax = TestUtility.Instance.RandomString(11, false);;
            mock.HomePage = TestUtility.Instance.RandomString(2, false);;

            // create a temporary collection and add the item to it
            TList<Suppliers> tempMockCollection = new TList<Suppliers>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Suppliers)mock;
        }
예제 #36
0
        ///<summary>
        ///  Returns a Typed Territories Entity with mock values.
        ///</summary>
        public static Territories CreateMockInstance_Generated(TransactionManager tm)
        {
            Territories mock = new Territories();

            mock.TerritoryId = TestUtility.Instance.RandomString(9, false);;
            mock.TerritoryDescription = TestUtility.Instance.RandomString(24, false);;

            int count0 = 0;
            TList<Region> _collection0 = DataRepository.RegionProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.RegionId = _collection0[0].RegionId;

            }

            // create a temporary collection and add the item to it
            TList<Territories> tempMockCollection = new TList<Territories>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Territories)mock;
        }
예제 #37
0
        ///<summary>
        ///  Returns a Typed Employees Entity with mock values.
        ///</summary>
        public static Employees CreateMockInstance_Generated(TransactionManager tm)
        {
            Employees mock = new Employees();

            mock.LastName = TestUtility.Instance.RandomString(9, false);;
            mock.FirstName = TestUtility.Instance.RandomString(10, false);;
            mock.Title = TestUtility.Instance.RandomString(14, false);;
            mock.TitleOfCourtesy = TestUtility.Instance.RandomString(11, false);;
            mock.BirthDate = TestUtility.Instance.RandomDateTime();
            mock.HireDate = TestUtility.Instance.RandomDateTime();
            mock.Address = TestUtility.Instance.RandomString(29, false);;
            mock.City = TestUtility.Instance.RandomString(6, false);;
            mock.Region = TestUtility.Instance.RandomString(6, false);;
            mock.PostalCode = TestUtility.Instance.RandomString(10, false);;
            mock.Country = TestUtility.Instance.RandomString(6, false);;
            mock.HomePhone = TestUtility.Instance.RandomString(11, false);;
            mock.Extension = TestUtility.Instance.RandomString(4, false);;
            mock.Photo = new byte[] { TestUtility.Instance.RandomByte() };
            mock.Notes = TestUtility.Instance.RandomString(2, false);;
            mock.PhotoPath = TestUtility.Instance.RandomString(126, false);;

            int count0 = 0;
            TList<Employees> _collection0 = DataRepository.EmployeesProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.ReportsTo = _collection0[0].EmployeeId;

            }

            // create a temporary collection and add the item to it
            TList<Employees> tempMockCollection = new TList<Employees>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Employees)mock;
        }
예제 #38
0
        ///<summary>
        ///  Returns a Typed OrderDetails Entity with mock values.
        ///</summary>
        public static OrderDetails CreateMockInstance_Generated(TransactionManager tm)
        {
            OrderDetails mock = new OrderDetails();

            mock.UnitPrice = TestUtility.Instance.RandomShort();
            mock.Quantity = TestUtility.Instance.RandomShort();
            mock.Discount = (float)TestUtility.Instance.RandomNumber();

            //OneToOneRelationship
            Orders mockOrdersByOrderId = OrdersTest.CreateMockInstance(tm);
            DataRepository.OrdersProvider.Insert(tm, mockOrdersByOrderId);
            mock.OrderId = mockOrdersByOrderId.OrderId;
            //OneToOneRelationship
            Products mockProductsByProductId = ProductsTest.CreateMockInstance(tm);
            DataRepository.ProductsProvider.Insert(tm, mockProductsByProductId);
            mock.ProductId = mockProductsByProductId.ProductId;

            // create a temporary collection and add the item to it
            TList<OrderDetails> tempMockCollection = new TList<OrderDetails>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (OrderDetails)mock;
        }
예제 #39
0
        ///<summary>
        ///  Returns a Typed Products Entity with mock values.
        ///</summary>
        public static Products CreateMockInstance_Generated(TransactionManager tm)
        {
            Products mock = new Products();

            mock.ProductName = TestUtility.Instance.RandomString(19, false);;
            mock.QuantityPerUnit = TestUtility.Instance.RandomString(9, false);;
            mock.UnitPrice = TestUtility.Instance.RandomShort();
            mock.UnitsInStock = TestUtility.Instance.RandomShort();
            mock.UnitsOnOrder = TestUtility.Instance.RandomShort();
            mock.ReorderLevel = TestUtility.Instance.RandomShort();
            mock.Discontinued = TestUtility.Instance.RandomBoolean();

            int count0 = 0;
            TList<Categories> _collection0 = DataRepository.CategoriesProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.CategoryId = _collection0[0].CategoryId;

            }
            int count1 = 0;
            TList<Suppliers> _collection1 = DataRepository.SuppliersProvider.GetPaged(tm, 0, 10, out count1);
            //_collection1.Shuffle();
            if (_collection1.Count > 0)
            {
                mock.SupplierId = _collection1[0].SupplierId;

            }

            // create a temporary collection and add the item to it
            TList<Products> tempMockCollection = new TList<Products>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Products)mock;
        }
예제 #40
0
 protected void rptmnctg_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         ProdCategory objproddtabound = e.Item.DataItem as ProdCategory;
         LinkButton lnkmainCTG = (LinkButton)e.Item.FindControl("lnkmainCTG");
         Repeater rptsubctg = (Repeater)e.Item.FindControl("rptsubctg");
         TList<ProdSubcategory> objprodsubctglist1 = new TList<ProdSubcategory>();
         List<int> objsubctgID = new List<int>();
         objsubctgID = ObjprodClass.GetAllProdmapBymainCtgID(objproddtabound.Id);
         if (objsubctgID != null)
         {
             foreach (int a in objsubctgID)
             {
                 objprodctg = null;
                 objprodctg = ObjprodClass.GetProdSubcategoryByID(a);
                 objprodsubctglist1.Add(objprodctg);
             }
         }
         rptsubctg.DataSource = objprodsubctglist1;
         rptsubctg.DataBind();
         lnkmainCTG.Text = objproddtabound.Name;
     }
 }
		///<summary>
		///  Returns a Typed ProductProductPhoto Entity with mock values.
		///</summary>
		static public ProductProductPhoto CreateMockInstance_Generated(TransactionManager tm)
		{		
			ProductProductPhoto mock = new ProductProductPhoto();
						
			mock.Primary = TestUtility.Instance.RandomBoolean();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			Product mockProductByProductId = ProductTest.CreateMockInstance(tm);
			DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
			mock.ProductId = mockProductByProductId.ProductId;
			//OneToOneRelationship
			ProductPhoto mockProductPhotoByProductPhotoId = ProductPhotoTest.CreateMockInstance(tm);
			DataRepository.ProductPhotoProvider.Insert(tm, mockProductPhotoByProductPhotoId);
			mock.ProductPhotoId = mockProductPhotoByProductPhotoId.ProductPhotoId;
		
			// create a temporary collection and add the item to it
			TList<ProductProductPhoto> tempMockCollection = new TList<ProductProductPhoto>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (ProductProductPhoto)mock;
		}
예제 #42
0
    /// <summary>
    /// Build object to string result
    /// </summary>
    /// <param name="lstRosters"></param>
    /// <param name="date"></param>
    /// <returns></returns>
    private static object BuildListSection(TList<Roster> lstRosters, DateTime? date)
    {
        object lst = null;
        try
        {
            DataRepository.RosterProvider.DeepLoad(lstRosters);

            // Lay danh sach doctor theo appointment
            var lstDoctor = new TList<Users>();

            // Lay danh sach service theo appointment
            var lstService = new TList<Services>();

            foreach (var roster in lstRosters)
            {
                Roster roster1 = roster;
                if (!lstDoctor.Exists(doctor => doctor.Username == roster1.Username))
                {
                    lstDoctor.Add(roster.UsernameSource);
                }

                lstDoctor.Sort((p1, p2) => p1.DisplayName.CompareTo(p2.DisplayName));

                DataRepository.UsersProvider.DeepLoad(roster1.UsernameSource);

                if (!lstService.Exists(service => service.Id == roster1.UsernameSource.ServicesId))
                {
                    lstService.Add(DataRepository.ServicesProvider.GetById(Convert.ToInt32(roster1.UsernameSource.ServicesId)));
                }
            }

            // Sort theo priority
            lstService.Sort("PriorityIndex ASC");

            var dtStart = Convert.ToDateTime(date);
            var dtEnd = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, 23, 59, 59);
            dtStart = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day);

            lst = lstService.Select(service => new
                {
                    service.Id,
                    Title = string.IsNullOrEmpty(service.ShortTitle) ? service.Title : service.ShortTitle,
                    Date = String.Format("{0:MM-dd-yyyy HH:mm:ss}", date),
                    Doctors = lstDoctor.Where(doctor => doctor.ServicesId == service.Id)
                        .Select(doctor => new
                        {
                            key = doctor.Username,
                            label = doctor.DisplayName,
                            Rosters = lstRosters.Where(roster => roster.Username == doctor.Username)
                                .Select(roster => new
                                    {
                                        startTime = (roster.StartTime < dtStart ? dtStart : roster.StartTime).ToString("MM-dd-yyyy HH:mm:ss"),
                                        endTime = (roster.EndTime > dtEnd ? dtEnd : roster.EndTime).ToString("MM-dd-yyyy HH:mm:ss"),
                                        color = roster.RosterTypeIdSource.ColorCode
                                    }).ToList()
                        }).ToList()
                }).ToList();
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
        }
        return lst;
    }
예제 #43
0
        private static TList<CountryUser> FilterCombatUsers(CountryLvGroup lvGroup)
        {
            var list = new TList<CountryUser>();
            var removeList = new TList<CountryUser>();

            while (lvGroup.PairCombatQueue.Count > 0)
            {
                CountryUser cuser = lvGroup.PairCombatQueue.Get();
                if (cuser == null) continue;

                GameUser gameUser = new GameDataCacheSet<GameUser>().FindKey(cuser.UserId);
                if (gameUser != null && gameUser.UserStatus == UserStatus.CountryCombat)
                {
                    cuser.Status = 2;
                    list.Add(cuser);
                }
            }
            while (lvGroup.CombaQueue.Count > 0)
            {
                CountryUser cuser = lvGroup.CombaQueue.Get();
                if (cuser == null) continue;

                if (cuser.Status == 1 && cuser.Refresh.AddSeconds(CombatInterval) <= DateTime.Now)
                {
                    GameUser gameUser = new GameDataCacheSet<GameUser>().FindKey(cuser.UserId);
                    if (gameUser != null && gameUser.UserStatus == UserStatus.CountryCombat)
                    {
                        cuser.Status = 2;
                        list.Add(cuser);
                    }
                }
                else if (cuser.Status == 1)
                {
                    removeList.Add(cuser);
                }
            }
            foreach (var countryUser in removeList)
            {
                lvGroup.CombaQueue.Add(countryUser);
            }
            return list;
        }
		///<summary>
		///  Returns a Typed NullFkeyParent Entity with mock values.
		///</summary>
		static public NullFkeyParent CreateMockInstance_Generated(TransactionManager tm)
		{		
			NullFkeyParent mock = new NullFkeyParent();
						
			mock.NullFkeyParentId = TestUtility.Instance.RandomNumber();
			mock.SomeText = TestUtility.Instance.RandomString(24, false);;
			
		
			// create a temporary collection and add the item to it
			TList<NullFkeyParent> tempMockCollection = new TList<NullFkeyParent>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (NullFkeyParent)mock;
		}
		///<summary>
		///  Returns a Typed SalesTerritory Entity with mock values.
		///</summary>
		static public SalesTerritory CreateMockInstance_Generated(TransactionManager tm)
		{		
			SalesTerritory mock = new SalesTerritory();
						
			mock.Name = TestUtility.Instance.RandomString(24, false);;
			mock.CountryRegionCode = TestUtility.Instance.RandomString(3, false);;
			mock.Group = TestUtility.Instance.RandomString(24, false);;
			mock.SalesYtd = TestUtility.Instance.RandomShort();
			mock.SalesLastYear = TestUtility.Instance.RandomShort();
			mock.CostYtd = TestUtility.Instance.RandomShort();
			mock.CostLastYear = TestUtility.Instance.RandomShort();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
		
			// create a temporary collection and add the item to it
			TList<SalesTerritory> tempMockCollection = new TList<SalesTerritory>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (SalesTerritory)mock;
		}
		///<summary>
		///  Returns a Typed NullFkeyChild Entity with mock values.
		///</summary>
		static public NullFkeyChild CreateMockInstance_Generated(TransactionManager tm)
		{		
			NullFkeyChild mock = new NullFkeyChild();
						
			mock.NullFkeyChildId = TestUtility.Instance.RandomNumber();
			mock.SomeText = TestUtility.Instance.RandomString(24, false);;
			
			//OneToOneRelationship
			NullFkeyParent mockNullFkeyParentByNullFkeyParentId = NullFkeyParentTest.CreateMockInstance(tm);
			DataRepository.NullFkeyParentProvider.Insert(tm, mockNullFkeyParentByNullFkeyParentId);
			mock.NullFkeyParentId = mockNullFkeyParentByNullFkeyParentId.NullFkeyParentId;
		
			// create a temporary collection and add the item to it
			TList<NullFkeyChild> tempMockCollection = new TList<NullFkeyChild>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (NullFkeyChild)mock;
		}
		///<summary>
		///  Returns a Typed ProductDescription Entity with mock values.
		///</summary>
		static public ProductDescription CreateMockInstance_Generated(TransactionManager tm)
		{		
			ProductDescription mock = new ProductDescription();
						
			mock.Description = TestUtility.Instance.RandomString(199, false);;
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
		
			// create a temporary collection and add the item to it
			TList<ProductDescription> tempMockCollection = new TList<ProductDescription>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (ProductDescription)mock;
		}
		///<summary>
		///  Returns a Typed PurchaseOrderHeader Entity with mock values.
		///</summary>
		static public PurchaseOrderHeader CreateMockInstance_Generated(TransactionManager tm)
		{		
			PurchaseOrderHeader mock = new PurchaseOrderHeader();
						
			mock.RevisionNumber = TestUtility.Instance.RandomByte();
			mock.Status = TestUtility.Instance.RandomByte();
			mock.OrderDate = TestUtility.Instance.RandomDateTime();
			mock.ShipDate = TestUtility.Instance.RandomDateTime();
			mock.SubTotal = TestUtility.Instance.RandomShort();
			mock.TaxAmt = TestUtility.Instance.RandomShort();
			mock.Freight = TestUtility.Instance.RandomShort();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			int count0 = 0;
			TList<Employee> _collection0 = DataRepository.EmployeeProvider.GetPaged(tm, 0, 10, out count0);
			//_collection0.Shuffle();
			if (_collection0.Count > 0)
			{
				mock.EmployeeId = _collection0[0].EmployeeId;
						
			}
			int count1 = 0;
			TList<ShipMethod> _collection1 = DataRepository.ShipMethodProvider.GetPaged(tm, 0, 10, out count1);
			//_collection1.Shuffle();
			if (_collection1.Count > 0)
			{
				mock.ShipMethodId = _collection1[0].ShipMethodId;
						
			}
			int count2 = 0;
			TList<Vendor> _collection2 = DataRepository.VendorProvider.GetPaged(tm, 0, 10, out count2);
			//_collection2.Shuffle();
			if (_collection2.Count > 0)
			{
				mock.VendorId = _collection2[0].VendorId;
						
			}
		
			// create a temporary collection and add the item to it
			TList<PurchaseOrderHeader> tempMockCollection = new TList<PurchaseOrderHeader>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (PurchaseOrderHeader)mock;
		}
예제 #49
0
		///<summary>
		///  Returns a Typed Document Entity with mock values.
		///</summary>
		static public Document CreateMockInstance_Generated(TransactionManager tm)
		{		
			Document mock = new Document();
						
			mock.Title = TestUtility.Instance.RandomString(24, false);;
			mock.FileName = TestUtility.Instance.RandomString(199, false);;
			mock.FileExtension = TestUtility.Instance.RandomString(8, false);;
			mock.Revision = TestUtility.Instance.RandomString(5, false);;
			mock.ChangeNumber = TestUtility.Instance.RandomNumber();
			mock.Status = TestUtility.Instance.RandomByte();
			mock.DocumentSummary = TestUtility.Instance.RandomString(2, false);;
			mock.Document = new byte[] { TestUtility.Instance.RandomByte() };
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
		
			// create a temporary collection and add the item to it
			TList<Document> tempMockCollection = new TList<Document>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (Document)mock;
		}
		///<summary>
		///  Returns a Typed ProductModelIllustration Entity with mock values.
		///</summary>
		static public ProductModelIllustration CreateMockInstance_Generated(TransactionManager tm)
		{		
			ProductModelIllustration mock = new ProductModelIllustration();
						
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			Illustration mockIllustrationByIllustrationId = IllustrationTest.CreateMockInstance(tm);
			DataRepository.IllustrationProvider.Insert(tm, mockIllustrationByIllustrationId);
			mock.IllustrationId = mockIllustrationByIllustrationId.IllustrationId;
			//OneToOneRelationship
			ProductModel mockProductModelByProductModelId = ProductModelTest.CreateMockInstance(tm);
			DataRepository.ProductModelProvider.Insert(tm, mockProductModelByProductModelId);
			mock.ProductModelId = mockProductModelByProductModelId.ProductModelId;
		
			// create a temporary collection and add the item to it
			TList<ProductModelIllustration> tempMockCollection = new TList<ProductModelIllustration>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (ProductModelIllustration)mock;
		}
예제 #51
0
		///<summary>
		///  Returns a Typed TestProduct Entity with mock values.
		///</summary>
		static public TestProduct CreateMockInstance_Generated(TransactionManager tm)
		{		
			TestProduct mock = new TestProduct();
						
			mock.ProductTypeId = TestUtility.Instance.RandomNumber();
			mock.DownloadId = TestUtility.Instance.RandomNumber();
			mock.ManufacturerId = TestUtility.Instance.RandomNumber();
			mock.BrandName = TestUtility.Instance.RandomString(249, false);;
			mock.ProductName = TestUtility.Instance.RandomString(249, false);;
			mock.ProductCode = TestUtility.Instance.RandomString(49, false);;
			mock.UniqueIdentifier = TestUtility.Instance.RandomString(249, false);;
			mock.TypeName = TestUtility.Instance.RandomString(24, false);;
			mock.ModelName = TestUtility.Instance.RandomString(74, false);;
			mock.DisplayName = TestUtility.Instance.RandomString(74, false);;
			mock.ProductLink = TestUtility.Instance.RandomString(499, false);;
			mock.ConnectorCode = TestUtility.Instance.RandomString(499, false);;
			mock.BaseId = TestUtility.Instance.RandomNumber();
			mock.OrgProductId = TestUtility.Instance.RandomNumber();
			mock.ImageFileType = TestUtility.Instance.RandomString(1, false);;
			mock.FullImageFileType = TestUtility.Instance.RandomString(1, false);;
			mock.Status = TestUtility.Instance.RandomString(1, false);;
			mock.AddedBy = TestUtility.Instance.RandomNumber();
			mock.AddedDate = TestUtility.Instance.RandomDateTime();
			mock.UpdatedBy = TestUtility.Instance.RandomNumber();
			mock.UpdatedDate = TestUtility.Instance.RandomDateTime();
			
		
			// create a temporary collection and add the item to it
			TList<TestProduct> tempMockCollection = new TList<TestProduct>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (TestProduct)mock;
		}
예제 #52
0
		/// <summary>
		/// Deep load all TestProduct children.
		/// </summary>
		private void Step_03_DeepLoad_Generated()
		{
			using (TransactionManager tm = CreateTransaction())
			{
				int count = -1;
				mock =  CreateMockInstance(tm);
				mockCollection = DataRepository.TestProductProvider.GetPaged(tm, 0, 10, out count);
			
				DataRepository.TestProductProvider.DeepLoading += new EntityProviderBaseCore<TestProduct, TestProductKey>.DeepLoadingEventHandler(
						delegate(object sender, DeepSessionEventArgs e)
						{
							if (e.DeepSession.Count > 3)
								e.Cancel = true;
						}
					);

				if (mockCollection.Count > 0)
				{
					
					DataRepository.TestProductProvider.DeepLoad(tm, mockCollection[0]);
					System.Console.WriteLine("TestProduct instance correctly deep loaded at 1 level.");
									
					mockCollection.Add(mock);
					// DataRepository.TestProductProvider.DeepSave(tm, mockCollection);
				}
				
				//normally one would commit here
				//tm.Commit();
				//IDisposable will Rollback Transaction since it's left uncommitted
			}
		}
		///<summary>
		///  Returns a Typed TransactionHistory Entity with mock values.
		///</summary>
		static public TransactionHistory CreateMockInstance_Generated(TransactionManager tm)
		{		
			TransactionHistory mock = new TransactionHistory();
						
			mock.ReferenceOrderId = TestUtility.Instance.RandomNumber();
			mock.ReferenceOrderLineId = TestUtility.Instance.RandomNumber();
			mock.TransactionDate = TestUtility.Instance.RandomDateTime();
			mock.TransactionType = TestUtility.Instance.RandomString(1, false);;
			mock.Quantity = TestUtility.Instance.RandomNumber();
			mock.ActualCost = TestUtility.Instance.RandomShort();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			Product mockProductByProductId = ProductTest.CreateMockInstance(tm);
			DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
			mock.ProductId = mockProductByProductId.ProductId;
		
			// create a temporary collection and add the item to it
			TList<TransactionHistory> tempMockCollection = new TList<TransactionHistory>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (TransactionHistory)mock;
		}
		///<summary>
		///  Returns a Typed CountryRegionCurrency Entity with mock values.
		///</summary>
		static public CountryRegionCurrency CreateMockInstance_Generated(TransactionManager tm)
		{		
			CountryRegionCurrency mock = new CountryRegionCurrency();
						
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			CountryRegion mockCountryRegionByCountryRegionCode = CountryRegionTest.CreateMockInstance(tm);
			DataRepository.CountryRegionProvider.Insert(tm, mockCountryRegionByCountryRegionCode);
			mock.CountryRegionCode = mockCountryRegionByCountryRegionCode.CountryRegionCode;
			//OneToOneRelationship
			Currency mockCurrencyByCurrencyCode = CurrencyTest.CreateMockInstance(tm);
			DataRepository.CurrencyProvider.Insert(tm, mockCurrencyByCurrencyCode);
			mock.CurrencyCode = mockCurrencyByCurrencyCode.CurrencyCode;
		
			// create a temporary collection and add the item to it
			TList<CountryRegionCurrency> tempMockCollection = new TList<CountryRegionCurrency>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (CountryRegionCurrency)mock;
		}
		///<summary>
		///  Returns a Typed SpecialOfferProduct Entity with mock values.
		///</summary>
		static public SpecialOfferProduct CreateMockInstance_Generated(TransactionManager tm)
		{		
			SpecialOfferProduct mock = new SpecialOfferProduct();
						
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			Product mockProductByProductId = ProductTest.CreateMockInstance(tm);
			DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
			mock.ProductId = mockProductByProductId.ProductId;
			//OneToOneRelationship
			SpecialOffer mockSpecialOfferBySpecialOfferId = SpecialOfferTest.CreateMockInstance(tm);
			DataRepository.SpecialOfferProvider.Insert(tm, mockSpecialOfferBySpecialOfferId);
			mock.SpecialOfferId = mockSpecialOfferBySpecialOfferId.SpecialOfferId;
		
			// create a temporary collection and add the item to it
			TList<SpecialOfferProduct> tempMockCollection = new TList<SpecialOfferProduct>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (SpecialOfferProduct)mock;
		}
		///<summary>
		///  Returns a Typed CustomerAddress Entity with mock values.
		///</summary>
		static public CustomerAddress CreateMockInstance_Generated(TransactionManager tm)
		{		
			CustomerAddress mock = new CustomerAddress();
						
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			Address mockAddressByAddressId = AddressTest.CreateMockInstance(tm);
			DataRepository.AddressProvider.Insert(tm, mockAddressByAddressId);
			mock.AddressId = mockAddressByAddressId.AddressId;
			//OneToOneRelationship
			AddressType mockAddressTypeByAddressTypeId = AddressTypeTest.CreateMockInstance(tm);
			DataRepository.AddressTypeProvider.Insert(tm, mockAddressTypeByAddressTypeId);
			mock.AddressTypeId = mockAddressTypeByAddressTypeId.AddressTypeId;
			//OneToOneRelationship
			Customer mockCustomerByCustomerId = CustomerTest.CreateMockInstance(tm);
			DataRepository.CustomerProvider.Insert(tm, mockCustomerByCustomerId);
			mock.CustomerId = mockCustomerByCustomerId.CustomerId;
		
			// create a temporary collection and add the item to it
			TList<CustomerAddress> tempMockCollection = new TList<CustomerAddress>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (CustomerAddress)mock;
		}
예제 #57
0
		/// <summary>
		/// Serialize a TestProduct 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_TestProductCollection.xml");
				
				mock = CreateMockInstance(tm);
				TList<TestProduct> mockCollection = new TList<TestProduct>();
				mockCollection.Add(mock);
			
				EntityHelper.SerializeXml(mockCollection, fileName);
				
				Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
				System.Console.WriteLine("TList<TestProduct> correctly serialized to a temporary file.");					
			}
		}
예제 #58
0
		///<summary>
		///  Returns a Typed TestVariant Entity with mock values.
		///</summary>
		static public TestVariant CreateMockInstance_Generated(TransactionManager tm)
		{		
			TestVariant mock = new TestVariant();
						
			mock.VariantField = null;
			
		
			// create a temporary collection and add the item to it
			TList<TestVariant> tempMockCollection = new TList<TestVariant>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (TestVariant)mock;
		}
		///<summary>
		///  Returns a Typed ProductPhoto Entity with mock values.
		///</summary>
		static public ProductPhoto CreateMockInstance_Generated(TransactionManager tm)
		{		
			ProductPhoto mock = new ProductPhoto();
						
			mock.ThumbNailPhoto = new byte[] { TestUtility.Instance.RandomByte() };
			mock.ThumbnailPhotoFileName = TestUtility.Instance.RandomString(24, false);;
			mock.LargePhoto = new byte[] { TestUtility.Instance.RandomByte() };
			mock.LargePhotoFileName = TestUtility.Instance.RandomString(24, false);;
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
		
			// create a temporary collection and add the item to it
			TList<ProductPhoto> tempMockCollection = new TList<ProductPhoto>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (ProductPhoto)mock;
		}
예제 #60
0
		///<summary>
		///  Returns a Typed WorkOrder Entity with mock values.
		///</summary>
		static public WorkOrder CreateMockInstance_Generated(TransactionManager tm)
		{		
			WorkOrder mock = new WorkOrder();
						
			mock.OrderQty = TestUtility.Instance.RandomNumber();
			mock.ScrappedQty = TestUtility.Instance.RandomShort();
			mock.StartDate = TestUtility.Instance.RandomDateTime();
			mock.EndDate = TestUtility.Instance.RandomDateTime();
			mock.DueDate = TestUtility.Instance.RandomDateTime();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			int count0 = 0;
			TList<Product> _collection0 = DataRepository.ProductProvider.GetPaged(tm, 0, 10, out count0);
			//_collection0.Shuffle();
			if (_collection0.Count > 0)
			{
				mock.ProductId = _collection0[0].ProductId;
						
			}
			int count1 = 0;
			TList<ScrapReason> _collection1 = DataRepository.ScrapReasonProvider.GetPaged(tm, 0, 10, out count1);
			//_collection1.Shuffle();
			if (_collection1.Count > 0)
			{
				mock.ScrapReasonId = _collection1[0].ScrapReasonId;
						
			}
		
			// create a temporary collection and add the item to it
			TList<WorkOrder> tempMockCollection = new TList<WorkOrder>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (WorkOrder)mock;
		}